Merge pull request #6224 from paulmey/update-azure-sdk
Update Azure SDK
This commit is contained in:
commit
8aee53ebe9
|
@ -16,25 +16,25 @@ func TestNewAuthenticate(t *testing.T) {
|
||||||
t.Fatalf(err.Error())
|
t.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if spn.Token.AccessToken != "" {
|
if spn.Token().AccessToken != "" {
|
||||||
t.Errorf("spn.Token.AccessToken: expected=\"\", actual=%s", spn.Token.AccessToken)
|
t.Errorf("spn.Token().AccessToken: expected=\"\", actual=%s", spn.Token().AccessToken)
|
||||||
}
|
}
|
||||||
if spn.Token.RefreshToken != "" {
|
if spn.Token().RefreshToken != "" {
|
||||||
t.Errorf("spn.Token.RefreshToken: expected=\"\", actual=%s", spn.Token.RefreshToken)
|
t.Errorf("spn.Token().RefreshToken: expected=\"\", actual=%s", spn.Token().RefreshToken)
|
||||||
}
|
}
|
||||||
if spn.Token.ExpiresIn != "" {
|
if spn.Token().ExpiresIn != "" {
|
||||||
t.Errorf("spn.Token.ExpiresIn: expected=\"\", actual=%s", spn.Token.ExpiresIn)
|
t.Errorf("spn.Token().ExpiresIn: expected=\"\", actual=%s", spn.Token().ExpiresIn)
|
||||||
}
|
}
|
||||||
if spn.Token.ExpiresOn != "" {
|
if spn.Token().ExpiresOn != "" {
|
||||||
t.Errorf("spn.Token.ExpiresOn: expected=\"\", actual=%s", spn.Token.ExpiresOn)
|
t.Errorf("spn.Token().ExpiresOn: expected=\"\", actual=%s", spn.Token().ExpiresOn)
|
||||||
}
|
}
|
||||||
if spn.Token.NotBefore != "" {
|
if spn.Token().NotBefore != "" {
|
||||||
t.Errorf("spn.Token.NotBefore: expected=\"\", actual=%s", spn.Token.NotBefore)
|
t.Errorf("spn.Token().NotBefore: expected=\"\", actual=%s", spn.Token().NotBefore)
|
||||||
}
|
}
|
||||||
if spn.Token.Resource != "" {
|
if spn.Token().Resource != "" {
|
||||||
t.Errorf("spn.Token.Resource: expected=\"\", actual=%s", spn.Token.Resource)
|
t.Errorf("spn.Token().Resource: expected=\"\", actual=%s", spn.Token().Resource)
|
||||||
}
|
}
|
||||||
if spn.Token.Type != "" {
|
if spn.Token().Type != "" {
|
||||||
t.Errorf("spn.Token.Type: expected=\"\", actual=%s", spn.Token.Type)
|
t.Errorf("spn.Token().Type: expected=\"\", actual=%s", spn.Token().Type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package arm
|
package arm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
@ -9,11 +10,10 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/disk"
|
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network"
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/network"
|
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources"
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
|
armStorage "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage"
|
||||||
armStorage "github.com/Azure/azure-sdk-for-go/arm/storage"
|
|
||||||
"github.com/Azure/azure-sdk-for-go/storage"
|
"github.com/Azure/azure-sdk-for-go/storage"
|
||||||
"github.com/Azure/go-autorest/autorest"
|
"github.com/Azure/go-autorest/autorest"
|
||||||
"github.com/Azure/go-autorest/autorest/adal"
|
"github.com/Azure/go-autorest/autorest/adal"
|
||||||
|
@ -39,7 +39,7 @@ type AzureClient struct {
|
||||||
compute.VirtualMachinesClient
|
compute.VirtualMachinesClient
|
||||||
common.VaultClient
|
common.VaultClient
|
||||||
armStorage.AccountsClient
|
armStorage.AccountsClient
|
||||||
disk.DisksClient
|
compute.DisksClient
|
||||||
|
|
||||||
InspectorMaxLength int
|
InspectorMaxLength int
|
||||||
Template *CaptureTemplate
|
Template *CaptureTemplate
|
||||||
|
@ -141,7 +141,7 @@ func NewAzureClient(subscriptionID, resourceGroupName, storageAccountName string
|
||||||
azureClient.DeploymentOperationsClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
azureClient.DeploymentOperationsClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
||||||
azureClient.DeploymentOperationsClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.DeploymentOperationsClient.UserAgent)
|
azureClient.DeploymentOperationsClient.UserAgent = fmt.Sprintf("%s %s", useragent.String(), azureClient.DeploymentOperationsClient.UserAgent)
|
||||||
|
|
||||||
azureClient.DisksClient = disk.NewDisksClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
azureClient.DisksClient = compute.NewDisksClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||||
azureClient.DisksClient.Authorizer = autorest.NewBearerAuthorizer(servicePrincipalToken)
|
azureClient.DisksClient.Authorizer = autorest.NewBearerAuthorizer(servicePrincipalToken)
|
||||||
azureClient.DisksClient.RequestInspector = withInspection(maxlen)
|
azureClient.DisksClient.RequestInspector = withInspection(maxlen)
|
||||||
azureClient.DisksClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
azureClient.DisksClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), errorCapture(azureClient))
|
||||||
|
@ -222,7 +222,7 @@ func NewAzureClient(subscriptionID, resourceGroupName, storageAccountName string
|
||||||
|
|
||||||
// If this is a managed disk build, this should be ignored.
|
// If this is a managed disk build, this should be ignored.
|
||||||
if resourceGroupName != "" && storageAccountName != "" {
|
if resourceGroupName != "" && storageAccountName != "" {
|
||||||
accountKeys, err := azureClient.AccountsClient.ListKeys(resourceGroupName, storageAccountName)
|
accountKeys, err := azureClient.AccountsClient.ListKeys(context.TODO(), resourceGroupName, storageAccountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package arm
|
package arm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
@ -11,11 +12,11 @@ import (
|
||||||
|
|
||||||
packerAzureCommon "github.com/hashicorp/packer/builder/azure/common"
|
packerAzureCommon "github.com/hashicorp/packer/builder/azure/common"
|
||||||
|
|
||||||
|
armstorage "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage"
|
||||||
|
"github.com/Azure/azure-sdk-for-go/storage"
|
||||||
|
"github.com/Azure/go-autorest/autorest/adal"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/lin"
|
"github.com/hashicorp/packer/builder/azure/common/lin"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/storage"
|
|
||||||
"github.com/Azure/go-autorest/autorest/adal"
|
|
||||||
packerCommon "github.com/hashicorp/packer/common"
|
packerCommon "github.com/hashicorp/packer/common"
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
"github.com/hashicorp/packer/helper/communicator"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
|
@ -23,15 +24,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config *Config
|
config *Config
|
||||||
stateBag multistep.StateBag
|
stateBag multistep.StateBag
|
||||||
runner multistep.Runner
|
runner multistep.Runner
|
||||||
|
ctxCancel context.CancelFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultSasBlobContainer = "system/Microsoft.Compute"
|
DefaultSasBlobContainer = "system/Microsoft.Compute"
|
||||||
DefaultSasBlobPermission = "r"
|
DefaultSecretName = "packerKeyVaultSecret"
|
||||||
DefaultSecretName = "packerKeyVaultSecret"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
|
@ -53,6 +54,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
|
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
|
||||||
ui.Say("Running builder ...")
|
ui.Say("Running builder ...")
|
||||||
|
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
b.ctxCancel = cancel
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
if err := newConfigRetriever().FillParameters(b.config); err != nil {
|
if err := newConfigRetriever().FillParameters(b.config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -87,7 +92,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.config.isManagedImage() {
|
if b.config.isManagedImage() {
|
||||||
group, err := azureClient.GroupsClient.Get(b.config.ManagedImageResourceGroupName)
|
group, err := azureClient.GroupsClient.Get(ctx, b.config.ManagedImageResourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Cannot locate the managed image resource group %s.", b.config.ManagedImageResourceGroupName)
|
return nil, fmt.Errorf("Cannot locate the managed image resource group %s.", b.config.ManagedImageResourceGroupName)
|
||||||
}
|
}
|
||||||
|
@ -95,12 +100,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
b.config.manageImageLocation = *group.Location
|
b.config.manageImageLocation = *group.Location
|
||||||
|
|
||||||
// If a managed image already exists it cannot be overwritten.
|
// If a managed image already exists it cannot be overwritten.
|
||||||
_, err = azureClient.ImagesClient.Get(b.config.ManagedImageResourceGroupName, b.config.ManagedImageName, "")
|
_, err = azureClient.ImagesClient.Get(ctx, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName, "")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if b.config.PackerForce {
|
if b.config.PackerForce {
|
||||||
_, errChan := azureClient.ImagesClient.Delete(b.config.ManagedImageResourceGroupName, b.config.ManagedImageName, nil)
|
|
||||||
ui.Say(fmt.Sprintf("the managed image named %s already exists, but deleting it due to -force flag", b.config.ManagedImageName))
|
ui.Say(fmt.Sprintf("the managed image named %s already exists, but deleting it due to -force flag", b.config.ManagedImageName))
|
||||||
err = <-errChan
|
f, err := azureClient.ImagesClient.Delete(ctx, b.config.ManagedImageResourceGroupName, b.config.ManagedImageName)
|
||||||
|
if err == nil {
|
||||||
|
err = f.WaitForCompletion(ctx, azureClient.ImagesClient.Client)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to delete the managed image named %s : %s", b.config.ManagedImageName, azureClient.LastError.Error())
|
return nil, fmt.Errorf("failed to delete the managed image named %s : %s", b.config.ManagedImageName, azureClient.LastError.Error())
|
||||||
}
|
}
|
||||||
|
@ -111,7 +118,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.config.BuildResourceGroupName != "" {
|
if b.config.BuildResourceGroupName != "" {
|
||||||
group, err := azureClient.GroupsClient.Get(b.config.BuildResourceGroupName)
|
group, err := azureClient.GroupsClient.Get(ctx, b.config.BuildResourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Cannot locate the existing build resource resource group %s.", b.config.BuildResourceGroupName)
|
return nil, fmt.Errorf("Cannot locate the existing build resource resource group %s.", b.config.BuildResourceGroupName)
|
||||||
}
|
}
|
||||||
|
@ -120,7 +127,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.config.StorageAccount != "" {
|
if b.config.StorageAccount != "" {
|
||||||
account, err := b.getBlobAccount(azureClient, b.config.ResourceGroupName, b.config.StorageAccount)
|
account, err := b.getBlobAccount(ctx, azureClient, b.config.ResourceGroupName, b.config.StorageAccount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -240,9 +247,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
return NewArtifact(
|
return NewArtifact(
|
||||||
template.(*CaptureTemplate),
|
template.(*CaptureTemplate),
|
||||||
func(name string) string {
|
func(name string) string {
|
||||||
month := time.Now().AddDate(0, 1, 0).UTC()
|
|
||||||
blob := azureClient.BlobStorageClient.GetContainerReference(DefaultSasBlobContainer).GetBlobReference(name)
|
blob := azureClient.BlobStorageClient.GetContainerReference(DefaultSasBlobContainer).GetBlobReference(name)
|
||||||
sasUrl, _ := blob.GetSASURI(month, DefaultSasBlobPermission)
|
options := storage.BlobSASOptions{}
|
||||||
|
options.BlobServiceSASPermissions.Read = true
|
||||||
|
options.Expiry = time.Now().AddDate(0, 1, 0).UTC() // one month
|
||||||
|
sasUrl, _ := blob.GetSASURI(options)
|
||||||
return sasUrl
|
return sasUrl
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -280,6 +289,10 @@ func (b *Builder) isPrivateNetworkCommunication() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Cancel() {
|
func (b *Builder) Cancel() {
|
||||||
|
if b.ctxCancel != nil {
|
||||||
|
log.Printf("Cancelling Azure builder...")
|
||||||
|
b.ctxCancel()
|
||||||
|
}
|
||||||
if b.runner != nil {
|
if b.runner != nil {
|
||||||
log.Println("Cancelling the step runner...")
|
log.Println("Cancelling the step runner...")
|
||||||
b.runner.Cancel()
|
b.runner.Cancel()
|
||||||
|
@ -294,8 +307,8 @@ func canonicalizeLocation(location string) string {
|
||||||
return strings.Replace(location, " ", "", -1)
|
return strings.Replace(location, " ", "", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) getBlobAccount(client *AzureClient, resourceGroupName string, storageAccountName string) (*storage.Account, error) {
|
func (b *Builder) getBlobAccount(ctx context.Context, client *AzureClient, resourceGroupName string, storageAccountName string) (*armstorage.Account, error) {
|
||||||
account, err := client.AccountsClient.GetProperties(resourceGroupName, storageAccountName)
|
account, err := client.AccountsClient.GetProperties(ctx, resourceGroupName, storageAccountName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -307,7 +320,7 @@ func (b *Builder) configureStateBag(stateBag multistep.StateBag) {
|
||||||
stateBag.Put(constants.AuthorizedKey, b.config.sshAuthorizedKey)
|
stateBag.Put(constants.AuthorizedKey, b.config.sshAuthorizedKey)
|
||||||
stateBag.Put(constants.PrivateKey, b.config.sshPrivateKey)
|
stateBag.Put(constants.PrivateKey, b.config.sshPrivateKey)
|
||||||
|
|
||||||
stateBag.Put(constants.ArmTags, &b.config.AzureTags)
|
stateBag.Put(constants.ArmTags, b.config.AzureTags)
|
||||||
stateBag.Put(constants.ArmComputeName, b.config.tmpComputeName)
|
stateBag.Put(constants.ArmComputeName, b.config.tmpComputeName)
|
||||||
stateBag.Put(constants.ArmDeploymentName, b.config.tmpDeploymentName)
|
stateBag.Put(constants.ArmDeploymentName, b.config.tmpDeploymentName)
|
||||||
if b.config.OSType == constants.Target_Windows {
|
if b.config.OSType == constants.Target_Windows {
|
||||||
|
|
|
@ -0,0 +1,195 @@
|
||||||
|
package arm
|
||||||
|
|
||||||
|
// these tests require the following variables to be set,
|
||||||
|
// although some test will only use a subset:
|
||||||
|
//
|
||||||
|
// * ARM_CLIENT_ID
|
||||||
|
// * ARM_CLIENT_SECRET
|
||||||
|
// * ARM_SUBSCRIPTION_ID
|
||||||
|
// * ARM_OBJECT_ID
|
||||||
|
// * ARM_STORAGE_ACCOUNT
|
||||||
|
//
|
||||||
|
// The subscription in question should have a resource group
|
||||||
|
// called "packer-acceptance-test" in "West US" region. The
|
||||||
|
// storage account refered to in the above variable should
|
||||||
|
// be inside this resource group and in "West US" as well.
|
||||||
|
//
|
||||||
|
// In addition, the PACKER_ACC variable should also be set to
|
||||||
|
// a non-empty value to enable Packer acceptance tests and the
|
||||||
|
// options "-v -timeout 90m" should be provided to the test
|
||||||
|
// command, e.g.:
|
||||||
|
// go test -v -timeout 90m -run TestBuilderAcc_.*
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestBuilderAcc_ManagedDisk_Windows(t *testing.T) {
|
||||||
|
builderT.Test(t, builderT.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Builder: &Builder{},
|
||||||
|
Template: testBuilderAccManagedDiskWindows,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBuilderAcc_ManagedDisk_Linux(t *testing.T) {
|
||||||
|
builderT.Test(t, builderT.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Builder: &Builder{},
|
||||||
|
Template: testBuilderAccManagedDiskLinux,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBuilderAcc_Blob_Windows(t *testing.T) {
|
||||||
|
builderT.Test(t, builderT.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Builder: &Builder{},
|
||||||
|
Template: testBuilderAccBlobWindows,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBuilderAcc_Blob_Linux(t *testing.T) {
|
||||||
|
builderT.Test(t, builderT.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Builder: &Builder{},
|
||||||
|
Template: testBuilderAccBlobLinux,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testAccPreCheck(*testing.T) {}
|
||||||
|
|
||||||
|
const testBuilderAccManagedDiskWindows = `
|
||||||
|
{
|
||||||
|
"variables": {
|
||||||
|
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
||||||
|
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
||||||
|
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}",
|
||||||
|
"object_id": "{{env ` + "`ARM_OBJECT_ID`" + `}}"
|
||||||
|
},
|
||||||
|
"builders": [{
|
||||||
|
"type": "test",
|
||||||
|
|
||||||
|
"client_id": "{{user ` + "`client_id`" + `}}",
|
||||||
|
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
||||||
|
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
||||||
|
"object_id": "{{user ` + "`object_id`" + `}}",
|
||||||
|
|
||||||
|
"managed_image_resource_group_name": "packer-acceptance-test",
|
||||||
|
"managed_image_name": "testBuilderAccManagedDiskWindows-{{timestamp}}",
|
||||||
|
|
||||||
|
"os_type": "Windows",
|
||||||
|
"image_publisher": "MicrosoftWindowsServer",
|
||||||
|
"image_offer": "WindowsServer",
|
||||||
|
"image_sku": "2012-R2-Datacenter",
|
||||||
|
|
||||||
|
"communicator": "winrm",
|
||||||
|
"winrm_use_ssl": "true",
|
||||||
|
"winrm_insecure": "true",
|
||||||
|
"winrm_timeout": "3m",
|
||||||
|
"winrm_username": "packer",
|
||||||
|
|
||||||
|
"location": "West US",
|
||||||
|
"vm_size": "Standard_DS2_v2"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const testBuilderAccManagedDiskLinux = `
|
||||||
|
{
|
||||||
|
"variables": {
|
||||||
|
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
||||||
|
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
||||||
|
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}"
|
||||||
|
},
|
||||||
|
"builders": [{
|
||||||
|
"type": "test",
|
||||||
|
|
||||||
|
"client_id": "{{user ` + "`client_id`" + `}}",
|
||||||
|
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
||||||
|
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
||||||
|
|
||||||
|
"managed_image_resource_group_name": "packer-acceptance-test",
|
||||||
|
"managed_image_name": "testBuilderAccManagedDiskLinux-{{timestamp}}",
|
||||||
|
|
||||||
|
"os_type": "Linux",
|
||||||
|
"image_publisher": "Canonical",
|
||||||
|
"image_offer": "UbuntuServer",
|
||||||
|
"image_sku": "16.04-LTS",
|
||||||
|
|
||||||
|
"location": "West US",
|
||||||
|
"vm_size": "Standard_DS2_v2"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const testBuilderAccBlobWindows = `
|
||||||
|
{
|
||||||
|
"variables": {
|
||||||
|
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
||||||
|
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
||||||
|
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}",
|
||||||
|
"object_id": "{{env ` + "`ARM_OBJECT_ID`" + `}}",
|
||||||
|
"storage_account": "{{env ` + "`ARM_STORAGE_ACCOUNT`" + `}}"
|
||||||
|
},
|
||||||
|
"builders": [{
|
||||||
|
"type": "test",
|
||||||
|
|
||||||
|
"client_id": "{{user ` + "`client_id`" + `}}",
|
||||||
|
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
||||||
|
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
||||||
|
"object_id": "{{user ` + "`object_id`" + `}}",
|
||||||
|
|
||||||
|
"storage_account": "{{user ` + "`storage_account`" + `}}",
|
||||||
|
"resource_group_name": "packer-acceptance-test",
|
||||||
|
"capture_container_name": "test",
|
||||||
|
"capture_name_prefix": "testBuilderAccBlobWin",
|
||||||
|
|
||||||
|
"os_type": "Windows",
|
||||||
|
"image_publisher": "MicrosoftWindowsServer",
|
||||||
|
"image_offer": "WindowsServer",
|
||||||
|
"image_sku": "2012-R2-Datacenter",
|
||||||
|
|
||||||
|
"communicator": "winrm",
|
||||||
|
"winrm_use_ssl": "true",
|
||||||
|
"winrm_insecure": "true",
|
||||||
|
"winrm_timeout": "3m",
|
||||||
|
"winrm_username": "packer",
|
||||||
|
|
||||||
|
"location": "West US",
|
||||||
|
"vm_size": "Standard_DS2_v2"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const testBuilderAccBlobLinux = `
|
||||||
|
{
|
||||||
|
"variables": {
|
||||||
|
"client_id": "{{env ` + "`ARM_CLIENT_ID`" + `}}",
|
||||||
|
"client_secret": "{{env ` + "`ARM_CLIENT_SECRET`" + `}}",
|
||||||
|
"subscription_id": "{{env ` + "`ARM_SUBSCRIPTION_ID`" + `}}",
|
||||||
|
"storage_account": "{{env ` + "`ARM_STORAGE_ACCOUNT`" + `}}"
|
||||||
|
},
|
||||||
|
"builders": [{
|
||||||
|
"type": "test",
|
||||||
|
|
||||||
|
"client_id": "{{user ` + "`client_id`" + `}}",
|
||||||
|
"client_secret": "{{user ` + "`client_secret`" + `}}",
|
||||||
|
"subscription_id": "{{user ` + "`subscription_id`" + `}}",
|
||||||
|
|
||||||
|
"storage_account": "{{user ` + "`storage_account`" + `}}",
|
||||||
|
"resource_group_name": "packer-acceptance-test",
|
||||||
|
"capture_container_name": "test",
|
||||||
|
"capture_name_prefix": "testBuilderAccBlobLinux",
|
||||||
|
|
||||||
|
"os_type": "Linux",
|
||||||
|
"image_publisher": "Canonical",
|
||||||
|
"image_offer": "UbuntuServer",
|
||||||
|
"image_sku": "16.04-LTS",
|
||||||
|
|
||||||
|
"location": "West US",
|
||||||
|
"vm_size": "Standard_DS2_v2"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
`
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/masterzen/winrm"
|
"github.com/masterzen/winrm"
|
||||||
|
@ -189,7 +189,7 @@ func (c *Config) toImageParameters() *compute.Image {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Location: to.StringPtr(c.Location),
|
Location: to.StringPtr(c.Location),
|
||||||
Tags: &c.AzureTags,
|
Tags: c.AzureTags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ func provideDefaultValues(c *Config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ManagedImageStorageAccountType == "" {
|
if c.ManagedImageStorageAccountType == "" {
|
||||||
c.managedImageStorageAccountType = compute.StandardLRS
|
c.managedImageStorageAccountType = compute.StorageAccountTypesStandardLRS
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ImagePublisher != "" && c.ImageVersion == "" {
|
if c.ImagePublisher != "" && c.ImageVersion == "" {
|
||||||
|
@ -697,10 +697,10 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch c.ManagedImageStorageAccountType {
|
switch c.ManagedImageStorageAccountType {
|
||||||
case "", string(compute.StandardLRS):
|
case "", string(compute.StorageAccountTypesStandardLRS):
|
||||||
c.managedImageStorageAccountType = compute.StandardLRS
|
c.managedImageStorageAccountType = compute.StorageAccountTypesStandardLRS
|
||||||
case string(compute.PremiumLRS):
|
case string(compute.StorageAccountTypesPremiumLRS):
|
||||||
c.managedImageStorageAccountType = compute.PremiumLRS
|
c.managedImageStorageAccountType = compute.StorageAccountTypesPremiumLRS
|
||||||
default:
|
default:
|
||||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("The managed_image_storage_account_type %q is invalid", c.ManagedImageStorageAccountType))
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("The managed_image_storage_account_type %q is invalid", c.ManagedImageStorageAccountType))
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
)
|
)
|
||||||
|
@ -86,7 +86,7 @@ func TestConfigShouldBeAbleToOverrideDefaultedValues(t *testing.T) {
|
||||||
t.Errorf("Expected 'vm_size' to be set to 'override_vm_size', but found %q!", c.VMSize)
|
t.Errorf("Expected 'vm_size' to be set to 'override_vm_size', but found %q!", c.VMSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.managedImageStorageAccountType != compute.PremiumLRS {
|
if c.managedImageStorageAccountType != compute.StorageAccountTypesPremiumLRS {
|
||||||
t.Errorf("Expected 'managed_image_storage_account_type' to be set to 'Premium_LRS', but found %q!", c.managedImageStorageAccountType)
|
t.Errorf("Expected 'managed_image_storage_account_type' to be set to 'Premium_LRS', but found %q!", c.managedImageStorageAccountType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,11 @@ package arm
|
||||||
// used to determine values without use of a client.
|
// used to determine values without use of a client.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
)
|
)
|
||||||
|
|
||||||
type resourceResolver struct {
|
type resourceResolver struct {
|
||||||
|
@ -72,33 +73,40 @@ func getResourceGroupNameFromId(id string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func findManagedImageByName(client *AzureClient, name, resourceGroupName string) (*compute.Image, error) {
|
func findManagedImageByName(client *AzureClient, name, resourceGroupName string) (*compute.Image, error) {
|
||||||
images, err := client.ImagesClient.ListByResourceGroup(resourceGroupName)
|
images, err := client.ImagesClient.ListByResourceGroupComplete(context.TODO(), resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, image := range *images.Value {
|
for images.NotDone() {
|
||||||
|
image := images.Value()
|
||||||
if strings.EqualFold(name, *image.Name) {
|
if strings.EqualFold(name, *image.Name) {
|
||||||
return &image, nil
|
return &image, nil
|
||||||
}
|
}
|
||||||
|
if err = images.Next(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("Cannot find an image named '%s' in the resource group '%s'", name, resourceGroupName)
|
return nil, fmt.Errorf("Cannot find an image named '%s' in the resource group '%s'", name, resourceGroupName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func findVirtualNetworkResourceGroup(client *AzureClient, name string) (string, error) {
|
func findVirtualNetworkResourceGroup(client *AzureClient, name string) (string, error) {
|
||||||
virtualNetworks, err := client.VirtualNetworksClient.ListAll()
|
virtualNetworks, err := client.VirtualNetworksClient.ListAllComplete(context.TODO())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
resourceGroupNames := make([]string, 0)
|
resourceGroupNames := make([]string, 0)
|
||||||
|
for virtualNetworks.NotDone() {
|
||||||
for _, virtualNetwork := range *virtualNetworks.Value {
|
virtualNetwork := virtualNetworks.Value()
|
||||||
if strings.EqualFold(name, *virtualNetwork.Name) {
|
if strings.EqualFold(name, *virtualNetwork.Name) {
|
||||||
rgn := getResourceGroupNameFromId(*virtualNetwork.ID)
|
rgn := getResourceGroupNameFromId(*virtualNetwork.ID)
|
||||||
resourceGroupNames = append(resourceGroupNames, rgn)
|
resourceGroupNames = append(resourceGroupNames, rgn)
|
||||||
}
|
}
|
||||||
|
if err = virtualNetworks.Next(); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(resourceGroupNames) == 0 {
|
if len(resourceGroupNames) == 0 {
|
||||||
|
@ -113,19 +121,21 @@ func findVirtualNetworkResourceGroup(client *AzureClient, name string) (string,
|
||||||
}
|
}
|
||||||
|
|
||||||
func findVirtualNetworkSubnet(client *AzureClient, resourceGroupName string, name string) (string, error) {
|
func findVirtualNetworkSubnet(client *AzureClient, resourceGroupName string, name string) (string, error) {
|
||||||
subnets, err := client.SubnetsClient.List(resourceGroupName, name)
|
subnets, err := client.SubnetsClient.List(context.TODO(), resourceGroupName, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(*subnets.Value) == 0 {
|
subnetList := subnets.Values() // only first page of subnets, but only interested in ==0 or >1
|
||||||
|
|
||||||
|
if len(subnetList) == 0 {
|
||||||
return "", fmt.Errorf("Cannot find a subnet in the resource group %q associated with the virtual network called %q", resourceGroupName, name)
|
return "", fmt.Errorf("Cannot find a subnet in the resource group %q associated with the virtual network called %q", resourceGroupName, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(*subnets.Value) > 1 {
|
if len(subnetList) > 1 {
|
||||||
return "", fmt.Errorf("Found multiple subnets in the resource group %q associated with the virtual network called %q, please use virtual_network_subnet_name and virtual_network_resource_group_name to disambiguate", resourceGroupName, name)
|
return "", fmt.Errorf("Found multiple subnets in the resource group %q associated with the virtual network called %q, please use virtual_network_subnet_name and virtual_network_resource_group_name to disambiguate", resourceGroupName, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
subnet := (*subnets.Value)[0]
|
subnet := subnetList[0]
|
||||||
return *subnet.Name, nil
|
return *subnet.Name, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
package arm
|
package arm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hashicorp/packer/builder/azure/common"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
)
|
)
|
||||||
|
|
||||||
func processInterruptibleResult(
|
|
||||||
result common.InterruptibleTaskResult, sayError func(error), state multistep.StateBag) multistep.StepAction {
|
|
||||||
if result.IsCancelled {
|
|
||||||
return multistep.ActionHalt
|
|
||||||
}
|
|
||||||
|
|
||||||
return processStepResult(result.Err, sayError, state)
|
|
||||||
}
|
|
||||||
|
|
||||||
func processStepResult(
|
func processStepResult(
|
||||||
err error, sayError func(error), state multistep.StateBag) multistep.StepAction {
|
err error, sayError func(error), state multistep.StateBag) multistep.StepAction {
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/hashicorp/packer/builder/azure/common"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
@ -14,8 +13,8 @@ import (
|
||||||
type StepCaptureImage struct {
|
type StepCaptureImage struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
generalizeVM func(resourceGroupName, computeName string) error
|
generalizeVM func(resourceGroupName, computeName string) error
|
||||||
captureVhd func(resourceGroupName string, computeName string, parameters *compute.VirtualMachineCaptureParameters, cancelCh <-chan struct{}) error
|
captureVhd func(ctx context.Context, resourceGroupName string, computeName string, parameters *compute.VirtualMachineCaptureParameters) error
|
||||||
captureManagedImage func(resourceGroupName string, computeName string, parameters *compute.Image, cancelCh <-chan struct{}) error
|
captureManagedImage func(ctx context.Context, resourceGroupName string, computeName string, parameters *compute.Image) error
|
||||||
get func(client *AzureClient) *CaptureTemplate
|
get func(client *AzureClient) *CaptureTemplate
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
|
@ -43,32 +42,30 @@ func NewStepCaptureImage(client *AzureClient, ui packer.Ui) *StepCaptureImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepCaptureImage) generalize(resourceGroupName string, computeName string) error {
|
func (s *StepCaptureImage) generalize(resourceGroupName string, computeName string) error {
|
||||||
_, err := s.client.Generalize(resourceGroupName, computeName)
|
_, err := s.client.Generalize(context.TODO(), resourceGroupName, computeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepCaptureImage) captureImageFromVM(resourceGroupName string, imageName string, image *compute.Image, cancelCh <-chan struct{}) error {
|
func (s *StepCaptureImage) captureImageFromVM(ctx context.Context, resourceGroupName string, imageName string, image *compute.Image) error {
|
||||||
_, errChan := s.client.ImagesClient.CreateOrUpdate(resourceGroupName, imageName, *image, cancelCh)
|
f, err := s.client.ImagesClient.CreateOrUpdate(ctx, resourceGroupName, imageName, *image)
|
||||||
err := <-errChan
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return <-errChan
|
return f.WaitForCompletion(ctx, s.client.ImagesClient.Client)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepCaptureImage) captureImage(resourceGroupName string, computeName string, parameters *compute.VirtualMachineCaptureParameters, cancelCh <-chan struct{}) error {
|
func (s *StepCaptureImage) captureImage(ctx context.Context, resourceGroupName string, computeName string, parameters *compute.VirtualMachineCaptureParameters) error {
|
||||||
_, errChan := s.client.Capture(resourceGroupName, computeName, *parameters, cancelCh)
|
f, err := s.client.VirtualMachinesClient.Capture(ctx, resourceGroupName, computeName, *parameters)
|
||||||
err := <-errChan
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return <-errChan
|
return f.WaitForCompletion(ctx, s.client.VirtualMachinesClient.Client)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepCaptureImage) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepCaptureImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Capturing image ...")
|
s.say("Capturing image ...")
|
||||||
|
|
||||||
var computeName = state.Get(constants.ArmComputeName).(string)
|
var computeName = state.Get(constants.ArmComputeName).(string)
|
||||||
|
@ -86,38 +83,37 @@ func (s *StepCaptureImage) Run(_ context.Context, state multistep.StateBag) mult
|
||||||
s.say(fmt.Sprintf(" -> Compute Name : '%s'", computeName))
|
s.say(fmt.Sprintf(" -> Compute Name : '%s'", computeName))
|
||||||
s.say(fmt.Sprintf(" -> Compute Location : '%s'", location))
|
s.say(fmt.Sprintf(" -> Compute Location : '%s'", location))
|
||||||
|
|
||||||
result := common.StartInterruptibleTask(
|
err := s.generalizeVM(resourceGroupName, computeName)
|
||||||
func() bool {
|
|
||||||
return common.IsStateCancelled(state)
|
|
||||||
},
|
|
||||||
func(cancelCh <-chan struct{}) error {
|
|
||||||
err := s.generalizeVM(resourceGroupName, computeName)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if isManagedImage {
|
if err == nil {
|
||||||
s.say(fmt.Sprintf(" -> Image ResourceGroupName : '%s'", targetManagedImageResourceGroupName))
|
if isManagedImage {
|
||||||
s.say(fmt.Sprintf(" -> Image Name : '%s'", targetManagedImageName))
|
s.say(fmt.Sprintf(" -> Image ResourceGroupName : '%s'", targetManagedImageResourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> Image Location : '%s'", targetManagedImageLocation))
|
s.say(fmt.Sprintf(" -> Image Name : '%s'", targetManagedImageName))
|
||||||
return s.captureManagedImage(targetManagedImageResourceGroupName, targetManagedImageName, imageParameters, cancelCh)
|
s.say(fmt.Sprintf(" -> Image Location : '%s'", targetManagedImageLocation))
|
||||||
} else {
|
err = s.captureManagedImage(ctx, targetManagedImageResourceGroupName, targetManagedImageName, imageParameters)
|
||||||
return s.captureVhd(resourceGroupName, computeName, vmCaptureParameters, cancelCh)
|
} else {
|
||||||
}
|
err = s.captureVhd(ctx, resourceGroupName, computeName, vmCaptureParameters)
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
state.Put(constants.Error, err)
|
||||||
|
s.error(err)
|
||||||
|
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
|
|
||||||
// HACK(chrboum): I do not like this. The capture method should be returning this value
|
// HACK(chrboum): I do not like this. The capture method should be returning this value
|
||||||
// instead having to pass in another lambda. I'm in this pickle because I am using
|
// instead having to pass in another lambda.
|
||||||
// common.StartInterruptibleTask which is not parametric, and only returns a type of error.
|
|
||||||
// I could change it to interface{}, but I do not like that solution either.
|
|
||||||
//
|
//
|
||||||
// Having to resort to capturing the template via an inspector is hack, and once I can
|
// Having to resort to capturing the template via an inspector is hack, and once I can
|
||||||
// resolve that I can cleanup this code too. See the comments in azure_client.go for more
|
// resolve that I can cleanup this code too. See the comments in azure_client.go for more
|
||||||
// details.
|
// details.
|
||||||
|
// [paulmey]: autorest.Future now has access to the last http.Response, but I'm not sure if
|
||||||
|
// the body is still accessible.
|
||||||
template := s.get(s.client)
|
template := s.get(s.client)
|
||||||
state.Put(constants.ArmCaptureTemplate, template)
|
state.Put(constants.ArmCaptureTemplate, template)
|
||||||
|
|
||||||
return processInterruptibleResult(result, s.error, state)
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*StepCaptureImage) Cleanup(multistep.StateBag) {
|
func (*StepCaptureImage) Cleanup(multistep.StateBag) {
|
||||||
|
|
|
@ -5,14 +5,14 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestStepCaptureImageShouldFailIfCaptureFails(t *testing.T) {
|
func TestStepCaptureImageShouldFailIfCaptureFails(t *testing.T) {
|
||||||
var testSubject = &StepCaptureImage{
|
var testSubject = &StepCaptureImage{
|
||||||
captureVhd: func(string, string, *compute.VirtualMachineCaptureParameters, <-chan struct{}) error {
|
captureVhd: func(context.Context, string, string, *compute.VirtualMachineCaptureParameters) error {
|
||||||
return fmt.Errorf("!! Unit Test FAIL !!")
|
return fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
},
|
},
|
||||||
generalizeVM: func(string, string) error {
|
generalizeVM: func(string, string) error {
|
||||||
|
@ -39,7 +39,7 @@ func TestStepCaptureImageShouldFailIfCaptureFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepCaptureImageShouldPassIfCapturePasses(t *testing.T) {
|
func TestStepCaptureImageShouldPassIfCapturePasses(t *testing.T) {
|
||||||
var testSubject = &StepCaptureImage{
|
var testSubject = &StepCaptureImage{
|
||||||
captureVhd: func(string, string, *compute.VirtualMachineCaptureParameters, <-chan struct{}) error { return nil },
|
captureVhd: func(context.Context, string, string, *compute.VirtualMachineCaptureParameters) error { return nil },
|
||||||
generalizeVM: func(string, string) error {
|
generalizeVM: func(string, string) error {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
@ -74,7 +74,7 @@ func TestStepCaptureImageShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var testSubject = &StepCaptureImage{
|
var testSubject = &StepCaptureImage{
|
||||||
captureVhd: func(resourceGroupName string, computeName string, parameters *compute.VirtualMachineCaptureParameters, cancelCh <-chan struct{}) error {
|
captureVhd: func(_ context.Context, resourceGroupName string, computeName string, parameters *compute.VirtualMachineCaptureParameters) error {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualComputeName = computeName
|
actualComputeName = computeName
|
||||||
actualVirtualMachineCaptureParameters = parameters
|
actualVirtualMachineCaptureParameters = parameters
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
|
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
@ -13,10 +13,10 @@ import (
|
||||||
|
|
||||||
type StepCreateResourceGroup struct {
|
type StepCreateResourceGroup struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
create func(resourceGroupName string, location string, tags *map[string]*string) error
|
create func(ctx context.Context, resourceGroupName string, location string, tags map[string]*string) error
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
exists func(resourceGroupName string) (bool, error)
|
exists func(ctx context.Context, resourceGroupName string) (bool, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStepCreateResourceGroup(client *AzureClient, ui packer.Ui) *StepCreateResourceGroup {
|
func NewStepCreateResourceGroup(client *AzureClient, ui packer.Ui) *StepCreateResourceGroup {
|
||||||
|
@ -31,8 +31,8 @@ func NewStepCreateResourceGroup(client *AzureClient, ui packer.Ui) *StepCreateRe
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepCreateResourceGroup) createResourceGroup(resourceGroupName string, location string, tags *map[string]*string) error {
|
func (s *StepCreateResourceGroup) createResourceGroup(ctx context.Context, resourceGroupName string, location string, tags map[string]*string) error {
|
||||||
_, err := s.client.GroupsClient.CreateOrUpdate(resourceGroupName, resources.Group{
|
_, err := s.client.GroupsClient.CreateOrUpdate(ctx, resourceGroupName, resources.Group{
|
||||||
Location: &location,
|
Location: &location,
|
||||||
Tags: tags,
|
Tags: tags,
|
||||||
})
|
})
|
||||||
|
@ -43,8 +43,8 @@ func (s *StepCreateResourceGroup) createResourceGroup(resourceGroupName string,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepCreateResourceGroup) doesResourceGroupExist(resourceGroupName string) (bool, error) {
|
func (s *StepCreateResourceGroup) doesResourceGroupExist(ctx context.Context, resourceGroupName string) (bool, error) {
|
||||||
exists, err := s.client.GroupsClient.CheckExistence(resourceGroupName)
|
exists, err := s.client.GroupsClient.CheckExistence(ctx, resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func (s *StepCreateResourceGroup) doesResourceGroupExist(resourceGroupName strin
|
||||||
return exists.Response.StatusCode != 404, err
|
return exists.Response.StatusCode != 404, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepCreateResourceGroup) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepCreateResourceGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
var doubleResource, ok = state.GetOk(constants.ArmDoubleResourceGroupNameSet)
|
var doubleResource, ok = state.GetOk(constants.ArmDoubleResourceGroupNameSet)
|
||||||
if ok && doubleResource.(bool) {
|
if ok && doubleResource.(bool) {
|
||||||
err := errors.New("You have filled in both temp_resource_group_name and build_resource_group_name. Please choose one.")
|
err := errors.New("You have filled in both temp_resource_group_name and build_resource_group_name. Please choose one.")
|
||||||
|
@ -61,9 +61,9 @@ func (s *StepCreateResourceGroup) Run(_ context.Context, state multistep.StateBa
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
var location = state.Get(constants.ArmLocation).(string)
|
var location = state.Get(constants.ArmLocation).(string)
|
||||||
var tags = state.Get(constants.ArmTags).(*map[string]*string)
|
var tags = state.Get(constants.ArmTags).(map[string]*string)
|
||||||
|
|
||||||
exists, err := s.exists(resourceGroupName)
|
exists, err := s.exists(ctx, resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return processStepResult(err, s.error, state)
|
return processStepResult(err, s.error, state)
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,10 @@ func (s *StepCreateResourceGroup) Run(_ context.Context, state multistep.StateBa
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> Location : '%s'", location))
|
s.say(fmt.Sprintf(" -> Location : '%s'", location))
|
||||||
s.say(fmt.Sprintf(" -> Tags :"))
|
s.say(fmt.Sprintf(" -> Tags :"))
|
||||||
for k, v := range *tags {
|
for k, v := range tags {
|
||||||
s.say(fmt.Sprintf(" ->> %s : %s", k, *v))
|
s.say(fmt.Sprintf(" ->> %s : %s", k, *v))
|
||||||
}
|
}
|
||||||
err = s.create(resourceGroupName, location, tags)
|
err = s.create(ctx, resourceGroupName, location, tags)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
state.Put(constants.ArmIsResourceGroupCreated, true)
|
state.Put(constants.ArmIsResourceGroupCreated, true)
|
||||||
}
|
}
|
||||||
|
@ -115,9 +115,11 @@ func (s *StepCreateResourceGroup) Cleanup(state multistep.StateBag) {
|
||||||
ui.Say("\nCleanup requested, deleting resource group ...")
|
ui.Say("\nCleanup requested, deleting resource group ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
_, errChan := s.client.GroupsClient.Delete(resourceGroupName, nil)
|
ctx := context.TODO()
|
||||||
err := <-errChan
|
f, err := s.client.GroupsClient.Delete(ctx, resourceGroupName)
|
||||||
|
if err == nil {
|
||||||
|
err = f.WaitForCompletion(ctx, s.client.GroupsClient.Client)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf("Error deleting resource group. Please delete it manually.\n\n"+
|
ui.Error(fmt.Sprintf("Error deleting resource group. Please delete it manually.\n\n"+
|
||||||
"Name: %s\n"+
|
"Name: %s\n"+
|
||||||
|
|
|
@ -20,12 +20,12 @@ func TestStepCreateResourceGroupShouldFailIfBothGroupNames(t *testing.T) {
|
||||||
"tag01": &value,
|
"tag01": &value,
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag.Put(constants.ArmTags, &tags)
|
stateBag.Put(constants.ArmTags, tags)
|
||||||
var testSubject = &StepCreateResourceGroup{
|
var testSubject = &StepCreateResourceGroup{
|
||||||
create: func(string, string, *map[string]*string) error { return nil },
|
create: func(context.Context, string, string, map[string]*string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
exists: func(string) (bool, error) { return false, nil },
|
exists: func(context.Context, string) (bool, error) { return false, nil },
|
||||||
}
|
}
|
||||||
var result = testSubject.Run(context.Background(), stateBag)
|
var result = testSubject.Run(context.Background(), stateBag)
|
||||||
if result != multistep.ActionHalt {
|
if result != multistep.ActionHalt {
|
||||||
|
@ -39,10 +39,12 @@ func TestStepCreateResourceGroupShouldFailIfBothGroupNames(t *testing.T) {
|
||||||
|
|
||||||
func TestStepCreateResourceGroupShouldFailIfCreateFails(t *testing.T) {
|
func TestStepCreateResourceGroupShouldFailIfCreateFails(t *testing.T) {
|
||||||
var testSubject = &StepCreateResourceGroup{
|
var testSubject = &StepCreateResourceGroup{
|
||||||
create: func(string, string, *map[string]*string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
create: func(context.Context, string, string, map[string]*string) error {
|
||||||
|
return fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
exists: func(string) (bool, error) { return false, nil },
|
exists: func(context.Context, string) (bool, error) { return false, nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := createTestStateBagStepCreateResourceGroup()
|
stateBag := createTestStateBagStepCreateResourceGroup()
|
||||||
|
@ -59,10 +61,10 @@ func TestStepCreateResourceGroupShouldFailIfCreateFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepCreateResourceGroupShouldFailIfExistsFails(t *testing.T) {
|
func TestStepCreateResourceGroupShouldFailIfExistsFails(t *testing.T) {
|
||||||
var testSubject = &StepCreateResourceGroup{
|
var testSubject = &StepCreateResourceGroup{
|
||||||
create: func(string, string, *map[string]*string) error { return nil },
|
create: func(context.Context, string, string, map[string]*string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
exists: func(string) (bool, error) { return false, errors.New("FAIL") },
|
exists: func(context.Context, string) (bool, error) { return false, errors.New("FAIL") },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := createTestStateBagStepCreateResourceGroup()
|
stateBag := createTestStateBagStepCreateResourceGroup()
|
||||||
|
@ -79,10 +81,10 @@ func TestStepCreateResourceGroupShouldFailIfExistsFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepCreateResourceGroupShouldPassIfCreatePasses(t *testing.T) {
|
func TestStepCreateResourceGroupShouldPassIfCreatePasses(t *testing.T) {
|
||||||
var testSubject = &StepCreateResourceGroup{
|
var testSubject = &StepCreateResourceGroup{
|
||||||
create: func(string, string, *map[string]*string) error { return nil },
|
create: func(context.Context, string, string, map[string]*string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
exists: func(string) (bool, error) { return false, nil },
|
exists: func(context.Context, string) (bool, error) { return false, nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := createTestStateBagStepCreateResourceGroup()
|
stateBag := createTestStateBagStepCreateResourceGroup()
|
||||||
|
@ -100,10 +102,10 @@ func TestStepCreateResourceGroupShouldPassIfCreatePasses(t *testing.T) {
|
||||||
func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
||||||
var actualResourceGroupName string
|
var actualResourceGroupName string
|
||||||
var actualLocation string
|
var actualLocation string
|
||||||
var actualTags *map[string]*string
|
var actualTags map[string]*string
|
||||||
|
|
||||||
var testSubject = &StepCreateResourceGroup{
|
var testSubject = &StepCreateResourceGroup{
|
||||||
create: func(resourceGroupName string, location string, tags *map[string]*string) error {
|
create: func(_ context.Context, resourceGroupName string, location string, tags map[string]*string) error {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualLocation = location
|
actualLocation = location
|
||||||
actualTags = tags
|
actualTags = tags
|
||||||
|
@ -111,7 +113,7 @@ func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T
|
||||||
},
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
exists: func(string) (bool, error) { return false, nil },
|
exists: func(context.Context, string) (bool, error) { return false, nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := createTestStateBagStepCreateResourceGroup()
|
stateBag := createTestStateBagStepCreateResourceGroup()
|
||||||
|
@ -123,7 +125,7 @@ func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T
|
||||||
|
|
||||||
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
||||||
var expectedLocation = stateBag.Get(constants.ArmLocation).(string)
|
var expectedLocation = stateBag.Get(constants.ArmLocation).(string)
|
||||||
var expectedTags = stateBag.Get(constants.ArmTags).(*map[string]*string)
|
var expectedTags = stateBag.Get(constants.ArmTags).(map[string]*string)
|
||||||
|
|
||||||
if actualResourceGroupName != expectedResourceGroupName {
|
if actualResourceGroupName != expectedResourceGroupName {
|
||||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||||
|
@ -133,7 +135,7 @@ func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T
|
||||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(*expectedTags) != len(*actualTags) && *(*expectedTags)["tag01"] != *(*actualTags)["tag01"] {
|
if len(expectedTags) != len(actualTags) && expectedTags["tag01"] != actualTags["tag01"] {
|
||||||
t.Fatal("Expected the step to source 'constants.ArmTags' from the state bag, but it did not.")
|
t.Fatal("Expected the step to source 'constants.ArmTags' from the state bag, but it did not.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,10 +147,12 @@ func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T
|
||||||
|
|
||||||
func TestStepCreateResourceGroupMarkShouldFailIfTryingExistingButDoesntExist(t *testing.T) {
|
func TestStepCreateResourceGroupMarkShouldFailIfTryingExistingButDoesntExist(t *testing.T) {
|
||||||
var testSubject = &StepCreateResourceGroup{
|
var testSubject = &StepCreateResourceGroup{
|
||||||
create: func(string, string, *map[string]*string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
create: func(context.Context, string, string, map[string]*string) error {
|
||||||
|
return fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
exists: func(string) (bool, error) { return false, nil },
|
exists: func(context.Context, string) (bool, error) { return false, nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := createTestExistingStateBagStepCreateResourceGroup()
|
stateBag := createTestExistingStateBagStepCreateResourceGroup()
|
||||||
|
@ -165,10 +169,12 @@ func TestStepCreateResourceGroupMarkShouldFailIfTryingExistingButDoesntExist(t *
|
||||||
|
|
||||||
func TestStepCreateResourceGroupMarkShouldFailIfTryingTempButExist(t *testing.T) {
|
func TestStepCreateResourceGroupMarkShouldFailIfTryingTempButExist(t *testing.T) {
|
||||||
var testSubject = &StepCreateResourceGroup{
|
var testSubject = &StepCreateResourceGroup{
|
||||||
create: func(string, string, *map[string]*string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
create: func(context.Context, string, string, map[string]*string) error {
|
||||||
|
return fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
exists: func(string) (bool, error) { return true, nil },
|
exists: func(context.Context, string) (bool, error) { return true, nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := createTestStateBagStepCreateResourceGroup()
|
stateBag := createTestStateBagStepCreateResourceGroup()
|
||||||
|
@ -195,7 +201,7 @@ func createTestStateBagStepCreateResourceGroup() multistep.StateBag {
|
||||||
"tag01": &value,
|
"tag01": &value,
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag.Put(constants.ArmTags, &tags)
|
stateBag.Put(constants.ArmTags, tags)
|
||||||
return stateBag
|
return stateBag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +217,6 @@ func createTestExistingStateBagStepCreateResourceGroup() multistep.StateBag {
|
||||||
"tag01": &value,
|
"tag01": &value,
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag.Put(constants.ArmTags, &tags)
|
stateBag.Put(constants.ArmTags, tags)
|
||||||
return stateBag
|
return stateBag
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
type StepDeleteAdditionalDisk struct {
|
type StepDeleteAdditionalDisk struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
delete func(string, string) error
|
delete func(string, string) error
|
||||||
deleteManaged func(string, string) error
|
deleteManaged func(context.Context, string, string) error
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
@ -43,15 +43,17 @@ func (s *StepDeleteAdditionalDisk) deleteBlob(storageContainerName string, blobN
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeleteAdditionalDisk) deleteManagedDisk(resourceGroupName string, imageName string) error {
|
func (s *StepDeleteAdditionalDisk) deleteManagedDisk(ctx context.Context, resourceGroupName string, diskName string) error {
|
||||||
xs := strings.Split(imageName, "/")
|
xs := strings.Split(diskName, "/")
|
||||||
diskName := xs[len(xs)-1]
|
diskName = xs[len(xs)-1]
|
||||||
_, errChan := s.client.DisksClient.Delete(resourceGroupName, diskName, nil)
|
f, err := s.client.DisksClient.Delete(ctx, resourceGroupName, diskName)
|
||||||
err := <-errChan
|
if err == nil {
|
||||||
|
err = f.WaitForCompletion(ctx, s.client.DisksClient.Client)
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeleteAdditionalDisk) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepDeleteAdditionalDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Deleting the temporary Additional disk ...")
|
s.say("Deleting the temporary Additional disk ...")
|
||||||
|
|
||||||
var dataDisks = state.Get(constants.ArmAdditionalDiskVhds).([]string)
|
var dataDisks = state.Get(constants.ArmAdditionalDiskVhds).([]string)
|
||||||
|
@ -73,7 +75,7 @@ func (s *StepDeleteAdditionalDisk) Run(_ context.Context, state multistep.StateB
|
||||||
s.say(fmt.Sprintf(" -> Additional Disk %d: '%s'", i+1, additionaldisk))
|
s.say(fmt.Sprintf(" -> Additional Disk %d: '%s'", i+1, additionaldisk))
|
||||||
var err error
|
var err error
|
||||||
if isManagedDisk {
|
if isManagedDisk {
|
||||||
err = s.deleteManaged(resourceGroupName, additionaldisk)
|
err = s.deleteManaged(ctx, resourceGroupName, additionaldisk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say("Failed to delete the managed Additional Disk!")
|
s.say("Failed to delete the managed Additional Disk!")
|
||||||
return processStepResult(err, s.error, state)
|
return processStepResult(err, s.error, state)
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
func TestStepDeleteAdditionalDiskShouldFailIfGetFails(t *testing.T) {
|
func TestStepDeleteAdditionalDiskShouldFailIfGetFails(t *testing.T) {
|
||||||
var testSubject = &StepDeleteAdditionalDisk{
|
var testSubject = &StepDeleteAdditionalDisk{
|
||||||
delete: func(string, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
delete: func(string, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ func TestStepDeleteAdditionalDiskShouldFailIfVHDNameCannotBeURLParsed(t *testing
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalid URL per https://golang.org/src/net/url/url_test.go
|
// Invalid URL per https://golang.org/src/net/url/url_test.go
|
||||||
|
@ -130,7 +130,7 @@ func TestStepDeleteAdditionalDiskShouldFailIfVHDNameIsTooShort(t *testing.T) {
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := DeleteTestStateBagStepDeleteAdditionalDisk([]string{"storage.blob.core.windows.net/abc"})
|
stateBag := DeleteTestStateBagStepDeleteAdditionalDisk([]string{"storage.blob.core.windows.net/abc"})
|
||||||
|
@ -173,7 +173,7 @@ func TestStepDeleteAdditionalDiskShouldFailIfManagedDiskInExistingResourceGroupF
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return errors.New("UNIT TEST FAIL!") },
|
deleteManaged: func(context.Context, string, string) error { return errors.New("UNIT TEST FAIL!") },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := new(multistep.BasicStateBag)
|
stateBag := new(multistep.BasicStateBag)
|
||||||
|
@ -197,7 +197,7 @@ func TestStepDeleteAdditionalDiskShouldFailIfManagedDiskInExistingResourceGroupI
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := new(multistep.BasicStateBag)
|
stateBag := new(multistep.BasicStateBag)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
type StepDeleteOSDisk struct {
|
type StepDeleteOSDisk struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
delete func(string, string) error
|
delete func(string, string) error
|
||||||
deleteManaged func(string, string) error
|
deleteManaged func(context.Context, string, string) error
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
@ -43,15 +43,17 @@ func (s *StepDeleteOSDisk) deleteBlob(storageContainerName string, blobName stri
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeleteOSDisk) deleteManagedDisk(resourceGroupName string, imageName string) error {
|
func (s *StepDeleteOSDisk) deleteManagedDisk(ctx context.Context, resourceGroupName string, imageName string) error {
|
||||||
xs := strings.Split(imageName, "/")
|
xs := strings.Split(imageName, "/")
|
||||||
diskName := xs[len(xs)-1]
|
diskName := xs[len(xs)-1]
|
||||||
_, errChan := s.client.DisksClient.Delete(resourceGroupName, diskName, nil)
|
f, err := s.client.DisksClient.Delete(ctx, resourceGroupName, diskName)
|
||||||
err := <-errChan
|
if err == nil {
|
||||||
|
err = f.WaitForCompletion(ctx, s.client.DisksClient.Client)
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeleteOSDisk) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepDeleteOSDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Deleting the temporary OS disk ...")
|
s.say("Deleting the temporary OS disk ...")
|
||||||
|
|
||||||
var osDisk = state.Get(constants.ArmOSDiskVhd).(string)
|
var osDisk = state.Get(constants.ArmOSDiskVhd).(string)
|
||||||
|
@ -68,7 +70,7 @@ func (s *StepDeleteOSDisk) Run(_ context.Context, state multistep.StateBag) mult
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if isManagedDisk {
|
if isManagedDisk {
|
||||||
err = s.deleteManaged(resourceGroupName, osDisk)
|
err = s.deleteManaged(ctx, resourceGroupName, osDisk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say("Failed to delete the managed OS Disk!")
|
s.say("Failed to delete the managed OS Disk!")
|
||||||
return processStepResult(err, s.error, state)
|
return processStepResult(err, s.error, state)
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
func TestStepDeleteOSDiskShouldFailIfGetFails(t *testing.T) {
|
func TestStepDeleteOSDiskShouldFailIfGetFails(t *testing.T) {
|
||||||
var testSubject = &StepDeleteOSDisk{
|
var testSubject = &StepDeleteOSDisk{
|
||||||
delete: func(string, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
delete: func(string, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ func TestStepDeleteOSDiskShouldFailIfVHDNameCannotBeURLParsed(t *testing.T) {
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalid URL per https://golang.org/src/net/url/url_test.go
|
// Invalid URL per https://golang.org/src/net/url/url_test.go
|
||||||
|
@ -130,7 +130,7 @@ func TestStepDeleteOSDiskShouldFailIfVHDNameIsTooShort(t *testing.T) {
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := DeleteTestStateBagStepDeleteOSDisk("storage.blob.core.windows.net/abc")
|
stateBag := DeleteTestStateBagStepDeleteOSDisk("storage.blob.core.windows.net/abc")
|
||||||
|
@ -173,7 +173,7 @@ func TestStepDeleteOSDiskShouldFailIfManagedDiskInExistingResourceGroupFailsToDe
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return errors.New("UNIT TEST FAIL!") },
|
deleteManaged: func(context.Context, string, string) error { return errors.New("UNIT TEST FAIL!") },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := new(multistep.BasicStateBag)
|
stateBag := new(multistep.BasicStateBag)
|
||||||
|
@ -197,7 +197,7 @@ func TestStepDeleteOSDiskShouldFailIfManagedDiskInExistingResourceGroupIsDeleted
|
||||||
delete: func(string, string) error { return nil },
|
delete: func(string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
deleteManaged: func(string, string) error { return nil },
|
deleteManaged: func(context.Context, string, string) error { return nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
stateBag := new(multistep.BasicStateBag)
|
stateBag := new(multistep.BasicStateBag)
|
||||||
|
|
|
@ -4,8 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Azure/go-autorest/autorest"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
@ -17,7 +15,7 @@ const (
|
||||||
|
|
||||||
type StepDeleteResourceGroup struct {
|
type StepDeleteResourceGroup struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
delete func(state multistep.StateBag, resourceGroupName string, cancelCh <-chan struct{}) error
|
delete func(ctx context.Context, state multistep.StateBag, resourceGroupName string) error
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
@ -33,18 +31,18 @@ func NewStepDeleteResourceGroup(client *AzureClient, ui packer.Ui) *StepDeleteRe
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeleteResourceGroup) deleteResourceGroup(state multistep.StateBag, resourceGroupName string, cancelCh <-chan struct{}) error {
|
func (s *StepDeleteResourceGroup) deleteResourceGroup(ctx context.Context, state multistep.StateBag, resourceGroupName string) error {
|
||||||
var err error
|
var err error
|
||||||
if state.Get(constants.ArmIsExistingResourceGroup).(bool) {
|
if state.Get(constants.ArmIsExistingResourceGroup).(bool) {
|
||||||
s.say("\nThe resource group was not created by Packer, only deleting individual resources ...")
|
s.say("\nThe resource group was not created by Packer, only deleting individual resources ...")
|
||||||
var deploymentName = state.Get(constants.ArmDeploymentName).(string)
|
var deploymentName = state.Get(constants.ArmDeploymentName).(string)
|
||||||
err = s.deleteDeploymentResources(deploymentName, resourceGroupName)
|
err = s.deleteDeploymentResources(ctx, deploymentName, resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if keyVaultDeploymentName, ok := state.GetOk(constants.ArmKeyVaultDeploymentName); ok {
|
if keyVaultDeploymentName, ok := state.GetOk(constants.ArmKeyVaultDeploymentName); ok {
|
||||||
err = s.deleteDeploymentResources(keyVaultDeploymentName.(string), resourceGroupName)
|
err = s.deleteDeploymentResources(ctx, keyVaultDeploymentName.(string), resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -53,8 +51,10 @@ func (s *StepDeleteResourceGroup) deleteResourceGroup(state multistep.StateBag,
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
s.say("\nThe resource group was created by Packer, deleting ...")
|
s.say("\nThe resource group was created by Packer, deleting ...")
|
||||||
_, errChan := s.client.GroupsClient.Delete(resourceGroupName, cancelCh)
|
f, err := s.client.GroupsClient.Delete(ctx, resourceGroupName)
|
||||||
err = <-errChan
|
if err == nil {
|
||||||
|
f.WaitForCompletion(ctx, s.client.GroupsClient.Client)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
|
@ -63,46 +63,36 @@ func (s *StepDeleteResourceGroup) deleteResourceGroup(state multistep.StateBag,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeleteResourceGroup) deleteDeploymentResources(deploymentName, resourceGroupName string) error {
|
func (s *StepDeleteResourceGroup) deleteDeploymentResources(ctx context.Context, deploymentName, resourceGroupName string) error {
|
||||||
maxResources := int32(maxResourcesToDelete)
|
maxResources := int32(maxResourcesToDelete)
|
||||||
|
|
||||||
deploymentOperations, err := s.client.DeploymentOperationsClient.List(resourceGroupName, deploymentName, &maxResources)
|
deploymentOperations, err := s.client.DeploymentOperationsClient.ListComplete(ctx, resourceGroupName, deploymentName, &maxResources)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.reportIfError(err, resourceGroupName)
|
s.reportIfError(err, resourceGroupName)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, deploymentOperation := range *deploymentOperations.Value {
|
for deploymentOperations.NotDone() {
|
||||||
|
deploymentOperation := deploymentOperations.Value()
|
||||||
// Sometimes an empty operation is added to the list by Azure
|
// Sometimes an empty operation is added to the list by Azure
|
||||||
if deploymentOperation.Properties.TargetResource == nil {
|
if deploymentOperation.Properties.TargetResource == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
s.say(fmt.Sprintf(" -> %s : '%s'",
|
|
||||||
*deploymentOperation.Properties.TargetResource.ResourceType,
|
|
||||||
*deploymentOperation.Properties.TargetResource.ResourceName))
|
|
||||||
|
|
||||||
var networkDeleteFunction func(string, string, <-chan struct{}) (<-chan autorest.Response, <-chan error)
|
|
||||||
resourceName := *deploymentOperation.Properties.TargetResource.ResourceName
|
resourceName := *deploymentOperation.Properties.TargetResource.ResourceName
|
||||||
|
resourceType := *deploymentOperation.Properties.TargetResource.ResourceType
|
||||||
|
|
||||||
switch *deploymentOperation.Properties.TargetResource.ResourceType {
|
s.say(fmt.Sprintf(" -> %s : '%s'",
|
||||||
case "Microsoft.Compute/virtualMachines":
|
resourceType,
|
||||||
_, errChan := s.client.VirtualMachinesClient.Delete(resourceGroupName, resourceName, nil)
|
resourceName))
|
||||||
err := <-errChan
|
|
||||||
s.reportIfError(err, resourceName)
|
err := deleteResource(ctx, s.client,
|
||||||
case "Microsoft.KeyVault/vaults":
|
resourceType,
|
||||||
_, err := s.client.VaultClientDelete.Delete(resourceGroupName, resourceName)
|
resourceName,
|
||||||
s.reportIfError(err, resourceName)
|
resourceGroupName)
|
||||||
case "Microsoft.Network/networkInterfaces":
|
s.reportIfError(err, resourceName)
|
||||||
networkDeleteFunction = s.client.InterfacesClient.Delete
|
if err = deploymentOperations.Next(); err != nil {
|
||||||
case "Microsoft.Network/virtualNetworks":
|
return err
|
||||||
networkDeleteFunction = s.client.VirtualNetworksClient.Delete
|
|
||||||
case "Microsoft.Network/publicIPAddresses":
|
|
||||||
networkDeleteFunction = s.client.PublicIPAddressesClient.Delete
|
|
||||||
}
|
|
||||||
if networkDeleteFunction != nil {
|
|
||||||
_, errChan := networkDeleteFunction(resourceGroupName, resourceName, nil)
|
|
||||||
err := <-errChan
|
|
||||||
s.reportIfError(err, resourceName)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,19 +108,23 @@ func (s *StepDeleteResourceGroup) reportIfError(err error, resourceName string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeleteResourceGroup) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepDeleteResourceGroup) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Deleting resource group ...")
|
s.say("Deleting resource group ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
|
|
||||||
result := common.StartInterruptibleTask(
|
err := s.delete(ctx, state, resourceGroupName)
|
||||||
func() bool { return common.IsStateCancelled(state) },
|
if err != nil {
|
||||||
func(cancelCh <-chan struct{}) error { return s.delete(state, resourceGroupName, cancelCh) })
|
state.Put(constants.Error, err)
|
||||||
stepAction := processInterruptibleResult(result, s.error, state)
|
s.error(err)
|
||||||
|
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
|
|
||||||
state.Put(constants.ArmIsResourceGroupCreated, false)
|
state.Put(constants.ArmIsResourceGroupCreated, false)
|
||||||
|
|
||||||
return stepAction
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*StepDeleteResourceGroup) Cleanup(multistep.StateBag) {
|
func (*StepDeleteResourceGroup) Cleanup(multistep.StateBag) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func TestStepDeleteResourceGroupShouldFailIfDeleteFails(t *testing.T) {
|
func TestStepDeleteResourceGroupShouldFailIfDeleteFails(t *testing.T) {
|
||||||
var testSubject = &StepDeleteResourceGroup{
|
var testSubject = &StepDeleteResourceGroup{
|
||||||
delete: func(multistep.StateBag, string, <-chan struct{}) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
delete: func(context.Context, multistep.StateBag, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func TestStepDeleteResourceGroupShouldFailIfDeleteFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepDeleteResourceGroupShouldPassIfDeletePasses(t *testing.T) {
|
func TestStepDeleteResourceGroupShouldPassIfDeletePasses(t *testing.T) {
|
||||||
var testSubject = &StepDeleteResourceGroup{
|
var testSubject = &StepDeleteResourceGroup{
|
||||||
delete: func(multistep.StateBag, string, <-chan struct{}) error { return nil },
|
delete: func(context.Context, multistep.StateBag, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ func TestStepDeleteResourceGroupShouldPassIfDeletePasses(t *testing.T) {
|
||||||
|
|
||||||
func TestStepDeleteResourceGroupShouldDeleteStateBagArmResourceGroupCreated(t *testing.T) {
|
func TestStepDeleteResourceGroupShouldDeleteStateBagArmResourceGroupCreated(t *testing.T) {
|
||||||
var testSubject = &StepDeleteResourceGroup{
|
var testSubject = &StepDeleteResourceGroup{
|
||||||
delete: func(s multistep.StateBag, resourceGroupName string, cancelCh <-chan struct{}) error {
|
delete: func(context.Context, multistep.StateBag, string) error {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
|
|
|
@ -7,8 +7,6 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Azure/go-autorest/autorest"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
@ -16,10 +14,10 @@ import (
|
||||||
|
|
||||||
type StepDeployTemplate struct {
|
type StepDeployTemplate struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
deploy func(resourceGroupName string, deploymentName string, cancelCh <-chan struct{}) error
|
deploy func(ctx context.Context, resourceGroupName string, deploymentName string) error
|
||||||
delete func(resourceType string, resourceName string, resourceGroupName string) error
|
delete func(ctx context.Context, client *AzureClient, resourceType string, resourceName string, resourceGroupName string) error
|
||||||
disk func(resourceGroupName string, computeName string) (string, string, error)
|
disk func(ctx context.Context, resourceGroupName string, computeName string) (string, string, error)
|
||||||
deleteDisk func(imageType string, imageName string, resourceGroupName string) error
|
deleteDisk func(ctx context.Context, imageType string, imageName string, resourceGroupName string) error
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
config *Config
|
config *Config
|
||||||
|
@ -38,28 +36,29 @@ func NewStepDeployTemplate(client *AzureClient, ui packer.Ui, config *Config, de
|
||||||
}
|
}
|
||||||
|
|
||||||
step.deploy = step.deployTemplate
|
step.deploy = step.deployTemplate
|
||||||
step.delete = step.deleteOperationResource
|
step.delete = deleteResource
|
||||||
step.disk = step.getImageDetails
|
step.disk = step.getImageDetails
|
||||||
step.deleteDisk = step.deleteImage
|
step.deleteDisk = step.deleteImage
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeployTemplate) deployTemplate(resourceGroupName string, deploymentName string, cancelCh <-chan struct{}) error {
|
func (s *StepDeployTemplate) deployTemplate(ctx context.Context, resourceGroupName string, deploymentName string) error {
|
||||||
deployment, err := s.factory(s.config)
|
deployment, err := s.factory(s.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, errChan := s.client.DeploymentsClient.CreateOrUpdate(resourceGroupName, deploymentName, *deployment, cancelCh)
|
f, err := s.client.DeploymentsClient.CreateOrUpdate(ctx, resourceGroupName, deploymentName, *deployment)
|
||||||
|
if err == nil {
|
||||||
err = <-errChan
|
err = f.WaitForCompletion(ctx, s.client.DeploymentsClient.Client)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeployTemplate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepDeployTemplate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Deploying deployment template ...")
|
s.say("Deploying deployment template ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
|
@ -67,21 +66,16 @@ func (s *StepDeployTemplate) Run(_ context.Context, state multistep.StateBag) mu
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> DeploymentName : '%s'", s.name))
|
s.say(fmt.Sprintf(" -> DeploymentName : '%s'", s.name))
|
||||||
|
|
||||||
result := common.StartInterruptibleTask(
|
return processStepResult(
|
||||||
func() bool { return common.IsStateCancelled(state) },
|
s.deploy(ctx, resourceGroupName, s.name),
|
||||||
func(cancelCh <-chan struct{}) error {
|
s.error, state)
|
||||||
return s.deploy(resourceGroupName, s.name, cancelCh)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
return processInterruptibleResult(result, s.error, state)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeployTemplate) getImageDetails(resourceGroupName string, computeName string) (string, string, error) {
|
func (s *StepDeployTemplate) getImageDetails(ctx context.Context, resourceGroupName string, computeName string) (string, string, error) {
|
||||||
//We can't depend on constants.ArmOSDiskVhd being set
|
//We can't depend on constants.ArmOSDiskVhd being set
|
||||||
var imageName string
|
var imageName string
|
||||||
var imageType string
|
var imageType string
|
||||||
vm, err := s.client.VirtualMachinesClient.Get(resourceGroupName, computeName, "")
|
vm, err := s.client.VirtualMachinesClient.Get(ctx, resourceGroupName, computeName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return imageName, imageType, err
|
return imageName, imageType, err
|
||||||
} else {
|
} else {
|
||||||
|
@ -96,44 +90,50 @@ func (s *StepDeployTemplate) getImageDetails(resourceGroupName string, computeNa
|
||||||
return imageType, imageName, nil
|
return imageType, imageName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeployTemplate) deleteOperationResource(resourceType string, resourceName string, resourceGroupName string) error {
|
//TODO(paulmey): move to helpers file
|
||||||
var networkDeleteFunction func(string, string, <-chan struct{}) (<-chan autorest.Response, <-chan error)
|
func deleteResource(ctx context.Context, client *AzureClient, resourceType string, resourceName string, resourceGroupName string) error {
|
||||||
switch resourceType {
|
switch resourceType {
|
||||||
case "Microsoft.Compute/virtualMachines":
|
case "Microsoft.Compute/virtualMachines":
|
||||||
_, errChan := s.client.VirtualMachinesClient.Delete(resourceGroupName,
|
f, err := client.VirtualMachinesClient.Delete(ctx, resourceGroupName, resourceName)
|
||||||
resourceName, nil)
|
if err == nil {
|
||||||
err := <-errChan
|
err = f.WaitForCompletion(ctx, client.VirtualMachinesClient.Client)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
case "Microsoft.KeyVault/vaults":
|
case "Microsoft.KeyVault/vaults":
|
||||||
_, err := s.client.VaultClientDelete.Delete(resourceGroupName, resourceName)
|
// TODO(paulmey): not sure why VaultClient doesn't do cancellation
|
||||||
|
_, err := client.VaultClientDelete.Delete(resourceGroupName, resourceName)
|
||||||
return err
|
return err
|
||||||
case "Microsoft.Network/networkInterfaces":
|
case "Microsoft.Network/networkInterfaces":
|
||||||
networkDeleteFunction = s.client.InterfacesClient.Delete
|
f, err := client.InterfacesClient.Delete(ctx, resourceGroupName, resourceName)
|
||||||
case "Microsoft.Network/virtualNetworks":
|
if err == nil {
|
||||||
networkDeleteFunction = s.client.VirtualNetworksClient.Delete
|
err = f.WaitForCompletion(ctx, client.InterfacesClient.Client)
|
||||||
case "Microsoft.Network/publicIPAddresses":
|
|
||||||
networkDeleteFunction = s.client.PublicIPAddressesClient.Delete
|
|
||||||
}
|
|
||||||
if networkDeleteFunction != nil {
|
|
||||||
_, errChan := networkDeleteFunction(resourceGroupName, resourceName, nil)
|
|
||||||
err := <-errChan
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
|
case "Microsoft.Network/virtualNetworks":
|
||||||
|
f, err := client.VirtualNetworksClient.Delete(ctx, resourceGroupName, resourceName)
|
||||||
|
if err == nil {
|
||||||
|
err = f.WaitForCompletion(ctx, client.VirtualNetworksClient.Client)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
case "Microsoft.Network/publicIPAddresses":
|
||||||
|
f, err := client.PublicIPAddressesClient.Delete(ctx, resourceGroupName, resourceName)
|
||||||
|
if err == nil {
|
||||||
|
err = f.WaitForCompletion(ctx, client.PublicIPAddressesClient.Client)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepDeployTemplate) deleteImage(imageType string, imageName string, resourceGroupName string) error {
|
func (s *StepDeployTemplate) deleteImage(ctx context.Context, imageType string, imageName string, resourceGroupName string) error {
|
||||||
// Managed disk
|
// Managed disk
|
||||||
if imageType == "Microsoft.Compute/disks" {
|
if imageType == "Microsoft.Compute/disks" {
|
||||||
xs := strings.Split(imageName, "/")
|
xs := strings.Split(imageName, "/")
|
||||||
diskName := xs[len(xs)-1]
|
diskName := xs[len(xs)-1]
|
||||||
_, errChan := s.client.DisksClient.Delete(resourceGroupName, diskName, nil)
|
f, err := s.client.DisksClient.Delete(ctx, resourceGroupName, diskName)
|
||||||
err := <-errChan
|
if err == nil {
|
||||||
|
err = f.WaitForCompletion(ctx, s.client.DisksClient.Client)
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// VHD image
|
// VHD image
|
||||||
|
@ -167,7 +167,7 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) {
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
var computeName = state.Get(constants.ArmComputeName).(string)
|
var computeName = state.Get(constants.ArmComputeName).(string)
|
||||||
var deploymentName = s.name
|
var deploymentName = s.name
|
||||||
imageType, imageName, err := s.disk(resourceGroupName, computeName)
|
imageType, imageName, err := s.disk(context.TODO(), resourceGroupName, computeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error("Could not retrieve OS Image details")
|
ui.Error("Could not retrieve OS Image details")
|
||||||
}
|
}
|
||||||
|
@ -175,13 +175,14 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) {
|
||||||
ui.Say(" -> Deployment: " + deploymentName)
|
ui.Say(" -> Deployment: " + deploymentName)
|
||||||
if deploymentName != "" {
|
if deploymentName != "" {
|
||||||
maxResources := int32(50)
|
maxResources := int32(50)
|
||||||
deploymentOperations, err := s.client.DeploymentOperationsClient.List(resourceGroupName, deploymentName, &maxResources)
|
deploymentOperations, err := s.client.DeploymentOperationsClient.ListComplete(context.TODO(), resourceGroupName, deploymentName, &maxResources)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf("Error deleting resources. Please delete them manually.\n\n"+
|
ui.Error(fmt.Sprintf("Error deleting resources. Please delete them manually.\n\n"+
|
||||||
"Name: %s\n"+
|
"Name: %s\n"+
|
||||||
"Error: %s", resourceGroupName, err))
|
"Error: %s", resourceGroupName, err))
|
||||||
}
|
}
|
||||||
for _, deploymentOperation := range *deploymentOperations.Value {
|
for deploymentOperations.NotDone() {
|
||||||
|
deploymentOperation := deploymentOperations.Value()
|
||||||
// Sometimes an empty operation is added to the list by Azure
|
// Sometimes an empty operation is added to the list by Azure
|
||||||
if deploymentOperation.Properties.TargetResource == nil {
|
if deploymentOperation.Properties.TargetResource == nil {
|
||||||
continue
|
continue
|
||||||
|
@ -189,7 +190,8 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) {
|
||||||
ui.Say(fmt.Sprintf(" -> %s : '%s'",
|
ui.Say(fmt.Sprintf(" -> %s : '%s'",
|
||||||
*deploymentOperation.Properties.TargetResource.ResourceType,
|
*deploymentOperation.Properties.TargetResource.ResourceType,
|
||||||
*deploymentOperation.Properties.TargetResource.ResourceName))
|
*deploymentOperation.Properties.TargetResource.ResourceName))
|
||||||
err = s.delete(*deploymentOperation.Properties.TargetResource.ResourceType,
|
err = s.delete(context.TODO(), s.client,
|
||||||
|
*deploymentOperation.Properties.TargetResource.ResourceType,
|
||||||
*deploymentOperation.Properties.TargetResource.ResourceName,
|
*deploymentOperation.Properties.TargetResource.ResourceName,
|
||||||
resourceGroupName)
|
resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -197,12 +199,18 @@ func (s *StepDeployTemplate) Cleanup(state multistep.StateBag) {
|
||||||
"Name: %s\n"+
|
"Name: %s\n"+
|
||||||
"Error: %s", *deploymentOperation.Properties.TargetResource.ResourceName, err))
|
"Error: %s", *deploymentOperation.Properties.TargetResource.ResourceName, err))
|
||||||
}
|
}
|
||||||
|
if err = deploymentOperations.Next(); err != nil {
|
||||||
|
ui.Error(fmt.Sprintf("Error deleting resources. Please delete them manually.\n\n"+
|
||||||
|
"Name: %s\n"+
|
||||||
|
"Error: %s", resourceGroupName, err))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The disk is not defined as an operation in the template so has to be
|
// The disk is not defined as an operation in the template so has to be
|
||||||
// deleted separately
|
// deleted separately
|
||||||
ui.Say(fmt.Sprintf(" -> %s : '%s'", imageType, imageName))
|
ui.Say(fmt.Sprintf(" -> %s : '%s'", imageType, imageName))
|
||||||
err = s.deleteDisk(imageType, imageName, resourceGroupName)
|
err = s.deleteDisk(context.TODO(), imageType, imageName, resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf("Error deleting resource. Please delete manually.\n\n"+
|
ui.Error(fmt.Sprintf("Error deleting resource. Please delete manually.\n\n"+
|
||||||
"Name: %s\n"+
|
"Name: %s\n"+
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func TestStepDeployTemplateShouldFailIfDeployFails(t *testing.T) {
|
func TestStepDeployTemplateShouldFailIfDeployFails(t *testing.T) {
|
||||||
var testSubject = &StepDeployTemplate{
|
var testSubject = &StepDeployTemplate{
|
||||||
deploy: func(string, string, <-chan struct{}) error {
|
deploy: func(context.Context, string, string) error {
|
||||||
return fmt.Errorf("!! Unit Test FAIL !!")
|
return fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
},
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
|
@ -32,7 +32,7 @@ func TestStepDeployTemplateShouldFailIfDeployFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepDeployTemplateShouldPassIfDeployPasses(t *testing.T) {
|
func TestStepDeployTemplateShouldPassIfDeployPasses(t *testing.T) {
|
||||||
var testSubject = &StepDeployTemplate{
|
var testSubject = &StepDeployTemplate{
|
||||||
deploy: func(string, string, <-chan struct{}) error { return nil },
|
deploy: func(context.Context, string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ func TestStepDeployTemplateShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
||||||
var actualDeploymentName string
|
var actualDeploymentName string
|
||||||
|
|
||||||
var testSubject = &StepDeployTemplate{
|
var testSubject = &StepDeployTemplate{
|
||||||
deploy: func(resourceGroupName string, deploymentName string, cancelCh <-chan struct{}) error {
|
deploy: func(_ context.Context, resourceGroupName string, deploymentName string) error {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualDeploymentName = deploymentName
|
actualDeploymentName = deploymentName
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ func TestStepDeployTemplateDeleteImageShouldFailWhenImageUrlCannotBeParsed(t *te
|
||||||
name: "--deployment-name--",
|
name: "--deployment-name--",
|
||||||
}
|
}
|
||||||
// Invalid URL per https://golang.org/src/net/url/url_test.go
|
// Invalid URL per https://golang.org/src/net/url/url_test.go
|
||||||
err := testSubject.deleteImage("image", "http://[fe80::1%en0]/", "Unit Test: ResourceGroupName")
|
err := testSubject.deleteImage(context.TODO(), "image", "http://[fe80::1%en0]/", "Unit Test: ResourceGroupName")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("Expected a failure because of the failed image name")
|
t.Fatal("Expected a failure because of the failed image name")
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ func TestStepDeployTemplateDeleteImageShouldFailWithInvalidImage(t *testing.T) {
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
name: "--deployment-name--",
|
name: "--deployment-name--",
|
||||||
}
|
}
|
||||||
err := testSubject.deleteImage("image", "storage.blob.core.windows.net/abc", "Unit Test: ResourceGroupName")
|
err := testSubject.deleteImage(context.TODO(), "image", "storage.blob.core.windows.net/abc", "Unit Test: ResourceGroupName")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("Expected a failure because of the failed image name")
|
t.Fatal("Expected a failure because of the failed image name")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
type StepGetDataDisk struct {
|
type StepGetDataDisk struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
query func(resourceGroupName string, computeName string) (compute.VirtualMachine, error)
|
query func(ctx context.Context, resourceGroupName string, computeName string) (compute.VirtualMachine, error)
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ func NewStepGetAdditionalDisks(client *AzureClient, ui packer.Ui) *StepGetDataDi
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetDataDisk) queryCompute(resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
func (s *StepGetDataDisk) queryCompute(ctx context.Context, resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
||||||
vm, err := s.client.VirtualMachinesClient.Get(resourceGroupName, computeName, "")
|
vm, err := s.client.VirtualMachinesClient.Get(ctx, resourceGroupName, computeName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return vm, err
|
return vm, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetDataDisk) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepGetDataDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Querying the machine's additional disks properties ...")
|
s.say("Querying the machine's additional disks properties ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
|
@ -47,7 +47,7 @@ func (s *StepGetDataDisk) Run(_ context.Context, state multistep.StateBag) multi
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
||||||
|
|
||||||
vm, err := s.query(resourceGroupName, computeName)
|
vm, err := s.query(ctx, resourceGroupName, computeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
state.Put(constants.Error, err)
|
state.Put(constants.Error, err)
|
||||||
s.error(err)
|
s.error(err)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
func TestStepGetAdditionalDiskShouldFailIfGetFails(t *testing.T) {
|
func TestStepGetAdditionalDiskShouldFailIfGetFails(t *testing.T) {
|
||||||
var testSubject = &StepGetDataDisk{
|
var testSubject = &StepGetDataDisk{
|
||||||
query: func(string, string) (compute.VirtualMachine, error) {
|
query: func(context.Context, string, string) (compute.VirtualMachine, error) {
|
||||||
return createVirtualMachineWithDataDisksFromUri("test.vhd"), fmt.Errorf("!! Unit Test FAIL !!")
|
return createVirtualMachineWithDataDisksFromUri("test.vhd"), fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
},
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
|
@ -35,7 +35,7 @@ func TestStepGetAdditionalDiskShouldFailIfGetFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepGetAdditionalDiskShouldPassIfGetPasses(t *testing.T) {
|
func TestStepGetAdditionalDiskShouldPassIfGetPasses(t *testing.T) {
|
||||||
var testSubject = &StepGetDataDisk{
|
var testSubject = &StepGetDataDisk{
|
||||||
query: func(string, string) (compute.VirtualMachine, error) {
|
query: func(context.Context, string, string) (compute.VirtualMachine, error) {
|
||||||
return createVirtualMachineWithDataDisksFromUri("test.vhd"), nil
|
return createVirtualMachineWithDataDisksFromUri("test.vhd"), nil
|
||||||
},
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
|
@ -59,7 +59,7 @@ func TestStepGetAdditionalDiskShouldTakeValidateArgumentsFromStateBag(t *testing
|
||||||
var actualComputeName string
|
var actualComputeName string
|
||||||
|
|
||||||
var testSubject = &StepGetDataDisk{
|
var testSubject = &StepGetDataDisk{
|
||||||
query: func(resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
query: func(ctx context.Context, resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualComputeName = computeName
|
actualComputeName = computeName
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ var (
|
||||||
type StepGetIPAddress struct {
|
type StepGetIPAddress struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
endpoint EndpointType
|
endpoint EndpointType
|
||||||
get func(resourceGroupName string, ipAddressName string, interfaceName string) (string, error)
|
get func(ctx context.Context, resourceGroupName string, ipAddressName string, interfaceName string) (string, error)
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,8 @@ func NewStepGetIPAddress(client *AzureClient, ui packer.Ui, endpoint EndpointTyp
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetIPAddress) getPrivateIP(resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
func (s *StepGetIPAddress) getPrivateIP(ctx context.Context, resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
||||||
resp, err := s.client.InterfacesClient.Get(resourceGroupName, interfaceName, "")
|
resp, err := s.client.InterfacesClient.Get(ctx, resourceGroupName, interfaceName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -63,8 +63,8 @@ func (s *StepGetIPAddress) getPrivateIP(resourceGroupName string, ipAddressName
|
||||||
return *(*resp.IPConfigurations)[0].PrivateIPAddress, nil
|
return *(*resp.IPConfigurations)[0].PrivateIPAddress, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetIPAddress) getPublicIP(resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
func (s *StepGetIPAddress) getPublicIP(ctx context.Context, resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
||||||
resp, err := s.client.PublicIPAddressesClient.Get(resourceGroupName, ipAddressName, "")
|
resp, err := s.client.PublicIPAddressesClient.Get(ctx, resourceGroupName, ipAddressName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -72,12 +72,12 @@ func (s *StepGetIPAddress) getPublicIP(resourceGroupName string, ipAddressName s
|
||||||
return *resp.IPAddress, nil
|
return *resp.IPAddress, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetIPAddress) getPublicIPInPrivateNetwork(resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
func (s *StepGetIPAddress) getPublicIPInPrivateNetwork(ctx context.Context, resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
||||||
s.getPrivateIP(resourceGroupName, ipAddressName, interfaceName)
|
s.getPrivateIP(ctx, resourceGroupName, ipAddressName, interfaceName)
|
||||||
return s.getPublicIP(resourceGroupName, ipAddressName, interfaceName)
|
return s.getPublicIP(ctx, resourceGroupName, ipAddressName, interfaceName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetIPAddress) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepGetIPAddress) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Getting the VM's IP address ...")
|
s.say("Getting the VM's IP address ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
|
@ -89,7 +89,7 @@ func (s *StepGetIPAddress) Run(_ context.Context, state multistep.StateBag) mult
|
||||||
s.say(fmt.Sprintf(" -> NicName : '%s'", nicName))
|
s.say(fmt.Sprintf(" -> NicName : '%s'", nicName))
|
||||||
s.say(fmt.Sprintf(" -> Network Connection : '%s'", EndpointCommunicationText[s.endpoint]))
|
s.say(fmt.Sprintf(" -> Network Connection : '%s'", EndpointCommunicationText[s.endpoint]))
|
||||||
|
|
||||||
address, err := s.get(resourceGroupName, ipAddressName, nicName)
|
address, err := s.get(ctx, resourceGroupName, ipAddressName, nicName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
state.Put(constants.Error, err)
|
state.Put(constants.Error, err)
|
||||||
s.error(err)
|
s.error(err)
|
||||||
|
|
|
@ -14,7 +14,9 @@ func TestStepGetIPAddressShouldFailIfGetFails(t *testing.T) {
|
||||||
|
|
||||||
for _, endpoint := range endpoints {
|
for _, endpoint := range endpoints {
|
||||||
var testSubject = &StepGetIPAddress{
|
var testSubject = &StepGetIPAddress{
|
||||||
get: func(string, string, string) (string, error) { return "", fmt.Errorf("!! Unit Test FAIL !!") },
|
get: func(context.Context, string, string, string) (string, error) {
|
||||||
|
return "", fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
|
},
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
|
@ -38,7 +40,7 @@ func TestStepGetIPAddressShouldPassIfGetPasses(t *testing.T) {
|
||||||
|
|
||||||
for _, endpoint := range endpoints {
|
for _, endpoint := range endpoints {
|
||||||
var testSubject = &StepGetIPAddress{
|
var testSubject = &StepGetIPAddress{
|
||||||
get: func(string, string, string) (string, error) { return "", nil },
|
get: func(context.Context, string, string, string) (string, error) { return "", nil },
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
|
@ -65,7 +67,7 @@ func TestStepGetIPAddressShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
||||||
|
|
||||||
for _, endpoint := range endpoints {
|
for _, endpoint := range endpoints {
|
||||||
var testSubject = &StepGetIPAddress{
|
var testSubject = &StepGetIPAddress{
|
||||||
get: func(resourceGroupName string, ipAddressName string, nicName string) (string, error) {
|
get: func(ctx context.Context, resourceGroupName string, ipAddressName string, nicName string) (string, error) {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualIPAddressName = ipAddressName
|
actualIPAddressName = ipAddressName
|
||||||
actualNicName = nicName
|
actualNicName = nicName
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
type StepGetOSDisk struct {
|
type StepGetOSDisk struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
query func(resourceGroupName string, computeName string) (compute.VirtualMachine, error)
|
query func(ctx context.Context, resourceGroupName string, computeName string) (compute.VirtualMachine, error)
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ func NewStepGetOSDisk(client *AzureClient, ui packer.Ui) *StepGetOSDisk {
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetOSDisk) queryCompute(resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
func (s *StepGetOSDisk) queryCompute(ctx context.Context, resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
||||||
vm, err := s.client.VirtualMachinesClient.Get(resourceGroupName, computeName, "")
|
vm, err := s.client.VirtualMachinesClient.Get(ctx, resourceGroupName, computeName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return vm, err
|
return vm, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepGetOSDisk) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepGetOSDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Querying the machine's properties ...")
|
s.say("Querying the machine's properties ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
|
@ -47,7 +47,7 @@ func (s *StepGetOSDisk) Run(_ context.Context, state multistep.StateBag) multist
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
||||||
|
|
||||||
vm, err := s.query(resourceGroupName, computeName)
|
vm, err := s.query(ctx, resourceGroupName, computeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
state.Put(constants.Error, err)
|
state.Put(constants.Error, err)
|
||||||
s.error(err)
|
s.error(err)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
func TestStepGetOSDiskShouldFailIfGetFails(t *testing.T) {
|
func TestStepGetOSDiskShouldFailIfGetFails(t *testing.T) {
|
||||||
var testSubject = &StepGetOSDisk{
|
var testSubject = &StepGetOSDisk{
|
||||||
query: func(string, string) (compute.VirtualMachine, error) {
|
query: func(context.Context, string, string) (compute.VirtualMachine, error) {
|
||||||
return createVirtualMachineFromUri("test.vhd"), fmt.Errorf("!! Unit Test FAIL !!")
|
return createVirtualMachineFromUri("test.vhd"), fmt.Errorf("!! Unit Test FAIL !!")
|
||||||
},
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
|
@ -35,7 +35,7 @@ func TestStepGetOSDiskShouldFailIfGetFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepGetOSDiskShouldPassIfGetPasses(t *testing.T) {
|
func TestStepGetOSDiskShouldPassIfGetPasses(t *testing.T) {
|
||||||
var testSubject = &StepGetOSDisk{
|
var testSubject = &StepGetOSDisk{
|
||||||
query: func(string, string) (compute.VirtualMachine, error) {
|
query: func(context.Context, string, string) (compute.VirtualMachine, error) {
|
||||||
return createVirtualMachineFromUri("test.vhd"), nil
|
return createVirtualMachineFromUri("test.vhd"), nil
|
||||||
},
|
},
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
|
@ -59,7 +59,7 @@ func TestStepGetOSDiskShouldTakeValidateArgumentsFromStateBag(t *testing.T) {
|
||||||
var actualComputeName string
|
var actualComputeName string
|
||||||
|
|
||||||
var testSubject = &StepGetOSDisk{
|
var testSubject = &StepGetOSDisk{
|
||||||
query: func(resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
query: func(ctx context.Context, resourceGroupName string, computeName string) (compute.VirtualMachine, error) {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualComputeName = computeName
|
actualComputeName = computeName
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
@ -12,7 +11,7 @@ import (
|
||||||
|
|
||||||
type StepPowerOffCompute struct {
|
type StepPowerOffCompute struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
powerOff func(resourceGroupName string, computeName string, cancelCh <-chan struct{}) error
|
powerOff func(ctx context.Context, resourceGroupName string, computeName string) error
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
}
|
}
|
||||||
|
@ -28,17 +27,18 @@ func NewStepPowerOffCompute(client *AzureClient, ui packer.Ui) *StepPowerOffComp
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepPowerOffCompute) powerOffCompute(resourceGroupName string, computeName string, cancelCh <-chan struct{}) error {
|
func (s *StepPowerOffCompute) powerOffCompute(ctx context.Context, resourceGroupName string, computeName string) error {
|
||||||
_, errChan := s.client.PowerOff(resourceGroupName, computeName, cancelCh)
|
f, err := s.client.VirtualMachinesClient.PowerOff(ctx, resourceGroupName, computeName)
|
||||||
|
if err == nil {
|
||||||
err := <-errChan
|
err = f.WaitForCompletion(ctx, s.client.VirtualMachinesClient.Client)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepPowerOffCompute) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepPowerOffCompute) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Powering off machine ...")
|
s.say("Powering off machine ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
|
@ -47,11 +47,9 @@ func (s *StepPowerOffCompute) Run(_ context.Context, state multistep.StateBag) m
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
s.say(fmt.Sprintf(" -> ComputeName : '%s'", computeName))
|
||||||
|
|
||||||
result := common.StartInterruptibleTask(
|
err := s.powerOff(ctx, resourceGroupName, computeName)
|
||||||
func() bool { return common.IsStateCancelled(state) },
|
|
||||||
func(cancelCh <-chan struct{}) error { return s.powerOff(resourceGroupName, computeName, cancelCh) })
|
|
||||||
|
|
||||||
return processInterruptibleResult(result, s.error, state)
|
return processStepResult(err, s.error, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*StepPowerOffCompute) Cleanup(multistep.StateBag) {
|
func (*StepPowerOffCompute) Cleanup(multistep.StateBag) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func TestStepPowerOffComputeShouldFailIfPowerOffFails(t *testing.T) {
|
func TestStepPowerOffComputeShouldFailIfPowerOffFails(t *testing.T) {
|
||||||
var testSubject = &StepPowerOffCompute{
|
var testSubject = &StepPowerOffCompute{
|
||||||
powerOff: func(string, string, <-chan struct{}) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
powerOff: func(context.Context, string, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func TestStepPowerOffComputeShouldFailIfPowerOffFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepPowerOffComputeShouldPassIfPowerOffPasses(t *testing.T) {
|
func TestStepPowerOffComputeShouldPassIfPowerOffPasses(t *testing.T) {
|
||||||
var testSubject = &StepPowerOffCompute{
|
var testSubject = &StepPowerOffCompute{
|
||||||
powerOff: func(string, string, <-chan struct{}) error { return nil },
|
powerOff: func(context.Context, string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func TestStepPowerOffComputeShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
||||||
var actualComputeName string
|
var actualComputeName string
|
||||||
|
|
||||||
var testSubject = &StepPowerOffCompute{
|
var testSubject = &StepPowerOffCompute{
|
||||||
powerOff: func(resourceGroupName string, computeName string, cancelCh <-chan struct{}) error {
|
powerOff: func(ctx context.Context, resourceGroupName string, computeName string) error {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualComputeName = computeName
|
actualComputeName = computeName
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common"
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
)
|
)
|
||||||
|
@ -39,59 +38,3 @@ func TestProcessStepResultShouldHaltOnError(t *testing.T) {
|
||||||
t.Errorf("Expected ActionHalt(%d), but got=%d", multistep.ActionHalt, code)
|
t.Errorf("Expected ActionHalt(%d), but got=%d", multistep.ActionHalt, code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProcessStepResultShouldContinueOnSuccessfulTask(t *testing.T) {
|
|
||||||
stateBag := new(multistep.BasicStateBag)
|
|
||||||
result := common.InterruptibleTaskResult{
|
|
||||||
IsCancelled: false,
|
|
||||||
Err: nil,
|
|
||||||
}
|
|
||||||
|
|
||||||
code := processInterruptibleResult(result, func(error) { t.Fatal("Should not be called!") }, stateBag)
|
|
||||||
if _, ok := stateBag.GetOk(constants.Error); ok {
|
|
||||||
t.Errorf("Error was nil, but was still in the state bag.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if code != multistep.ActionContinue {
|
|
||||||
t.Errorf("Expected ActionContinue(%d), but got=%d", multistep.ActionContinue, code)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestProcessStepResultShouldHaltWhenTaskIsCancelled(t *testing.T) {
|
|
||||||
stateBag := new(multistep.BasicStateBag)
|
|
||||||
result := common.InterruptibleTaskResult{
|
|
||||||
IsCancelled: true,
|
|
||||||
Err: nil,
|
|
||||||
}
|
|
||||||
|
|
||||||
code := processInterruptibleResult(result, func(error) { t.Fatal("Should not be called!") }, stateBag)
|
|
||||||
if _, ok := stateBag.GetOk(constants.Error); ok {
|
|
||||||
t.Errorf("Error was nil, but was still in the state bag.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if code != multistep.ActionHalt {
|
|
||||||
t.Errorf("Expected ActionHalt(%d), but got=%d", multistep.ActionHalt, code)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestProcessStepResultShouldHaltOnTaskError(t *testing.T) {
|
|
||||||
stateBag := new(multistep.BasicStateBag)
|
|
||||||
isSaidError := false
|
|
||||||
result := common.InterruptibleTaskResult{
|
|
||||||
IsCancelled: false,
|
|
||||||
Err: fmt.Errorf("boom"),
|
|
||||||
}
|
|
||||||
|
|
||||||
code := processInterruptibleResult(result, func(error) { isSaidError = true }, stateBag)
|
|
||||||
if _, ok := stateBag.GetOk(constants.Error); !ok {
|
|
||||||
t.Errorf("Error was *not* nil, but was not in the state bag.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !isSaidError {
|
|
||||||
t.Errorf("Expected error to be said, but it was not.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if code != multistep.ActionHalt {
|
|
||||||
t.Errorf("Expected ActionHalt(%d), but got=%d", multistep.ActionHalt, code)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
type StepValidateTemplate struct {
|
type StepValidateTemplate struct {
|
||||||
client *AzureClient
|
client *AzureClient
|
||||||
validate func(resourceGroupName string, deploymentName string) error
|
validate func(ctx context.Context, resourceGroupName string, deploymentName string) error
|
||||||
say func(message string)
|
say func(message string)
|
||||||
error func(e error)
|
error func(e error)
|
||||||
config *Config
|
config *Config
|
||||||
|
@ -31,20 +31,20 @@ func NewStepValidateTemplate(client *AzureClient, ui packer.Ui, config *Config,
|
||||||
return step
|
return step
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepValidateTemplate) validateTemplate(resourceGroupName string, deploymentName string) error {
|
func (s *StepValidateTemplate) validateTemplate(ctx context.Context, resourceGroupName string, deploymentName string) error {
|
||||||
deployment, err := s.factory(s.config)
|
deployment, err := s.factory(s.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = s.client.Validate(resourceGroupName, deploymentName, *deployment)
|
_, err = s.client.DeploymentsClient.Validate(ctx, resourceGroupName, deploymentName, *deployment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.say(s.client.LastError.Error())
|
s.say(s.client.LastError.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepValidateTemplate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *StepValidateTemplate) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
s.say("Validating deployment template ...")
|
s.say("Validating deployment template ...")
|
||||||
|
|
||||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||||
|
@ -53,7 +53,7 @@ func (s *StepValidateTemplate) Run(_ context.Context, state multistep.StateBag)
|
||||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||||
s.say(fmt.Sprintf(" -> DeploymentName : '%s'", deploymentName))
|
s.say(fmt.Sprintf(" -> DeploymentName : '%s'", deploymentName))
|
||||||
|
|
||||||
err := s.validate(resourceGroupName, deploymentName)
|
err := s.validate(ctx, resourceGroupName, deploymentName)
|
||||||
return processStepResult(err, s.error, state)
|
return processStepResult(err, s.error, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func TestStepValidateTemplateShouldFailIfValidateFails(t *testing.T) {
|
func TestStepValidateTemplateShouldFailIfValidateFails(t *testing.T) {
|
||||||
var testSubject = &StepValidateTemplate{
|
var testSubject = &StepValidateTemplate{
|
||||||
validate: func(string, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
validate: func(context.Context, string, string) error { return fmt.Errorf("!! Unit Test FAIL !!") },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func TestStepValidateTemplateShouldFailIfValidateFails(t *testing.T) {
|
||||||
|
|
||||||
func TestStepValidateTemplateShouldPassIfValidatePasses(t *testing.T) {
|
func TestStepValidateTemplateShouldPassIfValidatePasses(t *testing.T) {
|
||||||
var testSubject = &StepValidateTemplate{
|
var testSubject = &StepValidateTemplate{
|
||||||
validate: func(string, string) error { return nil },
|
validate: func(context.Context, string, string) error { return nil },
|
||||||
say: func(message string) {},
|
say: func(message string) {},
|
||||||
error: func(e error) {},
|
error: func(e error) {},
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func TestStepValidateTemplateShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
||||||
var actualDeploymentName string
|
var actualDeploymentName string
|
||||||
|
|
||||||
var testSubject = &StepValidateTemplate{
|
var testSubject = &StepValidateTemplate{
|
||||||
validate: func(resourceGroupName string, deploymentName string) error {
|
validate: func(ctx context.Context, resourceGroupName string, deploymentName string) error {
|
||||||
actualResourceGroupName = resourceGroupName
|
actualResourceGroupName = resourceGroupName
|
||||||
actualDeploymentName = deploymentName
|
actualDeploymentName = deploymentName
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ package arm
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
|
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources"
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
},
|
},
|
||||||
"osDisk": {
|
"osDisk": {
|
||||||
"caching": "ReadWrite",
|
"caching": "ReadWrite",
|
||||||
"createOption": "fromImage",
|
"createOption": "FromImage",
|
||||||
"managedDisk": {
|
"managedDisk": {
|
||||||
"storageAccountType": "Standard_LRS"
|
"storageAccountType": "Standard_LRS"
|
||||||
},
|
},
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
},
|
},
|
||||||
"osDisk": {
|
"osDisk": {
|
||||||
"caching": "ReadWrite",
|
"caching": "ReadWrite",
|
||||||
"createOption": "fromImage",
|
"createOption": "FromImage",
|
||||||
"managedDisk": {
|
"managedDisk": {
|
||||||
"storageAccountType": "Standard_LRS"
|
"storageAccountType": "Standard_LRS"
|
||||||
},
|
},
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
},
|
},
|
||||||
"osDisk": {
|
"osDisk": {
|
||||||
"caching": "ReadWrite",
|
"caching": "ReadWrite",
|
||||||
"createOption": "fromImage",
|
"createOption": "FromImage",
|
||||||
"managedDisk": {
|
"managedDisk": {
|
||||||
"storageAccountType": "Standard_LRS"
|
"storageAccountType": "Standard_LRS"
|
||||||
},
|
},
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
},
|
},
|
||||||
"osDisk": {
|
"osDisk": {
|
||||||
"caching": "ReadWrite",
|
"caching": "ReadWrite",
|
||||||
"createOption": "fromImage",
|
"createOption": "FromImage",
|
||||||
"managedDisk": {
|
"managedDisk": {
|
||||||
"storageAccountType": "Standard_LRS"
|
"storageAccountType": "Standard_LRS"
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
|
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-02-01/resources"
|
||||||
"github.com/approvals/go-approval-tests"
|
"github.com/approvals/go-approval-tests"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/template"
|
"github.com/hashicorp/packer/builder/azure/common/template"
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions"
|
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-06-01/subscriptions"
|
||||||
"github.com/Azure/go-autorest/autorest"
|
"github.com/Azure/go-autorest/autorest"
|
||||||
"github.com/Azure/go-autorest/autorest/adal"
|
"github.com/Azure/go-autorest/autorest/adal"
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
@ -100,7 +101,7 @@ func Authenticate(env azure.Environment, tenantID string, say func(string)) (*ad
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
say("Obtained service principal token.")
|
say("Obtained service principal token.")
|
||||||
if err := saveToken(spt.Token); err != nil {
|
if err := saveToken(spt.Token()); err != nil {
|
||||||
say("Error occurred saving token to cache file.")
|
say("Error occurred saving token to cache file.")
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -186,9 +187,9 @@ func mkTokenCallback(path string) adal.TokenRefreshCallback {
|
||||||
// automatically refresh the token using refresh_token (which might have
|
// automatically refresh the token using refresh_token (which might have
|
||||||
// expired). This check is essentially to make sure refresh_token is good.
|
// expired). This check is essentially to make sure refresh_token is good.
|
||||||
func validateToken(env azure.Environment, token *adal.ServicePrincipalToken) error {
|
func validateToken(env azure.Environment, token *adal.ServicePrincipalToken) error {
|
||||||
c := subscriptionsClient(env.ResourceManagerEndpoint)
|
c := subscriptions.NewClientWithBaseURI(env.ResourceManagerEndpoint)
|
||||||
c.Authorizer = autorest.NewBearerAuthorizer(token)
|
c.Authorizer = autorest.NewBearerAuthorizer(token)
|
||||||
_, err := c.List()
|
_, err := c.List(context.TODO())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Token validity check failed: %v", err)
|
return fmt.Errorf("Token validity check failed: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -200,12 +201,12 @@ func validateToken(env azure.Environment, token *adal.ServicePrincipalToken) err
|
||||||
// the value from WWW-Authenticate header.
|
// the value from WWW-Authenticate header.
|
||||||
func FindTenantID(env azure.Environment, subscriptionID string) (string, error) {
|
func FindTenantID(env azure.Environment, subscriptionID string) (string, error) {
|
||||||
const hdrKey = "WWW-Authenticate"
|
const hdrKey = "WWW-Authenticate"
|
||||||
c := subscriptionsClient(env.ResourceManagerEndpoint)
|
c := subscriptions.NewClientWithBaseURI(env.ResourceManagerEndpoint)
|
||||||
|
|
||||||
// we expect this request to fail (err != nil), but we are only interested
|
// we expect this request to fail (err != nil), but we are only interested
|
||||||
// in headers, so surface the error if the Response is not present (i.e.
|
// in headers, so surface the error if the Response is not present (i.e.
|
||||||
// network error etc)
|
// network error etc)
|
||||||
subs, err := c.Get(subscriptionID)
|
subs, err := c.Get(context.TODO(), subscriptionID)
|
||||||
if subs.Response.Response == nil {
|
if subs.Response.Response == nil {
|
||||||
return "", fmt.Errorf("Request failed: %v", err)
|
return "", fmt.Errorf("Request failed: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -228,8 +229,3 @@ func FindTenantID(env azure.Environment, subscriptionID string) (string, error)
|
||||||
}
|
}
|
||||||
return m[1], nil
|
return m[1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func subscriptionsClient(baseURI string) subscriptions.GroupClient {
|
|
||||||
client := subscriptions.NewGroupClientWithBaseURI(baseURI)
|
|
||||||
return client
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package common
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type InterruptibleTaskResult struct {
|
|
||||||
Err error
|
|
||||||
IsCancelled bool
|
|
||||||
}
|
|
||||||
|
|
||||||
type InterruptibleTask struct {
|
|
||||||
IsCancelled func() bool
|
|
||||||
Task func(cancelCh <-chan struct{}) error
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewInterruptibleTask(isCancelled func() bool, task func(cancelCh <-chan struct{}) error) *InterruptibleTask {
|
|
||||||
return &InterruptibleTask{
|
|
||||||
IsCancelled: isCancelled,
|
|
||||||
Task: task,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func StartInterruptibleTask(isCancelled func() bool, task func(cancelCh <-chan struct{}) error) InterruptibleTaskResult {
|
|
||||||
t := NewInterruptibleTask(isCancelled, task)
|
|
||||||
return t.Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *InterruptibleTask) Run() InterruptibleTaskResult {
|
|
||||||
completeCh := make(chan error)
|
|
||||||
|
|
||||||
cancelCh := make(chan struct{})
|
|
||||||
defer close(cancelCh)
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
err := s.Task(cancelCh)
|
|
||||||
completeCh <- err
|
|
||||||
|
|
||||||
// senders close, receivers check for close
|
|
||||||
close(completeCh)
|
|
||||||
}()
|
|
||||||
|
|
||||||
for {
|
|
||||||
if s.IsCancelled() {
|
|
||||||
return InterruptibleTaskResult{Err: nil, IsCancelled: true}
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
|
||||||
case err := <-completeCh:
|
|
||||||
return InterruptibleTaskResult{Err: err, IsCancelled: false}
|
|
||||||
case <-time.After(100 * time.Millisecond):
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
package common
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestInterruptibleTaskShouldImmediatelyEndOnCancel(t *testing.T) {
|
|
||||||
testSubject := NewInterruptibleTask(
|
|
||||||
func() bool { return true },
|
|
||||||
func(<-chan struct{}) error {
|
|
||||||
for {
|
|
||||||
time.Sleep(time.Second * 30)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
result := testSubject.Run()
|
|
||||||
if result.IsCancelled != true {
|
|
||||||
t.Fatal("Expected the task to be cancelled, but it was not.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestInterruptibleTaskShouldRunTaskUntilCompletion(t *testing.T) {
|
|
||||||
var count int
|
|
||||||
|
|
||||||
testSubject := &InterruptibleTask{
|
|
||||||
IsCancelled: func() bool {
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
Task: func(<-chan struct{}) error {
|
|
||||||
for i := 0; i < 10; i++ {
|
|
||||||
count += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
result := testSubject.Run()
|
|
||||||
if result.IsCancelled != false {
|
|
||||||
t.Errorf("Expected the task to *not* be cancelled, but it was.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if count != 10 {
|
|
||||||
t.Errorf("Expected the task to wait for completion, but it did not.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if result.Err != nil {
|
|
||||||
t.Errorf("Expected the task to return a nil error, but got=%s", result.Err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestInterruptibleTaskShouldImmediatelyStopOnTaskError(t *testing.T) {
|
|
||||||
testSubject := &InterruptibleTask{
|
|
||||||
IsCancelled: func() bool {
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
Task: func(cancelCh <-chan struct{}) error {
|
|
||||||
return fmt.Errorf("boom")
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
result := testSubject.Run()
|
|
||||||
if result.IsCancelled != false {
|
|
||||||
t.Errorf("Expected the task to *not* be cancelled, but it was.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if result.Err == nil {
|
|
||||||
t.Errorf("Expected the task to return an error, but it did not.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestInterruptibleTaskShouldProvideLiveChannel(t *testing.T) {
|
|
||||||
testSubject := &InterruptibleTask{
|
|
||||||
IsCancelled: func() bool {
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
Task: func(cancelCh <-chan struct{}) error {
|
|
||||||
isOpen := false
|
|
||||||
|
|
||||||
select {
|
|
||||||
case _, ok := <-cancelCh:
|
|
||||||
isOpen = !ok
|
|
||||||
if !isOpen {
|
|
||||||
t.Errorf("Expected the channel to open, but it was closed.")
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
isOpen = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if !isOpen {
|
|
||||||
t.Errorf("Check for openness failed.")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
testSubject.Run()
|
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
package template
|
package template
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/network"
|
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network"
|
||||||
)
|
)
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ func (s *TemplateBuilder) SetManagedDiskUrl(managedImageId string, storageAccoun
|
||||||
ID: &managedImageId,
|
ID: &managedImageId,
|
||||||
}
|
}
|
||||||
profile.OsDisk.OsType = s.osType
|
profile.OsDisk.OsType = s.osType
|
||||||
profile.OsDisk.CreateOption = compute.FromImage
|
profile.OsDisk.CreateOption = compute.DiskCreateOptionTypesFromImage
|
||||||
profile.OsDisk.Vhd = nil
|
profile.OsDisk.Vhd = nil
|
||||||
profile.OsDisk.ManagedDisk = &compute.ManagedDiskParameters{
|
profile.OsDisk.ManagedDisk = &compute.ManagedDiskParameters{
|
||||||
StorageAccountType: storageAccountType,
|
StorageAccountType: storageAccountType,
|
||||||
|
@ -136,7 +136,7 @@ func (s *TemplateBuilder) SetManagedMarketplaceImage(location, publisher, offer,
|
||||||
//ID: &imageID,
|
//ID: &imageID,
|
||||||
}
|
}
|
||||||
profile.OsDisk.OsType = s.osType
|
profile.OsDisk.OsType = s.osType
|
||||||
profile.OsDisk.CreateOption = compute.FromImage
|
profile.OsDisk.CreateOption = compute.DiskCreateOptionTypesFromImage
|
||||||
profile.OsDisk.Vhd = nil
|
profile.OsDisk.Vhd = nil
|
||||||
profile.OsDisk.ManagedDisk = &compute.ManagedDiskParameters{
|
profile.OsDisk.ManagedDisk = &compute.ManagedDiskParameters{
|
||||||
StorageAccountType: storageAccountType,
|
StorageAccountType: storageAccountType,
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
},
|
},
|
||||||
"osDisk": {
|
"osDisk": {
|
||||||
"caching": "ReadWrite",
|
"caching": "ReadWrite",
|
||||||
"createOption": "fromImage",
|
"createOption": "FromImage",
|
||||||
"managedDisk": {
|
"managedDisk": {
|
||||||
"storageAccountType": "Premium_LRS"
|
"storageAccountType": "Premium_LRS"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,7 @@ package template
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute"
|
||||||
"github.com/approvals/go-approval-tests"
|
"github.com/approvals/go-approval-tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
Microsoft Azure-SDK-for-Go
|
||||||
|
Copyright 2014-2017 Microsoft
|
||||||
|
|
||||||
|
This product includes software developed at
|
||||||
|
the Microsoft Corporation (https://www.microsoft.com).
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1316
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go
generated
vendored
1316
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go
generated
vendored
File diff suppressed because it is too large
Load Diff
872
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go
generated
vendored
872
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go
generated
vendored
|
@ -1,872 +0,0 @@
|
||||||
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 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VirtualMachineScaleSetVMsClient is the the Compute Management Client.
|
|
||||||
type VirtualMachineScaleSetVMsClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVirtualMachineScaleSetVMsClient creates an instance of the
|
|
||||||
// VirtualMachineScaleSetVMsClient client.
|
|
||||||
func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient {
|
|
||||||
return NewVirtualMachineScaleSetVMsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVirtualMachineScaleSetVMsClientWithBaseURI creates an instance of the
|
|
||||||
// VirtualMachineScaleSetVMsClient client.
|
|
||||||
func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient {
|
|
||||||
return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts
|
|
||||||
// down the virtual machine and releases the compute resources it uses. You are
|
|
||||||
// not billed for the compute resources of this virtual machine once it is
|
|
||||||
// deallocated. This method may poll for completion. Polling can be canceled by
|
|
||||||
// passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. VMScaleSetName is the
|
|
||||||
// name of the VM scale set. instanceID is the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) Deallocate(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeallocatePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeallocateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeallocateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeallocatePreparer prepares the Deallocate request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeallocateSender sends the Deallocate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) DeallocateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeallocateResponder handles the response to the Deallocate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes a virtual machine from a VM scale set. This method may poll
|
|
||||||
// for completion. Polling can be canceled by passing the cancel channel
|
|
||||||
// argument. The channel will be used to cancel polling and any outstanding
|
|
||||||
// HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. VMScaleSetName is the
|
|
||||||
// name of the VM scale set. instanceID is the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) Delete(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, VMScaleSetName, instanceID)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "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.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) GetPreparer(resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", 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 VirtualMachineScaleSetVMsClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) {
|
|
||||||
req, err := client.GetInstanceViewPreparer(resourceGroupName, VMScaleSetName, instanceID)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetInstanceViewSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetInstanceViewResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetInstanceViewPreparer prepares the GetInstanceView request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetInstanceViewSender sends the GetInstanceView request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetVMInstanceView, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List gets a list of all virtual machines in a VM scale sets.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualMachineScaleSetName is the name of the VM scale set. filter is the
|
|
||||||
// filter to apply to the operation. selectParameter is the list parameters.
|
|
||||||
// expand is the expand expression to apply to the operation.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResult, err error) {
|
|
||||||
req, err := client.ListPreparer(resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "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.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ListPreparer(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(filter) > 0 {
|
|
||||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
|
||||||
}
|
|
||||||
if len(selectParameter) > 0 {
|
|
||||||
queryParameters["$select"] = autorest.Encode("query", selectParameter)
|
|
||||||
}
|
|
||||||
if len(expand) > 0 {
|
|
||||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", 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 VirtualMachineScaleSetVMsClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetVMListResult, 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 VirtualMachineScaleSetVMsClient) ListNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) {
|
|
||||||
req, err := lastResults.VirtualMachineScaleSetVMListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// PowerOff power off (stop) a virtual machine in a VM scale set. Note that
|
|
||||||
// resources are still attached and you are getting charged for the resources.
|
|
||||||
// Instead, use deallocate to release resources and avoid charges. This method
|
|
||||||
// may poll for completion. Polling can be canceled by passing the cancel
|
|
||||||
// channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. VMScaleSetName is the
|
|
||||||
// name of the VM scale set. instanceID is the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) PowerOff(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.PowerOffPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.PowerOffSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.PowerOffResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// PowerOffPreparer prepares the PowerOff request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// PowerOffSender sends the PowerOff request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) PowerOffSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PowerOffResponder handles the response to the PowerOff request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reimage reimages (upgrade the operating system) a specific virtual machine
|
|
||||||
// in a VM scale set. This method may poll for completion. Polling can be
|
|
||||||
// canceled by passing the cancel channel argument. The channel will be used to
|
|
||||||
// cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. VMScaleSetName is the
|
|
||||||
// name of the VM scale set. instanceID is the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) Reimage(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.ReimagePreparer(resourceGroupName, VMScaleSetName, instanceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ReimageSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ReimageResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReimagePreparer prepares the Reimage request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReimageSender sends the Reimage request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ReimageSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReimageResponder handles the response to the Reimage request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReimageAll allows you to re-image all the disks ( including data disks ) in
|
|
||||||
// the a virtual machine scale set instance. This operation is only supported
|
|
||||||
// for managed disks. This method may poll for completion. Polling can be
|
|
||||||
// canceled by passing the cancel channel argument. The channel will be used to
|
|
||||||
// cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. VMScaleSetName is the
|
|
||||||
// name of the VM scale set. instanceID is the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ReimageAll(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.ReimageAllPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ReimageAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ReimageAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReimageAllPreparer prepares the ReimageAll request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReimageAllSender sends the ReimageAll request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ReimageAllSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReimageAllResponder handles the response to the ReimageAll request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restart restarts a virtual machine in a VM scale set. This method may poll
|
|
||||||
// for completion. Polling can be canceled by passing the cancel channel
|
|
||||||
// argument. The channel will be used to cancel polling and any outstanding
|
|
||||||
// HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. VMScaleSetName is the
|
|
||||||
// name of the VM scale set. instanceID is the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) Restart(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.RestartPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.RestartSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.RestartResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestartPreparer prepares the Restart request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestartSender sends the Restart request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) RestartSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestartResponder handles the response to the Restart request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start starts a virtual machine in a VM scale set. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. VMScaleSetName is the
|
|
||||||
// name of the VM scale set. instanceID is the instance ID of the virtual
|
|
||||||
// machine.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) Start(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.StartPreparer(resourceGroupName, VMScaleSetName, instanceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.StartSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.StartResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartPreparer prepares the Start request.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName string, VMScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"instanceId": autorest.Encode("path", instanceID),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartSender sends the Start request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) StartSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartResponder handles the response to the Start request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualMachineScaleSetVMsClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
// Package disk implements the Azure ARM Disk service API version
|
|
||||||
// 2016-04-30-preview.
|
|
||||||
//
|
|
||||||
// The Disk Resource Provider Client.
|
|
||||||
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,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,728 +0,0 @@
|
||||||
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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DisksClient is the the Disk Resource Provider Client.
|
|
||||||
type DisksClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewDisksClient creates an instance of the DisksClient client.
|
|
||||||
func NewDisksClient(subscriptionID string) DisksClient {
|
|
||||||
return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewDisksClientWithBaseURI creates an instance of the DisksClient client.
|
|
||||||
func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient {
|
|
||||||
return DisksClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates a disk. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. diskName is the name of
|
|
||||||
// the disk within the given subscription and resource group. diskParameter is
|
|
||||||
// disk object supplied in the body of the Put disk operation.
|
|
||||||
func (client DisksClient) CreateOrUpdate(resourceGroupName string, diskName string, diskParameter Model, cancel <-chan struct{}) (<-chan Model, <-chan error) {
|
|
||||||
resultChan := make(chan Model, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: diskParameter,
|
|
||||||
Constraints: []validation.Constraint{{Target: "diskParameter.Properties", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData", Name: validation.Null, Rule: true,
|
|
||||||
Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData.ImageReference", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "diskParameter.Properties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
|
|
||||||
}},
|
|
||||||
{Target: "diskParameter.Properties.EncryptionSettings", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
{Target: "diskParameter.Properties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
}},
|
|
||||||
{Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
{Target: "diskParameter.Properties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
}}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "disk.DisksClient", "CreateOrUpdate")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result Model
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, diskName, diskParameter, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client DisksClient) CreateOrUpdatePreparer(resourceGroupName string, diskName string, diskParameter Model, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"diskName": autorest.Encode("path", diskName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
|
||||||
autorest.WithJSON(diskParameter),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client DisksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Model, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes a disk. This method may poll for completion. Polling can be
|
|
||||||
// canceled by passing the cancel channel argument. The channel will be used to
|
|
||||||
// cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. diskName is the name of
|
|
||||||
// the disk within the given subscription and resource group.
|
|
||||||
func (client DisksClient) Delete(resourceGroupName string, diskName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, diskName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client DisksClient) DeletePreparer(resourceGroupName string, diskName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"diskName": autorest.Encode("path", diskName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client DisksClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get gets information about a disk.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. diskName is the name of
|
|
||||||
// the disk within the given subscription and resource group.
|
|
||||||
func (client DisksClient) Get(resourceGroupName string, diskName string) (result Model, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, diskName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client DisksClient) GetPreparer(resourceGroupName string, diskName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"diskName": autorest.Encode("path", diskName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", 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 DisksClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) GetResponder(resp *http.Response) (result Model, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccess grants access to a disk. This method may poll for completion.
|
|
||||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
|
||||||
// will be used to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. diskName is the name of
|
|
||||||
// the disk within the given subscription and resource group. grantAccessData
|
|
||||||
// is access data object supplied in the body of the get disk access operation.
|
|
||||||
func (client DisksClient) GrantAccess(resourceGroupName string, diskName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (<-chan AccessURI, <-chan error) {
|
|
||||||
resultChan := make(chan AccessURI, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: grantAccessData,
|
|
||||||
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "disk.DisksClient", "GrantAccess")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result AccessURI
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.GrantAccessPreparer(resourceGroupName, diskName, grantAccessData, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GrantAccessSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GrantAccessResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "GrantAccess", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccessPreparer prepares the GrantAccess request.
|
|
||||||
func (client DisksClient) GrantAccessPreparer(resourceGroupName string, diskName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"diskName": autorest.Encode("path", diskName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", pathParameters),
|
|
||||||
autorest.WithJSON(grantAccessData),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccessSender sends the GrantAccess request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client DisksClient) GrantAccessSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccessResponder handles the response to the GrantAccess request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists all the disks under a subscription.
|
|
||||||
func (client DisksClient) List() (result ListType, err error) {
|
|
||||||
req, err := client.ListPreparer()
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client DisksClient) ListPreparer() (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks", 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 DisksClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) ListResponder(resp *http.Response) (result ListType, 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 DisksClient) ListNextResults(lastResults ListType) (result ListType, err error) {
|
|
||||||
req, err := lastResults.ListTypePreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "disk.DisksClient", "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, "disk.DisksClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroup lists all the disks under a resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
func (client DisksClient) ListByResourceGroup(resourceGroupName string) (result ListType, err error) {
|
|
||||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListByResourceGroupSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListByResourceGroupResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
|
||||||
func (client DisksClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client DisksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) ListByResourceGroupResponder(resp *http.Response) (result ListType, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupNextResults retrieves the next set of results, if any.
|
|
||||||
func (client DisksClient) ListByResourceGroupNextResults(lastResults ListType) (result ListType, err error) {
|
|
||||||
req, err := lastResults.ListTypePreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListByResourceGroupSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListByResourceGroupResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "ListByResourceGroup", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccess revokes access to a disk. This method may poll for completion.
|
|
||||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
|
||||||
// will be used to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. diskName is the name of
|
|
||||||
// the disk within the given subscription and resource group.
|
|
||||||
func (client DisksClient) RevokeAccess(resourceGroupName string, diskName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.RevokeAccessPreparer(resourceGroupName, diskName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.RevokeAccessSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.RevokeAccessResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "RevokeAccess", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccessPreparer prepares the RevokeAccess request.
|
|
||||||
func (client DisksClient) RevokeAccessPreparer(resourceGroupName string, diskName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"diskName": autorest.Encode("path", diskName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccessSender sends the RevokeAccess request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client DisksClient) RevokeAccessSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update updates (patches) a disk. This method may poll for completion.
|
|
||||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
|
||||||
// will be used to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. diskName is the name of
|
|
||||||
// the disk within the given subscription and resource group. diskParameter is
|
|
||||||
// disk object supplied in the body of the Patch disk operation.
|
|
||||||
func (client DisksClient) Update(resourceGroupName string, diskName string, diskParameter UpdateType, cancel <-chan struct{}) (<-chan Model, <-chan error) {
|
|
||||||
resultChan := make(chan Model, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result Model
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.UpdatePreparer(resourceGroupName, diskName, diskParameter, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.UpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.UpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.DisksClient", "Update", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdatePreparer prepares the Update request.
|
|
||||||
func (client DisksClient) UpdatePreparer(resourceGroupName string, diskName string, diskParameter UpdateType, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"diskName": autorest.Encode("path", diskName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPatch(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
|
||||||
autorest.WithJSON(diskParameter),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateSender sends the Update request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client DisksClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateResponder handles the response to the Update request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client DisksClient) UpdateResponder(resp *http.Response) (result Model, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,278 +0,0 @@
|
||||||
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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/date"
|
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AccessLevel enumerates the values for access level.
|
|
||||||
type AccessLevel string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// None specifies the none state for access level.
|
|
||||||
None AccessLevel = "None"
|
|
||||||
// Read specifies the read state for access level.
|
|
||||||
Read AccessLevel = "Read"
|
|
||||||
)
|
|
||||||
|
|
||||||
// CreateOption enumerates the values for create option.
|
|
||||||
type CreateOption string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Attach specifies the attach state for create option.
|
|
||||||
Attach CreateOption = "Attach"
|
|
||||||
// Copy specifies the copy state for create option.
|
|
||||||
Copy CreateOption = "Copy"
|
|
||||||
// Empty specifies the empty state for create option.
|
|
||||||
Empty CreateOption = "Empty"
|
|
||||||
// FromImage specifies the from image state for create option.
|
|
||||||
FromImage CreateOption = "FromImage"
|
|
||||||
// Import specifies the import state for create option.
|
|
||||||
Import CreateOption = "Import"
|
|
||||||
// Restore specifies the restore state for create option.
|
|
||||||
Restore CreateOption = "Restore"
|
|
||||||
)
|
|
||||||
|
|
||||||
// OperatingSystemTypes enumerates the values for operating system types.
|
|
||||||
type OperatingSystemTypes string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Linux specifies the linux state for operating system types.
|
|
||||||
Linux OperatingSystemTypes = "Linux"
|
|
||||||
// Windows specifies the windows state for operating system types.
|
|
||||||
Windows OperatingSystemTypes = "Windows"
|
|
||||||
)
|
|
||||||
|
|
||||||
// StorageAccountTypes enumerates the values for storage account types.
|
|
||||||
type StorageAccountTypes string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// PremiumLRS specifies the premium lrs state for storage account types.
|
|
||||||
PremiumLRS StorageAccountTypes = "Premium_LRS"
|
|
||||||
// StandardLRS specifies the standard lrs state for storage account types.
|
|
||||||
StandardLRS StorageAccountTypes = "Standard_LRS"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AccessURI is a disk access SAS uri.
|
|
||||||
type AccessURI struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
*AccessURIOutput `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccessURIOutput is azure properties, including output.
|
|
||||||
type AccessURIOutput struct {
|
|
||||||
*AccessURIRaw `json:"output,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccessURIRaw is this object gets 'bubbled up' through flattening.
|
|
||||||
type AccessURIRaw struct {
|
|
||||||
AccessSAS *string `json:"accessSAS,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// APIError is api error.
|
|
||||||
type APIError struct {
|
|
||||||
Details *[]APIErrorBase `json:"details,omitempty"`
|
|
||||||
Innererror *InnerError `json:"innererror,omitempty"`
|
|
||||||
Code *string `json:"code,omitempty"`
|
|
||||||
Target *string `json:"target,omitempty"`
|
|
||||||
Message *string `json:"message,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// APIErrorBase is api error base.
|
|
||||||
type APIErrorBase struct {
|
|
||||||
Code *string `json:"code,omitempty"`
|
|
||||||
Target *string `json:"target,omitempty"`
|
|
||||||
Message *string `json:"message,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreationData is data used when creating a disk.
|
|
||||||
type CreationData struct {
|
|
||||||
CreateOption CreateOption `json:"createOption,omitempty"`
|
|
||||||
StorageAccountID *string `json:"storageAccountId,omitempty"`
|
|
||||||
ImageReference *ImageDiskReference `json:"imageReference,omitempty"`
|
|
||||||
SourceURI *string `json:"sourceUri,omitempty"`
|
|
||||||
SourceResourceID *string `json:"sourceResourceId,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// EncryptionSettings is encryption settings for disk or snapshot
|
|
||||||
type EncryptionSettings struct {
|
|
||||||
Enabled *bool `json:"enabled,omitempty"`
|
|
||||||
DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"`
|
|
||||||
KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccessData is data used for requesting a SAS.
|
|
||||||
type GrantAccessData struct {
|
|
||||||
Access AccessLevel `json:"access,omitempty"`
|
|
||||||
DurationInSeconds *int32 `json:"durationInSeconds,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageDiskReference is the source image used for creating the disk.
|
|
||||||
type ImageDiskReference struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Lun *int32 `json:"lun,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// InnerError is inner error details.
|
|
||||||
type InnerError struct {
|
|
||||||
Exceptiontype *string `json:"exceptiontype,omitempty"`
|
|
||||||
Errordetail *string `json:"errordetail,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// KeyVaultAndKeyReference is key Vault Key Url and vault id of KeK, KeK is
|
|
||||||
// optional and when provided is used to unwrap the encryptionKey
|
|
||||||
type KeyVaultAndKeyReference struct {
|
|
||||||
SourceVault *SourceVault `json:"sourceVault,omitempty"`
|
|
||||||
KeyURL *string `json:"keyUrl,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// KeyVaultAndSecretReference is key Vault Secret Url and vault id of the
|
|
||||||
// encryption key
|
|
||||||
type KeyVaultAndSecretReference struct {
|
|
||||||
SourceVault *SourceVault `json:"sourceVault,omitempty"`
|
|
||||||
SecretURL *string `json:"secretUrl,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListType is the List Disks operation response.
|
|
||||||
type ListType struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Model `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListTypePreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client ListType) ListTypePreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Model is disk resource.
|
|
||||||
type Model struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
*Properties `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// OperationStatusResponse is operation status response
|
|
||||||
type OperationStatusResponse struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Status *string `json:"status,omitempty"`
|
|
||||||
StartTime *date.Time `json:"startTime,omitempty"`
|
|
||||||
EndTime *date.Time `json:"endTime,omitempty"`
|
|
||||||
Error *APIError `json:"error,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Properties is disk resource properties.
|
|
||||||
type Properties struct {
|
|
||||||
AccountType StorageAccountTypes `json:"accountType,omitempty"`
|
|
||||||
TimeCreated *date.Time `json:"timeCreated,omitempty"`
|
|
||||||
OsType OperatingSystemTypes `json:"osType,omitempty"`
|
|
||||||
CreationData *CreationData `json:"creationData,omitempty"`
|
|
||||||
DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
|
|
||||||
EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"`
|
|
||||||
OwnerID *string `json:"ownerId,omitempty"`
|
|
||||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resource is the Resource model definition.
|
|
||||||
type Resource struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResourceUpdate is the Resource model definition.
|
|
||||||
type ResourceUpdate struct {
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Snapshot is snapshot resource.
|
|
||||||
type Snapshot struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
*Properties `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// SnapshotList is the List Snapshots operation response.
|
|
||||||
type SnapshotList struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Snapshot `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// SnapshotListPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client SnapshotList) SnapshotListPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SnapshotUpdate is snapshot update resource.
|
|
||||||
type SnapshotUpdate struct {
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
*UpdateProperties `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// SourceVault is the vault id is an Azure Resource Manager Resoure id in the
|
|
||||||
// form
|
|
||||||
// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
|
|
||||||
type SourceVault struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateProperties is disk resource update properties.
|
|
||||||
type UpdateProperties struct {
|
|
||||||
AccountType StorageAccountTypes `json:"accountType,omitempty"`
|
|
||||||
OsType OperatingSystemTypes `json:"osType,omitempty"`
|
|
||||||
CreationData *CreationData `json:"creationData,omitempty"`
|
|
||||||
DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
|
|
||||||
EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateType is disk update resource.
|
|
||||||
type UpdateType struct {
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
*UpdateProperties `json:"properties,omitempty"`
|
|
||||||
}
|
|
|
@ -1,733 +0,0 @@
|
||||||
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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SnapshotsClient is the the Disk Resource Provider Client.
|
|
||||||
type SnapshotsClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSnapshotsClient creates an instance of the SnapshotsClient client.
|
|
||||||
func NewSnapshotsClient(subscriptionID string) SnapshotsClient {
|
|
||||||
return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient
|
|
||||||
// client.
|
|
||||||
func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient {
|
|
||||||
return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates a snapshot. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. snapshotName is the
|
|
||||||
// name of the snapshot within the given subscription and resource group.
|
|
||||||
// snapshot is snapshot object supplied in the body of the Put disk operation.
|
|
||||||
func (client SnapshotsClient) CreateOrUpdate(resourceGroupName string, snapshotName string, snapshot Snapshot, cancel <-chan struct{}) (<-chan Snapshot, <-chan error) {
|
|
||||||
resultChan := make(chan Snapshot, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: snapshot,
|
|
||||||
Constraints: []validation.Constraint{{Target: "snapshot.Properties", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData", Name: validation.Null, Rule: true,
|
|
||||||
Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData.ImageReference", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "snapshot.Properties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
|
|
||||||
}},
|
|
||||||
{Target: "snapshot.Properties.EncryptionSettings", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
{Target: "snapshot.Properties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
}},
|
|
||||||
{Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
{Target: "snapshot.Properties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
}}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "disk.SnapshotsClient", "CreateOrUpdate")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result Snapshot
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, snapshotName, snapshot, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client SnapshotsClient) CreateOrUpdatePreparer(resourceGroupName string, snapshotName string, snapshot Snapshot, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"snapshotName": autorest.Encode("path", snapshotName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
|
||||||
autorest.WithJSON(snapshot),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes a snapshot. This method may poll for completion. Polling can
|
|
||||||
// be canceled by passing the cancel channel argument. The channel will be used
|
|
||||||
// to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. snapshotName is the
|
|
||||||
// name of the snapshot within the given subscription and resource group.
|
|
||||||
func (client SnapshotsClient) Delete(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, snapshotName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client SnapshotsClient) DeletePreparer(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"snapshotName": autorest.Encode("path", snapshotName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client SnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get gets information about a snapshot.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. snapshotName is the
|
|
||||||
// name of the snapshot within the given subscription and resource group.
|
|
||||||
func (client SnapshotsClient) Get(resourceGroupName string, snapshotName string) (result Snapshot, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, snapshotName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client SnapshotsClient) GetPreparer(resourceGroupName string, snapshotName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"snapshotName": autorest.Encode("path", snapshotName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", 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 SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccess grants access to a snapshot. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. snapshotName is the
|
|
||||||
// name of the snapshot within the given subscription and resource group.
|
|
||||||
// grantAccessData is access data object supplied in the body of the get
|
|
||||||
// snapshot access operation.
|
|
||||||
func (client SnapshotsClient) GrantAccess(resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (<-chan AccessURI, <-chan error) {
|
|
||||||
resultChan := make(chan AccessURI, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: grantAccessData,
|
|
||||||
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "disk.SnapshotsClient", "GrantAccess")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result AccessURI
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.GrantAccessPreparer(resourceGroupName, snapshotName, grantAccessData, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GrantAccessSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GrantAccessResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "GrantAccess", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccessPreparer prepares the GrantAccess request.
|
|
||||||
func (client SnapshotsClient) GrantAccessPreparer(resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"snapshotName": autorest.Encode("path", snapshotName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", pathParameters),
|
|
||||||
autorest.WithJSON(grantAccessData),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccessSender sends the GrantAccess request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client SnapshotsClient) GrantAccessSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrantAccessResponder handles the response to the GrantAccess request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List lists snapshots under a subscription.
|
|
||||||
func (client SnapshotsClient) List() (result SnapshotList, err error) {
|
|
||||||
req, err := client.ListPreparer()
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client SnapshotsClient) ListPreparer() (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots", 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 SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, 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 SnapshotsClient) ListNextResults(lastResults SnapshotList) (result SnapshotList, err error) {
|
|
||||||
req, err := lastResults.SnapshotListPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "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, "disk.SnapshotsClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroup lists snapshots under a resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
func (client SnapshotsClient) ListByResourceGroup(resourceGroupName string) (result SnapshotList, err error) {
|
|
||||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListByResourceGroupSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListByResourceGroupResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
|
||||||
func (client SnapshotsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListByResourceGroupNextResults retrieves the next set of results, if any.
|
|
||||||
func (client SnapshotsClient) ListByResourceGroupNextResults(lastResults SnapshotList) (result SnapshotList, err error) {
|
|
||||||
req, err := lastResults.SnapshotListPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListByResourceGroupSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListByResourceGroupResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccess revokes access to a snapshot. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. snapshotName is the
|
|
||||||
// name of the snapshot within the given subscription and resource group.
|
|
||||||
func (client SnapshotsClient) RevokeAccess(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.RevokeAccessPreparer(resourceGroupName, snapshotName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.RevokeAccessSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.RevokeAccessResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "RevokeAccess", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccessPreparer prepares the RevokeAccess request.
|
|
||||||
func (client SnapshotsClient) RevokeAccessPreparer(resourceGroupName string, snapshotName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"snapshotName": autorest.Encode("path", snapshotName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccessSender sends the RevokeAccess request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update updates (patches) a snapshot. This method may poll for completion.
|
|
||||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
|
||||||
// will be used to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. snapshotName is the
|
|
||||||
// name of the snapshot within the given subscription and resource group.
|
|
||||||
// snapshot is snapshot object supplied in the body of the Patch snapshot
|
|
||||||
// operation.
|
|
||||||
func (client SnapshotsClient) Update(resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, cancel <-chan struct{}) (<-chan Snapshot, <-chan error) {
|
|
||||||
resultChan := make(chan Snapshot, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result Snapshot
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.UpdatePreparer(resourceGroupName, snapshotName, snapshot, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.UpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.UpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "disk.SnapshotsClient", "Update", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdatePreparer prepares the Update request.
|
|
||||||
func (client SnapshotsClient) UpdatePreparer(resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"snapshotName": autorest.Encode("path", snapshotName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPatch(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
|
||||||
autorest.WithJSON(snapshot),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateSender sends the Update request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client SnapshotsClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateResponder handles the response to the Update request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,773 +0,0 @@
|
||||||
package network
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ApplicationGatewaysClient is the composite Swagger for Network Client
|
|
||||||
type ApplicationGatewaysClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewApplicationGatewaysClient creates an instance of the
|
|
||||||
// ApplicationGatewaysClient client.
|
|
||||||
func NewApplicationGatewaysClient(subscriptionID string) ApplicationGatewaysClient {
|
|
||||||
return NewApplicationGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewApplicationGatewaysClientWithBaseURI creates an instance of the
|
|
||||||
// ApplicationGatewaysClient client.
|
|
||||||
func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewaysClient {
|
|
||||||
return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// BackendHealth gets the backend health of the specified application gateway
|
|
||||||
// in a resource group. This method may poll for completion. Polling can be
|
|
||||||
// canceled by passing the cancel channel argument. The channel will be used to
|
|
||||||
// cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. applicationGatewayName
|
|
||||||
// is the name of the application gateway. expand is expands BackendAddressPool
|
|
||||||
// and BackendHttpSettings referenced in backend health.
|
|
||||||
func (client ApplicationGatewaysClient) BackendHealth(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (<-chan ApplicationGatewayBackendHealth, <-chan error) {
|
|
||||||
resultChan := make(chan ApplicationGatewayBackendHealth, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result ApplicationGatewayBackendHealth
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.BackendHealthPreparer(resourceGroupName, applicationGatewayName, expand, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.BackendHealthSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.BackendHealthResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// BackendHealthPreparer prepares the BackendHealth request.
|
|
||||||
func (client ApplicationGatewaysClient) BackendHealthPreparer(resourceGroupName string, applicationGatewayName string, expand string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(expand) > 0 {
|
|
||||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// BackendHealthSender sends the BackendHealth request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// BackendHealthResponder handles the response to the BackendHealth request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Response) (result ApplicationGatewayBackendHealth, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates the specified application gateway. This
|
|
||||||
// method may poll for completion. Polling can be canceled by passing the
|
|
||||||
// cancel channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. applicationGatewayName
|
|
||||||
// is the name of the application gateway. parameters is parameters supplied to
|
|
||||||
// the create or update application gateway operation.
|
|
||||||
func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (<-chan ApplicationGateway, <-chan error) {
|
|
||||||
resultChan := make(chan ApplicationGateway, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: parameters,
|
|
||||||
Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil},
|
|
||||||
}},
|
|
||||||
}}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result ApplicationGateway
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationGatewayName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes the specified application gateway. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. applicationGatewayName
|
|
||||||
// is the name of the application gateway.
|
|
||||||
func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, applicationGatewayName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get gets the specified application gateway.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. applicationGatewayName
|
|
||||||
// is the name of the application gateway.
|
|
||||||
func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, applicationGatewayName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client ApplicationGatewaysClient) GetPreparer(resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", 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 ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (result ApplicationGateway, 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 application gateways in a resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
func (client ApplicationGatewaysClient) List(resourceGroupName string) (result ApplicationGatewayListResult, err error) {
|
|
||||||
req, err := client.ListPreparer(resourceGroupName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client ApplicationGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", 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 ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (result ApplicationGatewayListResult, 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 ApplicationGatewaysClient) ListNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
|
|
||||||
req, err := lastResults.ApplicationGatewayListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAll gets all the application gateways in a subscription.
|
|
||||||
func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, err error) {
|
|
||||||
req, err := client.ListAllPreparer()
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllPreparer prepares the ListAll request.
|
|
||||||
func (client ApplicationGatewaysClient) ListAllPreparer() (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllSender sends the ListAll request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllResponder handles the response to the ListAll request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllNextResults retrieves the next set of results, if any.
|
|
||||||
func (client ApplicationGatewaysClient) ListAllNextResults(lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) {
|
|
||||||
req, err := lastResults.ApplicationGatewayListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAvailableWafRuleSets lists all available web application firewall rule
|
|
||||||
// sets.
|
|
||||||
func (client ApplicationGatewaysClient) ListAvailableWafRuleSets() (result ApplicationGatewayAvailableWafRuleSetsResult, err error) {
|
|
||||||
req, err := client.ListAvailableWafRuleSetsPreparer()
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAvailableWafRuleSetsSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAvailableWafRuleSetsResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAvailableWafRuleSetsPreparer prepares the ListAvailableWafRuleSets request.
|
|
||||||
func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer() (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAvailableWafRuleSetsSender sends the ListAvailableWafRuleSets request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAvailableWafRuleSetsResponder handles the response to the ListAvailableWafRuleSets request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *http.Response) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start starts the specified application gateway. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. applicationGatewayName
|
|
||||||
// is the name of the application gateway.
|
|
||||||
func (client ApplicationGatewaysClient) Start(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.StartPreparer(resourceGroupName, applicationGatewayName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.StartSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.StartResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartPreparer prepares the Start request.
|
|
||||||
func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartSender sends the Start request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client ApplicationGatewaysClient) StartSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// StartResponder handles the response to the Start request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop stops the specified application gateway in a resource group. This
|
|
||||||
// method may poll for completion. Polling can be canceled by passing the
|
|
||||||
// cancel channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. applicationGatewayName
|
|
||||||
// is the name of the application gateway.
|
|
||||||
func (client ApplicationGatewaysClient) Stop(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.StopPreparer(resourceGroupName, applicationGatewayName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.StopSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.StopResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// StopPreparer prepares the Stop request.
|
|
||||||
func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// StopSender sends the Stop request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client ApplicationGatewaysClient) StopSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// StopResponder handles the response to the Stop request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,871 +0,0 @@
|
||||||
package network
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// InterfacesClient is the composite Swagger for Network Client
|
|
||||||
type InterfacesClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewInterfacesClient creates an instance of the InterfacesClient client.
|
|
||||||
func NewInterfacesClient(subscriptionID string) InterfacesClient {
|
|
||||||
return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient
|
|
||||||
// client.
|
|
||||||
func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient {
|
|
||||||
return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates a network interface. This method may poll
|
|
||||||
// for completion. Polling can be canceled by passing the cancel channel
|
|
||||||
// argument. The channel will be used to cancel polling and any outstanding
|
|
||||||
// HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. networkInterfaceName is
|
|
||||||
// the name of the network interface. parameters is parameters supplied to the
|
|
||||||
// create or update network interface operation.
|
|
||||||
func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (<-chan Interface, <-chan error) {
|
|
||||||
resultChan := make(chan Interface, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result Interface
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result Interface, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes the specified network interface. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. networkInterfaceName is
|
|
||||||
// the name of the network interface.
|
|
||||||
func (client InterfacesClient) Delete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, networkInterfaceName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get gets information about the specified network interface.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. networkInterfaceName is
|
|
||||||
// the name of the network interface. expand is expands referenced resources.
|
|
||||||
func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client InterfacesClient) GetPreparer(resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(expand) > 0 {
|
|
||||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", 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 InterfacesClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) GetResponder(resp *http.Response) (result Interface, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetEffectiveRouteTable gets all route tables applied to a network interface.
|
|
||||||
// This method may poll for completion. Polling can be canceled by passing the
|
|
||||||
// cancel channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. networkInterfaceName is
|
|
||||||
// the name of the network interface.
|
|
||||||
func (client InterfacesClient) GetEffectiveRouteTable(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveRouteListResult, <-chan error) {
|
|
||||||
resultChan := make(chan EffectiveRouteListResult, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result EffectiveRouteListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.GetEffectiveRouteTablePreparer(resourceGroupName, networkInterfaceName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetEffectiveRouteTableSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetEffectiveRouteTableResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request.
|
|
||||||
func (client InterfacesClient) GetEffectiveRouteTablePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result EffectiveRouteListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 scale set.
|
|
||||||
// virtualmachineIndex is the virtual machine index. networkInterfaceName is
|
|
||||||
// the name of the network interface. expand is expands referenced resources.
|
|
||||||
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) {
|
|
||||||
req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request.
|
|
||||||
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualmachineIndex": autorest.Encode("path", virtualmachineIndex),
|
|
||||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(expand) > 0 {
|
|
||||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List gets all network interfaces in a resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) {
|
|
||||||
req, err := client.ListPreparer(resourceGroupName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client InterfacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", 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 InterfacesClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, 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 InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
|
|
||||||
req, err := lastResults.InterfaceListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAll gets all network interfaces in a subscription.
|
|
||||||
func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) {
|
|
||||||
req, err := client.ListAllPreparer()
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllPreparer prepares the ListAll request.
|
|
||||||
func (client InterfacesClient) ListAllPreparer() (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllSender sends the ListAll request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllResponder handles the response to the ListAll request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) ListAllResponder(resp *http.Response) (result InterfaceListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllNextResults retrieves the next set of results, if any.
|
|
||||||
func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
|
|
||||||
req, err := lastResults.InterfaceListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListEffectiveNetworkSecurityGroups gets all network security groups applied
|
|
||||||
// to a network interface. This method may poll for completion. Polling can be
|
|
||||||
// canceled by passing the cancel channel argument. The channel will be used to
|
|
||||||
// cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. networkInterfaceName is
|
|
||||||
// the name of the network interface.
|
|
||||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveNetworkSecurityGroupListResult, <-chan error) {
|
|
||||||
resultChan := make(chan EffectiveNetworkSecurityGroupListResult, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result EffectiveNetworkSecurityGroupListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName, networkInterfaceName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListEffectiveNetworkSecurityGroupsSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request.
|
|
||||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result EffectiveNetworkSecurityGroupListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 scale set.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResult, err error) {
|
|
||||||
req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
|
|
||||||
req, err := lastResults.InterfaceListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all
|
|
||||||
// network interfaces in a virtual machine in a virtual machine scale set.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualMachineScaleSetName is the name of the virtual machine scale set.
|
|
||||||
// virtualmachineIndex is the virtual machine index.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResult, err error) {
|
|
||||||
req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualmachineIndex": autorest.Encode("path", virtualmachineIndex),
|
|
||||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any.
|
|
||||||
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
|
|
||||||
req, err := lastResults.InterfaceListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,465 +0,0 @@
|
||||||
package network
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// PublicIPAddressesClient is the composite Swagger for Network Client
|
|
||||||
type PublicIPAddressesClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewPublicIPAddressesClient creates an instance of the
|
|
||||||
// PublicIPAddressesClient client.
|
|
||||||
func NewPublicIPAddressesClient(subscriptionID string) PublicIPAddressesClient {
|
|
||||||
return NewPublicIPAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewPublicIPAddressesClientWithBaseURI creates an instance of the
|
|
||||||
// PublicIPAddressesClient client.
|
|
||||||
func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPAddressesClient {
|
|
||||||
return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates a static or dynamic public IP address.
|
|
||||||
// This method may poll for completion. Polling can be canceled by passing the
|
|
||||||
// cancel channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. publicIPAddressName is
|
|
||||||
// the name of the public IP address. parameters is parameters supplied to the
|
|
||||||
// create or update public IP address operation.
|
|
||||||
func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) {
|
|
||||||
resultChan := make(chan PublicIPAddress, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: parameters,
|
|
||||||
Constraints: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
|
|
||||||
}},
|
|
||||||
}}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result PublicIPAddress
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"publicIpAddressName": autorest.Encode("path", publicIPAddressName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Response) (result PublicIPAddress, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes the specified public IP address. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. publicIPAddressName is
|
|
||||||
// the name of the subnet.
|
|
||||||
func (client PublicIPAddressesClient) Delete(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, publicIPAddressName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"publicIpAddressName": autorest.Encode("path", publicIPAddressName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get gets the specified public IP address in a specified resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. publicIPAddressName is
|
|
||||||
// the name of the subnet. expand is expands referenced resources.
|
|
||||||
func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, publicIPAddressName, expand)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client PublicIPAddressesClient) GetPreparer(resourceGroupName string, publicIPAddressName string, expand string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"publicIpAddressName": autorest.Encode("path", publicIPAddressName),
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(expand) > 0 {
|
|
||||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", 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 PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result PublicIPAddress, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List gets all public IP addresses in a resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, err error) {
|
|
||||||
req, err := client.ListPreparer(resourceGroupName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client PublicIPAddressesClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", 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 PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result PublicIPAddressListResult, 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 PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
|
|
||||||
req, err := lastResults.PublicIPAddressListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAll gets all the public IP addresses in a subscription.
|
|
||||||
func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) {
|
|
||||||
req, err := client.ListAllPreparer()
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllPreparer prepares the ListAll request.
|
|
||||||
func (client PublicIPAddressesClient) ListAllPreparer() (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllSender sends the ListAll request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllResponder handles the response to the ListAll request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (result PublicIPAddressListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllNextResults retrieves the next set of results, if any.
|
|
||||||
func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
|
|
||||||
req, err := lastResults.PublicIPAddressListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
785
vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go
generated
vendored
785
vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go
generated
vendored
|
@ -1,785 +0,0 @@
|
||||||
package network
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VirtualNetworkGatewaysClient is the composite Swagger for Network Client
|
|
||||||
type VirtualNetworkGatewaysClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVirtualNetworkGatewaysClient creates an instance of the
|
|
||||||
// VirtualNetworkGatewaysClient client.
|
|
||||||
func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient {
|
|
||||||
return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the
|
|
||||||
// VirtualNetworkGatewaysClient client.
|
|
||||||
func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient {
|
|
||||||
return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates a virtual network gateway in the specified
|
|
||||||
// resource group. This method may poll for completion. Polling can be canceled
|
|
||||||
// by passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway.
|
|
||||||
// parameters is parameters supplied to create or update virtual network
|
|
||||||
// gateway operation.
|
|
||||||
func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (<-chan VirtualNetworkGateway, <-chan error) {
|
|
||||||
resultChan := make(chan VirtualNetworkGateway, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: parameters,
|
|
||||||
Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result VirtualNetworkGateway
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes the specified virtual network gateway. This method may poll
|
|
||||||
// for completion. Polling can be canceled by passing the cancel channel
|
|
||||||
// argument. The channel will be used to cancel polling and any outstanding
|
|
||||||
// HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway.
|
|
||||||
func (client VirtualNetworkGatewaysClient) Delete(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generatevpnclientpackage generates VPN client package for P2S client of the
|
|
||||||
// virtual network gateway in the specified resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway.
|
|
||||||
// parameters is parameters supplied to the generate virtual network gateway
|
|
||||||
// VPN client package operation.
|
|
||||||
func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, err error) {
|
|
||||||
req, err := client.GeneratevpnclientpackagePreparer(resourceGroupName, virtualNetworkGatewayName, parameters)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GeneratevpnclientpackageSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GeneratevpnclientpackageResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GeneratevpnclientpackagePreparer prepares the Generatevpnclientpackage request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(resp *http.Response) (result String, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result.Value),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get gets the specified virtual network gateway by resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway.
|
|
||||||
func (client VirtualNetworkGatewaysClient) Get(resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetPreparer(resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", 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 VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAdvertisedRoutes this operation retrieves a list of routes the virtual
|
|
||||||
// network gateway is advertising to the specified peer. This method may poll
|
|
||||||
// for completion. Polling can be canceled by passing the cancel channel
|
|
||||||
// argument. The channel will be used to cancel polling and any outstanding
|
|
||||||
// HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway. peer
|
|
||||||
// is the IP address of the peer
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutes(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (<-chan GatewayRouteListResult, <-chan error) {
|
|
||||||
resultChan := make(chan GatewayRouteListResult, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result GatewayRouteListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.GetAdvertisedRoutesPreparer(resourceGroupName, virtualNetworkGatewayName, peer, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetAdvertisedRoutesSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetAdvertisedRoutesResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAdvertisedRoutesPreparer prepares the GetAdvertisedRoutes request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
"peer": autorest.Encode("query", peer),
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAdvertisedRoutesResponder handles the response to the GetAdvertisedRoutes request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetBgpPeerStatus the GetBgpPeerStatus operation retrieves the status of all
|
|
||||||
// BGP peers. This method may poll for completion. Polling can be canceled by
|
|
||||||
// passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway. peer
|
|
||||||
// is the IP address of the peer to retrieve the status of.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetBgpPeerStatus(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (<-chan BgpPeerStatusListResult, <-chan error) {
|
|
||||||
resultChan := make(chan BgpPeerStatusListResult, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result BgpPeerStatusListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.GetBgpPeerStatusPreparer(resourceGroupName, virtualNetworkGatewayName, peer, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetBgpPeerStatusSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetBgpPeerStatusResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetBgpPeerStatusPreparer prepares the GetBgpPeerStatus request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(resourceGroupName string, virtualNetworkGatewayName string, peer string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(peer) > 0 {
|
|
||||||
queryParameters["peer"] = autorest.Encode("query", peer)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetBgpPeerStatusResponder handles the response to the GetBgpPeerStatus request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusResponder(resp *http.Response) (result BgpPeerStatusListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetLearnedRoutes this operation retrieves a list of routes the virtual
|
|
||||||
// network gateway has learned, including routes learned from BGP peers. This
|
|
||||||
// method may poll for completion. Polling can be canceled by passing the
|
|
||||||
// cancel channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetLearnedRoutes(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (<-chan GatewayRouteListResult, <-chan error) {
|
|
||||||
resultChan := make(chan GatewayRouteListResult, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result GatewayRouteListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.GetLearnedRoutesPreparer(resourceGroupName, virtualNetworkGatewayName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetLearnedRoutesSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetLearnedRoutesResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetLearnedRoutesPreparer prepares the GetLearnedRoutes request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(resourceGroupName string, virtualNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetLearnedRoutesResponder handles the response to the GetLearnedRoutes request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List gets all virtual network gateways by resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, err error) {
|
|
||||||
req, err := client.ListPreparer(resourceGroupName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", 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 VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, 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 VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) {
|
|
||||||
req, err := lastResults.VirtualNetworkGatewayListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset resets the primary of the virtual network gateway in the specified
|
|
||||||
// resource group. This method may poll for completion. Polling can be canceled
|
|
||||||
// by passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
// virtualNetworkGatewayName is the name of the virtual network gateway.
|
|
||||||
// gatewayVip is virtual network gateway vip address supplied to the begin
|
|
||||||
// reset of the active-active feature enabled gateway.
|
|
||||||
func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (<-chan VirtualNetworkGateway, <-chan error) {
|
|
||||||
resultChan := make(chan VirtualNetworkGateway, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result VirtualNetworkGateway
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, gatewayVip, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ResetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ResetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResetPreparer prepares the Reset request.
|
|
||||||
func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(gatewayVip) > 0 {
|
|
||||||
queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResetSender sends the Reset request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResetResponder handles the response to the Reset request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,521 +0,0 @@
|
||||||
package network
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// VirtualNetworksClient is the composite Swagger for Network Client
|
|
||||||
type VirtualNetworksClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient
|
|
||||||
// client.
|
|
||||||
func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient {
|
|
||||||
return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewVirtualNetworksClientWithBaseURI creates an instance of the
|
|
||||||
// VirtualNetworksClient client.
|
|
||||||
func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient {
|
|
||||||
return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckIPAddressAvailability checks whether a private IP address is available
|
|
||||||
// for use.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
|
|
||||||
// the name of the virtual network. IPAddress is the private IP address to be
|
|
||||||
// verified.
|
|
||||||
func (client VirtualNetworksClient) CheckIPAddressAvailability(resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) {
|
|
||||||
req, err := client.CheckIPAddressAvailabilityPreparer(resourceGroupName, virtualNetworkName, IPAddress)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CheckIPAddressAvailabilitySender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CheckIPAddressAvailabilityResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request.
|
|
||||||
func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkName": autorest.Encode("path", virtualNetworkName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(IPAddress) > 0 {
|
|
||||||
queryParameters["ipAddress"] = autorest.Encode("query", IPAddress)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckIPAddressAvailabilityResponder handles the response to the CheckIPAddressAvailability request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *http.Response) (result IPAddressAvailabilityResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates a virtual network in the specified
|
|
||||||
// resource group. This method may poll for completion. Polling can be canceled
|
|
||||||
// by passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
|
|
||||||
// the name of the virtual network. parameters is parameters supplied to the
|
|
||||||
// create or update virtual network operation
|
|
||||||
func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) {
|
|
||||||
resultChan := make(chan VirtualNetwork, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result VirtualNetwork
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkName": autorest.Encode("path", virtualNetworkName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes the specified virtual network. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
|
|
||||||
// the name of the virtual network.
|
|
||||||
func (client VirtualNetworksClient) Delete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkName": autorest.Encode("path", virtualNetworkName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworksClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 is expands referenced resources.
|
|
||||||
func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) {
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, expand)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
"virtualNetworkName": autorest.Encode("path", virtualNetworkName),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(expand) > 0 {
|
|
||||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", 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 VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// List gets all virtual networks in a resource group.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group.
|
|
||||||
func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, err error) {
|
|
||||||
req, err := client.ListPreparer(resourceGroupName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client VirtualNetworksClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", 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 VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result VirtualNetworkListResult, 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 VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
|
|
||||||
req, err := lastResults.VirtualNetworkListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAll gets all virtual networks in a subscription.
|
|
||||||
func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, err error) {
|
|
||||||
req, err := client.ListAllPreparer()
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllPreparer prepares the ListAll request.
|
|
||||||
func (client VirtualNetworksClient) ListAllPreparer() (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllSender sends the ListAll request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllResponder handles the response to the ListAll request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (result VirtualNetworkListResult, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAllNextResults retrieves the next set of results, if any.
|
|
||||||
func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
|
|
||||||
req, err := lastResults.VirtualNetworkListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing next results request")
|
|
||||||
}
|
|
||||||
if req == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,457 +0,0 @@
|
||||||
package resources
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/date"
|
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeploymentMode enumerates the values for deployment mode.
|
|
||||||
type DeploymentMode string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Complete specifies the complete state for deployment mode.
|
|
||||||
Complete DeploymentMode = "Complete"
|
|
||||||
// Incremental specifies the incremental state for deployment mode.
|
|
||||||
Incremental DeploymentMode = "Incremental"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ResourceIdentityType enumerates the values for resource identity type.
|
|
||||||
type ResourceIdentityType string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// SystemAssigned specifies the system assigned state for resource identity
|
|
||||||
// type.
|
|
||||||
SystemAssigned ResourceIdentityType = "SystemAssigned"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AliasPathType is the type of the paths for alias.
|
|
||||||
type AliasPathType struct {
|
|
||||||
Path *string `json:"path,omitempty"`
|
|
||||||
APIVersions *[]string `json:"apiVersions,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AliasType is the alias type.
|
|
||||||
type AliasType struct {
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Paths *[]AliasPathType `json:"paths,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// BasicDependency is deployment dependency information.
|
|
||||||
type BasicDependency struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
ResourceType *string `json:"resourceType,omitempty"`
|
|
||||||
ResourceName *string `json:"resourceName,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DebugSetting is
|
|
||||||
type DebugSetting struct {
|
|
||||||
DetailLevel *string `json:"detailLevel,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dependency is deployment dependency information.
|
|
||||||
type Dependency struct {
|
|
||||||
DependsOn *[]BasicDependency `json:"dependsOn,omitempty"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
ResourceType *string `json:"resourceType,omitempty"`
|
|
||||||
ResourceName *string `json:"resourceName,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deployment is deployment operation parameters.
|
|
||||||
type Deployment struct {
|
|
||||||
Properties *DeploymentProperties `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentExportResult is the deployment export result.
|
|
||||||
type DeploymentExportResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Template *map[string]interface{} `json:"template,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentExtended is deployment information.
|
|
||||||
type DeploymentExtended struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentExtendedFilter is deployment filter.
|
|
||||||
type DeploymentExtendedFilter struct {
|
|
||||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentListResult is list of deployments.
|
|
||||||
type DeploymentListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]DeploymentExtended `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client DeploymentListResult) DeploymentListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentOperation is deployment operation information.
|
|
||||||
type DeploymentOperation struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
OperationID *string `json:"operationId,omitempty"`
|
|
||||||
Properties *DeploymentOperationProperties `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentOperationProperties is deployment operation properties.
|
|
||||||
type DeploymentOperationProperties struct {
|
|
||||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
|
||||||
Timestamp *date.Time `json:"timestamp,omitempty"`
|
|
||||||
ServiceRequestID *string `json:"serviceRequestId,omitempty"`
|
|
||||||
StatusCode *string `json:"statusCode,omitempty"`
|
|
||||||
StatusMessage *map[string]interface{} `json:"statusMessage,omitempty"`
|
|
||||||
TargetResource *TargetResource `json:"targetResource,omitempty"`
|
|
||||||
Request *HTTPMessage `json:"request,omitempty"`
|
|
||||||
Response *HTTPMessage `json:"response,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentOperationsListResult is list of deployment operations.
|
|
||||||
type DeploymentOperationsListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]DeploymentOperation `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentOperationsListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client DeploymentOperationsListResult) DeploymentOperationsListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentProperties is deployment properties.
|
|
||||||
type DeploymentProperties struct {
|
|
||||||
Template *map[string]interface{} `json:"template,omitempty"`
|
|
||||||
TemplateLink *TemplateLink `json:"templateLink,omitempty"`
|
|
||||||
Parameters *map[string]interface{} `json:"parameters,omitempty"`
|
|
||||||
ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
|
|
||||||
Mode DeploymentMode `json:"mode,omitempty"`
|
|
||||||
DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentPropertiesExtended is deployment properties with additional
|
|
||||||
// details.
|
|
||||||
type DeploymentPropertiesExtended struct {
|
|
||||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
|
||||||
CorrelationID *string `json:"correlationId,omitempty"`
|
|
||||||
Timestamp *date.Time `json:"timestamp,omitempty"`
|
|
||||||
Outputs *map[string]interface{} `json:"outputs,omitempty"`
|
|
||||||
Providers *[]Provider `json:"providers,omitempty"`
|
|
||||||
Dependencies *[]Dependency `json:"dependencies,omitempty"`
|
|
||||||
Template *map[string]interface{} `json:"template,omitempty"`
|
|
||||||
TemplateLink *TemplateLink `json:"templateLink,omitempty"`
|
|
||||||
Parameters *map[string]interface{} `json:"parameters,omitempty"`
|
|
||||||
ParametersLink *ParametersLink `json:"parametersLink,omitempty"`
|
|
||||||
Mode DeploymentMode `json:"mode,omitempty"`
|
|
||||||
DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentValidateResult is information from validate template deployment
|
|
||||||
// response.
|
|
||||||
type DeploymentValidateResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Error *ManagementErrorWithDetails `json:"error,omitempty"`
|
|
||||||
Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ExportTemplateRequest is export resource group template request parameters.
|
|
||||||
type ExportTemplateRequest struct {
|
|
||||||
ResourcesProperty *[]string `json:"resources,omitempty"`
|
|
||||||
Options *string `json:"options,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenericResource is resource information.
|
|
||||||
type GenericResource struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
Plan *Plan `json:"plan,omitempty"`
|
|
||||||
Properties *map[string]interface{} `json:"properties,omitempty"`
|
|
||||||
Kind *string `json:"kind,omitempty"`
|
|
||||||
ManagedBy *string `json:"managedBy,omitempty"`
|
|
||||||
Sku *Sku `json:"sku,omitempty"`
|
|
||||||
Identity *Identity `json:"identity,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenericResourceFilter is resource filter.
|
|
||||||
type GenericResourceFilter struct {
|
|
||||||
ResourceType *string `json:"resourceType,omitempty"`
|
|
||||||
Tagname *string `json:"tagname,omitempty"`
|
|
||||||
Tagvalue *string `json:"tagvalue,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Group is resource group information.
|
|
||||||
type Group struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Properties *GroupProperties `json:"properties,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
ManagedBy *string `json:"managedBy,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GroupExportResult is
|
|
||||||
type GroupExportResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Template *map[string]interface{} `json:"template,omitempty"`
|
|
||||||
Error *ManagementErrorWithDetails `json:"error,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GroupFilter is resource group filter.
|
|
||||||
type GroupFilter struct {
|
|
||||||
TagName *string `json:"tagName,omitempty"`
|
|
||||||
TagValue *string `json:"tagValue,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GroupListResult is list of resource groups.
|
|
||||||
type GroupListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Group `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GroupListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client GroupListResult) GroupListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// GroupProperties is the resource group properties.
|
|
||||||
type GroupProperties struct {
|
|
||||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTPMessage is
|
|
||||||
type HTTPMessage struct {
|
|
||||||
Content *map[string]interface{} `json:"content,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Identity is identity for the resource.
|
|
||||||
type Identity struct {
|
|
||||||
PrincipalID *string `json:"principalId,omitempty"`
|
|
||||||
TenantID *string `json:"tenantId,omitempty"`
|
|
||||||
Type ResourceIdentityType `json:"type,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResult is list of resource groups.
|
|
||||||
type ListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]GenericResource `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client ListResult) ListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ManagementErrorWithDetails is
|
|
||||||
type ManagementErrorWithDetails struct {
|
|
||||||
Code *string `json:"code,omitempty"`
|
|
||||||
Message *string `json:"message,omitempty"`
|
|
||||||
Target *string `json:"target,omitempty"`
|
|
||||||
Details *[]ManagementErrorWithDetails `json:"details,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// MoveInfo is parameters of move resources.
|
|
||||||
type MoveInfo struct {
|
|
||||||
ResourcesProperty *[]string `json:"resources,omitempty"`
|
|
||||||
TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ParametersLink is entity representing the reference to the deployment
|
|
||||||
// paramaters.
|
|
||||||
type ParametersLink struct {
|
|
||||||
URI *string `json:"uri,omitempty"`
|
|
||||||
ContentVersion *string `json:"contentVersion,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Plan is plan for the resource.
|
|
||||||
type Plan struct {
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Publisher *string `json:"publisher,omitempty"`
|
|
||||||
Product *string `json:"product,omitempty"`
|
|
||||||
PromotionCode *string `json:"promotionCode,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Provider is resource provider information.
|
|
||||||
type Provider struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Namespace *string `json:"namespace,omitempty"`
|
|
||||||
RegistrationState *string `json:"registrationState,omitempty"`
|
|
||||||
ResourceTypes *[]ProviderResourceType `json:"resourceTypes,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProviderListResult is list of resource providers.
|
|
||||||
type ProviderListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Provider `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProviderListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client ProviderListResult) ProviderListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProviderOperationDisplayProperties is resource provider operation's display
|
|
||||||
// properties.
|
|
||||||
type ProviderOperationDisplayProperties struct {
|
|
||||||
Publisher *string `json:"publisher,omitempty"`
|
|
||||||
Provider *string `json:"provider,omitempty"`
|
|
||||||
Resource *string `json:"resource,omitempty"`
|
|
||||||
Operation *string `json:"operation,omitempty"`
|
|
||||||
Description *string `json:"description,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProviderResourceType is resource type managed by the resource provider.
|
|
||||||
type ProviderResourceType struct {
|
|
||||||
ResourceType *string `json:"resourceType,omitempty"`
|
|
||||||
Locations *[]string `json:"locations,omitempty"`
|
|
||||||
Aliases *[]AliasType `json:"aliases,omitempty"`
|
|
||||||
APIVersions *[]string `json:"apiVersions,omitempty"`
|
|
||||||
Properties *map[string]*string `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resource is
|
|
||||||
type Resource struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sku is sKU for the resource.
|
|
||||||
type Sku struct {
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Tier *string `json:"tier,omitempty"`
|
|
||||||
Size *string `json:"size,omitempty"`
|
|
||||||
Family *string `json:"family,omitempty"`
|
|
||||||
Model *string `json:"model,omitempty"`
|
|
||||||
Capacity *int32 `json:"capacity,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// SubResource is
|
|
||||||
type SubResource struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TagCount is tag count.
|
|
||||||
type TagCount struct {
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Value *int32 `json:"value,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TagDetails is tag details.
|
|
||||||
type TagDetails struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
TagName *string `json:"tagName,omitempty"`
|
|
||||||
Count *TagCount `json:"count,omitempty"`
|
|
||||||
Values *[]TagValue `json:"values,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TagsListResult is list of subscription tags.
|
|
||||||
type TagsListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]TagDetails `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TagsListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client TagsListResult) TagsListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TagValue is tag information.
|
|
||||||
type TagValue struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
TagValue *string `json:"tagValue,omitempty"`
|
|
||||||
Count *TagCount `json:"count,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TargetResource is target resource.
|
|
||||||
type TargetResource struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
ResourceName *string `json:"resourceName,omitempty"`
|
|
||||||
ResourceType *string `json:"resourceType,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TemplateLink is entity representing the reference to the template.
|
|
||||||
type TemplateLink struct {
|
|
||||||
URI *string `json:"uri,omitempty"`
|
|
||||||
ContentVersion *string `json:"contentVersion,omitempty"`
|
|
||||||
}
|
|
898
vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go
generated
vendored
898
vendor/github.com/Azure/azure-sdk-for-go/arm/resources/resources/resourcesgroup.go
generated
vendored
|
@ -1,898 +0,0 @@
|
||||||
package resources
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/azure"
|
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GroupClient is the provides operations for working with resources and
|
|
||||||
// resource groups.
|
|
||||||
type GroupClient struct {
|
|
||||||
ManagementClient
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewGroupClient creates an instance of the GroupClient client.
|
|
||||||
func NewGroupClient(subscriptionID string) GroupClient {
|
|
||||||
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewGroupClientWithBaseURI creates an instance of the GroupClient client.
|
|
||||||
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
|
|
||||||
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistence checks whether a resource exists.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group containing the resource
|
|
||||||
// to check. The name is case insensitive. resourceProviderNamespace is the
|
|
||||||
// resource provider of the resource to check. parentResourcePath is the parent
|
|
||||||
// resource identity. resourceType is the resource type. resourceName is the
|
|
||||||
// name of the resource to check whether it exists.
|
|
||||||
func (client GroupClient) CheckExistence(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result autorest.Response, err error) {
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: resourceGroupName,
|
|
||||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
|
|
||||||
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "CheckExistence")
|
|
||||||
}
|
|
||||||
|
|
||||||
req, err := client.CheckExistencePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CheckExistenceSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CheckExistenceResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistence", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistencePreparer prepares the CheckExistence request.
|
|
||||||
func (client GroupClient) CheckExistencePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"parentResourcePath": parentResourcePath,
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"resourceName": autorest.Encode("path", resourceName),
|
|
||||||
"resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace),
|
|
||||||
"resourceType": resourceType,
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsHead(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistenceSender sends the CheckExistence request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) CheckExistenceSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistenceResponder handles the response to the CheckExistence request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistenceByID checks by ID whether a resource exists.
|
|
||||||
//
|
|
||||||
// resourceID is the fully qualified ID of the resource, including the resource
|
|
||||||
// name and resource type. Use the format,
|
|
||||||
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
|
|
||||||
func (client GroupClient) CheckExistenceByID(resourceID string) (result autorest.Response, err error) {
|
|
||||||
req, err := client.CheckExistenceByIDPreparer(resourceID)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CheckExistenceByIDSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CheckExistenceByIDResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CheckExistenceByID", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistenceByIDPreparer prepares the CheckExistenceByID request.
|
|
||||||
func (client GroupClient) CheckExistenceByIDPreparer(resourceID string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceId": resourceID,
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsHead(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/{resourceId}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistenceByIDSender sends the CheckExistenceByID request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) CheckExistenceByIDSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckExistenceByIDResponder handles the response to the CheckExistenceByID request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) CheckExistenceByIDResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdate creates a resource. This method may poll for completion.
|
|
||||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
|
||||||
// will be used to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group for the resource. The
|
|
||||||
// name is case insensitive. resourceProviderNamespace is the namespace of the
|
|
||||||
// resource provider. parentResourcePath is the parent resource identity.
|
|
||||||
// resourceType is the resource type of the resource to create. resourceName is
|
|
||||||
// the name of the resource to create. parameters is parameters for creating or
|
|
||||||
// updating the resource.
|
|
||||||
func (client GroupClient) CreateOrUpdate(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (<-chan GenericResource, <-chan error) {
|
|
||||||
resultChan := make(chan GenericResource, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: resourceGroupName,
|
|
||||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
|
|
||||||
{TargetValue: parameters,
|
|
||||||
Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdate")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result GenericResource
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
|
||||||
func (client GroupClient) CreateOrUpdatePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"parentResourcePath": parentResourcePath,
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"resourceName": autorest.Encode("path", resourceName),
|
|
||||||
"resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace),
|
|
||||||
"resourceType": resourceType,
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GenericResource, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateByID create a resource by ID. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceID is the fully qualified ID of the resource, including the resource
|
|
||||||
// name and resource type. Use the format,
|
|
||||||
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
|
|
||||||
// parameters is create or update resource parameters.
|
|
||||||
func (client GroupClient) CreateOrUpdateByID(resourceID string, parameters GenericResource, cancel <-chan struct{}) (<-chan GenericResource, <-chan error) {
|
|
||||||
resultChan := make(chan GenericResource, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: parameters,
|
|
||||||
Constraints: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Null, Rule: false,
|
|
||||||
Chain: []validation.Constraint{{Target: "parameters.Kind", Name: validation.Pattern, Rule: `^[-\w\._,\(\)]+$`, Chain: nil}}}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "CreateOrUpdateByID")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result GenericResource
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdateByIDPreparer(resourceID, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateByIDSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateByIDResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "CreateOrUpdateByID", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request.
|
|
||||||
func (client GroupClient) CreateOrUpdateByIDPreparer(resourceID string, parameters GenericResource, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceId": resourceID,
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPut(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/{resourceId}", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) CreateOrUpdateByIDSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) CreateOrUpdateByIDResponder(resp *http.Response) (result GenericResource, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK, http.StatusAccepted),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete deletes a resource. This method may poll for completion. Polling can
|
|
||||||
// be canceled by passing the cancel channel argument. The channel will be used
|
|
||||||
// to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group that contains the
|
|
||||||
// resource to delete. The name is case insensitive. resourceProviderNamespace
|
|
||||||
// is the namespace of the resource provider. parentResourcePath is the parent
|
|
||||||
// resource identity. resourceType is the resource type. resourceName is the
|
|
||||||
// name of the resource to delete.
|
|
||||||
func (client GroupClient) Delete(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: resourceGroupName,
|
|
||||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "Delete")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
|
||||||
func (client GroupClient) DeletePreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"parentResourcePath": parentResourcePath,
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"resourceName": autorest.Encode("path", resourceName),
|
|
||||||
"resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace),
|
|
||||||
"resourceType": resourceType,
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteByID deletes a resource by ID. This method may poll for completion.
|
|
||||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
|
||||||
// will be used to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// resourceID is the fully qualified ID of the resource, including the resource
|
|
||||||
// name and resource type. Use the format,
|
|
||||||
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
|
|
||||||
func (client GroupClient) DeleteByID(resourceID string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeleteByIDPreparer(resourceID, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteByIDSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteByIDResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "DeleteByID", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteByIDPreparer prepares the DeleteByID request.
|
|
||||||
func (client GroupClient) DeleteByIDPreparer(resourceID string, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceId": resourceID,
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsDelete(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/{resourceId}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteByIDSender sends the DeleteByID request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) DeleteByIDSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteByIDResponder handles the response to the DeleteByID request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get gets a resource.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group containing the resource
|
|
||||||
// to get. The name is case insensitive. resourceProviderNamespace is the
|
|
||||||
// namespace of the resource provider. parentResourcePath is the parent
|
|
||||||
// resource identity. resourceType is the resource type of the resource.
|
|
||||||
// resourceName is the name of the resource to get.
|
|
||||||
func (client GroupClient) Get(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result GenericResource, err error) {
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: resourceGroupName,
|
|
||||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
|
||||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
|
|
||||||
return result, validation.NewErrorWithValidationError(err, "resources.GroupClient", "Get")
|
|
||||||
}
|
|
||||||
|
|
||||||
req, err := client.GetPreparer(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "Get", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
|
||||||
func (client GroupClient) GetPreparer(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"parentResourcePath": parentResourcePath,
|
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
|
||||||
"resourceName": autorest.Encode("path", resourceName),
|
|
||||||
"resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace),
|
|
||||||
"resourceType": resourceType,
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", 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 GroupClient) GetSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) GetResponder(resp *http.Response) (result GenericResource, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetByID gets a resource by ID.
|
|
||||||
//
|
|
||||||
// resourceID is the fully qualified ID of the resource, including the resource
|
|
||||||
// name and resource type. Use the format,
|
|
||||||
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
|
|
||||||
func (client GroupClient) GetByID(resourceID string) (result GenericResource, err error) {
|
|
||||||
req, err := client.GetByIDPreparer(resourceID)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.GetByIDSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.GetByIDResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "GetByID", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetByIDPreparer prepares the GetByID request.
|
|
||||||
func (client GroupClient) GetByIDPreparer(resourceID string) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"resourceId": resourceID,
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/{resourceId}", pathParameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetByIDSender sends the GetByID request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) GetByIDSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetByIDResponder handles the response to the GetByID request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) GetByIDResponder(resp *http.Response) (result GenericResource, 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 get all the resources in a subscription.
|
|
||||||
//
|
|
||||||
// filter is the filter to apply on the operation. expand is the $expand query
|
|
||||||
// parameter. top is the number of results to return. If null is passed,
|
|
||||||
// returns all resource groups.
|
|
||||||
func (client GroupClient) List(filter string, expand string, top *int32) (result ListResult, err error) {
|
|
||||||
req, err := client.ListPreparer(filter, expand, top)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
|
||||||
func (client GroupClient) ListPreparer(filter string, expand string, top *int32) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
if len(filter) > 0 {
|
|
||||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
|
||||||
}
|
|
||||||
if len(expand) > 0 {
|
|
||||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
|
||||||
}
|
|
||||||
if top != nil {
|
|
||||||
queryParameters["$top"] = autorest.Encode("query", *top)
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", 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 GroupClient) ListSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) ListResponder(resp *http.Response) (result ListResult, 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 GroupClient) ListNextResults(lastResults ListResult) (result ListResult, err error) {
|
|
||||||
req, err := lastResults.ListResultPreparer()
|
|
||||||
if err != nil {
|
|
||||||
return result, autorest.NewErrorWithError(err, "resources.GroupClient", "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, "resources.GroupClient", "List", resp, "Failure sending next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "List", resp, "Failure responding to next results request")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// MoveResources the resources to move must be in the same source resource
|
|
||||||
// group. The target resource group may be in a different subscription. When
|
|
||||||
// moving resources, both the source group and the target group are locked for
|
|
||||||
// the duration of the operation. Write and delete operations are blocked on
|
|
||||||
// the groups until the move completes. This method may poll for completion.
|
|
||||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
|
||||||
// will be used to cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
|
||||||
// sourceResourceGroupName is the name of the resource group containing the
|
|
||||||
// rsources to move. parameters is parameters for moving resources.
|
|
||||||
func (client GroupClient) MoveResources(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
|
||||||
resultChan := make(chan autorest.Response, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
if err := validation.Validate([]validation.Validation{
|
|
||||||
{TargetValue: sourceResourceGroupName,
|
|
||||||
Constraints: []validation.Constraint{{Target: "sourceResourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
|
||||||
{Target: "sourceResourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
|
||||||
{Target: "sourceResourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "resources.GroupClient", "MoveResources")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.MoveResourcesPreparer(sourceResourceGroupName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.MoveResourcesSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = resp
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.MoveResourcesResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "resources.GroupClient", "MoveResources", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// MoveResourcesPreparer prepares the MoveResources request.
|
|
||||||
func (client GroupClient) MoveResourcesPreparer(sourceResourceGroupName string, parameters MoveInfo, cancel <-chan struct{}) (*http.Request, error) {
|
|
||||||
pathParameters := map[string]interface{}{
|
|
||||||
"sourceResourceGroupName": autorest.Encode("path", sourceResourceGroupName),
|
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
|
||||||
}
|
|
||||||
|
|
||||||
const APIVersion = "2016-09-01"
|
|
||||||
queryParameters := map[string]interface{}{
|
|
||||||
"api-version": APIVersion,
|
|
||||||
}
|
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsPost(),
|
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources", pathParameters),
|
|
||||||
autorest.WithJSON(parameters),
|
|
||||||
autorest.WithQueryParameters(queryParameters))
|
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
|
||||||
}
|
|
||||||
|
|
||||||
// MoveResourcesSender sends the MoveResources request. The method will close the
|
|
||||||
// http.Response Body if it receives an error.
|
|
||||||
func (client GroupClient) MoveResourcesSender(req *http.Request) (*http.Response, error) {
|
|
||||||
return autorest.SendWithSender(client,
|
|
||||||
req,
|
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
|
||||||
}
|
|
||||||
|
|
||||||
// MoveResourcesResponder handles the response to the MoveResources request. The method always
|
|
||||||
// closes the http.Response Body.
|
|
||||||
func (client GroupClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) {
|
|
||||||
err = autorest.Respond(
|
|
||||||
resp,
|
|
||||||
client.ByInspecting(),
|
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
|
||||||
autorest.ByClosing())
|
|
||||||
result.Response = resp
|
|
||||||
return
|
|
||||||
}
|
|
132
vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go
generated
vendored
132
vendor/github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions/models.go
generated
vendored
|
@ -1,132 +0,0 @@
|
||||||
package subscriptions
|
|
||||||
|
|
||||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
//
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SpendingLimit enumerates the values for spending limit.
|
|
||||||
type SpendingLimit string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// CurrentPeriodOff specifies the current period off state for spending
|
|
||||||
// limit.
|
|
||||||
CurrentPeriodOff SpendingLimit = "CurrentPeriodOff"
|
|
||||||
// Off specifies the off state for spending limit.
|
|
||||||
Off SpendingLimit = "Off"
|
|
||||||
// On specifies the on state for spending limit.
|
|
||||||
On SpendingLimit = "On"
|
|
||||||
)
|
|
||||||
|
|
||||||
// State enumerates the values for state.
|
|
||||||
type State string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Deleted specifies the deleted state for state.
|
|
||||||
Deleted State = "Deleted"
|
|
||||||
// Disabled specifies the disabled state for state.
|
|
||||||
Disabled State = "Disabled"
|
|
||||||
// Enabled specifies the enabled state for state.
|
|
||||||
Enabled State = "Enabled"
|
|
||||||
// PastDue specifies the past due state for state.
|
|
||||||
PastDue State = "PastDue"
|
|
||||||
// Warned specifies the warned state for state.
|
|
||||||
Warned State = "Warned"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ListResult is subscription list operation response.
|
|
||||||
type ListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Subscription `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client ListResult) ListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Location is location information.
|
|
||||||
type Location struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
SubscriptionID *string `json:"subscriptionId,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
DisplayName *string `json:"displayName,omitempty"`
|
|
||||||
Latitude *string `json:"latitude,omitempty"`
|
|
||||||
Longitude *string `json:"longitude,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// LocationListResult is location list operation response.
|
|
||||||
type LocationListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Location `json:"value,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Policies is subscription policies.
|
|
||||||
type Policies struct {
|
|
||||||
LocationPlacementID *string `json:"locationPlacementId,omitempty"`
|
|
||||||
QuotaID *string `json:"quotaId,omitempty"`
|
|
||||||
SpendingLimit SpendingLimit `json:"spendingLimit,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subscription is subscription information.
|
|
||||||
type Subscription struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
SubscriptionID *string `json:"subscriptionId,omitempty"`
|
|
||||||
DisplayName *string `json:"displayName,omitempty"`
|
|
||||||
State State `json:"state,omitempty"`
|
|
||||||
SubscriptionPolicies *Policies `json:"subscriptionPolicies,omitempty"`
|
|
||||||
AuthorizationSource *string `json:"authorizationSource,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TenantIDDescription is tenant Id information.
|
|
||||||
type TenantIDDescription struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
TenantID *string `json:"tenantId,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TenantListResult is tenant Ids information.
|
|
||||||
type TenantListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]TenantIDDescription `json:"value,omitempty"`
|
|
||||||
NextLink *string `json:"nextLink,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TenantListResultPreparer prepares a request to retrieve the next set of results. It returns
|
|
||||||
// nil if no more results exist.
|
|
||||||
func (client TenantListResult) TenantListResultPreparer() (*http.Request, error) {
|
|
||||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return autorest.Prepare(&http.Request{},
|
|
||||||
autorest.AsJSON(),
|
|
||||||
autorest.AsGet(),
|
|
||||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
|
||||||
}
|
|
|
@ -1,452 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
// 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"
|
|
||||||
"github.com/Azure/go-autorest/autorest/date"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AccessTier enumerates the values for access tier.
|
|
||||||
type AccessTier string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Cool specifies the cool state for access tier.
|
|
||||||
Cool AccessTier = "Cool"
|
|
||||||
// Hot specifies the hot state for access tier.
|
|
||||||
Hot AccessTier = "Hot"
|
|
||||||
)
|
|
||||||
|
|
||||||
// AccountStatus enumerates the values for account status.
|
|
||||||
type AccountStatus string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Available specifies the available state for account status.
|
|
||||||
Available AccountStatus = "available"
|
|
||||||
// Unavailable specifies the unavailable state for account status.
|
|
||||||
Unavailable AccountStatus = "unavailable"
|
|
||||||
)
|
|
||||||
|
|
||||||
// HTTPProtocol enumerates the values for http protocol.
|
|
||||||
type HTTPProtocol string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// HTTPS specifies the https state for http protocol.
|
|
||||||
HTTPS HTTPProtocol = "https"
|
|
||||||
// Httpshttp specifies the httpshttp state for http protocol.
|
|
||||||
Httpshttp HTTPProtocol = "https,http"
|
|
||||||
)
|
|
||||||
|
|
||||||
// KeyPermission enumerates the values for key permission.
|
|
||||||
type KeyPermission string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Full specifies the full state for key permission.
|
|
||||||
Full KeyPermission = "Full"
|
|
||||||
// Read specifies the read state for key permission.
|
|
||||||
Read KeyPermission = "Read"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Kind enumerates the values for kind.
|
|
||||||
type Kind string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// BlobStorage specifies the blob storage state for kind.
|
|
||||||
BlobStorage Kind = "BlobStorage"
|
|
||||||
// Storage specifies the storage state for kind.
|
|
||||||
Storage Kind = "Storage"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Permissions enumerates the values for permissions.
|
|
||||||
type Permissions string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// A specifies the a state for permissions.
|
|
||||||
A Permissions = "a"
|
|
||||||
// C specifies the c state for permissions.
|
|
||||||
C Permissions = "c"
|
|
||||||
// D specifies the d state for permissions.
|
|
||||||
D Permissions = "d"
|
|
||||||
// L specifies the l state for permissions.
|
|
||||||
L Permissions = "l"
|
|
||||||
// P specifies the p state for permissions.
|
|
||||||
P Permissions = "p"
|
|
||||||
// R specifies the r state for permissions.
|
|
||||||
R Permissions = "r"
|
|
||||||
// U specifies the u state for permissions.
|
|
||||||
U Permissions = "u"
|
|
||||||
// W specifies the w state for permissions.
|
|
||||||
W Permissions = "w"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Permissions1 enumerates the values for permissions 1.
|
|
||||||
type Permissions1 string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Permissions1A specifies the permissions 1a state for permissions 1.
|
|
||||||
Permissions1A Permissions1 = "a"
|
|
||||||
// Permissions1C specifies the permissions 1c state for permissions 1.
|
|
||||||
Permissions1C Permissions1 = "c"
|
|
||||||
// Permissions1D specifies the permissions 1d state for permissions 1.
|
|
||||||
Permissions1D Permissions1 = "d"
|
|
||||||
// Permissions1L specifies the permissions 1l state for permissions 1.
|
|
||||||
Permissions1L Permissions1 = "l"
|
|
||||||
// Permissions1P specifies the permissions 1p state for permissions 1.
|
|
||||||
Permissions1P Permissions1 = "p"
|
|
||||||
// Permissions1R specifies the permissions 1r state for permissions 1.
|
|
||||||
Permissions1R Permissions1 = "r"
|
|
||||||
// Permissions1U specifies the permissions 1u state for permissions 1.
|
|
||||||
Permissions1U Permissions1 = "u"
|
|
||||||
// Permissions1W specifies the permissions 1w state for permissions 1.
|
|
||||||
Permissions1W Permissions1 = "w"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ProvisioningState enumerates the values for provisioning state.
|
|
||||||
type ProvisioningState string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Creating specifies the creating state for provisioning state.
|
|
||||||
Creating ProvisioningState = "Creating"
|
|
||||||
// ResolvingDNS specifies the resolving dns state for provisioning state.
|
|
||||||
ResolvingDNS ProvisioningState = "ResolvingDNS"
|
|
||||||
// Succeeded specifies the succeeded state for provisioning state.
|
|
||||||
Succeeded ProvisioningState = "Succeeded"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reason enumerates the values for reason.
|
|
||||||
type Reason string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// AccountNameInvalid specifies the account name invalid state for reason.
|
|
||||||
AccountNameInvalid Reason = "AccountNameInvalid"
|
|
||||||
// AlreadyExists specifies the already exists state for reason.
|
|
||||||
AlreadyExists Reason = "AlreadyExists"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ResourceEnum enumerates the values for resource enum.
|
|
||||||
type ResourceEnum string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// ResourceEnumB specifies the resource enum b state for resource enum.
|
|
||||||
ResourceEnumB ResourceEnum = "b"
|
|
||||||
// ResourceEnumC specifies the resource enum c state for resource enum.
|
|
||||||
ResourceEnumC ResourceEnum = "c"
|
|
||||||
// ResourceEnumF specifies the resource enum f state for resource enum.
|
|
||||||
ResourceEnumF ResourceEnum = "f"
|
|
||||||
// ResourceEnumS specifies the resource enum s state for resource enum.
|
|
||||||
ResourceEnumS ResourceEnum = "s"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ResourceTypes enumerates the values for resource types.
|
|
||||||
type ResourceTypes string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// ResourceTypesC specifies the resource types c state for resource types.
|
|
||||||
ResourceTypesC ResourceTypes = "c"
|
|
||||||
// ResourceTypesO specifies the resource types o state for resource types.
|
|
||||||
ResourceTypesO ResourceTypes = "o"
|
|
||||||
// ResourceTypesS specifies the resource types s state for resource types.
|
|
||||||
ResourceTypesS ResourceTypes = "s"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Services enumerates the values for services.
|
|
||||||
type Services string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// B specifies the b state for services.
|
|
||||||
B Services = "b"
|
|
||||||
// F specifies the f state for services.
|
|
||||||
F Services = "f"
|
|
||||||
// Q specifies the q state for services.
|
|
||||||
Q Services = "q"
|
|
||||||
// T specifies the t state for services.
|
|
||||||
T Services = "t"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SkuName enumerates the values for sku name.
|
|
||||||
type SkuName string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// PremiumLRS specifies the premium lrs state for sku name.
|
|
||||||
PremiumLRS SkuName = "Premium_LRS"
|
|
||||||
// StandardGRS specifies the standard grs state for sku name.
|
|
||||||
StandardGRS SkuName = "Standard_GRS"
|
|
||||||
// StandardLRS specifies the standard lrs state for sku name.
|
|
||||||
StandardLRS SkuName = "Standard_LRS"
|
|
||||||
// StandardRAGRS specifies the standard ragrs state for sku name.
|
|
||||||
StandardRAGRS SkuName = "Standard_RAGRS"
|
|
||||||
// StandardZRS specifies the standard zrs state for sku name.
|
|
||||||
StandardZRS SkuName = "Standard_ZRS"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SkuTier enumerates the values for sku tier.
|
|
||||||
type SkuTier string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Premium specifies the premium state for sku tier.
|
|
||||||
Premium SkuTier = "Premium"
|
|
||||||
// Standard specifies the standard state for sku tier.
|
|
||||||
Standard SkuTier = "Standard"
|
|
||||||
)
|
|
||||||
|
|
||||||
// UsageUnit enumerates the values for usage unit.
|
|
||||||
type UsageUnit string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Bytes specifies the bytes state for usage unit.
|
|
||||||
Bytes UsageUnit = "Bytes"
|
|
||||||
// BytesPerSecond specifies the bytes per second state for usage unit.
|
|
||||||
BytesPerSecond UsageUnit = "BytesPerSecond"
|
|
||||||
// Count specifies the count state for usage unit.
|
|
||||||
Count UsageUnit = "Count"
|
|
||||||
// CountsPerSecond specifies the counts per second state for usage unit.
|
|
||||||
CountsPerSecond UsageUnit = "CountsPerSecond"
|
|
||||||
// Percent specifies the percent state for usage unit.
|
|
||||||
Percent UsageUnit = "Percent"
|
|
||||||
// Seconds specifies the seconds state for usage unit.
|
|
||||||
Seconds UsageUnit = "Seconds"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Account is the storage account.
|
|
||||||
type Account struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
Sku *Sku `json:"sku,omitempty"`
|
|
||||||
Kind Kind `json:"kind,omitempty"`
|
|
||||||
*AccountProperties `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountCheckNameAvailabilityParameters is the parameters used to check the
|
|
||||||
// availabity of the storage account name.
|
|
||||||
type AccountCheckNameAvailabilityParameters struct {
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountCreateParameters is the parameters used when creating a storage
|
|
||||||
// account.
|
|
||||||
type AccountCreateParameters struct {
|
|
||||||
Sku *Sku `json:"sku,omitempty"`
|
|
||||||
Kind Kind `json:"kind,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
*AccountPropertiesCreateParameters `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountKey is an access key for the storage account.
|
|
||||||
type AccountKey struct {
|
|
||||||
KeyName *string `json:"keyName,omitempty"`
|
|
||||||
Value *string `json:"value,omitempty"`
|
|
||||||
Permissions KeyPermission `json:"permissions,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountListKeysResult is the response from the ListKeys operation.
|
|
||||||
type AccountListKeysResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Keys *[]AccountKey `json:"keys,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountListResult is the response from the List Storage Accounts operation.
|
|
||||||
type AccountListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Account `json:"value,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountProperties is properties of the storage account.
|
|
||||||
type AccountProperties struct {
|
|
||||||
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
|
|
||||||
PrimaryEndpoints *Endpoints `json:"primaryEndpoints,omitempty"`
|
|
||||||
PrimaryLocation *string `json:"primaryLocation,omitempty"`
|
|
||||||
StatusOfPrimary AccountStatus `json:"statusOfPrimary,omitempty"`
|
|
||||||
LastGeoFailoverTime *date.Time `json:"lastGeoFailoverTime,omitempty"`
|
|
||||||
SecondaryLocation *string `json:"secondaryLocation,omitempty"`
|
|
||||||
StatusOfSecondary AccountStatus `json:"statusOfSecondary,omitempty"`
|
|
||||||
CreationTime *date.Time `json:"creationTime,omitempty"`
|
|
||||||
CustomDomain *CustomDomain `json:"customDomain,omitempty"`
|
|
||||||
SecondaryEndpoints *Endpoints `json:"secondaryEndpoints,omitempty"`
|
|
||||||
Encryption *Encryption `json:"encryption,omitempty"`
|
|
||||||
AccessTier AccessTier `json:"accessTier,omitempty"`
|
|
||||||
EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountPropertiesCreateParameters is the parameters used to create the
|
|
||||||
// storage account.
|
|
||||||
type AccountPropertiesCreateParameters struct {
|
|
||||||
CustomDomain *CustomDomain `json:"customDomain,omitempty"`
|
|
||||||
Encryption *Encryption `json:"encryption,omitempty"`
|
|
||||||
AccessTier AccessTier `json:"accessTier,omitempty"`
|
|
||||||
EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountPropertiesUpdateParameters is the parameters used when updating a
|
|
||||||
// storage account.
|
|
||||||
type AccountPropertiesUpdateParameters struct {
|
|
||||||
CustomDomain *CustomDomain `json:"customDomain,omitempty"`
|
|
||||||
Encryption *Encryption `json:"encryption,omitempty"`
|
|
||||||
AccessTier AccessTier `json:"accessTier,omitempty"`
|
|
||||||
EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountRegenerateKeyParameters is the parameters used to regenerate the
|
|
||||||
// storage account key.
|
|
||||||
type AccountRegenerateKeyParameters struct {
|
|
||||||
KeyName *string `json:"keyName,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountSasParameters is the parameters to list SAS credentials of a storage
|
|
||||||
// account.
|
|
||||||
type AccountSasParameters struct {
|
|
||||||
Services Services `json:"signedServices,omitempty"`
|
|
||||||
ResourceTypes ResourceTypes `json:"signedResourceTypes,omitempty"`
|
|
||||||
Permissions Permissions `json:"signedPermission,omitempty"`
|
|
||||||
IPAddressOrRange *string `json:"signedIp,omitempty"`
|
|
||||||
Protocols HTTPProtocol `json:"signedProtocol,omitempty"`
|
|
||||||
SharedAccessStartTime *date.Time `json:"signedStart,omitempty"`
|
|
||||||
SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"`
|
|
||||||
KeyToSign *string `json:"keyToSign,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountUpdateParameters is the parameters that can be provided when updating
|
|
||||||
// the storage account properties.
|
|
||||||
type AccountUpdateParameters struct {
|
|
||||||
Sku *Sku `json:"sku,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
*AccountPropertiesUpdateParameters `json:"properties,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckNameAvailabilityResult is the CheckNameAvailability operation response.
|
|
||||||
type CheckNameAvailabilityResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
NameAvailable *bool `json:"nameAvailable,omitempty"`
|
|
||||||
Reason Reason `json:"reason,omitempty"`
|
|
||||||
Message *string `json:"message,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CustomDomain is the custom domain assigned to this storage account. This can
|
|
||||||
// be set via Update.
|
|
||||||
type CustomDomain struct {
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
UseSubDomain *bool `json:"useSubDomain,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Encryption is the encryption settings on the storage account.
|
|
||||||
type Encryption struct {
|
|
||||||
Services *EncryptionServices `json:"services,omitempty"`
|
|
||||||
KeySource *string `json:"keySource,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// EncryptionService is a service that allows server-side encryption to be
|
|
||||||
// used.
|
|
||||||
type EncryptionService struct {
|
|
||||||
Enabled *bool `json:"enabled,omitempty"`
|
|
||||||
LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// EncryptionServices is a list of services that support encryption.
|
|
||||||
type EncryptionServices struct {
|
|
||||||
Blob *EncryptionService `json:"blob,omitempty"`
|
|
||||||
File *EncryptionService `json:"file,omitempty"`
|
|
||||||
Table *EncryptionService `json:"table,omitempty"`
|
|
||||||
Queue *EncryptionService `json:"queue,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Endpoints is the URIs that are used to perform a retrieval of a public blob,
|
|
||||||
// queue, or table object.
|
|
||||||
type Endpoints struct {
|
|
||||||
Blob *string `json:"blob,omitempty"`
|
|
||||||
Queue *string `json:"queue,omitempty"`
|
|
||||||
Table *string `json:"table,omitempty"`
|
|
||||||
File *string `json:"file,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListAccountSasResponse is the List SAS credentials operation response.
|
|
||||||
type ListAccountSasResponse struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
AccountSasToken *string `json:"accountSasToken,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListServiceSasResponse is the List service SAS credentials operation
|
|
||||||
// response.
|
|
||||||
type ListServiceSasResponse struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
ServiceSasToken *string `json:"serviceSasToken,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resource is describes a storage resource.
|
|
||||||
type Resource struct {
|
|
||||||
ID *string `json:"id,omitempty"`
|
|
||||||
Name *string `json:"name,omitempty"`
|
|
||||||
Type *string `json:"type,omitempty"`
|
|
||||||
Location *string `json:"location,omitempty"`
|
|
||||||
Tags *map[string]*string `json:"tags,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServiceSasParameters is the parameters to list service SAS credentials of a
|
|
||||||
// speicific resource.
|
|
||||||
type ServiceSasParameters struct {
|
|
||||||
CanonicalizedResource *string `json:"canonicalizedResource,omitempty"`
|
|
||||||
Resource Resource `json:"signedResource,omitempty"`
|
|
||||||
Permissions Permissions `json:"signedPermission,omitempty"`
|
|
||||||
IPAddressOrRange *string `json:"signedIp,omitempty"`
|
|
||||||
Protocols HTTPProtocol `json:"signedProtocol,omitempty"`
|
|
||||||
SharedAccessStartTime *date.Time `json:"signedStart,omitempty"`
|
|
||||||
SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"`
|
|
||||||
Identifier *string `json:"signedIdentifier,omitempty"`
|
|
||||||
PartitionKeyStart *string `json:"startPk,omitempty"`
|
|
||||||
PartitionKeyEnd *string `json:"endPk,omitempty"`
|
|
||||||
RowKeyStart *string `json:"startRk,omitempty"`
|
|
||||||
RowKeyEnd *string `json:"endRk,omitempty"`
|
|
||||||
KeyToSign *string `json:"keyToSign,omitempty"`
|
|
||||||
CacheControl *string `json:"rscc,omitempty"`
|
|
||||||
ContentDisposition *string `json:"rscd,omitempty"`
|
|
||||||
ContentEncoding *string `json:"rsce,omitempty"`
|
|
||||||
ContentLanguage *string `json:"rscl,omitempty"`
|
|
||||||
ContentType *string `json:"rsct,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sku is the SKU of the storage account.
|
|
||||||
type Sku struct {
|
|
||||||
Name SkuName `json:"name,omitempty"`
|
|
||||||
Tier SkuTier `json:"tier,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Usage is describes Storage Resource Usage.
|
|
||||||
type Usage struct {
|
|
||||||
Unit UsageUnit `json:"unit,omitempty"`
|
|
||||||
CurrentValue *int32 `json:"currentValue,omitempty"`
|
|
||||||
Limit *int32 `json:"limit,omitempty"`
|
|
||||||
Name *UsageName `json:"name,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// UsageListResult is the response from the List Usages operation.
|
|
||||||
type UsageListResult struct {
|
|
||||||
autorest.Response `json:"-"`
|
|
||||||
Value *[]Usage `json:"value,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// UsageName is the usage names that can be used; currently limited to
|
|
||||||
// StorageAccount.
|
|
||||||
type UsageName struct {
|
|
||||||
Value *string `json:"value,omitempty"`
|
|
||||||
LocalizedValue *string `json:"localizedValue,omitempty"`
|
|
||||||
}
|
|
|
@ -14,40 +14,37 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AvailabilitySetsClient is the the Compute Management Client.
|
// AvailabilitySetsClient is the compute Client
|
||||||
type AvailabilitySetsClient struct {
|
type AvailabilitySetsClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient
|
// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient client.
|
||||||
// client.
|
|
||||||
func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient {
|
func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient {
|
||||||
return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAvailabilitySetsClientWithBaseURI creates an instance of the
|
// NewAvailabilitySetsClientWithBaseURI creates an instance of the AvailabilitySetsClient client.
|
||||||
// AvailabilitySetsClient client.
|
|
||||||
func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient {
|
func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient {
|
||||||
return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdate create or update an availability set.
|
// CreateOrUpdate create or update an availability set.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. name is the name of the
|
// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
|
||||||
// availability set. parameters is parameters supplied to the Create
|
// parameters is parameters supplied to the Create Availability Set operation.
|
||||||
// Availability Set operation.
|
func (client AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
|
||||||
func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters)
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -69,32 +66,33 @@ func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, na
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
func (client AvailabilitySetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters AvailabilitySet) (*http.Request, error) {
|
func (client AvailabilitySetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"name": autorest.Encode("path", name),
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
autorest.AsJSON(),
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
autorest.AsPut(),
|
autorest.AsPut(),
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{name}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
autorest.WithJSON(parameters),
|
autorest.WithJSON(parameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
@ -112,10 +110,9 @@ func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response
|
||||||
|
|
||||||
// Delete delete an availability set.
|
// Delete delete an availability set.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. availabilitySetName is
|
// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
|
||||||
// the name of the availability set.
|
func (client AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string) (result OperationStatusResponse, err error) {
|
||||||
func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result OperationStatusResponse, err error) {
|
req, err := client.DeletePreparer(ctx, resourceGroupName, availabilitySetName)
|
||||||
req, err := client.DeletePreparer(resourceGroupName, availabilitySetName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -137,14 +134,14 @@ func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabili
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
// DeletePreparer prepares the Delete request.
|
||||||
func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
func (client AvailabilitySetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -154,13 +151,14 @@ func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, av
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
@ -178,10 +176,9 @@ func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (resul
|
||||||
|
|
||||||
// Get retrieves information about an availability set.
|
// Get retrieves information about an availability set.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. availabilitySetName is
|
// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
|
||||||
// the name of the availability set.
|
func (client AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) {
|
||||||
func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) {
|
req, err := client.GetPreparer(ctx, resourceGroupName, availabilitySetName)
|
||||||
req, err := client.GetPreparer(resourceGroupName, availabilitySetName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -203,14 +200,14 @@ func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilityS
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
func (client AvailabilitySetsClient) GetPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -220,13 +217,14 @@ func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, avail
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
@ -245,8 +243,8 @@ func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result A
|
||||||
// List lists all availability sets in a resource group.
|
// List lists all availability sets in a resource group.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group.
|
// resourceGroupName is the name of the resource group.
|
||||||
func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, err error) {
|
func (client AvailabilitySetsClient) List(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResult, err error) {
|
||||||
req, err := client.ListPreparer(resourceGroupName)
|
req, err := client.ListPreparer(ctx, resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -268,13 +266,13 @@ func (client AvailabilitySetsClient) List(resourceGroupName string) (result Avai
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
func (client AvailabilitySetsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -284,13 +282,14 @@ func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*ht
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", 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 AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -306,13 +305,12 @@ func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAvailableSizes lists all available virtual machine sizes that can be
|
// ListAvailableSizes lists all available virtual machine sizes that can be used to create a new virtual machine in an
|
||||||
// used to create a new virtual machine in an existing availability set.
|
// existing availability set.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. availabilitySetName is
|
// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
|
||||||
// the name of the availability set.
|
func (client AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) {
|
||||||
func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) {
|
req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, availabilitySetName)
|
||||||
req, err := client.ListAvailableSizesPreparer(resourceGroupName, availabilitySetName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -334,14 +332,14 @@ func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAvailableSizesPreparer prepares the ListAvailableSizes request.
|
// ListAvailableSizesPreparer prepares the ListAvailableSizes request.
|
||||||
func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
func (client AvailabilitySetsClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -351,13 +349,14 @@ func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupNam
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
|
// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) {
|
func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always
|
// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always
|
||||||
|
@ -372,3 +371,72 @@ func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Resp
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update update an availability set.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
|
||||||
|
// parameters is parameters supplied to the Update Availability Set operation.
|
||||||
|
func (client AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (result AvailabilitySet, err error) {
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, availabilitySetName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Update", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client AvailabilitySetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailabilitySetsClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client AvailabilitySetsClient) UpdateResponder(resp *http.Response) (result AvailabilitySet, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
// Package compute implements the Azure ARM Compute service API version
|
// Package compute implements the Azure ARM Compute service API version .
|
||||||
// 2016-04-30-preview.
|
|
||||||
//
|
//
|
||||||
// The Compute Management Client.
|
// Compute Client
|
||||||
package compute
|
package compute
|
||||||
|
|
||||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
@ -18,9 +17,8 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Azure/go-autorest/autorest"
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
@ -31,21 +29,21 @@ const (
|
||||||
DefaultBaseURI = "https://management.azure.com"
|
DefaultBaseURI = "https://management.azure.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ManagementClient is the base client for Compute.
|
// BaseClient is the base client for Compute.
|
||||||
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,
|
471
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/containerservices.go
generated
vendored
Normal file
471
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/containerservices.go
generated
vendored
Normal file
|
@ -0,0 +1,471 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ContainerServicesClient is the compute Client
|
||||||
|
type ContainerServicesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContainerServicesClient creates an instance of the ContainerServicesClient client.
|
||||||
|
func NewContainerServicesClient(subscriptionID string) ContainerServicesClient {
|
||||||
|
return NewContainerServicesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContainerServicesClientWithBaseURI creates an instance of the ContainerServicesClient client.
|
||||||
|
func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string) ContainerServicesClient {
|
||||||
|
return ContainerServicesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and
|
||||||
|
// agents.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
|
||||||
|
// in the specified subscription and resource group. parameters is parameters supplied to the Create or Update a
|
||||||
|
// Container Service operation.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFuture, err error) {
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: parameters,
|
||||||
|
Constraints: []validation.Constraint{{Target: "parameters.ContainerServiceProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.CustomProfile", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.CustomProfile.Orchestrator", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.ServicePrincipalProfile.Secret", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.MasterProfile", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.AgentPoolProfiles", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{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.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
{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.Pattern, Rule: `^[a-z][a-z0-9_-]*$`, Chain: nil}}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.LinuxProfile.SSH", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ContainerServiceProperties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.ContainerServicesClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"containerServiceName": autorest.Encode("path", containerServiceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (future ContainerServicesCreateOrUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes the specified container service in the specified subscription and resource group. The operation does
|
||||||
|
// not delete other resources created as part of creating a container service, including storage accounts, VMs, and
|
||||||
|
// availability sets. All the other resources created with the container service are part of the same resource group
|
||||||
|
// and can be deleted individually.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
|
||||||
|
// in the specified subscription and resource group.
|
||||||
|
func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFuture, err error) {
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client ContainerServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"containerServiceName": autorest.Encode("path", containerServiceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) DeleteSender(req *http.Request) (future ContainerServicesDeleteFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets the properties of the specified container service in the specified subscription and resource group. The
|
||||||
|
// operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters
|
||||||
|
// and agents.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
|
||||||
|
// in the specified subscription and resource group.
|
||||||
|
func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "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.ContainerServicesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client ContainerServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"containerServiceName": autorest.Encode("path", containerServiceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) 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 ContainerServicesClient) GetResponder(resp *http.Response) (result ContainerService, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets a list of container services in the specified subscription. The operation returns properties of each
|
||||||
|
// container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents.
|
||||||
|
func (client ContainerServicesClient) List(ctx context.Context) (result ContainerServiceListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.cslr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.cslr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client ContainerServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) 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 ContainerServicesClient) ListResponder(resp *http.Response) (result ContainerServiceListResult, 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 ContainerServicesClient) listNextResults(lastResults ContainerServiceListResult) (result ContainerServiceListResult, err error) {
|
||||||
|
req, err := lastResults.containerServiceListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", 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.ContainerServicesClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ContainerServicesClient) ListComplete(ctx context.Context) (result ContainerServiceListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup gets a list of container services in the specified subscription and resource group. The
|
||||||
|
// operation returns properties of each container service including state, orchestrator, number of masters and agents,
|
||||||
|
// and FQDNs of masters and agents.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerServiceListResultPage, err error) {
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.cslr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.cslr, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-01-31"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ContainerServiceListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ContainerServicesClient) listByResourceGroupNextResults(lastResults ContainerServiceListResult) (result ContainerServiceListResult, err error) {
|
||||||
|
req, err := lastResults.containerServiceListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ContainerServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ContainerServiceListResultIterator, err error) {
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
678
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/disks.go
generated
vendored
Normal file
678
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/disks.go
generated
vendored
Normal file
|
@ -0,0 +1,678 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DisksClient is the compute Client
|
||||||
|
type DisksClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDisksClient creates an instance of the DisksClient client.
|
||||||
|
func NewDisksClient(subscriptionID string) DisksClient {
|
||||||
|
return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDisksClientWithBaseURI creates an instance of the DisksClient client.
|
||||||
|
func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient {
|
||||||
|
return DisksClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. 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 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) {
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: disk,
|
||||||
|
Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
{Target: "disk.DiskProperties.EncryptionSettings", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "disk.DiskProperties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
{Target: "disk.DiskProperties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "disk.DiskProperties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.DisksClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskName, disk)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithJSON(disk),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) CreateOrUpdateSender(req *http.Request) (future DisksCreateOrUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a disk.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
|
||||||
|
// created. 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 maximum name length is 80 characters.
|
||||||
|
func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, diskName string) (result DisksDeleteFuture, err error) {
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, diskName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) DeleteSender(req *http.Request) (future DisksDeleteFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. 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 maximum name length is 80 characters.
|
||||||
|
func (client DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string) (result Disk, err error) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, diskName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "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.DisksClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) 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 DisksClient) GetResponder(resp *http.Response) (result Disk, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. 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 maximum name length is 80 characters. grantAccessData is access data object supplied in the body
|
||||||
|
// of the get disk access operation.
|
||||||
|
func (client DisksClient) GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (result DisksGrantAccessFuture, err error) {
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: grantAccessData,
|
||||||
|
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.DisksClient", "GrantAccess", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.GrantAccessPreparer(ctx, resourceGroupName, diskName, grantAccessData)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GrantAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessPreparer prepares the GrantAccess request.
|
||||||
|
func (client DisksClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", pathParameters),
|
||||||
|
autorest.WithJSON(grantAccessData),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessSender sends the GrantAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) GrantAccessSender(req *http.Request) (future DisksGrantAccessFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessResponder handles the response to the GrantAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists all the disks under a subscription.
|
||||||
|
func (client DisksClient) List(ctx context.Context) (result DiskListPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.dl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.dl, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client DisksClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) 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 DisksClient) ListResponder(resp *http.Response) (result DiskList, 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 DisksClient) listNextResults(lastResults DiskList) (result DiskList, err error) {
|
||||||
|
req, err := lastResults.diskListPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", 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.DisksClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client DisksClient) ListComplete(ctx context.Context) (result DiskListIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup lists all the disks under a resource group.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group.
|
||||||
|
func (client DisksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DiskListPage, err error) {
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.dl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.dl, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client DisksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) ListByResourceGroupResponder(resp *http.Response) (result DiskList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client DisksClient) listByResourceGroupNextResults(lastResults DiskList) (result DiskList, err error) {
|
||||||
|
req, err := lastResults.diskListPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DiskListIterator, err error) {
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. 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 maximum name length is 80 characters.
|
||||||
|
func (client DisksClient) RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result DisksRevokeAccessFuture, err error) {
|
||||||
|
req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.RevokeAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessPreparer prepares the RevokeAccess request.
|
||||||
|
func (client DisksClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessSender sends the RevokeAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) RevokeAccessSender(req *http.Request) (future DisksRevokeAccessFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. 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 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) {
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"diskName": autorest.Encode("path", diskName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
|
||||||
|
autorest.WithJSON(disk),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DisksClient) UpdateSender(req *http.Request) (future DisksUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client DisksClient) UpdateResponder(resp *http.Response) (result Disk, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
|
@ -14,20 +14,19 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImagesClient is the the Compute Management Client.
|
// ImagesClient is the compute Client
|
||||||
type ImagesClient struct {
|
type ImagesClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImagesClient creates an instance of the ImagesClient client.
|
// NewImagesClient creates an instance of the ImagesClient client.
|
||||||
|
@ -40,88 +39,62 @@ func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesCli
|
||||||
return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdate create or update an image. This method may poll for
|
// CreateOrUpdate create or update an image.
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. imageName is the name
|
// resourceGroupName is the name of the resource group. imageName is the name of the image. parameters is
|
||||||
// of the image. parameters is parameters supplied to the Create Image
|
// parameters supplied to the Create Image operation.
|
||||||
// operation.
|
func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (result ImagesCreateOrUpdateFuture, err error) {
|
||||||
func (client ImagesClient) CreateOrUpdate(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (<-chan Image, <-chan error) {
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters)
|
||||||
resultChan := make(chan Image, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
if err := validation.Validate([]validation.Validation{
|
return
|
||||||
{TargetValue: parameters,
|
|
||||||
Constraints: []validation.Constraint{{Target: "parameters.ImageProperties", 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}}},
|
|
||||||
}}}}}); err != nil {
|
|
||||||
errChan <- validation.NewErrorWithValidationError(err, "compute.ImagesClient", "CreateOrUpdate")
|
|
||||||
close(errChan)
|
|
||||||
close(resultChan)
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
var err error
|
if err != nil {
|
||||||
var result Image
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
defer func() {
|
return
|
||||||
resultChan <- result
|
}
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, imageName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
return
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
func (client ImagesClient) CreateOrUpdatePreparer(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"imageName": autorest.Encode("path", imageName),
|
"imageName": autorest.Encode("path", imageName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
autorest.AsJSON(),
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
autorest.AsPut(),
|
autorest.AsPut(),
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
autorest.WithJSON(parameters),
|
autorest.WithJSON(parameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (future ImagesCreateOrUpdateFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
@ -137,54 +110,34 @@ func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes an Image. This method may poll for completion. Polling can be
|
// Delete deletes an Image.
|
||||||
// canceled by passing the cancel channel argument. The channel will be used to
|
|
||||||
// cancel polling and any outstanding HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. imageName is the name
|
// resourceGroupName is the name of the resource group. imageName is the name of the image.
|
||||||
// of the image.
|
func (client ImagesClient) Delete(ctx context.Context, resourceGroupName string, imageName string) (result ImagesDeleteFuture, err error) {
|
||||||
func (client ImagesClient) Delete(resourceGroupName string, imageName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
req, err := client.DeletePreparer(ctx, resourceGroupName, imageName)
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request")
|
||||||
go func() {
|
return
|
||||||
var err error
|
}
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, imageName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
result, err = client.DeleteSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
// DeletePreparer prepares the Delete request.
|
||||||
func (client ImagesClient) DeletePreparer(resourceGroupName string, imageName string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, imageName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"imageName": autorest.Encode("path", imageName),
|
"imageName": autorest.Encode("path", imageName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -194,15 +147,22 @@ func (client ImagesClient) DeletePreparer(resourceGroupName string, imageName st
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ImagesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
func (client ImagesClient) DeleteSender(req *http.Request) (future ImagesDeleteFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
@ -220,10 +180,10 @@ func (client ImagesClient) DeleteResponder(resp *http.Response) (result Operatio
|
||||||
|
|
||||||
// Get gets an image.
|
// Get gets an image.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. imageName is the name
|
// resourceGroupName is the name of the resource group. imageName is the name of the image. expand is the expand
|
||||||
// of the image. expand is the expand expression to apply on the operation.
|
// expression to apply on the operation.
|
||||||
func (client ImagesClient) Get(resourceGroupName string, imageName string, expand string) (result Image, err error) {
|
func (client ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, expand string) (result Image, err error) {
|
||||||
req, err := client.GetPreparer(resourceGroupName, imageName, expand)
|
req, err := client.GetPreparer(ctx, resourceGroupName, imageName, expand)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -245,14 +205,14 @@ func (client ImagesClient) Get(resourceGroupName string, imageName string, expan
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client ImagesClient) GetPreparer(resourceGroupName string, imageName string, expand string) (*http.Request, error) {
|
func (client ImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, imageName string, expand string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"imageName": autorest.Encode("path", imageName),
|
"imageName": autorest.Encode("path", imageName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -265,13 +225,14 @@ func (client ImagesClient) GetPreparer(resourceGroupName string, imageName strin
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client ImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
@ -287,11 +248,11 @@ func (client ImagesClient) GetResponder(resp *http.Response) (result Image, err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets the list of Images in the subscription. Use nextLink property in
|
// List gets the list of Images in the subscription. Use nextLink property in the response to get the next page of
|
||||||
// the response to get the next page of Images. Do this till nextLink is not
|
// Images. Do this till nextLink is null to fetch all the Images.
|
||||||
// null to fetch all the Images.
|
func (client ImagesClient) List(ctx context.Context) (result ImageListResultPage, err error) {
|
||||||
func (client ImagesClient) List() (result ImageListResult, err error) {
|
result.fn = client.listNextResults
|
||||||
req, err := client.ListPreparer()
|
req, err := client.ListPreparer(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -299,12 +260,12 @@ func (client ImagesClient) List() (result ImageListResult, 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.ilr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result.ilr, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -313,12 +274,12 @@ func (client ImagesClient) List() (result ImageListResult, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client ImagesClient) ListPreparer() (*http.Request, error) {
|
func (client ImagesClient) 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 = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -328,13 +289,14 @@ func (client ImagesClient) ListPreparer() (*http.Request, error) {
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", 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 ImagesClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client ImagesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -350,35 +312,39 @@ func (client ImagesClient) ListResponder(resp *http.Response) (result ImageListR
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNextResults retrieves the next set of results, if any.
|
// listNextResults retrieves the next set of results, if any.
|
||||||
func (client ImagesClient) ListNextResults(lastResults ImageListResult) (result ImageListResult, err error) {
|
func (client ImagesClient) listNextResults(lastResults ImageListResult) (result ImageListResult, err error) {
|
||||||
req, err := lastResults.ImageListResultPreparer()
|
req, err := lastResults.imageListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "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, "compute.ImagesClient", "List", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "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, "compute.ImagesClient", "List", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ImagesClient) ListComplete(ctx context.Context) (result ImageListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListByResourceGroup gets the list of images under a resource group.
|
// ListByResourceGroup gets the list of images under a resource group.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group.
|
// resourceGroupName is the name of the resource group.
|
||||||
func (client ImagesClient) ListByResourceGroup(resourceGroupName string) (result ImageListResult, err error) {
|
func (client ImagesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ImageListResultPage, err error) {
|
||||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -386,12 +352,12 @@ func (client ImagesClient) ListByResourceGroup(resourceGroupName string) (result
|
||||||
|
|
||||||
resp, err := client.ListByResourceGroupSender(req)
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.ilr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListByResourceGroupResponder(resp)
|
result.ilr, err = client.ListByResourceGroupResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -400,13 +366,13 @@ func (client ImagesClient) ListByResourceGroup(resourceGroupName string) (result
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
func (client ImagesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
func (client ImagesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -416,13 +382,14 @@ func (client ImagesClient) ListByResourceGroupPreparer(resourceGroupName string)
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ImagesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
func (client ImagesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
@ -438,26 +405,100 @@ func (client ImagesClient) ListByResourceGroupResponder(resp *http.Response) (re
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListByResourceGroupNextResults retrieves the next set of results, if any.
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
func (client ImagesClient) ListByResourceGroupNextResults(lastResults ImageListResult) (result ImageListResult, err error) {
|
func (client ImagesClient) listByResourceGroupNextResults(lastResults ImageListResult) (result ImageListResult, err error) {
|
||||||
req, err := lastResults.ImageListResultPreparer()
|
req, err := lastResults.imageListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
}
|
}
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.ListByResourceGroupSender(req)
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListByResourceGroupResponder(resp)
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ImagesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ImageListResultIterator, err error) {
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update update an image.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. imageName is the name of the image. parameters is
|
||||||
|
// parameters supplied to the Update Image operation.
|
||||||
|
func (client ImagesClient) Update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (result ImagesUpdateFuture, err error) {
|
||||||
|
req, err := client.UpdatePreparer(ctx, resourceGroupName, imageName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Update", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client ImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"imageName": autorest.Encode("path", imageName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ImagesClient) UpdateSender(req *http.Request) (future ImagesUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ImagesClient) UpdateResponder(resp *http.Response) (result Image, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
195
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/loganalytics.go
generated
vendored
Normal file
195
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/loganalytics.go
generated
vendored
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LogAnalyticsClient is the compute Client
|
||||||
|
type LogAnalyticsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLogAnalyticsClient creates an instance of the LogAnalyticsClient client.
|
||||||
|
func NewLogAnalyticsClient(subscriptionID string) LogAnalyticsClient {
|
||||||
|
return NewLogAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewLogAnalyticsClientWithBaseURI creates an instance of the LogAnalyticsClient client.
|
||||||
|
func NewLogAnalyticsClientWithBaseURI(baseURI string, subscriptionID string) LogAnalyticsClient {
|
||||||
|
return LogAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByInterval export logs that show Api requests made by this subscription in the given time window to
|
||||||
|
// show throttling activities.
|
||||||
|
//
|
||||||
|
// parameters is parameters supplied to the LogAnalytics getRequestRateByInterval Api. location is the location
|
||||||
|
// upon which virtual-machine-sizes is queried.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByInterval(ctx context.Context, parameters RequestRateByIntervalInput, location string) (result LogAnalyticsExportRequestRateByIntervalFuture, 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.NewError("compute.LogAnalyticsClient", "ExportRequestRateByInterval", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.ExportRequestRateByIntervalPreparer(ctx, parameters, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ExportRequestRateByIntervalSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportRequestRateByInterval", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByIntervalPreparer prepares the ExportRequestRateByInterval request.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByIntervalPreparer(ctx context.Context, parameters RequestRateByIntervalInput, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByIntervalSender sends the ExportRequestRateByInterval request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByIntervalSender(req *http.Request) (future LogAnalyticsExportRequestRateByIntervalFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportRequestRateByIntervalResponder handles the response to the ExportRequestRateByInterval request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client LogAnalyticsClient) ExportRequestRateByIntervalResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequests export logs that show total throttled Api requests for this subscription in the given time
|
||||||
|
// window.
|
||||||
|
//
|
||||||
|
// parameters is parameters supplied to the LogAnalytics getThrottledRequests Api. location is the location upon
|
||||||
|
// which virtual-machine-sizes is queried.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequests(ctx context.Context, parameters ThrottledRequestsInput, location string) (result LogAnalyticsExportThrottledRequestsFuture, 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.NewError("compute.LogAnalyticsClient", "ExportThrottledRequests", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.ExportThrottledRequestsPreparer(ctx, parameters, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ExportThrottledRequestsSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.LogAnalyticsClient", "ExportThrottledRequests", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequestsPreparer prepares the ExportThrottledRequests request.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequestsPreparer(ctx context.Context, parameters ThrottledRequestsInput, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequestsSender sends the ExportThrottledRequests request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequestsSender(req *http.Request) (future LogAnalyticsExportThrottledRequestsFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportThrottledRequestsResponder handles the response to the ExportThrottledRequests request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client LogAnalyticsClient) ExportThrottledRequestsResponder(resp *http.Response) (result LogAnalyticsOperationResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
9677
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/models.go
generated
vendored
Normal file
9677
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/models.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
98
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/operations.go
generated
vendored
Normal file
98
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/operations.go
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OperationsClient is the compute Client
|
||||||
|
type OperationsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOperationsClient creates an instance of the OperationsClient client.
|
||||||
|
func NewOperationsClient(subscriptionID string) OperationsClient {
|
||||||
|
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client.
|
||||||
|
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
|
||||||
|
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets a list of compute operations.
|
||||||
|
func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) {
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.OperationsClient", "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.OperationsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.OperationsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPath("/providers/Microsoft.Compute/operations"),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
130
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/resourceskus.go
generated
vendored
Normal file
130
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/resourceskus.go
generated
vendored
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ResourceSkusClient is the compute Client
|
||||||
|
type ResourceSkusClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(ctx context.Context) (result ResourceSkusResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.rsr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.rsr, 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(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-09-01"
|
||||||
|
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{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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", "listNextResults", 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", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.ResourceSkusClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ResourceSkusClient) ListComplete(ctx context.Context) (result ResourceSkusResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
678
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/snapshots.go
generated
vendored
Normal file
678
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/snapshots.go
generated
vendored
Normal file
|
@ -0,0 +1,678 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SnapshotsClient is the compute Client
|
||||||
|
type SnapshotsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSnapshotsClient creates an instance of the SnapshotsClient client.
|
||||||
|
func NewSnapshotsClient(subscriptionID string) SnapshotsClient {
|
||||||
|
return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client.
|
||||||
|
func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient {
|
||||||
|
return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
|
||||||
|
// 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) {
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: snapshot,
|
||||||
|
Constraints: []validation.Constraint{{Target: "snapshot.DiskProperties", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.CreationData", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.CreationData.ImageReference", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
{Target: "snapshot.DiskProperties.EncryptionSettings", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "snapshot.DiskProperties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
{Target: "snapshot.DiskProperties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
{Target: "snapshot.DiskProperties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.SnapshotsClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithJSON(snapshot),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (future SnapshotsCreateOrUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes a snapshot.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
|
||||||
|
// created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
|
||||||
|
// 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) {
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
|
||||||
|
// 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) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "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.SnapshotsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) 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 SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
|
||||||
|
// A-Z, 0-9 and _. The max name length is 80 characters. grantAccessData is access data object supplied in the body
|
||||||
|
// of the get snapshot access operation.
|
||||||
|
func (client SnapshotsClient) GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (result SnapshotsGrantAccessFuture, err error) {
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: grantAccessData,
|
||||||
|
Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||||
|
return result, validation.NewError("compute.SnapshotsClient", "GrantAccess", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.GrantAccessPreparer(ctx, resourceGroupName, snapshotName, grantAccessData)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GrantAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessPreparer prepares the GrantAccess request.
|
||||||
|
func (client SnapshotsClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", pathParameters),
|
||||||
|
autorest.WithJSON(grantAccessData),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessSender sends the GrantAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) GrantAccessSender(req *http.Request) (future SnapshotsGrantAccessFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantAccessResponder handles the response to the GrantAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List lists snapshots under a subscription.
|
||||||
|
func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.sl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.sl, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) 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 SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, 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 SnapshotsClient) listNextResults(lastResults SnapshotList) (result SnapshotList, err error) {
|
||||||
|
req, err := lastResults.snapshotListPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", 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.SnapshotsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroup lists snapshots under a resource group.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListPage, err error) {
|
||||||
|
result.fn = client.listByResourceGroupNextResults
|
||||||
|
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.sl.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.sl, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listByResourceGroupNextResults retrieves the next set of results, if any.
|
||||||
|
func (client SnapshotsClient) listByResourceGroupNextResults(lastResults SnapshotList) (result SnapshotList, err error) {
|
||||||
|
req, err := lastResults.snapshotListPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListByResourceGroupSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListByResourceGroupResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListIterator, err error) {
|
||||||
|
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
|
||||||
|
// 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) {
|
||||||
|
req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.RevokeAccessSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessPreparer prepares the RevokeAccess request.
|
||||||
|
func (client SnapshotsClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessSender sends the RevokeAccess request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (future SnapshotsRevokeAccessFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update updates (patches) a snapshot.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot that is being
|
||||||
|
// created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z,
|
||||||
|
// A-Z, 0-9 and _. The max name length is 80 characters. snapshot is snapshot object supplied in the body of the
|
||||||
|
// Patch snapshot operation.
|
||||||
|
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)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatePreparer prepares the Update request.
|
||||||
|
func (client SnapshotsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"snapshotName": autorest.Encode("path", snapshotName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-04-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
|
||||||
|
autorest.WithJSON(snapshot),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateSender sends the Update request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateResponder handles the response to the Update request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
|
@ -14,20 +14,20 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UsageClient is the the Compute Management Client.
|
// UsageClient is the compute Client
|
||||||
type UsageClient struct {
|
type UsageClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUsageClient creates an instance of the UsageClient client.
|
// NewUsageClient creates an instance of the UsageClient client.
|
||||||
|
@ -40,19 +40,19 @@ func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClien
|
||||||
return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets, for the specified location, the current compute resource usage
|
// List gets, for the specified location, the current compute resource usage information as well as the limits for
|
||||||
// information as well as the limits for compute resources under the
|
// compute resources under the subscription.
|
||||||
// subscription.
|
|
||||||
//
|
//
|
||||||
// location is the location for which resource usage is queried.
|
// location is the location for which resource usage is queried.
|
||||||
func (client UsageClient) List(location string) (result ListUsagesResult, err error) {
|
func (client UsageClient) List(ctx context.Context, location string) (result ListUsagesResultPage, 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.UsageClient", "List")
|
return result, validation.NewError("compute.UsageClient", "List", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := client.ListPreparer(location)
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -60,12 +60,12 @@ func (client UsageClient) List(location string) (result ListUsagesResult, err er
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
resp, err := client.ListSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.lur.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result.lur, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -74,13 +74,13 @@ func (client UsageClient) List(location string) (result ListUsagesResult, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client UsageClient) ListPreparer(location string) (*http.Request, error) {
|
func (client UsageClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -90,13 +90,14 @@ func (client UsageClient) ListPreparer(location string) (*http.Request, error) {
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/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, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -112,26 +113,29 @@ func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesR
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNextResults retrieves the next set of results, if any.
|
// listNextResults retrieves the next set of results, if any.
|
||||||
func (client UsageClient) ListNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
|
func (client UsageClient) listNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
|
||||||
req, err := lastResults.ListUsagesResultPreparer()
|
req, err := lastResults.listUsagesResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "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, "compute.UsageClient", "List", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "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, "compute.UsageClient", "List", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client UsageClient) ListComplete(ctx context.Context, location string) (result ListUsagesResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, location)
|
||||||
return
|
return
|
||||||
}
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
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");
|
||||||
|
@ -14,16 +16,15 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
// 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/v10.0.2-beta arm-compute/2016-04-30-preview"
|
return "Azure-SDK-For-Go/" + version.Number + " compute/2018-04-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 "v10.0.2-beta"
|
return version.Number
|
||||||
}
|
}
|
|
@ -14,37 +14,37 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VirtualMachineExtensionImagesClient is the the Compute Management Client.
|
// VirtualMachineExtensionImagesClient is the compute Client
|
||||||
type VirtualMachineExtensionImagesClient struct {
|
type VirtualMachineExtensionImagesClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineExtensionImagesClient creates an instance of the
|
// NewVirtualMachineExtensionImagesClient creates an instance of the VirtualMachineExtensionImagesClient client.
|
||||||
// VirtualMachineExtensionImagesClient client.
|
|
||||||
func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient {
|
func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient {
|
||||||
return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the
|
// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the VirtualMachineExtensionImagesClient
|
||||||
// VirtualMachineExtensionImagesClient client.
|
// client.
|
||||||
func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
|
func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
|
||||||
return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get gets a virtual machine extension image.
|
// Get gets a virtual machine extension image.
|
||||||
//
|
//
|
||||||
func (client VirtualMachineExtensionImagesClient) Get(location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) {
|
// location is the name of a supported Azure region.
|
||||||
req, err := client.GetPreparer(location, publisherName, typeParameter, version)
|
func (client VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) {
|
||||||
|
req, err := client.GetPreparer(ctx, location, publisherName, typeParameter, version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -66,7 +66,7 @@ func (client VirtualMachineExtensionImagesClient) Get(location string, publisher
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, publisherName string, typeParameter string, version string) (*http.Request, error) {
|
func (client VirtualMachineExtensionImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, typeParameter string, version string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"publisherName": autorest.Encode("path", publisherName),
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
@ -75,7 +75,7 @@ func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, p
|
||||||
"version": autorest.Encode("path", version),
|
"version": autorest.Encode("path", version),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -85,13 +85,14 @@ func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, p
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
@ -109,8 +110,9 @@ func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Respon
|
||||||
|
|
||||||
// ListTypes gets a list of virtual machine extension image types.
|
// ListTypes gets a list of virtual machine extension image types.
|
||||||
//
|
//
|
||||||
func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) {
|
// location is the name of a supported Azure region.
|
||||||
req, err := client.ListTypesPreparer(location, publisherName)
|
func (client VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) {
|
||||||
|
req, err := client.ListTypesPreparer(ctx, location, publisherName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -132,14 +134,14 @@ func (client VirtualMachineExtensionImagesClient) ListTypes(location string, pub
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListTypesPreparer prepares the ListTypes request.
|
// ListTypesPreparer prepares the ListTypes request.
|
||||||
func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location string, publisherName string) (*http.Request, error) {
|
func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"publisherName": autorest.Encode("path", publisherName),
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -149,13 +151,14 @@ func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location str
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListTypesSender sends the ListTypes request. The method will close the
|
// ListTypesSender sends the ListTypes request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListTypesResponder handles the response to the ListTypes request. The method always
|
// ListTypesResponder handles the response to the ListTypes request. The method always
|
||||||
|
@ -173,9 +176,9 @@ func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.
|
||||||
|
|
||||||
// ListVersions gets a list of virtual machine extension image versions.
|
// ListVersions gets a list of virtual machine extension image versions.
|
||||||
//
|
//
|
||||||
// filter is the filter to apply on the operation.
|
// location is the name of a supported Azure region. filter is the filter to apply on the operation.
|
||||||
func (client VirtualMachineExtensionImagesClient) ListVersions(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) {
|
func (client VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) {
|
||||||
req, err := client.ListVersionsPreparer(location, publisherName, typeParameter, filter, top, orderby)
|
req, err := client.ListVersionsPreparer(ctx, location, publisherName, typeParameter, filter, top, orderby)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -197,7 +200,7 @@ func (client VirtualMachineExtensionImagesClient) ListVersions(location string,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListVersionsPreparer prepares the ListVersions request.
|
// ListVersionsPreparer prepares the ListVersions request.
|
||||||
func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) {
|
func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"publisherName": autorest.Encode("path", publisherName),
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
|
@ -205,7 +208,7 @@ func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location
|
||||||
"type": autorest.Encode("path", typeParameter),
|
"type": autorest.Encode("path", typeParameter),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -224,13 +227,14 @@ func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListVersionsSender sends the ListVersions request. The method will close the
|
// ListVersionsSender sends the ListVersions request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListVersionsResponder handles the response to the ListVersions request. The method always
|
// ListVersionsResponder handles the response to the ListVersions request. The method always
|
|
@ -14,78 +14,54 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VirtualMachineExtensionsClient is the the Compute Management Client.
|
// VirtualMachineExtensionsClient is the compute Client
|
||||||
type VirtualMachineExtensionsClient struct {
|
type VirtualMachineExtensionsClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineExtensionsClient creates an instance of the
|
// NewVirtualMachineExtensionsClient creates an instance of the VirtualMachineExtensionsClient client.
|
||||||
// VirtualMachineExtensionsClient client.
|
|
||||||
func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient {
|
func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient {
|
||||||
return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the
|
// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the VirtualMachineExtensionsClient client.
|
||||||
// VirtualMachineExtensionsClient client.
|
|
||||||
func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient {
|
func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient {
|
||||||
return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdate the operation to create or update the extension. This method
|
// CreateOrUpdate the operation to create or update the extension.
|
||||||
// may poll for completion. Polling can be canceled by passing the cancel
|
|
||||||
// channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. VMName is the name of
|
// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the
|
||||||
// the virtual machine where the extension should be create or updated.
|
// extension should be create or updated. VMExtensionName is the name of the virtual machine extension.
|
||||||
// VMExtensionName is the name of the virtual machine extension.
|
// extensionParameters is parameters supplied to the Create Virtual Machine Extension operation.
|
||||||
// extensionParameters is parameters supplied to the Create Virtual Machine
|
func (client VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtensionsCreateOrUpdateFuture, err error) {
|
||||||
// Extension operation.
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters)
|
||||||
func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (<-chan VirtualMachineExtension, <-chan error) {
|
if err != nil {
|
||||||
resultChan := make(chan VirtualMachineExtension, 1)
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
errChan := make(chan error, 1)
|
return
|
||||||
go func() {
|
}
|
||||||
var err error
|
|
||||||
var result VirtualMachineExtension
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, VMName, VMExtensionName, extensionParameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (*http.Request, error) {
|
func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
@ -93,27 +69,34 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGrou
|
||||||
"vmName": autorest.Encode("path", VMName),
|
"vmName": autorest.Encode("path", VMName),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
autorest.AsJSON(),
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
autorest.AsPut(),
|
autorest.AsPut(),
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||||
autorest.WithJSON(extensionParameters),
|
autorest.WithJSON(extensionParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineExtensionsCreateOrUpdateFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
@ -129,49 +112,28 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the operation to delete the extension. This method may poll for
|
// Delete the operation to delete the extension.
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. VMName is the name of
|
// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the
|
||||||
// the virtual machine where the extension should be deleted. VMExtensionName
|
// extension should be deleted. VMExtensionName is the name of the virtual machine extension.
|
||||||
// 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(resourceGroupName string, VMName string, VMExtensionName string, cancel <-chan struct{}) (<-chan OperationStatusResponse, <-chan error) {
|
req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName)
|
||||||
resultChan := make(chan OperationStatusResponse, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request")
|
||||||
go func() {
|
return
|
||||||
var err error
|
}
|
||||||
var result OperationStatusResponse
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, VMName, VMExtensionName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
result, err = client.DeleteSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
// DeletePreparer prepares the Delete request.
|
||||||
func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName string, VMName string, VMExtensionName string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client VirtualMachineExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
@ -179,7 +141,7 @@ func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName st
|
||||||
"vmName": autorest.Encode("path", VMName),
|
"vmName": autorest.Encode("path", VMName),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -189,15 +151,22 @@ func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName st
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineExtensionsDeleteFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
@ -215,12 +184,11 @@ func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response
|
||||||
|
|
||||||
// Get the operation to get the extension.
|
// Get the operation to get the extension.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. VMName is the name of
|
// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine containing the
|
||||||
// the virtual machine containing the extension. VMExtensionName is the name of
|
// extension. VMExtensionName is the name of the virtual machine extension. expand is the expand expression to
|
||||||
// the virtual machine extension. expand is the expand expression to apply on
|
// apply on the operation.
|
||||||
// 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(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(resourceGroupName, VMName, VMExtensionName, expand)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -242,7 +210,7 @@ func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, VMNam
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) {
|
func (client VirtualMachineExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
@ -250,7 +218,7 @@ func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName strin
|
||||||
"vmName": autorest.Encode("path", VMName),
|
"vmName": autorest.Encode("path", VMName),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -263,13 +231,14 @@ func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName strin
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
|
@ -14,40 +14,37 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VirtualMachineImagesClient is the the Compute Management Client.
|
// VirtualMachineImagesClient is the compute Client
|
||||||
type VirtualMachineImagesClient struct {
|
type VirtualMachineImagesClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineImagesClient creates an instance of the
|
// NewVirtualMachineImagesClient creates an instance of the VirtualMachineImagesClient client.
|
||||||
// VirtualMachineImagesClient client.
|
|
||||||
func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient {
|
func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient {
|
||||||
return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineImagesClientWithBaseURI creates an instance of the
|
// NewVirtualMachineImagesClientWithBaseURI creates an instance of the VirtualMachineImagesClient client.
|
||||||
// VirtualMachineImagesClient client.
|
|
||||||
func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient {
|
func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient {
|
||||||
return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
|
||||||
// image publisher. offer is a valid image publisher offer. skus is a valid
|
// image publisher offer. skus is a valid image SKU. version is a valid image SKU version.
|
||||||
// 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(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(location, publisherName, offer, skus, version)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -69,7 +66,7 @@ func (client VirtualMachineImagesClient) Get(location string, publisherName stri
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client VirtualMachineImagesClient) GetPreparer(location string, publisherName string, offer string, skus string, version string) (*http.Request, error) {
|
func (client VirtualMachineImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"offer": autorest.Encode("path", offer),
|
"offer": autorest.Encode("path", offer),
|
||||||
|
@ -79,7 +76,7 @@ func (client VirtualMachineImagesClient) GetPreparer(location string, publisherN
|
||||||
"version": autorest.Encode("path", version),
|
"version": autorest.Encode("path", version),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -89,13 +86,14 @@ func (client VirtualMachineImagesClient) GetPreparer(location string, publisherN
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
@ -111,14 +109,12 @@ func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (resu
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets a list of all virtual machine image versions for the specified
|
// List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
|
||||||
// location, publisher, offer, and SKU.
|
|
||||||
//
|
//
|
||||||
// location is the name of a supported Azure region. publisherName is a valid
|
// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
|
||||||
// image publisher. offer is a valid image publisher offer. skus is a valid
|
// image publisher offer. skus is a valid image SKU. filter is the filter to apply on the operation.
|
||||||
// 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(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(location, publisherName, offer, skus, filter, top, orderby)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -140,7 +136,7 @@ func (client VirtualMachineImagesClient) List(location string, publisherName str
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client VirtualMachineImagesClient) ListPreparer(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) {
|
func (client VirtualMachineImagesClient) ListPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"offer": autorest.Encode("path", offer),
|
"offer": autorest.Encode("path", offer),
|
||||||
|
@ -149,7 +145,7 @@ func (client VirtualMachineImagesClient) ListPreparer(location string, publisher
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -168,13 +164,14 @@ func (client VirtualMachineImagesClient) ListPreparer(location string, publisher
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", 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 VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -190,13 +187,11 @@ func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (res
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListOffers gets a list of virtual machine image offers for the specified
|
// ListOffers gets a list of virtual machine image offers for the specified location and publisher.
|
||||||
// location and publisher.
|
|
||||||
//
|
//
|
||||||
// location is the name of a supported Azure region. publisherName is a valid
|
// location is the name of a supported Azure region. publisherName is a valid image publisher.
|
||||||
// image publisher.
|
func (client VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
|
||||||
func (client VirtualMachineImagesClient) ListOffers(location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
|
req, err := client.ListOffersPreparer(ctx, location, publisherName)
|
||||||
req, err := client.ListOffersPreparer(location, publisherName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -218,14 +213,14 @@ func (client VirtualMachineImagesClient) ListOffers(location string, publisherNa
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListOffersPreparer prepares the ListOffers request.
|
// ListOffersPreparer prepares the ListOffers request.
|
||||||
func (client VirtualMachineImagesClient) ListOffersPreparer(location string, publisherName string) (*http.Request, error) {
|
func (client VirtualMachineImagesClient) ListOffersPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"publisherName": autorest.Encode("path", publisherName),
|
"publisherName": autorest.Encode("path", publisherName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -235,13 +230,14 @@ func (client VirtualMachineImagesClient) ListOffersPreparer(location string, pub
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListOffersSender sends the ListOffers request. The method will close the
|
// ListOffersSender sends the ListOffers request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListOffersResponder handles the response to the ListOffers request. The method always
|
// ListOffersResponder handles the response to the ListOffers request. The method always
|
||||||
|
@ -257,12 +253,11 @@ func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPublishers gets a list of virtual machine image publishers for the
|
// ListPublishers gets a list of virtual machine image publishers for the specified Azure location.
|
||||||
// specified Azure location.
|
|
||||||
//
|
//
|
||||||
// location is the name of a supported Azure region.
|
// location is the name of a supported Azure region.
|
||||||
func (client VirtualMachineImagesClient) ListPublishers(location string) (result ListVirtualMachineImageResource, err error) {
|
func (client VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string) (result ListVirtualMachineImageResource, err error) {
|
||||||
req, err := client.ListPublishersPreparer(location)
|
req, err := client.ListPublishersPreparer(ctx, location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -284,13 +279,13 @@ func (client VirtualMachineImagesClient) ListPublishers(location string) (result
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPublishersPreparer prepares the ListPublishers request.
|
// ListPublishersPreparer prepares the ListPublishers request.
|
||||||
func (client VirtualMachineImagesClient) ListPublishersPreparer(location string) (*http.Request, error) {
|
func (client VirtualMachineImagesClient) ListPublishersPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -300,13 +295,14 @@ func (client VirtualMachineImagesClient) ListPublishersPreparer(location string)
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPublishersSender sends the ListPublishers request. The method will close the
|
// ListPublishersSender sends the ListPublishers request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPublishersResponder handles the response to the ListPublishers request. The method always
|
// ListPublishersResponder handles the response to the ListPublishers request. The method always
|
||||||
|
@ -322,13 +318,12 @@ func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Resp
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListSkus gets a list of virtual machine image SKUs for the specified
|
// ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
|
||||||
// location, publisher, and offer.
|
|
||||||
//
|
//
|
||||||
// location is the name of a supported Azure region. publisherName is a valid
|
// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
|
||||||
// image publisher. offer is a valid image publisher offer.
|
// image publisher offer.
|
||||||
func (client VirtualMachineImagesClient) ListSkus(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(location, publisherName, offer)
|
req, err := client.ListSkusPreparer(ctx, location, publisherName, offer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -350,7 +345,7 @@ func (client VirtualMachineImagesClient) ListSkus(location string, publisherName
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListSkusPreparer prepares the ListSkus request.
|
// ListSkusPreparer prepares the ListSkus request.
|
||||||
func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publisherName string, offer string) (*http.Request, error) {
|
func (client VirtualMachineImagesClient) ListSkusPreparer(ctx context.Context, location string, publisherName string, offer string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"offer": autorest.Encode("path", offer),
|
"offer": autorest.Encode("path", offer),
|
||||||
|
@ -358,7 +353,7 @@ func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publi
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -368,13 +363,14 @@ func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publi
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListSkusSender sends the ListSkus request. The method will close the
|
// ListSkusSender sends the ListSkus request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListSkusResponder handles the response to the ListSkus request. The method always
|
// ListSkusResponder handles the response to the ListSkus request. The method always
|
212
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineruncommands.go
generated
vendored
Normal file
212
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachineruncommands.go
generated
vendored
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"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 {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(ctx context.Context, 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.NewError("compute.VirtualMachineRunCommandsClient", "Get", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.GetPreparer(ctx, 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(ctx context.Context, 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-12-01"
|
||||||
|
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{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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(ctx context.Context, location string) (result RunCommandListResultPage, 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.NewError("compute.VirtualMachineRunCommandsClient", "List", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, 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.rclr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.rclr, 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(ctx context.Context, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
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{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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", "listNextResults", 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", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineRunCommandsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client VirtualMachineRunCommandsClient) ListComplete(ctx context.Context, location string) (result RunCommandListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, location)
|
||||||
|
return
|
||||||
|
}
|
1361
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachines.go
generated
vendored
Normal file
1361
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachines.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
351
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetextensions.go
generated
vendored
Normal file
351
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetextensions.go
generated
vendored
Normal file
|
@ -0,0 +1,351 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineScaleSetExtensionsClient is the compute Client
|
||||||
|
type VirtualMachineScaleSetExtensionsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetExtensionsClient creates an instance of the VirtualMachineScaleSetExtensionsClient client.
|
||||||
|
func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string) VirtualMachineScaleSetExtensionsClient {
|
||||||
|
return NewVirtualMachineScaleSetExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetExtensionsClientWithBaseURI creates an instance of the
|
||||||
|
// VirtualMachineScaleSetExtensionsClient client.
|
||||||
|
func NewVirtualMachineScaleSetExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetExtensionsClient {
|
||||||
|
return VirtualMachineScaleSetExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate the operation to create or update an extension.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set where the
|
||||||
|
// extension should be create or updated. vmssExtensionName is the name of the VM scale set extension.
|
||||||
|
// extensionParameters is parameters supplied to the Create VM scale set Extension operation.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (result VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) {
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName, extensionParameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
"vmssExtensionName": autorest.Encode("path", vmssExtensionName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters),
|
||||||
|
autorest.WithJSON(extensionParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetExtensionsCreateOrUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the operation to delete the extension.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set where the
|
||||||
|
// extension should be deleted. vmssExtensionName is the name of the VM scale set extension.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (result VirtualMachineScaleSetExtensionsDeleteFuture, err error) {
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, vmssExtensionName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
"vmssExtensionName": autorest.Encode("path", vmssExtensionName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetExtensionsDeleteFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 extension. vmssExtensionName is the name of the VM scale set extension. expand is the expand expression to
|
||||||
|
// apply on the operation.
|
||||||
|
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)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "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.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, vmssExtensionName string, expand string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
"vmssExtensionName": autorest.Encode("path", vmssExtensionName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(expand) > 0 {
|
||||||
|
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) 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 VirtualMachineScaleSetExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetExtension, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets a list of 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 extension.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.vmsselr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.vmsselr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) 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 VirtualMachineScaleSetExtensionsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetExtensionListResult, 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 VirtualMachineScaleSetExtensionsClient) listNextResults(lastResults VirtualMachineScaleSetExtensionListResult) (result VirtualMachineScaleSetExtensionListResult, err error) {
|
||||||
|
req, err := lastResults.virtualMachineScaleSetExtensionListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", 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.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetExtensionsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client VirtualMachineScaleSetExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetExtensionListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
return
|
||||||
|
}
|
245
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetrollingupgrades.go
generated
vendored
Normal file
245
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetrollingupgrades.go
generated
vendored
Normal file
|
@ -0,0 +1,245 @@
|
||||||
|
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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VirtualMachineScaleSetRollingUpgradesClient is the compute Client
|
||||||
|
type VirtualMachineScaleSetRollingUpgradesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetRollingUpgradesClient creates an instance of the
|
||||||
|
// VirtualMachineScaleSetRollingUpgradesClient client.
|
||||||
|
func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient {
|
||||||
|
return NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI creates an instance of the
|
||||||
|
// VirtualMachineScaleSetRollingUpgradesClient client.
|
||||||
|
func NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetRollingUpgradesClient {
|
||||||
|
return VirtualMachineScaleSetRollingUpgradesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel cancels the current virtual machine scale set rolling upgrade.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) Cancel(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) {
|
||||||
|
req, err := client.CancelPreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CancelSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "Cancel", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelPreparer prepares the Cancel request.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) CancelPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelSender sends the Cancel request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) CancelSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesCancelFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelResponder handles the response to the Cancel request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) CancelResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatest gets the status of the latest virtual machine scale set rolling upgrade.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result RollingUpgradeStatusInfo, err error) {
|
||||||
|
req, err := client.GetLatestPreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetLatestSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetLatestResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "GetLatest", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatestPreparer prepares the GetLatest request.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatestSender sends the GetLatest request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLatestResponder handles the response to the GetLatest request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) GetLatestResponder(resp *http.Response) (result RollingUpgradeStatusInfo, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgrade starts a rolling upgrade to move all virtual machine scale set instances to the latest available
|
||||||
|
// Platform Image OS version. Instances which are already running the latest available OS version are not affected.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgrade(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) {
|
||||||
|
req, err := client.StartOSUpgradePreparer(ctx, resourceGroupName, VMScaleSetName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.StartOSUpgradeSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetRollingUpgradesClient", "StartOSUpgrade", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgradePreparer prepares the StartOSUpgrade request.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
"vmScaleSetName": autorest.Encode("path", VMScaleSetName),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2017-12-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgradeSender sends the StartOSUpgrade request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeSender(req *http.Request) (future VirtualMachineScaleSetRollingUpgradesStartOSUpgradeFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartOSUpgradeResponder handles the response to the StartOSUpgrade request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeResponder(resp *http.Response) (result OperationStatusResponse, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
1504
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesets.go
generated
vendored
Normal file
1504
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesets.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1010
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetvms.go
generated
vendored
Normal file
1010
vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-04-01/compute/virtualmachinescalesetvms.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -14,46 +14,43 @@ package compute
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
"github.com/Azure/go-autorest/autorest/validation"
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VirtualMachineSizesClient is the the Compute Management Client.
|
// VirtualMachineSizesClient is the compute Client
|
||||||
type VirtualMachineSizesClient struct {
|
type VirtualMachineSizesClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineSizesClient creates an instance of the
|
// NewVirtualMachineSizesClient creates an instance of the VirtualMachineSizesClient client.
|
||||||
// VirtualMachineSizesClient client.
|
|
||||||
func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
|
func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
|
||||||
return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewVirtualMachineSizesClientWithBaseURI creates an instance of the
|
// NewVirtualMachineSizesClientWithBaseURI creates an instance of the VirtualMachineSizesClient client.
|
||||||
// VirtualMachineSizesClient client.
|
|
||||||
func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
|
func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
|
||||||
return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List lists all available virtual machine sizes for a subscription in a
|
// List lists all available virtual machine sizes for a subscription in a location.
|
||||||
// location.
|
|
||||||
//
|
//
|
||||||
// location is the location upon which virtual-machine-sizes is queried.
|
// location is the location upon which virtual-machine-sizes is queried.
|
||||||
func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) {
|
func (client VirtualMachineSizesClient) List(ctx context.Context, location string) (result VirtualMachineSizeListResult, 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.VirtualMachineSizesClient", "List")
|
return result, validation.NewError("compute.VirtualMachineSizesClient", "List", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := client.ListPreparer(location)
|
req, err := client.ListPreparer(ctx, location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -75,13 +72,13 @@ func (client VirtualMachineSizesClient) List(location string) (result VirtualMac
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Request, error) {
|
func (client VirtualMachineSizesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2016-04-30-preview"
|
const APIVersion = "2017-12-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -91,13 +88,14 @@ func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Req
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", 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 VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
1004
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationgateways.go
generated
vendored
Normal file
1004
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationgateways.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
429
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationsecuritygroups.go
generated
vendored
Normal file
429
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/applicationsecuritygroups.go
generated
vendored
Normal file
|
@ -0,0 +1,429 @@
|
||||||
|
package network
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ApplicationSecurityGroupsClient is the network Client
|
||||||
|
type ApplicationSecurityGroupsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewApplicationSecurityGroupsClient creates an instance of the ApplicationSecurityGroupsClient client.
|
||||||
|
func NewApplicationSecurityGroupsClient(subscriptionID string) ApplicationSecurityGroupsClient {
|
||||||
|
return NewApplicationSecurityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewApplicationSecurityGroupsClientWithBaseURI creates an instance of the ApplicationSecurityGroupsClient client.
|
||||||
|
func NewApplicationSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationSecurityGroupsClient {
|
||||||
|
return ApplicationSecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate creates or updates an application security group.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application
|
||||||
|
// security group. parameters is parameters supplied to the create or update ApplicationSecurityGroup operation.
|
||||||
|
func (client ApplicationSecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup) (result ApplicationSecurityGroupsCreateOrUpdateFuture, err error) {
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationSecurityGroupName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ApplicationSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationSecurityGroupsCreateOrUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ApplicationSecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationSecurityGroup, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes the specified application security group.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application
|
||||||
|
// security group.
|
||||||
|
func (client ApplicationSecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroupsDeleteFuture, err error) {
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, applicationSecurityGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client ApplicationSecurityGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ApplicationSecurityGroupsClient) DeleteSender(req *http.Request) (future ApplicationSecurityGroupsDeleteFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ApplicationSecurityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets information about the specified application security group.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application
|
||||||
|
// security group.
|
||||||
|
func (client ApplicationSecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroup, err error) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, applicationSecurityGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client ApplicationSecurityGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ApplicationSecurityGroupsClient) 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 ApplicationSecurityGroupsClient) GetResponder(resp *http.Response) (result ApplicationSecurityGroup, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets all the application security groups in a resource group.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group.
|
||||||
|
func (client ApplicationSecurityGroupsClient) List(ctx context.Context, resourceGroupName string) (result ApplicationSecurityGroupListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.asglr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.asglr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client ApplicationSecurityGroupsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ApplicationSecurityGroupsClient) 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 ApplicationSecurityGroupsClient) ListResponder(resp *http.Response) (result ApplicationSecurityGroupListResult, 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 ApplicationSecurityGroupsClient) listNextResults(lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) {
|
||||||
|
req, err := lastResults.applicationSecurityGroupListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", 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, "network.ApplicationSecurityGroupsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ApplicationSecurityGroupsClient) ListComplete(ctx context.Context, resourceGroupName string) (result ApplicationSecurityGroupListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAll gets all application security groups in a subscription.
|
||||||
|
func (client ApplicationSecurityGroupsClient) ListAll(ctx context.Context) (result ApplicationSecurityGroupListResultPage, err error) {
|
||||||
|
result.fn = client.listAllNextResults
|
||||||
|
req, err := client.ListAllPreparer(ctx)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListAllSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.asglr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.asglr, err = client.ListAllResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAllPreparer prepares the ListAll request.
|
||||||
|
func (client ApplicationSecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAllSender sends the ListAll request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ApplicationSecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) {
|
||||||
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAllResponder handles the response to the ListAll request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ApplicationSecurityGroupsClient) ListAllResponder(resp *http.Response) (result ApplicationSecurityGroupListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// listAllNextResults retrieves the next set of results, if any.
|
||||||
|
func (client ApplicationSecurityGroupsClient) listAllNextResults(lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) {
|
||||||
|
req, err := lastResults.applicationSecurityGroupListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", nil, "Failure preparing next results request")
|
||||||
|
}
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.ListAllSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListAllResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ApplicationSecurityGroupsClient) ListAllComplete(ctx context.Context) (result ApplicationSecurityGroupListResultIterator, err error) {
|
||||||
|
result.page, err = client.ListAll(ctx)
|
||||||
|
return
|
||||||
|
}
|
133
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/availableendpointservices.go
generated
vendored
Normal file
133
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/availableendpointservices.go
generated
vendored
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
package network
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AvailableEndpointServicesClient is the network Client
|
||||||
|
type AvailableEndpointServicesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAvailableEndpointServicesClient creates an instance of the AvailableEndpointServicesClient client.
|
||||||
|
func NewAvailableEndpointServicesClient(subscriptionID string) AvailableEndpointServicesClient {
|
||||||
|
return NewAvailableEndpointServicesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAvailableEndpointServicesClientWithBaseURI creates an instance of the AvailableEndpointServicesClient client.
|
||||||
|
func NewAvailableEndpointServicesClientWithBaseURI(baseURI string, subscriptionID string) AvailableEndpointServicesClient {
|
||||||
|
return AvailableEndpointServicesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List list what values of endpoint services are available for use.
|
||||||
|
//
|
||||||
|
// location is the location to check available endpoint services.
|
||||||
|
func (client AvailableEndpointServicesClient) List(ctx context.Context, location string) (result EndpointServicesListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, location)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.eslr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.eslr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client AvailableEndpointServicesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"location": autorest.Encode("path", location),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client AvailableEndpointServicesClient) 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 AvailableEndpointServicesClient) ListResponder(resp *http.Response) (result EndpointServicesListResult, 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 AvailableEndpointServicesClient) listNextResults(lastResults EndpointServicesListResult) (result EndpointServicesListResult, err error) {
|
||||||
|
req, err := lastResults.endpointServicesListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", 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, "network.AvailableEndpointServicesClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client AvailableEndpointServicesClient) ListComplete(ctx context.Context, location string) (result EndpointServicesListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, location)
|
||||||
|
return
|
||||||
|
}
|
|
@ -14,36 +14,35 @@ package network
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BgpServiceCommunitiesClient is the composite Swagger for Network Client
|
// BgpServiceCommunitiesClient is the network Client
|
||||||
type BgpServiceCommunitiesClient struct {
|
type BgpServiceCommunitiesClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBgpServiceCommunitiesClient creates an instance of the
|
// NewBgpServiceCommunitiesClient creates an instance of the BgpServiceCommunitiesClient client.
|
||||||
// BgpServiceCommunitiesClient client.
|
|
||||||
func NewBgpServiceCommunitiesClient(subscriptionID string) BgpServiceCommunitiesClient {
|
func NewBgpServiceCommunitiesClient(subscriptionID string) BgpServiceCommunitiesClient {
|
||||||
return NewBgpServiceCommunitiesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewBgpServiceCommunitiesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBgpServiceCommunitiesClientWithBaseURI creates an instance of the
|
// NewBgpServiceCommunitiesClientWithBaseURI creates an instance of the BgpServiceCommunitiesClient client.
|
||||||
// BgpServiceCommunitiesClient client.
|
|
||||||
func NewBgpServiceCommunitiesClientWithBaseURI(baseURI string, subscriptionID string) BgpServiceCommunitiesClient {
|
func NewBgpServiceCommunitiesClientWithBaseURI(baseURI string, subscriptionID string) BgpServiceCommunitiesClient {
|
||||||
return BgpServiceCommunitiesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return BgpServiceCommunitiesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets all the available bgp service communities.
|
// List gets all the available bgp service communities.
|
||||||
func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityListResult, err error) {
|
func (client BgpServiceCommunitiesClient) List(ctx context.Context) (result BgpServiceCommunityListResultPage, 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, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -51,12 +50,12 @@ func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityList
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
resp, err := client.ListSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.bsclr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result.bsclr, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -65,12 +64,12 @@ func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityList
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client BgpServiceCommunitiesClient) ListPreparer() (*http.Request, error) {
|
func (client BgpServiceCommunitiesClient) 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-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -80,13 +79,14 @@ func (client BgpServiceCommunitiesClient) ListPreparer() (*http.Request, error)
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities", 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 BgpServiceCommunitiesClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client BgpServiceCommunitiesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -102,26 +102,29 @@ func (client BgpServiceCommunitiesClient) ListResponder(resp *http.Response) (re
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNextResults retrieves the next set of results, if any.
|
// listNextResults retrieves the next set of results, if any.
|
||||||
func (client BgpServiceCommunitiesClient) ListNextResults(lastResults BgpServiceCommunityListResult) (result BgpServiceCommunityListResult, err error) {
|
func (client BgpServiceCommunitiesClient) listNextResults(lastResults BgpServiceCommunityListResult) (result BgpServiceCommunityListResult, err error) {
|
||||||
req, err := lastResults.BgpServiceCommunityListResultPreparer()
|
req, err := lastResults.bgpServiceCommunityListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "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, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "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, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client BgpServiceCommunitiesClient) ListComplete(ctx context.Context) (result BgpServiceCommunityListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
// Package network implements the Azure ARM Network service API version .
|
// Package network implements the Azure ARM Network service API version .
|
||||||
//
|
//
|
||||||
// Composite Swagger for Network Client
|
// Network Client
|
||||||
package network
|
package network
|
||||||
|
|
||||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||||
|
@ -17,11 +17,11 @@ package network
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
|
@ -32,68 +32,64 @@ const (
|
||||||
DefaultBaseURI = "https://management.azure.com"
|
DefaultBaseURI = "https://management.azure.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ManagementClient is the base client for Network.
|
// BaseClient is the base client for Network.
|
||||||
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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckDNSNameAvailability checks whether a domain name in the cloudapp.net
|
// CheckDNSNameAvailability checks whether a domain name in the cloudapp.azure.com zone is available for use.
|
||||||
// zone is available for use.
|
|
||||||
//
|
//
|
||||||
// location is the location of the domain name. domainNameLabel is the domain
|
// location is the location of the domain name. domainNameLabel is the domain name to be verified. It must conform
|
||||||
// name to be verified. It must conform to the following regular expression:
|
// to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
|
||||||
// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
|
func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) {
|
||||||
func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) {
|
req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel)
|
||||||
req, err := client.CheckDNSNameAvailabilityPreparer(location, domainNameLabel)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.CheckDNSNameAvailabilitySender(req)
|
resp, err := client.CheckDNSNameAvailabilitySender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.CheckDNSNameAvailabilityResponder(resp)
|
result, err = client.CheckDNSNameAvailabilityResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request.
|
// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request.
|
||||||
func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string, domainNameLabel string) (*http.Request, error) {
|
func (client BaseClient) CheckDNSNameAvailabilityPreparer(ctx context.Context, location string, domainNameLabel string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"location": autorest.Encode("path", location),
|
"location": autorest.Encode("path", location),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
"domainNameLabel": autorest.Encode("query", domainNameLabel),
|
||||||
if len(domainNameLabel) > 0 {
|
|
||||||
queryParameters["domainNameLabel"] = autorest.Encode("query", domainNameLabel)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
|
@ -101,18 +97,19 @@ func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string,
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the
|
// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ManagementClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) {
|
func (client BaseClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always
|
// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always
|
||||||
// closes the http.Response Body.
|
// closes the http.Response Body.
|
||||||
func (client ManagementClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) {
|
func (client BaseClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) {
|
||||||
err = autorest.Respond(
|
err = autorest.Respond(
|
||||||
resp,
|
resp,
|
||||||
client.ByInspecting(),
|
client.ByInspecting(),
|
536
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/connectionmonitors.go
generated
vendored
Normal file
536
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/connectionmonitors.go
generated
vendored
Normal file
|
@ -0,0 +1,536 @@
|
||||||
|
package network
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ConnectionMonitorsClient is the network Client
|
||||||
|
type ConnectionMonitorsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConnectionMonitorsClient creates an instance of the ConnectionMonitorsClient client.
|
||||||
|
func NewConnectionMonitorsClient(subscriptionID string) ConnectionMonitorsClient {
|
||||||
|
return NewConnectionMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConnectionMonitorsClientWithBaseURI creates an instance of the ConnectionMonitorsClient client.
|
||||||
|
func NewConnectionMonitorsClientWithBaseURI(baseURI string, subscriptionID string) ConnectionMonitorsClient {
|
||||||
|
return ConnectionMonitorsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate create or update a connection monitor.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name
|
||||||
|
// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor. parameters is
|
||||||
|
// parameters that define the operation to create a connection monitor.
|
||||||
|
func (client ConnectionMonitorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor) (result ConnectionMonitorsCreateOrUpdateFuture, err error) {
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: parameters,
|
||||||
|
Constraints: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Source", Name: validation.Null, Rule: true,
|
||||||
|
Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Source.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||||
|
{Target: "parameters.ConnectionMonitorParameters.Destination", Name: validation.Null, Rule: true, Chain: nil},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("network.ConnectionMonitorsClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client ConnectionMonitorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"connectionMonitorName": autorest.Encode("path", connectionMonitorName),
|
||||||
|
"networkWatcherName": autorest.Encode("path", networkWatcherName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ConnectionMonitorsClient) CreateOrUpdateSender(req *http.Request) (future ConnectionMonitorsCreateOrUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ConnectionMonitorsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionMonitorResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes the specified connection monitor.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name
|
||||||
|
// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor.
|
||||||
|
func (client ConnectionMonitorsClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsDeleteFuture, err error) {
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client ConnectionMonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"connectionMonitorName": autorest.Encode("path", connectionMonitorName),
|
||||||
|
"networkWatcherName": autorest.Encode("path", networkWatcherName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ConnectionMonitorsClient) DeleteSender(req *http.Request) (future ConnectionMonitorsDeleteFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ConnectionMonitorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets a connection monitor by name.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name
|
||||||
|
// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor.
|
||||||
|
func (client ConnectionMonitorsClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorResult, err error) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client ConnectionMonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"connectionMonitorName": autorest.Encode("path", connectionMonitorName),
|
||||||
|
"networkWatcherName": autorest.Encode("path", networkWatcherName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ConnectionMonitorsClient) 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 ConnectionMonitorsClient) GetResponder(resp *http.Response) (result ConnectionMonitorResult, 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 connection monitors for the specified Network Watcher.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name
|
||||||
|
// of the Network Watcher resource.
|
||||||
|
func (client ConnectionMonitorsClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result ConnectionMonitorListResult, err error) {
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client ConnectionMonitorsClient) ListPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"networkWatcherName": autorest.Encode("path", networkWatcherName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ConnectionMonitorsClient) 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 ConnectionMonitorsClient) ListResponder(resp *http.Response) (result ConnectionMonitorListResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query query a snapshot of the most recent connection states.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name
|
||||||
|
// of the Network Watcher resource. connectionMonitorName is the name given to the connection monitor.
|
||||||
|
func (client ConnectionMonitorsClient) Query(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsQueryFuture, err error) {
|
||||||
|
req, err := client.QueryPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Query", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.QuerySender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Query", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryPreparer prepares the Query request.
|
||||||
|
func (client ConnectionMonitorsClient) QueryPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"connectionMonitorName": autorest.Encode("path", connectionMonitorName),
|
||||||
|
"networkWatcherName": autorest.Encode("path", networkWatcherName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// QuerySender sends the Query request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ConnectionMonitorsClient) QuerySender(req *http.Request) (future ConnectionMonitorsQueryFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryResponder handles the response to the Query request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ConnectionMonitorsClient) QueryResponder(resp *http.Response) (result ConnectionMonitorQueryResult, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start starts the specified connection monitor.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name
|
||||||
|
// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor.
|
||||||
|
func (client ConnectionMonitorsClient) Start(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStartFuture, err error) {
|
||||||
|
req, err := client.StartPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Start", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.StartSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Start", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartPreparer prepares the Start request.
|
||||||
|
func (client ConnectionMonitorsClient) StartPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"connectionMonitorName": autorest.Encode("path", connectionMonitorName),
|
||||||
|
"networkWatcherName": autorest.Encode("path", networkWatcherName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartSender sends the Start request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ConnectionMonitorsClient) StartSender(req *http.Request) (future ConnectionMonitorsStartFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StartResponder handles the response to the Start request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ConnectionMonitorsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop stops the specified connection monitor.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group containing Network Watcher. networkWatcherName is the name
|
||||||
|
// of the Network Watcher resource. connectionMonitorName is the name of the connection monitor.
|
||||||
|
func (client ConnectionMonitorsClient) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStopFuture, err error) {
|
||||||
|
req, err := client.StopPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Stop", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.StopSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Stop", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StopPreparer prepares the Stop request.
|
||||||
|
func (client ConnectionMonitorsClient) StopPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"connectionMonitorName": autorest.Encode("path", connectionMonitorName),
|
||||||
|
"networkWatcherName": autorest.Encode("path", networkWatcherName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsPost(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StopSender sends the Stop request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ConnectionMonitorsClient) StopSender(req *http.Request) (future ConnectionMonitorsStopFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// StopResponder handles the response to the Stop request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ConnectionMonitorsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
203
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/defaultsecurityrules.go
generated
vendored
Normal file
203
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/defaultsecurityrules.go
generated
vendored
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
package network
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultSecurityRulesClient is the network Client
|
||||||
|
type DefaultSecurityRulesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDefaultSecurityRulesClient creates an instance of the DefaultSecurityRulesClient client.
|
||||||
|
func NewDefaultSecurityRulesClient(subscriptionID string) DefaultSecurityRulesClient {
|
||||||
|
return NewDefaultSecurityRulesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewDefaultSecurityRulesClientWithBaseURI creates an instance of the DefaultSecurityRulesClient client.
|
||||||
|
func NewDefaultSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) DefaultSecurityRulesClient {
|
||||||
|
return DefaultSecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get get the specified default network security rule.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network
|
||||||
|
// 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) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client DefaultSecurityRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"defaultSecurityRuleName": autorest.Encode("path", defaultSecurityRuleName),
|
||||||
|
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DefaultSecurityRulesClient) 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 DefaultSecurityRulesClient) GetResponder(resp *http.Response) (result SecurityRule, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets 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 group.
|
||||||
|
func (client DefaultSecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.srlr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.srlr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client DefaultSecurityRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client DefaultSecurityRulesClient) 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 DefaultSecurityRulesClient) ListResponder(resp *http.Response) (result SecurityRuleListResult, 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 DefaultSecurityRulesClient) listNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) {
|
||||||
|
req, err := lastResults.securityRuleListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", 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, "network.DefaultSecurityRulesClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client DefaultSecurityRulesClient) ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, networkSecurityGroupName)
|
||||||
|
return
|
||||||
|
}
|
|
@ -14,78 +14,56 @@ package network
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExpressRouteCircuitAuthorizationsClient is the composite Swagger for Network
|
// ExpressRouteCircuitAuthorizationsClient is the network Client
|
||||||
// Client
|
|
||||||
type ExpressRouteCircuitAuthorizationsClient struct {
|
type ExpressRouteCircuitAuthorizationsClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteCircuitAuthorizationsClient creates an instance of the
|
// NewExpressRouteCircuitAuthorizationsClient creates an instance of the ExpressRouteCircuitAuthorizationsClient
|
||||||
// ExpressRouteCircuitAuthorizationsClient client.
|
// client.
|
||||||
func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string) ExpressRouteCircuitAuthorizationsClient {
|
func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string) ExpressRouteCircuitAuthorizationsClient {
|
||||||
return NewExpressRouteCircuitAuthorizationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewExpressRouteCircuitAuthorizationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteCircuitAuthorizationsClientWithBaseURI creates an instance of
|
// NewExpressRouteCircuitAuthorizationsClientWithBaseURI creates an instance of the
|
||||||
// the ExpressRouteCircuitAuthorizationsClient client.
|
// ExpressRouteCircuitAuthorizationsClient client.
|
||||||
func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitAuthorizationsClient {
|
func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitAuthorizationsClient {
|
||||||
return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates an authorization in the specified express
|
// CreateOrUpdate creates or updates an authorization in the specified express route circuit.
|
||||||
// route circuit. This method may poll for completion. Polling can be canceled
|
|
||||||
// by passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. authorizationName is the name of the
|
// authorizationName is the name of the authorization. authorizationParameters is parameters supplied to the create
|
||||||
// authorization. authorizationParameters is parameters supplied to the create
|
|
||||||
// or update express route circuit authorization operation.
|
// or update express route circuit authorization operation.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (<-chan ExpressRouteCircuitAuthorization, <-chan error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (result ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) {
|
||||||
resultChan := make(chan ExpressRouteCircuitAuthorization, 1)
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters)
|
||||||
errChan := make(chan error, 1)
|
if err != nil {
|
||||||
go func() {
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
var err error
|
return
|
||||||
var result ExpressRouteCircuitAuthorization
|
}
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, authorizationName, authorizationParameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"authorizationName": autorest.Encode("path", authorizationName),
|
"authorizationName": autorest.Encode("path", authorizationName),
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
|
@ -93,27 +71,34 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(res
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
autorest.AsJSON(),
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
autorest.AsPut(),
|
autorest.AsPut(),
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
||||||
autorest.WithJSON(authorizationParameters),
|
autorest.WithJSON(authorizationParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
@ -122,56 +107,35 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(re
|
||||||
err = autorest.Respond(
|
err = autorest.Respond(
|
||||||
resp,
|
resp,
|
||||||
client.ByInspecting(),
|
client.ByInspecting(),
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
autorest.ByClosing())
|
autorest.ByClosing())
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes the specified authorization from the specified express route
|
// Delete deletes the specified authorization from the specified express route circuit.
|
||||||
// circuit. This method may poll for completion. Polling can be canceled by
|
|
||||||
// passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. authorizationName is the name of the
|
// authorizationName is the name of the authorization.
|
||||||
// authorization.
|
func (client ExpressRouteCircuitAuthorizationsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorizationsDeleteFuture, err error) {
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) Delete(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, authorizationName)
|
||||||
resultChan := make(chan autorest.Response, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request")
|
||||||
go func() {
|
return
|
||||||
var err error
|
}
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, circuitName, authorizationName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
result, err = client.DeleteSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = resp
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
// DeletePreparer prepares the Delete request.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"authorizationName": autorest.Encode("path", authorizationName),
|
"authorizationName": autorest.Encode("path", authorizationName),
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
|
@ -179,7 +143,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGro
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -189,15 +153,22 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGro
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsDeleteFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
@ -206,20 +177,18 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http
|
||||||
err = autorest.Respond(
|
err = autorest.Respond(
|
||||||
resp,
|
resp,
|
||||||
client.ByInspecting(),
|
client.ByInspecting(),
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent),
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
autorest.ByClosing())
|
autorest.ByClosing())
|
||||||
result.Response = resp
|
result.Response = resp
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get gets the specified authorization from the specified express route
|
// Get gets the specified authorization from the specified express route circuit.
|
||||||
// circuit.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. authorizationName is the name of the
|
// authorizationName is the name of the authorization.
|
||||||
// authorization.
|
func (client ExpressRouteCircuitAuthorizationsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) {
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) {
|
req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, authorizationName)
|
||||||
req, err := client.GetPreparer(resourceGroupName, circuitName, authorizationName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -241,7 +210,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName stri
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"authorizationName": autorest.Encode("path", authorizationName),
|
"authorizationName": autorest.Encode("path", authorizationName),
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
|
@ -249,7 +218,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupN
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -259,13 +228,14 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupN
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
@ -283,10 +253,10 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Re
|
||||||
|
|
||||||
// List gets all authorizations in an express route circuit.
|
// List gets all authorizations in an express route circuit.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the circuit.
|
||||||
// of the circuit.
|
func (client ExpressRouteCircuitAuthorizationsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result AuthorizationListResultPage, err error) {
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, err error) {
|
result.fn = client.listNextResults
|
||||||
req, err := client.ListPreparer(resourceGroupName, circuitName)
|
req, err := client.ListPreparer(ctx, resourceGroupName, circuitName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -294,12 +264,12 @@ func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName str
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
resp, err := client.ListSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.alr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result.alr, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -308,14 +278,14 @@ func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName str
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -325,13 +295,14 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroup
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", 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 ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -347,26 +318,29 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListResponder(resp *http.R
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNextResults retrieves the next set of results, if any.
|
// listNextResults retrieves the next set of results, if any.
|
||||||
func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) {
|
func (client ExpressRouteCircuitAuthorizationsClient) listNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) {
|
||||||
req, err := lastResults.AuthorizationListResultPreparer()
|
req, err := lastResults.authorizationListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "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, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "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, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ExpressRouteCircuitAuthorizationsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result AuthorizationListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, circuitName)
|
||||||
return
|
return
|
||||||
}
|
}
|
|
@ -14,78 +14,66 @@ package network
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExpressRouteCircuitPeeringsClient is the composite Swagger for Network
|
// ExpressRouteCircuitPeeringsClient is the network Client
|
||||||
// Client
|
|
||||||
type ExpressRouteCircuitPeeringsClient struct {
|
type ExpressRouteCircuitPeeringsClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteCircuitPeeringsClient creates an instance of the
|
// NewExpressRouteCircuitPeeringsClient creates an instance of the ExpressRouteCircuitPeeringsClient client.
|
||||||
// ExpressRouteCircuitPeeringsClient client.
|
|
||||||
func NewExpressRouteCircuitPeeringsClient(subscriptionID string) ExpressRouteCircuitPeeringsClient {
|
func NewExpressRouteCircuitPeeringsClient(subscriptionID string) ExpressRouteCircuitPeeringsClient {
|
||||||
return NewExpressRouteCircuitPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewExpressRouteCircuitPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteCircuitPeeringsClientWithBaseURI creates an instance of the
|
// NewExpressRouteCircuitPeeringsClientWithBaseURI creates an instance of the ExpressRouteCircuitPeeringsClient client.
|
||||||
// ExpressRouteCircuitPeeringsClient client.
|
|
||||||
func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitPeeringsClient {
|
func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitPeeringsClient {
|
||||||
return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates a peering in the specified express route
|
// CreateOrUpdate creates or updates a peering in the specified express route circuits.
|
||||||
// circuits. This method may poll for completion. Polling can be canceled by
|
|
||||||
// passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. peeringName is the name of the peering.
|
// peeringName is the name of the peering. peeringParameters is parameters supplied to the create or update express
|
||||||
// peeringParameters is parameters supplied to the create or update express
|
|
||||||
// route circuit peering operation.
|
// route circuit peering operation.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (<-chan ExpressRouteCircuitPeering, <-chan error) {
|
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (result ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) {
|
||||||
resultChan := make(chan ExpressRouteCircuitPeering, 1)
|
if err := validation.Validate([]validation.Validation{
|
||||||
errChan := make(chan error, 1)
|
{TargetValue: peeringParameters,
|
||||||
go func() {
|
Constraints: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat", Name: validation.Null, Rule: false,
|
||||||
var err error
|
Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.Null, Rule: false,
|
||||||
var result ExpressRouteCircuitPeering
|
Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMaximum, Rule: 4294967295, Chain: nil},
|
||||||
defer func() {
|
{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
|
||||||
resultChan <- result
|
}},
|
||||||
errChan <- err
|
}}}}}); err != nil {
|
||||||
close(resultChan)
|
return result, validation.NewError("network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", err.Error())
|
||||||
close(errChan)
|
}
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, peeringName, peeringParameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, peeringName, peeringParameters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
}
|
return
|
||||||
}()
|
}
|
||||||
return resultChan, errChan
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"peeringName": autorest.Encode("path", peeringName),
|
"peeringName": autorest.Encode("path", peeringName),
|
||||||
|
@ -93,27 +81,34 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceG
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
autorest.AsJSON(),
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
autorest.AsPut(),
|
autorest.AsPut(),
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
||||||
autorest.WithJSON(peeringParameters),
|
autorest.WithJSON(peeringParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
@ -129,48 +124,28 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *ht
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes the specified peering from the specified express route
|
// Delete deletes the specified peering from the specified express route circuit.
|
||||||
// circuit. This method may poll for completion. Polling can be canceled by
|
|
||||||
// passing the cancel channel argument. The channel will be used to cancel
|
|
||||||
// polling and any outstanding HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. peeringName is the name of the peering.
|
// peeringName is the name of the peering.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) Delete(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
func (client ExpressRouteCircuitPeeringsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeeringsDeleteFuture, err error) {
|
||||||
resultChan := make(chan autorest.Response, 1)
|
req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, peeringName)
|
||||||
errChan := make(chan error, 1)
|
if err != nil {
|
||||||
go func() {
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request")
|
||||||
var err error
|
return
|
||||||
var result autorest.Response
|
}
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, circuitName, peeringName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
result, err = client.DeleteSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = resp
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
// DeletePreparer prepares the Delete request.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"peeringName": autorest.Encode("path", peeringName),
|
"peeringName": autorest.Encode("path", peeringName),
|
||||||
|
@ -178,7 +153,7 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -188,15 +163,22 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitPeeringsDeleteFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
@ -211,13 +193,12 @@ func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Respo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get gets the specified authorization from the specified express route
|
// Get gets the specified authorization from the specified express route circuit.
|
||||||
// circuit.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. peeringName is the name of the peering.
|
// peeringName is the name of the peering.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) {
|
func (client ExpressRouteCircuitPeeringsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) {
|
||||||
req, err := client.GetPreparer(resourceGroupName, circuitName, peeringName)
|
req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, peeringName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -239,7 +220,7 @@ func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, ci
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"peeringName": autorest.Encode("path", peeringName),
|
"peeringName": autorest.Encode("path", peeringName),
|
||||||
|
@ -247,7 +228,7 @@ func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName st
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -257,13 +238,14 @@ func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName st
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
@ -281,10 +263,10 @@ func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response
|
||||||
|
|
||||||
// List gets all peerings in a specified express route circuit.
|
// List gets all peerings in a specified express route circuit.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit.
|
func (client ExpressRouteCircuitPeeringsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResultPage, err error) {
|
||||||
func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, err error) {
|
result.fn = client.listNextResults
|
||||||
req, err := client.ListPreparer(resourceGroupName, circuitName)
|
req, err := client.ListPreparer(ctx, resourceGroupName, circuitName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -292,12 +274,12 @@ func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, c
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
resp, err := client.ListSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.ercplr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result.ercplr, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -306,14 +288,14 @@ func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, c
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -323,13 +305,14 @@ func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName s
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", 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 ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -345,26 +328,29 @@ func (client ExpressRouteCircuitPeeringsClient) ListResponder(resp *http.Respons
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNextResults retrieves the next set of results, if any.
|
// listNextResults retrieves the next set of results, if any.
|
||||||
func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) {
|
func (client ExpressRouteCircuitPeeringsClient) listNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) {
|
||||||
req, err := lastResults.ExpressRouteCircuitPeeringListResultPreparer()
|
req, err := lastResults.expressRouteCircuitPeeringListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "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, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "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, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ExpressRouteCircuitPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, circuitName)
|
||||||
return
|
return
|
||||||
}
|
}
|
|
@ -14,103 +14,87 @@ package network
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExpressRouteCircuitsClient is the composite Swagger for Network Client
|
// ExpressRouteCircuitsClient is the network Client
|
||||||
type ExpressRouteCircuitsClient struct {
|
type ExpressRouteCircuitsClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteCircuitsClient creates an instance of the
|
// NewExpressRouteCircuitsClient creates an instance of the ExpressRouteCircuitsClient client.
|
||||||
// ExpressRouteCircuitsClient client.
|
|
||||||
func NewExpressRouteCircuitsClient(subscriptionID string) ExpressRouteCircuitsClient {
|
func NewExpressRouteCircuitsClient(subscriptionID string) ExpressRouteCircuitsClient {
|
||||||
return NewExpressRouteCircuitsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewExpressRouteCircuitsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteCircuitsClientWithBaseURI creates an instance of the
|
// NewExpressRouteCircuitsClientWithBaseURI creates an instance of the ExpressRouteCircuitsClient client.
|
||||||
// ExpressRouteCircuitsClient client.
|
|
||||||
func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitsClient {
|
func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitsClient {
|
||||||
return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdate creates or updates an express route circuit. This method may
|
// CreateOrUpdate creates or updates an express route circuit.
|
||||||
// poll for completion. Polling can be canceled by passing the cancel channel
|
|
||||||
// argument. The channel will be used to cancel polling and any outstanding
|
|
||||||
// HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. parameters is
|
||||||
// of the circuit. parameters is parameters supplied to the create or update
|
// parameters supplied to the create or update express route circuit operation.
|
||||||
// express route circuit operation.
|
func (client ExpressRouteCircuitsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (result ExpressRouteCircuitsCreateOrUpdateFuture, err error) {
|
||||||
func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (<-chan ExpressRouteCircuit, <-chan error) {
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, parameters)
|
||||||
resultChan := make(chan ExpressRouteCircuit, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
go func() {
|
return
|
||||||
var err error
|
}
|
||||||
var result ExpressRouteCircuit
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, parameters, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.CreateOrUpdateSender(req)
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.CreateOrUpdateResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
preparer := autorest.CreatePreparer(
|
preparer := autorest.CreatePreparer(
|
||||||
autorest.AsJSON(),
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
autorest.AsPut(),
|
autorest.AsPut(),
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
||||||
autorest.WithJSON(parameters),
|
autorest.WithJSON(parameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitsCreateOrUpdateFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
@ -119,62 +103,41 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Resp
|
||||||
err = autorest.Respond(
|
err = autorest.Respond(
|
||||||
resp,
|
resp,
|
||||||
client.ByInspecting(),
|
client.ByInspecting(),
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
autorest.ByUnmarshallingJSON(&result),
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
autorest.ByClosing())
|
autorest.ByClosing())
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes the specified express route circuit. This method may poll for
|
// Delete deletes the specified express route circuit.
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit.
|
func (client ExpressRouteCircuitsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitsDeleteFuture, err error) {
|
||||||
func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName)
|
||||||
resultChan := make(chan autorest.Response, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request")
|
||||||
go func() {
|
return
|
||||||
var err error
|
}
|
||||||
var result autorest.Response
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.DeletePreparer(resourceGroupName, circuitName, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.DeleteSender(req)
|
result, err = client.DeleteSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = resp
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.DeleteResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeletePreparer prepares the Delete request.
|
// DeletePreparer prepares the Delete request.
|
||||||
func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string, circuitName string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -184,15 +147,22 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSender sends the Delete request. The method will close the
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitsDeleteFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteResponder handles the response to the Delete request. The method always
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
@ -201,7 +171,7 @@ func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (r
|
||||||
err = autorest.Respond(
|
err = autorest.Respond(
|
||||||
resp,
|
resp,
|
||||||
client.ByInspecting(),
|
client.ByInspecting(),
|
||||||
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
autorest.ByClosing())
|
autorest.ByClosing())
|
||||||
result.Response = resp
|
result.Response = resp
|
||||||
return
|
return
|
||||||
|
@ -209,10 +179,9 @@ func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (r
|
||||||
|
|
||||||
// Get gets information about the specified express route circuit.
|
// Get gets information about the specified express route circuit.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of express route circuit.
|
||||||
// of express route circuit.
|
func (client ExpressRouteCircuitsClient) Get(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) {
|
||||||
func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) {
|
req, err := client.GetPreparer(ctx, resourceGroupName, circuitName)
|
||||||
req, err := client.GetPreparer(resourceGroupName, circuitName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -234,14 +203,14 @@ func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitNa
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPreparer prepares the Get request.
|
// GetPreparer prepares the Get request.
|
||||||
func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -251,13 +220,14 @@ func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, c
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSender sends the Get request. The method will close the
|
// GetSender sends the Get request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResponder handles the response to the Get request. The method always
|
// GetResponder handles the response to the Get request. The method always
|
||||||
|
@ -273,13 +243,12 @@ func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (resu
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPeeringStats gets all stats from an express route circuit in a resource
|
// GetPeeringStats gets all stats from an express route circuit in a resource group.
|
||||||
// group.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. peeringName is the name of the peering.
|
// peeringName is the name of the peering.
|
||||||
func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) {
|
func (client ExpressRouteCircuitsClient) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) {
|
||||||
req, err := client.GetPeeringStatsPreparer(resourceGroupName, circuitName, peeringName)
|
req, err := client.GetPeeringStatsPreparer(ctx, resourceGroupName, circuitName, peeringName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -301,7 +270,7 @@ func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName strin
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPeeringStatsPreparer prepares the GetPeeringStats request.
|
// GetPeeringStatsPreparer prepares the GetPeeringStats request.
|
||||||
func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"peeringName": autorest.Encode("path", peeringName),
|
"peeringName": autorest.Encode("path", peeringName),
|
||||||
|
@ -309,7 +278,7 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupNa
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -319,13 +288,14 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupNa
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the
|
// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPeeringStatsResponder handles the response to the GetPeeringStats request. The method always
|
// GetPeeringStatsResponder handles the response to the GetPeeringStats request. The method always
|
||||||
|
@ -341,13 +311,11 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Res
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStats gets all the stats from an express route circuit in a resource
|
// GetStats gets all the stats from an express route circuit in a resource group.
|
||||||
// group.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit.
|
func (client ExpressRouteCircuitsClient) GetStats(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) {
|
||||||
func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) {
|
req, err := client.GetStatsPreparer(ctx, resourceGroupName, circuitName)
|
||||||
req, err := client.GetStatsPreparer(resourceGroupName, circuitName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -369,14 +337,14 @@ func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circ
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStatsPreparer prepares the GetStats request.
|
// GetStatsPreparer prepares the GetStats request.
|
||||||
func (client ExpressRouteCircuitsClient) GetStatsPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) GetStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -386,13 +354,14 @@ func (client ExpressRouteCircuitsClient) GetStatsPreparer(resourceGroupName stri
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStatsSender sends the GetStats request. The method will close the
|
// GetStatsSender sends the GetStats request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStatsResponder handles the response to the GetStats request. The method always
|
// GetStatsResponder handles the response to the GetStats request. The method always
|
||||||
|
@ -411,8 +380,9 @@ func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response)
|
||||||
// List gets all the express route circuits in a resource group.
|
// List gets all the express route circuits in a resource group.
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group.
|
// resourceGroupName is the name of the resource group.
|
||||||
func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, err error) {
|
func (client ExpressRouteCircuitsClient) List(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultPage, err error) {
|
||||||
req, err := client.ListPreparer(resourceGroupName)
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -420,12 +390,12 @@ func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
resp, err := client.ListSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.erclr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result.erclr, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -434,13 +404,13 @@ func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -450,13 +420,14 @@ func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string)
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", 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 ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -472,33 +443,37 @@ func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (res
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNextResults retrieves the next set of results, if any.
|
// listNextResults retrieves the next set of results, if any.
|
||||||
func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
|
func (client ExpressRouteCircuitsClient) listNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
|
||||||
req, err := lastResults.ExpressRouteCircuitListResultPreparer()
|
req, err := lastResults.expressRouteCircuitListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "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, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "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, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ExpressRouteCircuitsClient) ListComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAll gets all the express route circuits in a subscription.
|
// ListAll gets all the express route circuits in a subscription.
|
||||||
func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) {
|
func (client ExpressRouteCircuitsClient) ListAll(ctx context.Context) (result ExpressRouteCircuitListResultPage, err error) {
|
||||||
req, err := client.ListAllPreparer()
|
result.fn = client.listAllNextResults
|
||||||
|
req, err := client.ListAllPreparer(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -506,12 +481,12 @@ func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitLi
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
resp, err := client.ListAllSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.erclr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
result.erclr, err = client.ListAllResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -520,12 +495,12 @@ func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitLi
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAllPreparer prepares the ListAll request.
|
// ListAllPreparer prepares the ListAll request.
|
||||||
func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) ListAllPreparer(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-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -535,13 +510,14 @@ func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAllSender sends the ListAll request. The method will close the
|
// ListAllSender sends the ListAll request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAllResponder handles the response to the ListAll request. The method always
|
// ListAllResponder handles the response to the ListAll request. The method always
|
||||||
|
@ -557,74 +533,55 @@ func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAllNextResults retrieves the next set of results, if any.
|
// listAllNextResults retrieves the next set of results, if any.
|
||||||
func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
|
func (client ExpressRouteCircuitsClient) listAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
|
||||||
req, err := lastResults.ExpressRouteCircuitListResultPreparer()
|
req, err := lastResults.expressRouteCircuitListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", nil, "Failure preparing next results request")
|
||||||
}
|
}
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.ListAllSender(req)
|
resp, err := client.ListAllSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure sending next results request")
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListAllResponder(resp)
|
result, err = client.ListAllResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ExpressRouteCircuitsClient) ListAllComplete(ctx context.Context) (result ExpressRouteCircuitListResultIterator, err error) {
|
||||||
|
result.page, err = client.ListAll(ctx)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListArpTable gets the currently advertised ARP table associated with the express route circuit in a resource group.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
|
// peeringName is the name of the peering. devicePath is the path of the device.
|
||||||
|
func (client ExpressRouteCircuitsClient) ListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListArpTableFuture, err error) {
|
||||||
|
req, err := client.ListArpTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.ListArpTableSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListArpTable gets the currently advertised ARP table associated with the
|
|
||||||
// express route circuit in a resource group. This method may poll for
|
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
|
||||||
// of the express route circuit. peeringName is the name of the peering.
|
|
||||||
// devicePath is the path of the device.
|
|
||||||
func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsArpTableListResult, <-chan error) {
|
|
||||||
resultChan := make(chan ExpressRouteCircuitsArpTableListResult, 1)
|
|
||||||
errChan := make(chan error, 1)
|
|
||||||
go func() {
|
|
||||||
var err error
|
|
||||||
var result ExpressRouteCircuitsArpTableListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.ListArpTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListArpTableSender(req)
|
|
||||||
if err != nil {
|
|
||||||
result.Response = autorest.Response{Response: resp}
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListArpTableResponder(resp)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListArpTablePreparer prepares the ListArpTable request.
|
// ListArpTablePreparer prepares the ListArpTable request.
|
||||||
func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"devicePath": autorest.Encode("path", devicePath),
|
"devicePath": autorest.Encode("path", devicePath),
|
||||||
|
@ -633,7 +590,7 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -643,15 +600,22 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListArpTableSender sends the ListArpTable request. The method will close the
|
// ListArpTableSender sends the ListArpTable request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCircuitsListArpTableFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListArpTableResponder handles the response to the ListArpTable request. The method always
|
// ListArpTableResponder handles the response to the ListArpTable request. The method always
|
||||||
|
@ -667,50 +631,29 @@ func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Respon
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTable gets the currently advertised routes table associated with
|
// ListRoutesTable gets the currently advertised routes table associated with the express route circuit in a resource
|
||||||
// the express route circuit in a resource group. This method may poll for
|
// group.
|
||||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
|
||||||
// The channel will be used to cancel polling and any outstanding HTTP
|
|
||||||
// requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. peeringName is the name of the peering.
|
// peeringName is the name of the peering. devicePath is the path of the device.
|
||||||
// devicePath is the path of the device.
|
func (client ExpressRouteCircuitsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableFuture, err error) {
|
||||||
func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableListResult, <-chan error) {
|
req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath)
|
||||||
resultChan := make(chan ExpressRouteCircuitsRoutesTableListResult, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request")
|
||||||
go func() {
|
return
|
||||||
var err error
|
}
|
||||||
var result ExpressRouteCircuitsRoutesTableListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListRoutesTableSender(req)
|
result, err = client.ListRoutesTableSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListRoutesTableResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTablePreparer prepares the ListRoutesTable request.
|
// ListRoutesTablePreparer prepares the ListRoutesTable request.
|
||||||
func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"devicePath": autorest.Encode("path", devicePath),
|
"devicePath": autorest.Encode("path", devicePath),
|
||||||
|
@ -719,7 +662,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupNa
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -729,15 +672,22 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupNa
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTableSender sends the ListRoutesTable request. The method will close the
|
// ListRoutesTableSender sends the ListRoutesTable request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always
|
// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always
|
||||||
|
@ -753,50 +703,29 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Res
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTableSummary gets the currently advertised routes table summary
|
// ListRoutesTableSummary gets the currently advertised routes table summary associated with the express route circuit
|
||||||
// associated with the express route circuit in a resource group. This method
|
// in a resource group.
|
||||||
// may poll for completion. Polling can be canceled by passing the cancel
|
|
||||||
// channel argument. The channel will be used to cancel polling and any
|
|
||||||
// outstanding HTTP requests.
|
|
||||||
//
|
//
|
||||||
// resourceGroupName is the name of the resource group. circuitName is the name
|
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
|
||||||
// of the express route circuit. peeringName is the name of the peering.
|
// peeringName is the name of the peering. devicePath is the path of the device.
|
||||||
// devicePath is the path of the device.
|
func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) {
|
||||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableSummaryListResult, <-chan error) {
|
req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath)
|
||||||
resultChan := make(chan ExpressRouteCircuitsRoutesTableSummaryListResult, 1)
|
if err != nil {
|
||||||
errChan := make(chan error, 1)
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request")
|
||||||
go func() {
|
return
|
||||||
var err error
|
}
|
||||||
var result ExpressRouteCircuitsRoutesTableSummaryListResult
|
|
||||||
defer func() {
|
|
||||||
resultChan <- result
|
|
||||||
errChan <- err
|
|
||||||
close(resultChan)
|
|
||||||
close(errChan)
|
|
||||||
}()
|
|
||||||
req, err := client.ListRoutesTableSummaryPreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
|
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.ListRoutesTableSummarySender(req)
|
result, err = client.ListRoutesTableSummarySender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", result.Response(), "Failure sending request")
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure sending request")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result, err = client.ListRoutesTableSummaryResponder(resp)
|
return
|
||||||
if err != nil {
|
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure responding to request")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return resultChan, errChan
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request.
|
// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request.
|
||||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) {
|
func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) {
|
||||||
pathParameters := map[string]interface{}{
|
pathParameters := map[string]interface{}{
|
||||||
"circuitName": autorest.Encode("path", circuitName),
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
"devicePath": autorest.Encode("path", devicePath),
|
"devicePath": autorest.Encode("path", devicePath),
|
||||||
|
@ -805,7 +734,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resource
|
||||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
}
|
}
|
||||||
|
|
||||||
const APIVersion = "2017-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -815,15 +744,22 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resource
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters),
|
||||||
autorest.WithQueryParameters(queryParameters))
|
autorest.WithQueryParameters(queryParameters))
|
||||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the
|
// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the
|
||||||
// http.Response Body if it receives an error.
|
// http.Response Body if it receives an error.
|
||||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) {
|
||||||
return autorest.SendWithSender(client,
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
req,
|
future.Future = azure.NewFuture(req)
|
||||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always
|
// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always
|
||||||
|
@ -838,3 +774,74 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *h
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.Response = autorest.Response{Response: resp}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateTags updates an express route circuit tags.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. parameters is
|
||||||
|
// parameters supplied to update express route circuit tags.
|
||||||
|
func (client ExpressRouteCircuitsClient) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (result ExpressRouteCircuitsUpdateTagsFuture, err error) {
|
||||||
|
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, circuitName, parameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.UpdateTagsSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateTagsPreparer prepares the UpdateTags request.
|
||||||
|
func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"circuitName": autorest.Encode("path", circuitName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPatch(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
||||||
|
autorest.WithJSON(parameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateTagsSender sends the UpdateTags request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client ExpressRouteCircuitsClient) UpdateTagsSender(req *http.Request) (future ExpressRouteCircuitsUpdateTagsFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateTagsResponder handles the response to the UpdateTags request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client ExpressRouteCircuitsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCircuit, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
|
@ -14,37 +14,36 @@ package network
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||||
// Changes may cause incorrect behavior and will be lost if the code is
|
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||||
// regenerated.
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExpressRouteServiceProvidersClient is the composite Swagger for Network
|
// ExpressRouteServiceProvidersClient is the network Client
|
||||||
// Client
|
|
||||||
type ExpressRouteServiceProvidersClient struct {
|
type ExpressRouteServiceProvidersClient struct {
|
||||||
ManagementClient
|
BaseClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteServiceProvidersClient creates an instance of the
|
// NewExpressRouteServiceProvidersClient creates an instance of the ExpressRouteServiceProvidersClient client.
|
||||||
// ExpressRouteServiceProvidersClient client.
|
|
||||||
func NewExpressRouteServiceProvidersClient(subscriptionID string) ExpressRouteServiceProvidersClient {
|
func NewExpressRouteServiceProvidersClient(subscriptionID string) ExpressRouteServiceProvidersClient {
|
||||||
return NewExpressRouteServiceProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
return NewExpressRouteServiceProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExpressRouteServiceProvidersClientWithBaseURI creates an instance of the
|
// NewExpressRouteServiceProvidersClientWithBaseURI creates an instance of the ExpressRouteServiceProvidersClient
|
||||||
// ExpressRouteServiceProvidersClient client.
|
// client.
|
||||||
func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteServiceProvidersClient {
|
func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteServiceProvidersClient {
|
||||||
return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)}
|
return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List gets all the available express route service providers.
|
// List gets all the available express route service providers.
|
||||||
func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) {
|
func (client ExpressRouteServiceProvidersClient) List(ctx context.Context) (result ExpressRouteServiceProviderListResultPage, 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, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request")
|
||||||
return
|
return
|
||||||
|
@ -52,12 +51,12 @@ func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServ
|
||||||
|
|
||||||
resp, err := client.ListSender(req)
|
resp, err := client.ListSender(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result.Response = autorest.Response{Response: resp}
|
result.ersplr.Response = autorest.Response{Response: resp}
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err = client.ListResponder(resp)
|
result.ersplr, err = client.ListResponder(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request")
|
||||||
}
|
}
|
||||||
|
@ -66,12 +65,12 @@ func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServ
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPreparer prepares the List request.
|
// ListPreparer prepares the List request.
|
||||||
func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request, error) {
|
func (client ExpressRouteServiceProvidersClient) 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-03-01"
|
const APIVersion = "2018-01-01"
|
||||||
queryParameters := map[string]interface{}{
|
queryParameters := map[string]interface{}{
|
||||||
"api-version": APIVersion,
|
"api-version": APIVersion,
|
||||||
}
|
}
|
||||||
|
@ -81,13 +80,14 @@ func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request,
|
||||||
autorest.WithBaseURL(client.BaseURI),
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", pathParameters),
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", 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 ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) {
|
func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||||
return autorest.SendWithSender(client, req)
|
return autorest.SendWithSender(client, req,
|
||||||
|
azure.DoRetryWithRegistration(client.Client))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponder handles the response to the List request. The method always
|
// ListResponder handles the response to the List request. The method always
|
||||||
|
@ -103,26 +103,29 @@ func (client ExpressRouteServiceProvidersClient) ListResponder(resp *http.Respon
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListNextResults retrieves the next set of results, if any.
|
// listNextResults retrieves the next set of results, if any.
|
||||||
func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) {
|
func (client ExpressRouteServiceProvidersClient) listNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) {
|
||||||
req, err := lastResults.ExpressRouteServiceProviderListResultPreparer()
|
req, err := lastResults.expressRouteServiceProviderListResultPreparer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "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, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending next results request")
|
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "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, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to next results request")
|
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client ExpressRouteServiceProvidersClient) ListComplete(ctx context.Context) (result ExpressRouteServiceProviderListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
367
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/inboundnatrules.go
generated
vendored
Normal file
367
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/inboundnatrules.go
generated
vendored
Normal file
|
@ -0,0 +1,367 @@
|
||||||
|
package network
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"github.com/Azure/go-autorest/autorest/validation"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InboundNatRulesClient is the network Client
|
||||||
|
type InboundNatRulesClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInboundNatRulesClient creates an instance of the InboundNatRulesClient client.
|
||||||
|
func NewInboundNatRulesClient(subscriptionID string) InboundNatRulesClient {
|
||||||
|
return NewInboundNatRulesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInboundNatRulesClientWithBaseURI creates an instance of the InboundNatRulesClient client.
|
||||||
|
func NewInboundNatRulesClientWithBaseURI(baseURI string, subscriptionID string) InboundNatRulesClient {
|
||||||
|
return InboundNatRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdate creates or updates a load balancer inbound nat rule.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
|
||||||
|
// inboundNatRuleName is the name of the inbound nat rule. inboundNatRuleParameters is parameters supplied to the
|
||||||
|
// create or update inbound nat rule operation.
|
||||||
|
func (client InboundNatRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule) (result InboundNatRulesCreateOrUpdateFuture, err error) {
|
||||||
|
if err := validation.Validate([]validation.Validation{
|
||||||
|
{TargetValue: inboundNatRuleParameters,
|
||||||
|
Constraints: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false,
|
||||||
|
Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}}}}}); err != nil {
|
||||||
|
return result, validation.NewError("network.InboundNatRulesClient", "CreateOrUpdate", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.CreateOrUpdateSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||||
|
func (client InboundNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"inboundNatRuleName": autorest.Encode("path", inboundNatRuleName),
|
||||||
|
"loadBalancerName": autorest.Encode("path", loadBalancerName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsContentType("application/json; charset=utf-8"),
|
||||||
|
autorest.AsPut(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters),
|
||||||
|
autorest.WithJSON(inboundNatRuleParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client InboundNatRulesClient) CreateOrUpdateSender(req *http.Request) (future InboundNatRulesCreateOrUpdateFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client InboundNatRulesClient) CreateOrUpdateResponder(resp *http.Response) (result InboundNatRule, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete deletes the specified load balancer inbound nat rule.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
|
||||||
|
// inboundNatRuleName is the name of the inbound nat rule.
|
||||||
|
func (client InboundNatRulesClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (result InboundNatRulesDeleteFuture, err error) {
|
||||||
|
req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.DeleteSender(req)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", result.Response(), "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletePreparer prepares the Delete request.
|
||||||
|
func (client InboundNatRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"inboundNatRuleName": autorest.Encode("path", inboundNatRuleName),
|
||||||
|
"loadBalancerName": autorest.Encode("path", loadBalancerName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsDelete(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteSender sends the Delete request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client InboundNatRulesClient) DeleteSender(req *http.Request) (future InboundNatRulesDeleteFuture, err error) {
|
||||||
|
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
|
||||||
|
future.Future = azure.NewFuture(req)
|
||||||
|
future.req = req
|
||||||
|
_, err = future.Done(sender)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = autorest.Respond(future.Response(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteResponder handles the response to the Delete request. The method always
|
||||||
|
// closes the http.Response Body.
|
||||||
|
func (client InboundNatRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = resp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets the specified load balancer inbound nat rule.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
|
||||||
|
// inboundNatRuleName is the name of the inbound nat rule. expand is expands referenced resources.
|
||||||
|
func (client InboundNatRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (result InboundNatRule, err error) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, expand)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client InboundNatRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"inboundNatRuleName": autorest.Encode("path", inboundNatRuleName),
|
||||||
|
"loadBalancerName": autorest.Encode("path", loadBalancerName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
if len(expand) > 0 {
|
||||||
|
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client InboundNatRulesClient) 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 InboundNatRulesClient) GetResponder(resp *http.Response) (result InboundNatRule, err error) {
|
||||||
|
err = autorest.Respond(
|
||||||
|
resp,
|
||||||
|
client.ByInspecting(),
|
||||||
|
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||||
|
autorest.ByUnmarshallingJSON(&result),
|
||||||
|
autorest.ByClosing())
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// List gets all the inbound nat rules in a load balancer.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
|
||||||
|
func (client InboundNatRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.inrlr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.inrlr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client InboundNatRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"loadBalancerName": autorest.Encode("path", loadBalancerName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client InboundNatRulesClient) 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 InboundNatRulesClient) ListResponder(resp *http.Response) (result InboundNatRuleListResult, 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 InboundNatRulesClient) listNextResults(lastResults InboundNatRuleListResult) (result InboundNatRuleListResult, err error) {
|
||||||
|
req, err := lastResults.inboundNatRuleListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", 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, "network.InboundNatRulesClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client InboundNatRulesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, loadBalancerName)
|
||||||
|
return
|
||||||
|
}
|
202
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceipconfigurations.go
generated
vendored
Normal file
202
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceipconfigurations.go
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
package network
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InterfaceIPConfigurationsClient is the network Client
|
||||||
|
type InterfaceIPConfigurationsClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInterfaceIPConfigurationsClient creates an instance of the InterfaceIPConfigurationsClient client.
|
||||||
|
func NewInterfaceIPConfigurationsClient(subscriptionID string) InterfaceIPConfigurationsClient {
|
||||||
|
return NewInterfaceIPConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInterfaceIPConfigurationsClientWithBaseURI creates an instance of the InterfaceIPConfigurationsClient client.
|
||||||
|
func NewInterfaceIPConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) InterfaceIPConfigurationsClient {
|
||||||
|
return InterfaceIPConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get gets the specified network interface ip configuration.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
|
||||||
|
// IPConfigurationName is the name of the ip configuration name.
|
||||||
|
func (client InterfaceIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (result InterfaceIPConfiguration, err error) {
|
||||||
|
req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, IPConfigurationName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.GetSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err = client.GetResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPreparer prepares the Get request.
|
||||||
|
func (client InterfaceIPConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"ipConfigurationName": autorest.Encode("path", IPConfigurationName),
|
||||||
|
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSender sends the Get request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client InterfaceIPConfigurationsClient) 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 InterfaceIPConfigurationsClient) GetResponder(resp *http.Response) (result InterfaceIPConfiguration, 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 get all ip configurations in a network interface
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
|
||||||
|
func (client InterfaceIPConfigurationsClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.iiclr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.iiclr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client InterfaceIPConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client InterfaceIPConfigurationsClient) 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 InterfaceIPConfigurationsClient) ListResponder(resp *http.Response) (result InterfaceIPConfigurationListResult, 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 InterfaceIPConfigurationsClient) listNextResults(lastResults InterfaceIPConfigurationListResult) (result InterfaceIPConfigurationListResult, err error) {
|
||||||
|
req, err := lastResults.interfaceIPConfigurationListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", 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, "network.InterfaceIPConfigurationsClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client InterfaceIPConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, networkInterfaceName)
|
||||||
|
return
|
||||||
|
}
|
134
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceloadbalancers.go
generated
vendored
Normal file
134
vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-01-01/network/interfaceloadbalancers.go
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
package network
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
"context"
|
||||||
|
"github.com/Azure/go-autorest/autorest"
|
||||||
|
"github.com/Azure/go-autorest/autorest/azure"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InterfaceLoadBalancersClient is the network Client
|
||||||
|
type InterfaceLoadBalancersClient struct {
|
||||||
|
BaseClient
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInterfaceLoadBalancersClient creates an instance of the InterfaceLoadBalancersClient client.
|
||||||
|
func NewInterfaceLoadBalancersClient(subscriptionID string) InterfaceLoadBalancersClient {
|
||||||
|
return NewInterfaceLoadBalancersClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInterfaceLoadBalancersClientWithBaseURI creates an instance of the InterfaceLoadBalancersClient client.
|
||||||
|
func NewInterfaceLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) InterfaceLoadBalancersClient {
|
||||||
|
return InterfaceLoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List list all load balancers in a network interface.
|
||||||
|
//
|
||||||
|
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
|
||||||
|
func (client InterfaceLoadBalancersClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResultPage, err error) {
|
||||||
|
result.fn = client.listNextResults
|
||||||
|
req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", nil, "Failure preparing request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.ListSender(req)
|
||||||
|
if err != nil {
|
||||||
|
result.ilblr.Response = autorest.Response{Response: resp}
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure sending request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result.ilblr, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure responding to request")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListPreparer prepares the List request.
|
||||||
|
func (client InterfaceLoadBalancersClient) ListPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) {
|
||||||
|
pathParameters := map[string]interface{}{
|
||||||
|
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
||||||
|
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||||
|
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||||
|
}
|
||||||
|
|
||||||
|
const APIVersion = "2018-01-01"
|
||||||
|
queryParameters := map[string]interface{}{
|
||||||
|
"api-version": APIVersion,
|
||||||
|
}
|
||||||
|
|
||||||
|
preparer := autorest.CreatePreparer(
|
||||||
|
autorest.AsGet(),
|
||||||
|
autorest.WithBaseURL(client.BaseURI),
|
||||||
|
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers", pathParameters),
|
||||||
|
autorest.WithQueryParameters(queryParameters))
|
||||||
|
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListSender sends the List request. The method will close the
|
||||||
|
// http.Response Body if it receives an error.
|
||||||
|
func (client InterfaceLoadBalancersClient) 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 InterfaceLoadBalancersClient) ListResponder(resp *http.Response) (result InterfaceLoadBalancerListResult, 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 InterfaceLoadBalancersClient) listNextResults(lastResults InterfaceLoadBalancerListResult) (result InterfaceLoadBalancerListResult, err error) {
|
||||||
|
req, err := lastResults.interfaceLoadBalancerListResultPreparer()
|
||||||
|
if err != nil {
|
||||||
|
return result, autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", 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, "network.InterfaceLoadBalancersClient", "listNextResults", resp, "Failure sending next results request")
|
||||||
|
}
|
||||||
|
result, err = client.ListResponder(resp)
|
||||||
|
if err != nil {
|
||||||
|
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", resp, "Failure responding to next results request")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||||
|
func (client InterfaceLoadBalancersClient) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResultIterator, err error) {
|
||||||
|
result.page, err = client.List(ctx, resourceGroupName, networkInterfaceName)
|
||||||
|
return
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue