provider/azurerm: Upgrading to v10 of the Azure SDK (#14004)

provider/azurerm: Upgrading to v10.0.2 of the Azure SDK
This commit is contained in:
Tom Harvey 2017-06-01 10:18:22 +01:00 committed by GitHub
parent 0a09a1ea40
commit df2875045d
242 changed files with 21805 additions and 8282 deletions

View File

@ -664,9 +664,10 @@ func resourceAzureInstanceDelete(d *schema.ResourceData, meta interface{}) error
}
err = resource.Retry(15*time.Minute, func() *resource.RetryError {
exists, err := blobClient.BlobExists(
storageContainterName, fmt.Sprintf(osDiskBlobNameFormat, name),
)
container := blobClient.GetContainerReference(storageContainterName)
blobName := fmt.Sprintf(osDiskBlobNameFormat, name)
blob := container.GetBlobReference(blobName)
exists, err := blob.Exists()
if err != nil {
return resource.NonRetryableError(err)
}

View File

@ -513,7 +513,7 @@ resource "azure_security_group_rule" "foo" {
resource "azure_instance" "foo" {
name = "terraform-test1"
image = "Windows Server 2012 R2 Datacenter, January 2016"
image = "Windows Server 2012 R2 Datacenter, April 2017"
size = "Basic_A1"
storage_service_name = "%s"
location = "West US"
@ -588,7 +588,7 @@ resource "azure_security_group_rule" "bar" {
resource "azure_instance" "foo" {
name = "terraform-test1"
image = "Windows Server 2012 R2 Datacenter, January 2016"
image = "Windows Server 2012 R2 Datacenter, April 2017"
size = "Basic_A2"
storage_service_name = "%s"
location = "West US"

View File

@ -187,7 +187,7 @@ resource "azure_sql_database_server" "foo" {
location = "West US"
username = "SuperUser"
password = "SuperSEKR3T"
version = "2.0"
version = "12.0"
}
resource "azure_sql_database_server_firewall_rule" "foo" {
@ -204,14 +204,14 @@ resource "azure_sql_database_server" "foo" {
location = "West US"
username = "SuperUser"
password = "SuperSEKR3T"
version = "2.0"
version = "12.0"
}
resource "azure_sql_database_server" "bar" {
location = "West US"
username = "SuperUser"
password = "SuperSEKR3T"
version = "2.0"
version = "12.0"
}
resource "azure_sql_database_server_firewall_rule" "foo" {
@ -234,14 +234,14 @@ resource "azure_sql_database_server" "foo" {
location = "West US"
username = "SuperUser"
password = "SuperSEKR3T"
version = "2.0"
version = "12.0"
}
resource "azure_sql_database_server" "bar" {
location = "West US"
username = "SuperUser"
password = "SuperSEKR3T"
version = "2.0"
version = "12.0"
}
resource "azure_sql_database_server_firewall_rule" "foo" {

View File

@ -29,7 +29,7 @@ func TestAccAzureSqlDatabaseServer(t *testing.T) {
resource.TestCheckResourceAttrPtr(name, "name", testAccAzureSqlServerName),
resource.TestCheckResourceAttr(name, "username", "SuperUser"),
resource.TestCheckResourceAttr(name, "password", "SuperSEKR3T"),
resource.TestCheckResourceAttr(name, "version", "2.0"),
resource.TestCheckResourceAttr(name, "version", "12.0"),
),
},
},
@ -153,6 +153,6 @@ resource "azure_sql_database_server" "foo" {
location = "West US"
username = "SuperUser"
password = "SuperSEKR3T"
version = "2.0"
version = "12.0"
}
`

View File

@ -4,6 +4,7 @@ import (
"fmt"
"log"
"github.com/Azure/azure-sdk-for-go/storage"
"github.com/hashicorp/terraform/helper/schema"
)
@ -73,12 +74,19 @@ func resourceAzureStorageBlobCreate(d *schema.ResourceData, meta interface{}) er
name := d.Get("name").(string)
blobType := d.Get("type").(string)
cont := d.Get("storage_container_name").(string)
container := blobClient.GetContainerReference(cont)
blob := container.GetBlobReference(name)
switch blobType {
case "BlockBlob":
err = blobClient.CreateBlockBlob(cont, name)
options := &storage.PutBlobOptions{}
err = blob.CreateBlockBlob(options)
case "PageBlob":
size := int64(d.Get("size").(int))
err = blobClient.PutPageBlob(cont, name, size, map[string]string{})
options := &storage.PutBlobOptions{}
blob.Properties.ContentLength = size
err = blob.PutPageBlob(options)
default:
err = fmt.Errorf("Invalid blob type specified; see parameter desciptions for more info.")
}
@ -112,7 +120,9 @@ func resourceAzureStorageBlobRead(d *schema.ResourceData, meta interface{}) erro
name := d.Get("name").(string)
cont := d.Get("storage_container_name").(string)
url := blobClient.GetBlobURL(cont, name)
container := blobClient.GetContainerReference(cont)
blob := container.GetBlobReference(name)
url := blob.GetURL()
d.Set("url", url)
}
@ -135,7 +145,9 @@ func resourceAzureStorageBlobExists(d *schema.ResourceData, meta interface{}) (b
log.Println("[INFO] Querying Azure for storage blob's existence.")
name := d.Get("name").(string)
cont := d.Get("storage_container_name").(string)
exists, err := blobClient.BlobExists(cont, name)
container := blobClient.GetContainerReference(cont)
blob := container.GetBlobReference(name)
exists, err := blob.Exists()
if err != nil {
return false, fmt.Errorf("Error whilst checking for Azure storage blob's existence: %s", err)
}
@ -163,7 +175,13 @@ func resourceAzureStorageBlobDelete(d *schema.ResourceData, meta interface{}) er
log.Println("[INFO] Issuing storage blob delete command off Azure.")
name := d.Get("name").(string)
cont := d.Get("storage_container_name").(string)
if _, err = blobClient.DeleteBlobIfExists(cont, name, make(map[string]string)); err != nil {
container := blobClient.GetContainerReference(cont)
blob := container.GetBlobReference(name)
options := &storage.DeleteBlobOptions{}
_, err = blob.DeleteIfExists(options)
if err != nil {
return fmt.Errorf("Error whilst deleting storage blob: %s", err)
}

View File

@ -72,8 +72,10 @@ func testAccCheckAzureStorageBlobExists(name, typ string) resource.TestCheckFunc
return err
}
exists, err := blobClient.BlobExists(fmt.Sprintf("%s-%s", testAccStorageContainerName, typ),
resource.Primary.ID)
containerName := fmt.Sprintf("%s-%s", testAccStorageContainerName, typ)
container := blobClient.GetContainerReference(containerName)
blob := container.GetBlobReference(resource.Primary.ID)
exists, err := blob.Exists()
if err != nil {
return err
}
@ -98,8 +100,10 @@ func testAccCheckAzureStorageBlobDeleted(typ string) resource.TestCheckFunc {
return err
}
exists, err := blobClient.BlobExists(fmt.Sprintf("%s-%s", testAccStorageContainerName,
typ), resource.Primary.ID)
containerName := fmt.Sprintf("%s-%s", testAccStorageContainerName, typ)
container := blobClient.GetContainerReference(containerName)
blob := container.GetBlobReference(resource.Primary.ID)
exists, err := blob.Exists()
if err != nil {
return err
}

View File

@ -60,7 +60,11 @@ func resourceAzureStorageContainerCreate(d *schema.ResourceData, meta interface{
log.Println("[INFO] Creating storage container on Azure.")
name := d.Get("name").(string)
accessType := storage.ContainerAccessType(d.Get("container_access_type").(string))
err = blobClient.CreateContainer(name, accessType)
container := blobClient.GetContainerReference(name)
options := &storage.CreateContainerOptions{
Access: accessType,
}
err = container.Create(options)
if err != nil {
return fmt.Errorf("Failed to create storage container on Azure: %s", err)
}
@ -129,7 +133,8 @@ func resourceAzureStorageContainerExists(d *schema.ResourceData, meta interface{
log.Println("[INFO] Checking existence of storage container on Azure.")
name := d.Get("name").(string)
exists, err := blobClient.ContainerExists(name)
container := blobClient.GetContainerReference(name)
exists, err := container.Exists()
if err != nil {
return false, fmt.Errorf("Failed to query for Azure storage container existence: %s", err)
}
@ -154,7 +159,10 @@ func resourceAzureStorageContainerDelete(d *schema.ResourceData, meta interface{
log.Println("[INFO] Issuing Azure storage container deletion call.")
name := d.Get("name").(string)
if _, err := blobClient.DeleteContainerIfExists(name); err != nil {
container := blobClient.GetContainerReference(name)
options := &storage.DeleteContainerOptions{}
_, err = container.DeleteIfExists(options)
if err != nil {
return fmt.Errorf("Failed deleting storage container off Azure: %s", err)
}

View File

@ -50,7 +50,8 @@ func testAccCheckAzureStorageContainerExists(name string) resource.TestCheckFunc
return err
}
exists, err := blobClient.ContainerExists(resource.Primary.ID)
container := blobClient.GetContainerReference(resource.Primary.ID)
exists, err := container.Exists()
if err != nil {
return err
}
@ -74,7 +75,8 @@ func testAccCheckAzureStorageContainerDestroyed(s *terraform.State) error {
return err
}
exists, err := blobClient.ContainerExists(resource.Primary.ID)
container := blobClient.GetContainerReference(resource.Primary.ID)
exists, err := container.Exists()
if err != nil {
return err
}

View File

@ -4,6 +4,7 @@ import (
"fmt"
"log"
"github.com/Azure/azure-sdk-for-go/storage"
"github.com/hashicorp/terraform/helper/schema"
)
@ -45,7 +46,9 @@ func resourceAzureStorageQueueCreate(d *schema.ResourceData, meta interface{}) e
// create the queue:
log.Println("Sending Storage Queue creation request to Azure.")
name := d.Get("name").(string)
err = queueClient.CreateQueue(name)
queue := queueClient.GetQueueReference(name)
options := &storage.QueueServiceOptions{}
err = queue.Create(options)
if err != nil {
return fmt.Errorf("Error creation Storage Queue on Azure: %s", err)
}
@ -67,7 +70,8 @@ func resourceAzureStorageQueueRead(d *schema.ResourceData, meta interface{}) err
// check for queue's existence:
log.Println("[INFO] Sending Storage Queue existence query to Azure.")
name := d.Get("name").(string)
exists, err := queueClient.QueueExists(name)
queue := queueClient.GetQueueReference(name)
exists, err := queue.Exists()
if err != nil {
return fmt.Errorf("Error checking for Storage Queue existence: %s", err)
}
@ -94,7 +98,9 @@ func resourceAzureStorageQueueDelete(d *schema.ResourceData, meta interface{}) e
// issue the deletion of the storage queue:
log.Println("[INFO] Sending Storage Queue deletion request to Azure.")
name := d.Get("name").(string)
err = queueClient.DeleteQueue(name)
queue := queueClient.GetQueueReference(name)
options := &storage.QueueServiceOptions{}
err = queue.Delete(options)
if err != nil {
return fmt.Errorf("Error deleting Storage queue off Azure: %s", err)
}

View File

@ -45,7 +45,8 @@ func testAccCheckAzureStorageQueueExists(name string) resource.TestCheckFunc {
return err
}
exists, err := queueClient.QueueExists(resource.Primary.ID)
queue := queueClient.GetQueueReference(resource.Primary.ID)
exists, err := queue.Exists()
if err != nil {
return fmt.Errorf("Error querying Azure for Storage Queue existence: %s", err)
}
@ -73,7 +74,8 @@ func testAccCheckAzureStorageQueueDeleted(s *terraform.State) error {
return err
}
exists, err := queueClient.QueueExists(resource.Primary.ID)
queue := queueClient.GetQueueReference(resource.Primary.ID)
exists, err := queue.Exists()
if err != nil {
return fmt.Errorf("Error querying Azure for Storage Queue existence: %s", err)
}

View File

@ -87,7 +87,7 @@ type ArmClient struct {
jobsCollectionsClient scheduler.JobCollectionsClient
storageServiceClient storage.AccountsClient
storageUsageClient storage.UsageOperationsClient
storageUsageClient storage.UsageClient
deploymentsClient resources.DeploymentsClient
@ -402,7 +402,7 @@ func (c *Config) getArmClient() (*ArmClient, error) {
ssc.Sender = autorest.CreateSender(withRequestLogging())
client.storageServiceClient = ssc
suc := storage.NewUsageOperationsClientWithBaseURI(endpoint, c.SubscriptionID)
suc := storage.NewUsageClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&suc.Client)
suc.Authorizer = spt
suc.Sender = autorest.CreateSender(withRequestLogging())

View File

@ -1,7 +1,6 @@
package azurerm
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
@ -13,7 +12,7 @@ func TestAccAzureRMContainerRegistry_importBasic(t *testing.T) {
ri := acctest.RandInt()
rs := acctest.RandString(4)
config := fmt.Sprintf(testAccAzureRMContainerRegistry_basic, ri, rs, ri)
config := testAccAzureRMContainerRegistry_basic(ri, rs)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -39,7 +38,7 @@ func TestAccAzureRMContainerRegistry_importComplete(t *testing.T) {
ri := acctest.RandInt()
rs := acctest.RandString(4)
config := fmt.Sprintf(testAccAzureRMContainerRegistry_complete, ri, rs, ri)
config := testAccAzureRMContainerRegistry_complete(ri, rs)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },

View File

@ -16,6 +16,17 @@ func locationSchema() *schema.Schema {
}
}
func deprecatedLocationSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
ForceNew: true,
Optional: true,
StateFunc: azureRMNormalizeLocation,
DiffSuppressFunc: azureRMSuppressLocationDiff,
Deprecated: "location is no longer used",
}
}
// azureRMNormalizeLocation is a function which normalises human-readable region/location
// names (e.g. "West US") to the values used and returned by the Azure API (e.g. "westus").
// In state we track the API internal version as it is easier to go from the human form

View File

@ -190,7 +190,8 @@ func resourceArmCdnEndpointCreate(d *schema.ResourceData, meta interface{}) erro
Tags: expandTags(tags),
}
_, err := cdnEndpointsClient.Create(resGroup, profileName, name, cdnEndpoint, make(chan struct{}))
_, error := cdnEndpointsClient.Create(resGroup, profileName, name, cdnEndpoint, make(<-chan struct{}))
err := <-error
if err != nil {
return err
}
@ -305,7 +306,8 @@ func resourceArmCdnEndpointUpdate(d *schema.ResourceData, meta interface{}) erro
EndpointPropertiesUpdateParameters: &properties,
}
_, err := cdnEndpointsClient.Update(resGroup, profileName, name, updateProps, make(chan struct{}))
_, error := cdnEndpointsClient.Update(resGroup, profileName, name, updateProps, make(<-chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Error issuing Azure ARM update request to update CDN Endpoint %q: %s", name, err)
}
@ -327,15 +329,17 @@ func resourceArmCdnEndpointDelete(d *schema.ResourceData, meta interface{}) erro
}
name := id.Path["endpoints"]
accResp, err := client.Delete(resGroup, profileName, name, make(chan struct{}))
accResp, error := client.Delete(resGroup, profileName, name, make(<-chan struct{}))
resp := <-accResp
err = <-error
if err != nil {
if accResp.StatusCode == http.StatusNotFound {
if resp.StatusCode == http.StatusNotFound {
return nil
}
return fmt.Errorf("Error issuing AzureRM delete request for CDN Endpoint %q: %s", name, err)
}
return err
return nil
}
func validateCdnEndpointQuerystringCachingBehaviour(v interface{}, k string) (ws []string, errors []error) {

View File

@ -134,7 +134,8 @@ func testCheckAzureRMCdnEndpointDisappears(name string) resource.TestCheckFunc {
conn := testAccProvider.Meta().(*ArmClient).cdnEndpointsClient
_, err := conn.Delete(resourceGroup, profileName, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, profileName, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on cdnEndpointsClient: %s", err)
}
@ -156,7 +157,6 @@ func testCheckAzureRMCdnEndpointDestroy(s *terraform.State) error {
profileName := rs.Primary.Attributes["profile_name"]
resp, err := conn.Get(resourceGroup, profileName, name)
if err != nil {
return nil
}

View File

@ -68,7 +68,8 @@ func resourceArmCdnProfileCreate(d *schema.ResourceData, meta interface{}) error
},
}
_, err := cdnProfilesClient.Create(resGroup, name, cdnProfile, make(chan struct{}))
_, error := cdnProfilesClient.Create(resGroup, name, cdnProfile, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -133,7 +134,8 @@ func resourceArmCdnProfileUpdate(d *schema.ResourceData, meta interface{}) error
Tags: expandTags(newTags),
}
_, err := cdnProfilesClient.Update(resGroup, name, props, make(chan struct{}))
_, error := cdnProfilesClient.Update(resGroup, name, props, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Error issuing Azure ARM update request to update CDN Profile %q: %s", name, err)
}
@ -151,7 +153,8 @@ func resourceArmCdnProfileDelete(d *schema.ResourceData, meta interface{}) error
resGroup := id.ResourceGroup
name := id.Path["profiles"]
_, err = cdnProfilesClient.Delete(resGroup, name, make(chan struct{}))
_, error := cdnProfilesClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
// TODO: check the status code
return err

View File

@ -11,6 +11,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/containerregistry"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/jen20/riviera/azure"
)
@ -18,11 +19,13 @@ func resourceArmContainerRegistry() *schema.Resource {
return &schema.Resource{
Create: resourceArmContainerRegistryCreate,
Read: resourceArmContainerRegistryRead,
Update: resourceArmContainerRegistryCreate,
Update: resourceArmContainerRegistryUpdate,
Delete: resourceArmContainerRegistryDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
MigrateState: resourceAzureRMContainerRegistryMigrateState,
SchemaVersion: 1,
Schema: map[string]*schema.Schema{
"name": {
@ -40,6 +43,16 @@ func resourceArmContainerRegistry() *schema.Resource {
"location": locationSchema(),
"sku": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
ValidateFunc: validation.StringInSlice([]string{
string(containerregistry.Basic),
}, true),
},
"admin_enabled": {
Type: schema.TypeBool,
Optional: true,
@ -93,13 +106,18 @@ func resourceArmContainerRegistryCreate(d *schema.ResourceData, meta interface{}
resourceGroup := d.Get("resource_group_name").(string)
name := d.Get("name").(string)
location := d.Get("location").(string)
sku := d.Get("sku").(string)
adminUserEnabled := d.Get("admin_enabled").(bool)
tags := d.Get("tags").(map[string]interface{})
parameters := containerregistry.Registry{
parameters := containerregistry.RegistryCreateParameters{
Location: &location,
RegistryProperties: &containerregistry.RegistryProperties{
Sku: &containerregistry.Sku{
Name: &sku,
Tier: containerregistry.SkuTier(sku),
},
RegistryPropertiesCreateParameters: &containerregistry.RegistryPropertiesCreateParameters{
AdminUserEnabled: &adminUserEnabled,
},
Tags: expandTags(tags),
@ -109,17 +127,63 @@ func resourceArmContainerRegistryCreate(d *schema.ResourceData, meta interface{}
account := accounts[0].(map[string]interface{})
storageAccountName := account["name"].(string)
storageAccountAccessKey := account["access_key"].(string)
parameters.RegistryProperties.StorageAccount = &containerregistry.StorageAccountProperties{
parameters.RegistryPropertiesCreateParameters.StorageAccount = &containerregistry.StorageAccountParameters{
Name: azure.String(storageAccountName),
AccessKey: azure.String(storageAccountAccessKey),
}
_, err := client.CreateOrUpdate(resourceGroup, name, parameters)
_, error := client.Create(resourceGroup, name, parameters, make(<-chan struct{}))
err := <-error
if err != nil {
return err
}
read, err := client.GetProperties(resourceGroup, name)
read, err := client.Get(resourceGroup, name)
if err != nil {
return err
}
if read.ID == nil {
return fmt.Errorf("Cannot read Container Registry %s (resource group %s) ID", name, resourceGroup)
}
d.SetId(*read.ID)
return resourceArmContainerRegistryRead(d, meta)
}
func resourceArmContainerRegistryUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient).containerRegistryClient
log.Printf("[INFO] preparing arguments for AzureRM Container Registry update.")
resourceGroup := d.Get("resource_group_name").(string)
name := d.Get("name").(string)
accounts := d.Get("storage_account").(*schema.Set).List()
account := accounts[0].(map[string]interface{})
storageAccountName := account["name"].(string)
storageAccountAccessKey := account["access_key"].(string)
adminUserEnabled := d.Get("admin_enabled").(bool)
tags := d.Get("tags").(map[string]interface{})
parameters := containerregistry.RegistryUpdateParameters{
RegistryPropertiesUpdateParameters: &containerregistry.RegistryPropertiesUpdateParameters{
AdminUserEnabled: &adminUserEnabled,
StorageAccount: &containerregistry.StorageAccountParameters{
Name: azure.String(storageAccountName),
AccessKey: azure.String(storageAccountAccessKey),
},
},
Tags: expandTags(tags),
}
_, err := client.Update(resourceGroup, name, parameters)
if err != nil {
return err
}
read, err := client.Get(resourceGroup, name)
if err != nil {
return err
}
@ -143,7 +207,7 @@ func resourceArmContainerRegistryRead(d *schema.ResourceData, meta interface{})
resourceGroup := id.ResourceGroup
name := id.Path["registries"]
resp, err := client.GetProperties(resourceGroup, name)
resp, err := client.Get(resourceGroup, name)
if err != nil {
return fmt.Errorf("Error making Read request on Azure Container Registry %s: %s", name, err)
}
@ -158,18 +222,25 @@ func resourceArmContainerRegistryRead(d *schema.ResourceData, meta interface{})
d.Set("admin_enabled", resp.AdminUserEnabled)
d.Set("login_server", resp.LoginServer)
if resp.Sku != nil {
d.Set("sku", string(resp.Sku.Tier))
}
if resp.StorageAccount != nil {
flattenArmContainerRegistryStorageAccount(d, resp.StorageAccount)
}
if *resp.AdminUserEnabled {
credsResp, err := client.GetCredentials(resourceGroup, name)
credsResp, err := client.ListCredentials(resourceGroup, name)
if err != nil {
return fmt.Errorf("Error making Read request on Azure Container Registry %s for Credentials: %s", name, err)
}
d.Set("admin_username", credsResp.Username)
d.Set("admin_password", credsResp.Password)
for _, v := range *credsResp.Passwords {
d.Set("admin_password", v.Value)
break
}
} else {
d.Set("admin_username", "")
d.Set("admin_password", "")

View File

@ -0,0 +1,34 @@
package azurerm
import (
"fmt"
"log"
"github.com/hashicorp/terraform/terraform"
)
func resourceAzureRMContainerRegistryMigrateState(
v int, is *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) {
switch v {
case 0:
log.Println("[INFO] Found AzureRM Container Registry State v0; migrating to v1")
return migrateAzureRMContainerRegistryStateV0toV1(is)
default:
return is, fmt.Errorf("Unexpected schema version: %d", v)
}
}
func migrateAzureRMContainerRegistryStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) {
if is.Empty() {
log.Println("[DEBUG] Empty InstanceState; nothing to migrate.")
return is, nil
}
log.Printf("[DEBUG] ARM Container Registry Attributes before Migration: %#v", is.Attributes)
is.Attributes["sku"] = "Basic"
log.Printf("[DEBUG] ARM Container Registry Attributes after State Migration: %#v", is.Attributes)
return is, nil
}

View File

@ -0,0 +1,40 @@
package azurerm
import (
"testing"
"github.com/hashicorp/terraform/terraform"
)
func TestAzureRMContainerRegistryMigrateState(t *testing.T) {
cases := map[string]struct {
StateVersion int
ID string
Attributes map[string]string
Expected string
Meta interface{}
}{
"v0_1_without_value": {
StateVersion: 0,
ID: "some_id",
Attributes: map[string]string{},
Expected: "Basic",
},
}
for tn, tc := range cases {
is := &terraform.InstanceState{
ID: tc.ID,
Attributes: tc.Attributes,
}
is, err := resourceAzureRMContainerRegistryMigrateState(tc.StateVersion, is, tc.Meta)
if err != nil {
t.Fatalf("bad: %s, err: %#v", tn, err)
}
if is.Attributes["sku"] != tc.Expected {
t.Fatalf("bad Container Registry Migrate: %s\n\n expected: %s", is.Attributes["sku"], tc.Expected)
}
}
}

View File

@ -69,7 +69,7 @@ func TestAccAzureRMContainerRegistryName_validation(t *testing.T) {
func TestAccAzureRMContainerRegistry_basic(t *testing.T) {
ri := acctest.RandInt()
rs := acctest.RandString(4)
config := fmt.Sprintf(testAccAzureRMContainerRegistry_basic, ri, rs, ri)
config := testAccAzureRMContainerRegistry_basic(ri, rs)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -89,7 +89,7 @@ func TestAccAzureRMContainerRegistry_basic(t *testing.T) {
func TestAccAzureRMContainerRegistry_complete(t *testing.T) {
ri := acctest.RandInt()
rs := acctest.RandString(4)
config := fmt.Sprintf(testAccAzureRMContainerRegistry_complete, ri, rs, ri)
config := testAccAzureRMContainerRegistry_complete(ri, rs)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -106,6 +106,33 @@ func TestAccAzureRMContainerRegistry_complete(t *testing.T) {
})
}
func TestAccAzureRMContainerRegistry_update(t *testing.T) {
ri := acctest.RandInt()
rs := acctest.RandString(4)
config := testAccAzureRMContainerRegistry_complete(ri, rs)
updatedConfig := testAccAzureRMContainerRegistry_completeUpdated(ri, rs)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMContainerRegistryDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMContainerRegistryExists("azurerm_container_registry.test"),
),
},
{
Config: updatedConfig,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMContainerRegistryExists("azurerm_container_registry.test"),
),
},
},
})
}
func testCheckAzureRMContainerRegistryDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*ArmClient).containerRegistryClient
@ -117,7 +144,7 @@ func testCheckAzureRMContainerRegistryDestroy(s *terraform.State) error {
name := rs.Primary.Attributes["name"]
resourceGroup := rs.Primary.Attributes["resource_group_name"]
resp, err := conn.GetProperties(resourceGroup, name)
resp, err := conn.Get(resourceGroup, name)
if err != nil {
return nil
@ -147,7 +174,7 @@ func testCheckAzureRMContainerRegistryExists(name string) resource.TestCheckFunc
conn := testAccProvider.Meta().(*ArmClient).containerRegistryClient
resp, err := conn.GetProperties(resourceGroup, name)
resp, err := conn.Get(resourceGroup, name)
if err != nil {
return fmt.Errorf("Bad: Get on containerRegistryClient: %s", err)
}
@ -160,7 +187,8 @@ func testCheckAzureRMContainerRegistryExists(name string) resource.TestCheckFunc
}
}
var testAccAzureRMContainerRegistry_basic = `
func testAccAzureRMContainerRegistry_basic(rInt int, rStr string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "testAccRg-%d"
location = "West US"
@ -177,15 +205,18 @@ resource "azurerm_container_registry" "test" {
name = "testacccr%d"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
sku = "Basic"
storage_account {
name = "${azurerm_storage_account.test.name}"
access_key = "${azurerm_storage_account.test.primary_access_key}"
}
}
`
`, rInt, rStr, rInt)
}
var testAccAzureRMContainerRegistry_complete = `
func testAccAzureRMContainerRegistry_complete(rInt int, rStr string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "testAccRg-%d"
location = "West US"
@ -203,6 +234,7 @@ resource "azurerm_container_registry" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
admin_enabled = false
sku = "Basic"
storage_account {
name = "${azurerm_storage_account.test.name}"
@ -213,4 +245,38 @@ resource "azurerm_container_registry" "test" {
environment = "production"
}
}
`
`, rInt, rStr, rInt)
}
func testAccAzureRMContainerRegistry_completeUpdated(rInt int, rStr string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "testAccRg-%d"
location = "West US"
}
resource "azurerm_storage_account" "test" {
name = "testaccsa%s"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
account_type = "Standard_LRS"
}
resource "azurerm_container_registry" "test" {
name = "testacccr%d"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
admin_enabled = true
sku = "Basic"
storage_account {
name = "${azurerm_storage_account.test.name}"
access_key = "${azurerm_storage_account.test.primary_access_key}"
}
tags {
environment = "production"
}
}
`, rInt, rStr, rInt)
}

View File

@ -224,7 +224,8 @@ func resourceArmContainerServiceCreate(d *schema.ResourceData, meta interface{})
parameters.ServicePrincipalProfile = servicePrincipalProfile
}
_, err := containerServiceClient.CreateOrUpdate(resGroup, name, parameters, make(chan struct{}))
_, error := containerServiceClient.CreateOrUpdate(resGroup, name, parameters, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -315,7 +316,9 @@ func resourceArmContainerServiceDelete(d *schema.ResourceData, meta interface{})
resGroup := id.ResourceGroup
name := id.Path["containerServices"]
resp, err := containerServiceClient.Delete(resGroup, name, make(chan struct{}))
delResp, error := containerServiceClient.Delete(resGroup, name, make(chan struct{}))
resp := <-delResp
err = <-error
if err != nil {
return err
}

View File

@ -69,8 +69,8 @@ func resourceArmEventHubCreate(d *schema.ResourceData, meta interface{}) error {
log.Printf("[INFO] preparing arguments for Azure ARM EventHub creation.")
name := d.Get("name").(string)
namespaceName := d.Get("namespace_name").(string)
location := d.Get("location").(string)
namespaceName := d.Get("namespace_name").(string)
resGroup := d.Get("resource_group_name").(string)
partitionCount := int64(d.Get("partition_count").(int))
messageRetention := int64(d.Get("message_retention").(int))
@ -123,9 +123,9 @@ func resourceArmEventHubRead(d *schema.ResourceData, meta interface{}) error {
}
d.Set("name", resp.Name)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("namespace_name", namespaceName)
d.Set("resource_group_name", resGroup)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("partition_count", resp.Properties.PartitionCount)
d.Set("message_retention", resp.Properties.MessageRetentionInDays)

View File

@ -90,12 +90,12 @@ func resourceArmEventHubAuthorizationRule() *schema.Resource {
func resourceArmEventHubAuthorizationRuleCreateUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient).eventHubClient
log.Printf("[INFO] preparing arguments for Azure ARM EventHub Authorization Rule creation.")
log.Printf("[INFO] preparing arguments for AzureRM EventHub Authorization Rule creation.")
name := d.Get("name").(string)
location := d.Get("location").(string)
namespaceName := d.Get("namespace_name").(string)
eventHubName := d.Get("eventhub_name").(string)
location := d.Get("location").(string)
resGroup := d.Get("resource_group_name").(string)
rights, err := expandEventHubAuthorizationRuleAccessRights(d)
@ -157,10 +157,10 @@ func resourceArmEventHubAuthorizationRuleRead(d *schema.ResourceData, meta inter
}
d.Set("name", name)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("eventhub_name", eventHubName)
d.Set("namespace_name", namespaceName)
d.Set("resource_group_name", resGroup)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
flattenEventHubAuthorizationRuleAccessRights(d, resp)

View File

@ -144,20 +144,20 @@ func testCheckAzureRMEventHubAuthorizationRuleExists(name string) resource.TestC
var testAccAzureRMEventHubAuthorizationRule_listen = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "West US"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_eventhub_namespace" "test" {
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
}
resource "azurerm_eventhub" "test" {
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
partition_count = 2
message_retention = 7
}
@ -174,20 +174,20 @@ resource "azurerm_eventhub_authorization_rule" "test" {
var testAccAzureRMEventHubAuthorizationRule_send = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "West US"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_eventhub_namespace" "test" {
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
}
resource "azurerm_eventhub" "test" {
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
partition_count = 2
message_retention = 7
}
@ -204,20 +204,20 @@ resource "azurerm_eventhub_authorization_rule" "test" {
var testAccAzureRMEventHubAuthorizationRule_readwrite = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "West US"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_eventhub_namespace" "test" {
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
}
resource "azurerm_eventhub" "test" {
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
partition_count = 2
message_retention = 7
}
@ -234,20 +234,20 @@ resource "azurerm_eventhub_authorization_rule" "test" {
var testAccAzureRMEventHubAuthorizationRule_manage = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "West US"
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_eventhub_namespace" "test" {
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
name = "acctesteventhubnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard"
}
resource "azurerm_eventhub" "test" {
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
partition_count = 2
message_retention = 7
}

View File

@ -58,12 +58,12 @@ func resourceArmEventHubConsumerGroup() *schema.Resource {
func resourceArmEventHubConsumerGroupCreateUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient)
eventhubClient := client.eventHubConsumerGroupClient
log.Printf("[INFO] preparing arguments for Azure ARM EventHub Consumer Group creation.")
log.Printf("[INFO] preparing arguments for AzureRM EventHub Consumer Group creation.")
name := d.Get("name").(string)
location := d.Get("location").(string)
namespaceName := d.Get("namespace_name").(string)
eventHubName := d.Get("eventhub_name").(string)
location := d.Get("location").(string)
resGroup := d.Get("resource_group_name").(string)
userMetaData := d.Get("user_metadata").(string)
@ -117,10 +117,10 @@ func resourceArmEventHubConsumerGroupRead(d *schema.ResourceData, meta interface
}
d.Set("name", name)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("eventhub_name", eventHubName)
d.Set("namespace_name", namespaceName)
d.Set("resource_group_name", resGroup)
d.Set("location", azureRMNormalizeLocation(*resp.Location))
d.Set("user_metadata", resp.ConsumerGroupProperties.UserMetadata)
return nil

View File

@ -122,20 +122,20 @@ resource "azurerm_eventhub_namespace" "test" {
}
resource "azurerm_eventhub" "test" {
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
partition_count = 2
message_retention = 7
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
partition_count = 2
message_retention = 7
}
resource "azurerm_eventhub_consumer_group" "test" {
name = "acctesteventhubcg-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
eventhub_name = "${azurerm_eventhub.test.name}"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
eventhub_name = "${azurerm_eventhub.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
}
`
@ -152,20 +152,20 @@ resource "azurerm_eventhub_namespace" "test" {
}
resource "azurerm_eventhub" "test" {
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
partition_count = 2
message_retention = 7
name = "acctesteventhub-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
partition_count = 2
message_retention = 7
}
resource "azurerm_eventhub_consumer_group" "test" {
name = "acctesteventhubcg-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
eventhub_name = "${azurerm_eventhub.test.name}"
name = "acctesteventhubcg-%d"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
eventhub_name = "${azurerm_eventhub.test.name}"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
user_metadata = "some-meta-data"
user_metadata = "some-meta-data"
}
`

View File

@ -100,7 +100,8 @@ func resourceArmEventHubNamespaceCreate(d *schema.ResourceData, meta interface{}
Tags: expandTags(tags),
}
_, err := namespaceClient.CreateOrUpdate(resGroup, name, parameters, make(chan struct{}))
_, error := namespaceClient.CreateOrUpdate(resGroup, name, parameters, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -169,9 +170,10 @@ func resourceArmEventHubNamespaceDelete(d *schema.ResourceData, meta interface{}
resGroup := id.ResourceGroup
name := id.Path["namespaces"]
resp, err := namespaceClient.Delete(resGroup, name, make(chan struct{}))
_, error := namespaceClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
if resp.StatusCode != http.StatusNotFound {
if err != nil {
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Namespace '%s': %+v", name, err)
}

View File

@ -142,7 +142,8 @@ func resourceArmExpressRouteCircuitCreateOrUpdate(d *schema.ResourceData, meta i
Tags: expandedTags,
}
_, err := ercClient.CreateOrUpdate(resGroup, name, erc, make(chan struct{}))
_, error := ercClient.CreateOrUpdate(resGroup, name, erc, make(chan struct{}))
err := <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating ExpressRouteCircuit {{err}}", err)
}
@ -203,7 +204,8 @@ func resourceArmExpressRouteCircuitDelete(d *schema.ResourceData, meta interface
return errwrap.Wrapf("Error Parsing Azure Resource ID {{err}}", err)
}
_, err = ercClient.Delete(resGroup, name, make(chan struct{}))
_, error := ercClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -127,7 +127,8 @@ func resourceArmLoadBalancerCreate(d *schema.ResourceData, meta interface{}) err
LoadBalancerPropertiesFormat: &properties,
}
_, err := loadBalancerClient.CreateOrUpdate(resGroup, name, loadbalancer, make(chan struct{}))
_, error := loadBalancerClient.CreateOrUpdate(resGroup, name, loadbalancer, make(chan struct{}))
err := <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}
@ -205,7 +206,8 @@ func resourceArmLoadBalancerDelete(d *schema.ResourceData, meta interface{}) err
resGroup := id.ResourceGroup
name := id.Path["loadBalancers"]
_, err = loadBalancerClient.Delete(resGroup, name, make(chan struct{}))
_, error := loadBalancerClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Deleting LoadBalancer {{err}}", err)
}

View File

@ -28,14 +28,7 @@ func resourceArmLoadBalancerBackendAddressPool() *schema.Resource {
ForceNew: true,
},
"location": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
StateFunc: azureRMNormalizeLocation,
DiffSuppressFunc: azureRMSuppressLocationDiff,
Deprecated: "location is no longer used",
},
"location": deprecatedLocationSchema(),
"resource_group_name": {
Type: schema.TypeString,
@ -99,7 +92,8 @@ func resourceArmLoadBalancerBackendAddressPoolCreate(d *schema.ResourceData, met
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}
@ -217,7 +211,8 @@ func resourceArmLoadBalancerBackendAddressPoolDelete(d *schema.ResourceData, met
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}

View File

@ -157,7 +157,8 @@ func testCheckAzureRMLoadBalancerBackEndAddressPoolDisappears(addressPoolName st
return err
}
_, err = conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
_, error := conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
err = <-error
if err != nil {
return fmt.Errorf("Error Creating/Updating LoadBalancer %s", err)
}

View File

@ -29,14 +29,7 @@ func resourceArmLoadBalancerNatPool() *schema.Resource {
ForceNew: true,
},
"location": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
StateFunc: azureRMNormalizeLocation,
DiffSuppressFunc: azureRMSuppressLocationDiff,
Deprecated: "location is no longer used",
},
"location": deprecatedLocationSchema(),
"resource_group_name": {
Type: schema.TypeString,
@ -124,7 +117,8 @@ func resourceArmLoadBalancerNatPoolCreate(d *schema.ResourceData, meta interface
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}
@ -239,7 +233,8 @@ func resourceArmLoadBalancerNatPoolDelete(d *schema.ResourceData, meta interface
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}

View File

@ -197,7 +197,8 @@ func testCheckAzureRMLoadBalancerNatPoolDisappears(natPoolName string, lb *netwo
return err
}
_, err = conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
_, error := conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
err = <-error
if err != nil {
return fmt.Errorf("Error Creating/Updating LoadBalancer %s", err)
}

View File

@ -29,14 +29,7 @@ func resourceArmLoadBalancerNatRule() *schema.Resource {
ForceNew: true,
},
"location": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
StateFunc: azureRMNormalizeLocation,
DiffSuppressFunc: azureRMSuppressLocationDiff,
Deprecated: "location is no longer used",
},
"location": deprecatedLocationSchema(),
"resource_group_name": {
Type: schema.TypeString,
@ -124,7 +117,8 @@ func resourceArmLoadBalancerNatRuleCreate(d *schema.ResourceData, meta interface
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating / Updating LoadBalancer {{err}}", err)
}
@ -242,7 +236,8 @@ func resourceArmLoadBalancerNatRuleDelete(d *schema.ResourceData, meta interface
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}

View File

@ -199,7 +199,8 @@ func testCheckAzureRMLoadBalancerNatRuleDisappears(natRuleName string, lb *netwo
return err
}
_, err = conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
_, error := conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
err = <-error
if err != nil {
return fmt.Errorf("Error Creating/Updating LoadBalancer %s", err)
}

View File

@ -29,14 +29,7 @@ func resourceArmLoadBalancerProbe() *schema.Resource {
ForceNew: true,
},
"location": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
StateFunc: azureRMNormalizeLocation,
DiffSuppressFunc: azureRMSuppressLocationDiff,
Deprecated: "location is no longer used",
},
"location": deprecatedLocationSchema(),
"resource_group_name": {
Type: schema.TypeString,
@ -129,7 +122,8 @@ func resourceArmLoadBalancerProbeCreate(d *schema.ResourceData, meta interface{}
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}
@ -243,7 +237,8 @@ func resourceArmLoadBalancerProbeDelete(d *schema.ResourceData, meta interface{}
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}

View File

@ -227,7 +227,8 @@ func testCheckAzureRMLoadBalancerProbeDisappears(addressPoolName string, lb *net
return err
}
_, err = conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
_, error := conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
err = <-error
if err != nil {
return fmt.Errorf("Error Creating/Updating LoadBalancer %s", err)
}

View File

@ -31,14 +31,7 @@ func resourceArmLoadBalancerRule() *schema.Resource {
ValidateFunc: validateArmLoadBalancerRuleName,
},
"location": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
StateFunc: azureRMNormalizeLocation,
DiffSuppressFunc: azureRMSuppressLocationDiff,
Deprecated: "location is no longer used",
},
"location": deprecatedLocationSchema(),
"resource_group_name": {
Type: schema.TypeString,
@ -151,7 +144,8 @@ func resourceArmLoadBalancerRuleCreate(d *schema.ResourceData, meta interface{})
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}
@ -286,7 +280,8 @@ func resourceArmLoadBalancerRuleDelete(d *schema.ResourceData, meta interface{})
return errwrap.Wrapf("Error Getting LoadBalancer Name and Group: {{err}}", err)
}
_, err = lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
_, error := lbClient.CreateOrUpdate(resGroup, loadBalancerName, *loadBalancer, make(chan struct{}))
err = <-error
if err != nil {
return errwrap.Wrapf("Error Creating/Updating LoadBalancer {{err}}", err)
}

View File

@ -294,7 +294,8 @@ func testCheckAzureRMLoadBalancerRuleDisappears(ruleName string, lb *network.Loa
return err
}
_, err = conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
_, error := conn.CreateOrUpdate(id.ResourceGroup, *lb.Name, *lb, make(chan struct{}))
err = <-error
if err != nil {
return fmt.Errorf("Error Creating/Updating LoadBalancer %s", err)
}

View File

@ -74,7 +74,8 @@ func resourceArmLocalNetworkGatewayCreate(d *schema.ResourceData, meta interface
},
}
_, err := lnetClient.CreateOrUpdate(resGroup, name, gateway, make(chan struct{}))
_, error := lnetClient.CreateOrUpdate(resGroup, name, gateway, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Error creating Azure ARM Local Network Gateway '%s': %s", name, err)
}
@ -140,7 +141,8 @@ func resourceArmLocalNetworkGatewayDelete(d *schema.ResourceData, meta interface
name := id.Path["localNetworkGateways"]
resGroup := id.ResourceGroup
_, err = lnetClient.Delete(resGroup, name, make(chan struct{}))
_, error := lnetClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
if err != nil {
return fmt.Errorf("Error issuing Azure ARM delete request of local network gateway '%s': %s", name, err)
}

View File

@ -104,7 +104,9 @@ func testCheckAzureRMLocalNetworkGatewayDisappears(name string) resource.TestChe
// and finally, check that it exists on Azure:
lnetClient := testAccProvider.Meta().(*ArmClient).localNetConnClient
resp, err := lnetClient.Delete(resGrp, localNetName, make(chan struct{}))
deleteResp, error := lnetClient.Delete(resGrp, localNetName, make(chan struct{}))
resp := <-deleteResp
err = <-error
if err != nil {
if resp.StatusCode == http.StatusNotFound {
return fmt.Errorf("Local network gateway '%s' (resource group '%s') does not exist on Azure.", localNetName, resGrp)

View File

@ -151,8 +151,9 @@ func resourceArmManagedDiskCreate(d *schema.ResourceData, meta interface{}) erro
createDisk.CreationData = creationData
_, diskErr := diskClient.CreateOrUpdate(resGroup, name, createDisk, make(chan struct{}))
if diskErr != nil {
return diskErr
err := <-diskErr
if err != nil {
return err
}
read, err := diskClient.Get(resGroup, name)
@ -214,7 +215,9 @@ func resourceArmManagedDiskDelete(d *schema.ResourceData, meta interface{}) erro
resGroup := id.ResourceGroup
name := id.Path["disks"]
if _, err = diskClient.Delete(resGroup, name, make(chan struct{})); err != nil {
_, error := diskClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
if err != nil {
return err
}

View File

@ -199,7 +199,8 @@ func testDeleteAzureRMVirtualMachine(name string) resource.TestCheckFunc {
conn := testAccProvider.Meta().(*ArmClient).vmClient
_, err := conn.Delete(resourceGroup, vmName, make(chan struct{}))
_, error := conn.Delete(resourceGroup, vmName, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on vmClient: %s", err)
}

View File

@ -224,7 +224,8 @@ func resourceArmNetworkInterfaceCreate(d *schema.ResourceData, meta interface{})
Tags: expandTags(tags),
}
_, err := ifaceClient.CreateOrUpdate(resGroup, name, iface, make(chan struct{}))
_, error := ifaceClient.CreateOrUpdate(resGroup, name, iface, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -350,7 +351,8 @@ func resourceArmNetworkInterfaceDelete(d *schema.ResourceData, meta interface{})
azureRMLockMultiple(&namesToLock)
defer azureRMUnlockMultiple(&namesToLock)
_, err = ifaceClient.Delete(resGroup, name, make(chan struct{}))
_, error := ifaceClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -161,7 +161,8 @@ func testCheckAzureRMNetworkInterfaceDisappears(name string) resource.TestCheckF
conn := testAccProvider.Meta().(*ArmClient).ifaceClient
_, err := conn.Delete(resourceGroup, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on ifaceClient: %s", err)
}

View File

@ -146,7 +146,8 @@ func resourceArmNetworkSecurityGroupCreate(d *schema.ResourceData, meta interfac
Tags: expandTags(tags),
}
_, err := secClient.CreateOrUpdate(resGroup, name, sg, make(chan struct{}))
_, error := secClient.CreateOrUpdate(resGroup, name, sg, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -217,7 +218,8 @@ func resourceArmNetworkSecurityGroupDelete(d *schema.ResourceData, meta interfac
resGroup := id.ResourceGroup
name := id.Path["networkSecurityGroups"]
_, err = secGroupClient.Delete(resGroup, name, make(chan struct{}))
_, error := secGroupClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -153,7 +153,8 @@ func testCheckAzureRMNetworkSecurityGroupDisappears(name string) resource.TestCh
conn := testAccProvider.Meta().(*ArmClient).secGroupClient
_, err := conn.Delete(resourceGroup, sgName, make(chan struct{}))
_, error := conn.Delete(resourceGroup, sgName, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on secGroupClient: %s", err)
}

View File

@ -144,7 +144,8 @@ func resourceArmNetworkSecurityRuleCreate(d *schema.ResourceData, meta interface
SecurityRulePropertiesFormat: &properties,
}
_, err := secClient.CreateOrUpdate(resGroup, nsgName, name, sgr, make(chan struct{}))
_, error := secClient.CreateOrUpdate(resGroup, nsgName, name, sgr, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -213,7 +214,8 @@ func resourceArmNetworkSecurityRuleDelete(d *schema.ResourceData, meta interface
armMutexKV.Lock(nsgName)
defer armMutexKV.Unlock(nsgName)
_, err = secRuleClient.Delete(resGroup, nsgName, sgRuleName, make(chan struct{}))
_, error := secRuleClient.Delete(resGroup, nsgName, sgRuleName, make(chan struct{}))
err = <-error
return err
}

View File

@ -119,7 +119,8 @@ func testCheckAzureRMNetworkSecurityRuleDisappears(name string) resource.TestChe
conn := testAccProvider.Meta().(*ArmClient).secRuleClient
_, err := conn.Delete(resourceGroup, sgName, sgrName, make(chan struct{}))
_, error := conn.Delete(resourceGroup, sgName, sgrName, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on secRuleClient: %s", err)
}

View File

@ -130,7 +130,8 @@ func resourceArmPublicIpCreate(d *schema.ResourceData, meta interface{}) error {
Tags: expandTags(tags),
}
_, err := publicIPClient.CreateOrUpdate(resGroup, name, publicIp, make(chan struct{}))
_, error := publicIPClient.CreateOrUpdate(resGroup, name, publicIp, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -195,7 +196,8 @@ func resourceArmPublicIpDelete(d *schema.ResourceData, meta interface{}) error {
resGroup := id.ResourceGroup
name := id.Path["publicIPAddresses"]
_, err = publicIPClient.Delete(resGroup, name, make(chan struct{}))
_, error := publicIPClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -278,7 +278,8 @@ func testCheckAzureRMPublicIpDisappears(name string) resource.TestCheckFunc {
conn := testAccProvider.Meta().(*ArmClient).publicIPClient
_, err := conn.Delete(resourceGroup, publicIpName, make(chan struct{}))
_, error := conn.Delete(resourceGroup, publicIpName, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on publicIPClient: %s", err)
}

View File

@ -170,7 +170,8 @@ func resourceArmRedisCacheCreate(d *schema.ResourceData, meta interface{}) error
parameters.ShardCount = &shardCount
}
_, err := client.Create(resGroup, name, parameters, make(chan struct{}))
_, error := client.Create(resGroup, name, parameters, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -333,7 +334,9 @@ func resourceArmRedisCacheDelete(d *schema.ResourceData, meta interface{}) error
resGroup := id.ResourceGroup
name := id.Path["Redis"]
resp, err := redisClient.Delete(resGroup, name, make(chan struct{}))
deleteResp, error := redisClient.Delete(resGroup, name, make(chan struct{}))
resp := <-deleteResp
err = <-error
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("Error issuing Azure ARM delete request of Redis Cache Instance '%s': %s", name, err)

View File

@ -126,7 +126,8 @@ func testCheckAzureRMResourceGroupDisappears(name string) resource.TestCheckFunc
// Ensure resource group exists in API
conn := testAccProvider.Meta().(*ArmClient).resourceGroupClient
_, err := conn.Delete(resourceGroup, make(chan struct{}))
_, error := conn.Delete(resourceGroup, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on resourceGroupClient: %s", err)
}

View File

@ -90,7 +90,8 @@ func resourceArmRouteCreate(d *schema.ResourceData, meta interface{}) error {
RoutePropertiesFormat: &properties,
}
_, err := routesClient.CreateOrUpdate(resGroup, rtName, name, route, make(chan struct{}))
_, error := routesClient.CreateOrUpdate(resGroup, rtName, name, route, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -155,7 +156,8 @@ func resourceArmRouteDelete(d *schema.ResourceData, meta interface{}) error {
armMutexKV.Lock(rtName)
defer armMutexKV.Unlock(rtName)
_, err = routesClient.Delete(resGroup, rtName, routeName, make(chan struct{}))
_, error := routesClient.Delete(resGroup, rtName, routeName, make(chan struct{}))
err = <-error
return err
}

View File

@ -111,7 +111,8 @@ func resourceArmRouteTableCreate(d *schema.ResourceData, meta interface{}) error
}
}
_, err := routeTablesClient.CreateOrUpdate(resGroup, name, routeSet, make(chan struct{}))
_, error := routeTablesClient.CreateOrUpdate(resGroup, name, routeSet, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -180,7 +181,8 @@ func resourceArmRouteTableDelete(d *schema.ResourceData, meta interface{}) error
resGroup := id.ResourceGroup
name := id.Path["routeTables"]
_, err = routeTablesClient.Delete(resGroup, name, make(chan struct{}))
_, error := routeTablesClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -215,7 +215,8 @@ func testCheckAzureRMRouteTableDisappears(name string) resource.TestCheckFunc {
conn := testAccProvider.Meta().(*ArmClient).routeTablesClient
_, err := conn.Delete(resourceGroup, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on routeTablesClient: %s", err)
}

View File

@ -127,7 +127,8 @@ func testCheckAzureRMRouteDisappears(name string) resource.TestCheckFunc {
conn := testAccProvider.Meta().(*ArmClient).routesClient
_, err := conn.Delete(resourceGroup, rtName, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, rtName, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on routesClient: %s", err)
}

View File

@ -101,7 +101,8 @@ func resourceArmServiceBusNamespaceCreate(d *schema.ResourceData, meta interface
Tags: expandTags(tags),
}
_, err := namespaceClient.CreateOrUpdate(resGroup, name, parameters, make(chan struct{}))
_, error := namespaceClient.CreateOrUpdate(resGroup, name, parameters, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -170,7 +171,9 @@ func resourceArmServiceBusNamespaceDelete(d *schema.ResourceData, meta interface
resGroup := id.ResourceGroup
name := id.Path["namespaces"]
resp, err := namespaceClient.Delete(resGroup, name, make(chan struct{}))
deleteResp, error := namespaceClient.Delete(resGroup, name, make(chan struct{}))
resp := <-deleteResp
err = <-error
if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("Error issuing Azure ARM delete request of ServiceBus Namespace'%s': %+v", name, err)

View File

@ -101,7 +101,8 @@ func resourceArmSqlElasticPoolCreate(d *schema.ResourceData, meta interface{}) e
Tags: expandTags(tags),
}
_, err := elasticPoolsClient.CreateOrUpdate(resGroup, serverName, name, elasticPool, make(chan struct{}))
_, error := elasticPoolsClient.CreateOrUpdate(resGroup, serverName, name, elasticPool, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -176,7 +177,7 @@ func resourceArmSqlElasticPoolDelete(d *schema.ResourceData, meta interface{}) e
}
func getArmSqlElasticPoolProperties(d *schema.ResourceData) *sql.ElasticPoolProperties {
edition := sql.ElasticPoolEditions(d.Get("edition").(string))
edition := sql.ElasticPoolEdition(d.Get("edition").(string))
dtu := int32(d.Get("dtu").(int))
props := &sql.ElasticPoolProperties{
@ -213,8 +214,8 @@ func parseArmSqlElasticPoolId(sqlElasticPoolId string) (string, string, string,
func validateSqlElasticPoolEdition() schema.SchemaValidateFunc {
return validation.StringInSlice([]string{
string(sql.ElasticPoolEditionsBasic),
string(sql.ElasticPoolEditionsStandard),
string(sql.ElasticPoolEditionsPremium),
string(sql.ElasticPoolEditionBasic),
string(sql.ElasticPoolEditionStandard),
string(sql.ElasticPoolEditionPremium),
}, false)
}

View File

@ -187,8 +187,8 @@ func resourceArmStorageAccountCreate(d *schema.ResourceData, meta interface{}) e
}
// Create
_, createErr := storageClient.Create(
resourceGroupName, storageAccountName, opts, make(chan struct{}))
_, createError := storageClient.Create(resourceGroupName, storageAccountName, opts, make(chan struct{}))
createErr := <-createError
// The only way to get the ID back apparently is to read the resource again
read, err := storageClient.GetProperties(resourceGroupName, storageAccountName)

View File

@ -155,13 +155,21 @@ func resourceArmStorageBlobCreate(d *schema.ResourceData, meta interface{}) erro
log.Printf("[INFO] Creating blob %q in storage account %q", name, storageAccountName)
if sourceUri != "" {
if err := blobClient.CopyBlob(cont, name, sourceUri); err != nil {
options := &storage.CopyOptions{}
container := blobClient.GetContainerReference(cont)
blob := container.GetBlobReference(name)
err := blob.Copy(sourceUri, options)
if err != nil {
return fmt.Errorf("Error creating storage blob on Azure: %s", err)
}
} else {
switch strings.ToLower(blobType) {
case "block":
if err := blobClient.CreateBlockBlob(cont, name); err != nil {
options := &storage.PutBlobOptions{}
container := blobClient.GetContainerReference(cont)
blob := container.GetBlobReference(name)
err := blob.CreateBlockBlob(options)
if err != nil {
return fmt.Errorf("Error creating storage blob on Azure: %s", err)
}
@ -183,7 +191,13 @@ func resourceArmStorageBlobCreate(d *schema.ResourceData, meta interface{}) erro
}
} else {
size := int64(d.Get("size").(int))
if err := blobClient.PutPageBlob(cont, name, size, map[string]string{}); err != nil {
options := &storage.PutBlobOptions{}
container := blobClient.GetContainerReference(cont)
blob := container.GetBlobReference(name)
blob.Properties.ContentLength = size
err := blob.PutPageBlob(options)
if err != nil {
return fmt.Errorf("Error creating storage blob on Azure: %s", err)
}
}
@ -213,7 +227,12 @@ func resourceArmStorageBlobPageUploadFromSource(container, name, source string,
return fmt.Errorf("Error splitting source file %q into pages: %s", source, err)
}
if err := client.PutPageBlob(container, name, blobSize, map[string]string{}); err != nil {
options := &storage.PutBlobOptions{}
containerRef := client.GetContainerReference(container)
blob := containerRef.GetBlobReference(name)
blob.Properties.ContentLength = blobSize
err = blob.PutPageBlob(options)
if err != nil {
return fmt.Errorf("Error creating storage blob on Azure: %s", err)
}
@ -343,7 +362,15 @@ func resourceArmStorageBlobPageUploadWorker(ctx resourceArmStorageBlobPageUpload
}
for x := 0; x < ctx.attempts; x++ {
err = ctx.client.PutPage(ctx.container, ctx.name, start, end, storage.PageWriteTypeUpdate, chunk, map[string]string{})
container := ctx.client.GetContainerReference(ctx.container)
blob := container.GetBlobReference(ctx.name)
blobRange := storage.BlobRange{
Start: uint64(start),
End: uint64(end),
}
options := &storage.PutPageOptions{}
reader := bytes.NewReader(chunk)
err = blob.WriteRange(blobRange, reader, options)
if err == nil {
break
}
@ -406,7 +433,10 @@ func resourceArmStorageBlobBlockUploadFromSource(container, name, source string,
return fmt.Errorf("Error while uploading source file %q: %s", source, <-errors)
}
err = client.PutBlockList(container, name, blockList)
containerReference := client.GetContainerReference(container)
blobReference := containerReference.GetBlobReference(name)
options := &storage.PutBlockListOptions{}
err = blobReference.PutBlockList(blockList, options)
if err != nil {
return fmt.Errorf("Error updating block list for source file %q: %s", source, err)
}
@ -479,7 +509,10 @@ func resourceArmStorageBlobBlockUploadWorker(ctx resourceArmStorageBlobBlockUplo
}
for i := 0; i < ctx.attempts; i++ {
err = ctx.client.PutBlock(ctx.container, ctx.name, block.id, buffer)
container := ctx.client.GetContainerReference(ctx.container)
blob := container.GetBlobReference(ctx.name)
options := &storage.PutBlockOptions{}
err = blob.PutBlock(block.id, buffer, options)
if err == nil {
break
}
@ -523,7 +556,9 @@ func resourceArmStorageBlobRead(d *schema.ResourceData, meta interface{}) error
name := d.Get("name").(string)
storageContainerName := d.Get("storage_container_name").(string)
url := blobClient.GetBlobURL(storageContainerName, name)
container := blobClient.GetContainerReference(storageContainerName)
blob := container.GetBlobReference(name)
url := blob.GetURL()
if url == "" {
log.Printf("[INFO] URL for %q is empty", name)
}
@ -552,7 +587,9 @@ func resourceArmStorageBlobExists(d *schema.ResourceData, meta interface{}) (boo
storageContainerName := d.Get("storage_container_name").(string)
log.Printf("[INFO] Checking for existence of storage blob %q.", name)
exists, err := blobClient.BlobExists(storageContainerName, name)
container := blobClient.GetContainerReference(storageContainerName)
blob := container.GetBlobReference(name)
exists, err := blob.Exists()
if err != nil {
return false, fmt.Errorf("error testing existence of storage blob %q: %s", name, err)
}
@ -584,7 +621,11 @@ func resourceArmStorageBlobDelete(d *schema.ResourceData, meta interface{}) erro
storageContainerName := d.Get("storage_container_name").(string)
log.Printf("[INFO] Deleting storage blob %q", name)
if _, err = blobClient.DeleteBlobIfExists(storageContainerName, name, map[string]string{}); err != nil {
options := &storage.DeleteBlobOptions{}
container := blobClient.GetContainerReference(storageContainerName)
blob := container.GetBlobReference(name)
_, err = blob.DeleteIfExists(options)
if err != nil {
return fmt.Errorf("Error deleting storage blob %q: %s", name, err)
}

View File

@ -339,7 +339,9 @@ func testCheckAzureRMStorageBlobExists(name string) resource.TestCheckFunc {
return fmt.Errorf("Bad: Storage Account %q does not exist", storageAccountName)
}
exists, err := blobClient.BlobExists(storageContainerName, name)
container := blobClient.GetContainerReference(storageContainerName)
blob := container.GetBlobReference(name)
exists, err := blob.Exists()
if err != nil {
return err
}
@ -377,7 +379,10 @@ func testCheckAzureRMStorageBlobDisappears(name string) resource.TestCheckFunc {
return fmt.Errorf("Bad: Storage Account %q does not exist", storageAccountName)
}
_, err = blobClient.DeleteBlobIfExists(storageContainerName, name, map[string]string{})
container := blobClient.GetContainerReference(storageContainerName)
blob := container.GetBlobReference(name)
options := &storage.DeleteBlobOptions{}
_, err = blob.DeleteIfExists(options)
if err != nil {
return err
}
@ -411,16 +416,22 @@ func testCheckAzureRMStorageBlobMatchesFile(name string, kind storage.BlobType,
return fmt.Errorf("Bad: Storage Account %q does not exist", storageAccountName)
}
properties, err := blobClient.GetBlobProperties(storageContainerName, name)
containerReference := blobClient.GetContainerReference(storageContainerName)
blobReference := containerReference.GetBlobReference(name)
propertyOptions := &storage.GetBlobPropertiesOptions{}
err = blobReference.GetProperties(propertyOptions)
if err != nil {
return err
}
properties := blobReference.Properties
if properties.BlobType != kind {
return fmt.Errorf("Bad: blob type %q does not match expected type %q", properties.BlobType, kind)
}
blob, err := blobClient.GetBlob(storageContainerName, name)
getOptions := &storage.GetBlobOptions{}
blob, err := blobReference.Get(getOptions)
if err != nil {
return err
}
@ -467,7 +478,9 @@ func testCheckAzureRMStorageBlobDestroy(s *terraform.State) error {
return nil
}
exists, err := blobClient.BlobExists(storageContainerName, name)
container := blobClient.GetContainerReference(storageContainerName)
blob := container.GetBlobReference(name)
exists, err := blob.Exists()
if err != nil {
return nil
}

View File

@ -107,11 +107,23 @@ func resourceArmStorageContainerCreate(d *schema.ResourceData, meta interface{})
}
log.Printf("[INFO] Creating container %q in storage account %q.", name, storageAccountName)
_, err = blobClient.CreateContainerIfNotExists(name, accessType)
reference := blobClient.GetContainerReference(name)
createOptions := &storage.CreateContainerOptions{}
_, err = reference.CreateIfNotExists(createOptions)
if err != nil {
return fmt.Errorf("Error creating container %q in storage account %q: %s", name, storageAccountName, err)
}
permissions := storage.ContainerPermissions{
AccessType: accessType,
}
permissionOptions := &storage.SetContainerPermissionOptions{}
err = reference.SetPermissions(permissions, permissionOptions)
if err != nil {
return fmt.Errorf("Error setting permissions for container %s in storage account %s: %+v", name, storageAccountName, err)
}
d.SetId(name)
return resourceArmStorageContainerRead(d, meta)
}
@ -185,7 +197,8 @@ func resourceArmStorageContainerExists(d *schema.ResourceData, meta interface{})
name := d.Get("name").(string)
log.Printf("[INFO] Checking existence of storage container %q in storage account %q", name, storageAccountName)
exists, err := blobClient.ContainerExists(name)
reference := blobClient.GetContainerReference(name)
exists, err := reference.Exists()
if err != nil {
return false, fmt.Errorf("Error querying existence of storage container %q in storage account %q: %s", name, storageAccountName, err)
}
@ -218,7 +231,9 @@ func resourceArmStorageContainerDelete(d *schema.ResourceData, meta interface{})
name := d.Get("name").(string)
log.Printf("[INFO] Deleting storage container %q in account %q", name, storageAccountName)
if _, err := blobClient.DeleteContainerIfExists(name); err != nil {
reference := blobClient.GetContainerReference(name)
deleteOptions := &storage.DeleteContainerOptions{}
if _, err := reference.DeleteIfExists(deleteOptions); err != nil {
return fmt.Errorf("Error deleting storage container %q from storage account %q: %s", name, storageAccountName, err)
}

View File

@ -154,7 +154,9 @@ func testAccARMStorageContainerDisappears(name string, c *storage.Container) res
return nil
}
_, err = blobClient.DeleteContainerIfExists(c.Name)
reference := blobClient.GetContainerReference(c.Name)
options := &storage.DeleteContainerOptions{}
_, err = reference.DeleteIfExists(options)
if err != nil {
return err
}

View File

@ -5,6 +5,7 @@ import (
"log"
"regexp"
"github.com/Azure/azure-sdk-for-go/storage"
"github.com/hashicorp/terraform/helper/schema"
)
@ -82,7 +83,9 @@ func resourceArmStorageQueueCreate(d *schema.ResourceData, meta interface{}) err
name := d.Get("name").(string)
log.Printf("[INFO] Creating queue %q in storage account %q", name, storageAccountName)
err = queueClient.CreateQueue(name)
queueReference := queueClient.GetQueueReference(name)
options := &storage.QueueServiceOptions{}
err = queueReference.Create(options)
if err != nil {
return fmt.Errorf("Error creating storage queue on Azure: %s", err)
}
@ -125,7 +128,8 @@ func resourceArmStorageQueueExists(d *schema.ResourceData, meta interface{}) (bo
name := d.Get("name").(string)
log.Printf("[INFO] Checking for existence of storage queue %q.", name)
exists, err := queueClient.QueueExists(name)
queueReference := queueClient.GetQueueReference(name)
exists, err := queueReference.Exists()
if err != nil {
return false, fmt.Errorf("error testing existence of storage queue %q: %s", name, err)
}
@ -156,7 +160,9 @@ func resourceArmStorageQueueDelete(d *schema.ResourceData, meta interface{}) err
name := d.Get("name").(string)
log.Printf("[INFO] Deleting storage queue %q", name)
if err = queueClient.DeleteQueue(name); err != nil {
queueReference := queueClient.GetQueueReference(name)
options := &storage.QueueServiceOptions{}
if err = queueReference.Delete(options); err != nil {
return fmt.Errorf("Error deleting storage queue %q: %s", name, err)
}

View File

@ -95,7 +95,8 @@ func testCheckAzureRMStorageQueueExists(name string) resource.TestCheckFunc {
return fmt.Errorf("Bad: Storage Account %q does not exist", storageAccountName)
}
exists, err := queueClient.QueueExists(name)
queueReference := queueClient.GetQueueReference(name)
exists, err := queueReference.Exists()
if err != nil {
return err
}
@ -130,7 +131,8 @@ func testCheckAzureRMStorageQueueDestroy(s *terraform.State) error {
return nil
}
exists, err := queueClient.QueueExists(name)
queueReference := queueClient.GetQueueReference(name)
exists, err := queueReference.Exists()
if err != nil {
return nil
}

View File

@ -62,20 +62,21 @@ func resourceArmStorageShareCreate(d *schema.ResourceData, meta interface{}) err
name := d.Get("name").(string)
metaData := make(map[string]string) // TODO: support MetaData
options := &storage.FileRequestOptions{}
log.Printf("[INFO] Creating share %q in storage account %q", name, storageAccountName)
reference := fileClient.GetShareReference(name)
err = reference.Create()
err = reference.Create(options)
log.Printf("[INFO] Setting share %q metadata in storage account %q", name, storageAccountName)
reference.Metadata = metaData
reference.SetMetadata()
reference.SetMetadata(options)
log.Printf("[INFO] Setting share %q properties in storage account %q", name, storageAccountName)
reference.Properties = storage.ShareProperties{
Quota: d.Get("quota").(int),
}
reference.SetProperties()
reference.SetProperties(options)
d.SetId(name)
return resourceArmStorageShareRead(d, meta)
@ -170,9 +171,9 @@ func resourceArmStorageShareDelete(d *schema.ResourceData, meta interface{}) err
name := d.Get("name").(string)
reference := fileClient.GetShareReference(name)
err = reference.Create()
options := &storage.FileRequestOptions{}
if _, err = reference.DeleteIfExists(); err != nil {
if _, err = reference.DeleteIfExists(options); err != nil {
return fmt.Errorf("Error deleting storage file %q: %s", name, err)
}

View File

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

View File

@ -67,10 +67,13 @@ func resourceArmStorageTableCreate(d *schema.ResourceData, meta interface{}) err
}
name := d.Get("name").(string)
table := storage.AzureTable(name)
table := tableClient.GetTableReference(name)
log.Printf("[INFO] Creating table %q in storage account %q.", name, storageAccountName)
err = tableClient.CreateTable(table)
timeout := uint(60)
options := &storage.TableOptions{}
err = table.Create(timeout, storage.NoMetadata, options)
if err != nil {
return fmt.Errorf("Error creating table %q in storage account %q: %s", name, storageAccountName, err)
}
@ -97,16 +100,19 @@ func resourceArmStorageTableRead(d *schema.ResourceData, meta interface{}) error
}
name := d.Get("name").(string)
tables, err := tableClient.QueryTables()
metaDataLevel := storage.MinimalMetadata
options := &storage.QueryTablesOptions{}
tables, err := tableClient.QueryTables(metaDataLevel, options)
if err != nil {
return fmt.Errorf("Failed to retrieve storage tables in account %q: %s", name, err)
}
var found bool
for _, table := range tables {
if string(table) == name {
for _, table := range tables.Tables {
tableName := string(table.Name)
if tableName == name {
found = true
d.Set("name", string(table))
d.Set("name", tableName)
}
}
@ -129,15 +135,17 @@ func resourceArmStorageTableDelete(d *schema.ResourceData, meta interface{}) err
return err
}
if !accountExists {
log.Printf("[INFO]Storage Account %q doesn't exist so the table won't exist", storageAccountName)
log.Printf("[INFO] Storage Account %q doesn't exist so the table won't exist", storageAccountName)
return nil
}
name := d.Get("name").(string)
table := storage.AzureTable(name)
table := tableClient.GetTableReference(name)
timeout := uint(60)
options := &storage.TableOptions{}
log.Printf("[INFO] Deleting storage table %q in account %q", name, storageAccountName)
if err := tableClient.DeleteTable(table); err != nil {
if err := table.Delete(timeout, options); err != nil {
return fmt.Errorf("Error deleting storage table %q from storage account %q: %s", name, storageAccountName, err)
}

View File

@ -13,7 +13,7 @@ import (
)
func TestAccAzureRMStorageTable_basic(t *testing.T) {
var table storage.AzureTable
var table storage.Table
ri := acctest.RandInt()
rs := strings.ToLower(acctest.RandString(11))
@ -35,7 +35,7 @@ func TestAccAzureRMStorageTable_basic(t *testing.T) {
}
func TestAccAzureRMStorageTable_disappears(t *testing.T) {
var table storage.AzureTable
var table storage.Table
ri := acctest.RandInt()
rs := strings.ToLower(acctest.RandString(11))
@ -58,7 +58,7 @@ func TestAccAzureRMStorageTable_disappears(t *testing.T) {
})
}
func testCheckAzureRMStorageTableExists(name string, t *storage.AzureTable) resource.TestCheckFunc {
func testCheckAzureRMStorageTableExists(name string, t *storage.Table) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
@ -82,15 +82,16 @@ func testCheckAzureRMStorageTableExists(name string, t *storage.AzureTable) reso
return fmt.Errorf("Bad: Storage Account %q does not exist", storageAccountName)
}
tables, err := tableClient.QueryTables()
options := &storage.QueryTablesOptions{}
tables, err := tableClient.QueryTables(storage.MinimalMetadata, options)
if len(tables) == 0 {
if len(tables.Tables) == 0 {
return fmt.Errorf("Bad: Storage Table %q (storage account: %q) does not exist", name, storageAccountName)
}
var found bool
for _, table := range tables {
if string(table) == name {
for _, table := range tables.Tables {
if table.Name == name {
found = true
*t = table
}
@ -104,7 +105,7 @@ func testCheckAzureRMStorageTableExists(name string, t *storage.AzureTable) reso
}
}
func testAccARMStorageTableDisappears(name string, t *storage.AzureTable) resource.TestCheckFunc {
func testAccARMStorageTableDisappears(name string, t *storage.Table) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
if !ok {
@ -116,7 +117,7 @@ func testAccARMStorageTableDisappears(name string, t *storage.AzureTable) resour
storageAccountName := rs.Primary.Attributes["storage_account_name"]
resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"]
if !hasResourceGroup {
return fmt.Errorf("Bad: no resource group found in state for storage table: %s", string(*t))
return fmt.Errorf("Bad: no resource group found in state for storage table: %s", t.Name)
}
tableClient, accountExists, err := armClient.getTableServiceClientForStorageAccount(resourceGroup, storageAccountName)
@ -128,8 +129,10 @@ func testAccARMStorageTableDisappears(name string, t *storage.AzureTable) resour
return nil
}
table := storage.AzureTable(string(*t))
err = tableClient.DeleteTable(table)
table := tableClient.GetTableReference(t.Name)
timeout := uint(60)
options := &storage.TableOptions{}
err = table.Delete(timeout, options)
if err != nil {
return err
}
@ -161,15 +164,16 @@ func testCheckAzureRMStorageTableDestroy(s *terraform.State) error {
return nil
}
tables, err := tableClient.QueryTables()
options := &storage.QueryTablesOptions{}
tables, err := tableClient.QueryTables(storage.NoMetadata, options)
if err != nil {
return nil
}
var found bool
for _, table := range tables {
if string(table) == name {
for _, table := range tables.Tables {
if table.Name == name {
found = true
}
}

View File

@ -122,7 +122,8 @@ func resourceArmSubnetCreate(d *schema.ResourceData, meta interface{}) error {
SubnetPropertiesFormat: &properties,
}
_, err := subnetClient.CreateOrUpdate(resGroup, vnetName, name, subnet, make(chan struct{}))
_, error := subnetClient.CreateOrUpdate(resGroup, vnetName, name, subnet, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -229,7 +230,8 @@ func resourceArmSubnetDelete(d *schema.ResourceData, meta interface{}) error {
armMutexKV.Lock(name)
defer armMutexKV.Unlock(name)
_, err = subnetClient.Delete(resGroup, vnetName, name, make(chan struct{}))
_, error := subnetClient.Delete(resGroup, vnetName, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -99,7 +99,8 @@ func testCheckAzureRMSubnetDisappears(name string) resource.TestCheckFunc {
conn := testAccProvider.Meta().(*ArmClient).subnetClient
_, err := conn.Delete(resourceGroup, vnetName, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, vnetName, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on subnetClient: %s", err)
}

View File

@ -100,7 +100,8 @@ func resourceArmTemplateDeploymentCreate(d *schema.ResourceData, meta interface{
Properties: &properties,
}
_, err := deployClient.CreateOrUpdate(resGroup, name, deployment, make(chan struct{}))
_, error := deployClient.CreateOrUpdate(resGroup, name, deployment, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Error creating deployment: %s", err)
}
@ -206,8 +207,10 @@ func resourceArmTemplateDeploymentDelete(d *schema.ResourceData, meta interface{
name = id.Path["Deployments"]
}
_, err = deployClient.Delete(resGroup, name, make(chan struct{}))
return nil
_, error := deployClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}
func expandTemplateBody(template string) (map[string]interface{}, error) {

View File

@ -152,7 +152,8 @@ func testCheckAzureRMTemplateDeploymentDisappears(name string) resource.TestChec
conn := testAccProvider.Meta().(*ArmClient).deploymentsClient
_, err := conn.Delete(resourceGroup, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on deploymentsClient: %s", err)
}

View File

@ -9,6 +9,7 @@ import (
"strings"
"github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/storage"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
@ -584,7 +585,8 @@ func resourceArmVirtualMachineCreate(d *schema.ResourceData, meta interface{}) e
vm.Plan = plan
}
_, vmErr := vmClient.CreateOrUpdate(resGroup, name, vm, make(chan struct{}))
_, vmError := vmClient.CreateOrUpdate(resGroup, name, vm, make(chan struct{}))
vmErr := <-vmError
if vmErr != nil {
return vmErr
}
@ -712,7 +714,10 @@ func resourceArmVirtualMachineDelete(d *schema.ResourceData, meta interface{}) e
resGroup := id.ResourceGroup
name := id.Path["virtualMachines"]
if _, err = vmClient.Delete(resGroup, name, make(chan struct{})); err != nil {
_, error := vmClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
if err != nil {
return err
}
@ -793,7 +798,10 @@ func resourceArmVirtualMachineDeleteVhd(uri string, meta interface{}) error {
}
log.Printf("[INFO] Deleting VHD blob %s", blobName)
_, err = blobClient.DeleteBlobIfExists(containerName, blobName, nil)
container := blobClient.GetContainerReference(containerName)
blob := container.GetBlobReference(blobName)
options := &storage.DeleteBlobOptions{}
err = blob.Delete(options)
if err != nil {
return fmt.Errorf("Error deleting VHD blob: %s", err)
}
@ -811,7 +819,8 @@ func resourceArmVirtualMachineDeleteManagedDisk(managedDiskID string, meta inter
resGroup := id.ResourceGroup
name := id.Path["disks"]
_, err = diskClient.Delete(resGroup, name, make(chan struct{}))
_, error := diskClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
if err != nil {
return fmt.Errorf("Error deleting Managed Disk (%s %s) %s", name, resGroup, err)
}

View File

@ -122,7 +122,8 @@ func resourceArmVirtualMachineExtensionsCreate(d *schema.ResourceData, meta inte
extension.VirtualMachineExtensionProperties.ProtectedSettings = &protectedSettings
}
_, err := client.CreateOrUpdate(resGroup, vmName, name, extension, make(chan struct{}))
_, error := client.CreateOrUpdate(resGroup, vmName, name, extension, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -195,7 +196,8 @@ func resourceArmVirtualMachineExtensionsDelete(d *schema.ResourceData, meta inte
name := id.Path["extensions"]
vmName := id.Path["virtualMachines"]
_, err = client.Delete(resGroup, vmName, name, make(chan struct{}))
_, error := client.Delete(resGroup, vmName, name, make(chan struct{}))
err = <-error
return nil
return err
}

View File

@ -543,7 +543,8 @@ func resourceArmVirtualMachineScaleSetCreate(d *schema.ResourceData, meta interf
Sku: sku,
VirtualMachineScaleSetProperties: &scaleSetProps,
}
_, vmErr := vmScaleSetClient.CreateOrUpdate(resGroup, name, scaleSetParams, make(chan struct{}))
_, vmError := vmScaleSetClient.CreateOrUpdate(resGroup, name, scaleSetParams, make(chan struct{}))
vmErr := <-vmError
if vmErr != nil {
return vmErr
}
@ -665,7 +666,8 @@ func resourceArmVirtualMachineScaleSetDelete(d *schema.ResourceData, meta interf
resGroup := id.ResourceGroup
name := id.Path["virtualMachineScaleSets"]
_, err = vmScaleSetClient.Delete(resGroup, name, make(chan struct{}))
_, error := vmScaleSetClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -282,7 +282,8 @@ func testCheckAzureRMVirtualMachineScaleSetDisappears(name string) resource.Test
conn := testAccProvider.Meta().(*ArmClient).vmScaleSetClient
_, err := conn.Delete(resourceGroup, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on vmScaleSetClient: %s", err)
}

View File

@ -737,7 +737,9 @@ func testCheckAzureRMVirtualMachineVHDExistence(name string, shouldExist bool) r
return fmt.Errorf("Error creating Blob storage client: %s", err)
}
exists, err := storageClient.BlobExists(containerName, name)
container := storageClient.GetContainerReference(containerName)
blob := container.GetBlobReference(name)
exists, err := blob.Exists()
if err != nil {
return fmt.Errorf("Error checking if Disk VHD Blob exists: %s", err)
}
@ -769,7 +771,8 @@ func testCheckAzureRMVirtualMachineDisappears(name string) resource.TestCheckFun
conn := testAccProvider.Meta().(*ArmClient).vmClient
_, err := conn.Delete(resourceGroup, vmName, make(chan struct{}))
_, error := conn.Delete(resourceGroup, vmName, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on vmClient: %s", err)
}

View File

@ -112,7 +112,8 @@ func resourceArmVirtualNetworkCreate(d *schema.ResourceData, meta interface{}) e
azureRMLockMultiple(&networkSecurityGroupNames)
defer azureRMUnlockMultiple(&networkSecurityGroupNames)
_, err := vnetClient.CreateOrUpdate(resGroup, name, vnet, make(chan struct{}))
_, error := vnetClient.CreateOrUpdate(resGroup, name, vnet, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -205,7 +206,8 @@ func resourceArmVirtualNetworkDelete(d *schema.ResourceData, meta interface{}) e
azureRMLockMultiple(&nsgNames)
defer azureRMUnlockMultiple(&nsgNames)
_, err = vnetClient.Delete(resGroup, name, make(chan struct{}))
_, error := vnetClient.Delete(resGroup, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -93,7 +93,8 @@ func resourceArmVirtualNetworkPeeringCreate(d *schema.ResourceData, meta interfa
peerMutex.Lock()
defer peerMutex.Unlock()
_, err := client.CreateOrUpdate(resGroup, vnetName, name, peer, make(chan struct{}))
_, error := client.CreateOrUpdate(resGroup, vnetName, name, peer, make(chan struct{}))
err := <-error
if err != nil {
return err
}
@ -160,7 +161,8 @@ func resourceArmVirtualNetworkPeeringDelete(d *schema.ResourceData, meta interfa
peerMutex.Lock()
defer peerMutex.Unlock()
_, err = client.Delete(resGroup, vnetName, name, make(chan struct{}))
_, error := client.Delete(resGroup, vnetName, name, make(chan struct{}))
err = <-error
return err
}

View File

@ -154,7 +154,8 @@ func testCheckAzureRMVirtualNetworkPeeringDisappears(name string) resource.TestC
// Ensure resource group/virtual network peering combination exists in API
conn := testAccProvider.Meta().(*ArmClient).vnetPeeringsClient
_, err := conn.Delete(resourceGroup, vnetName, name, make(chan struct{}))
_, error := conn.Delete(resourceGroup, vnetName, name, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on vnetPeeringsClient: %s", err)
}

View File

@ -20,7 +20,7 @@ func TestAccAzureRMVirtualNetwork_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMVirtualNetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMVirtualNetworkExists("azurerm_virtual_network.test"),
@ -40,7 +40,7 @@ func TestAccAzureRMVirtualNetwork_disappears(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMVirtualNetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMVirtualNetworkExists("azurerm_virtual_network.test"),
@ -137,7 +137,8 @@ func testCheckAzureRMVirtualNetworkDisappears(name string) resource.TestCheckFun
// Ensure resource group/virtual network combination exists in API
conn := testAccProvider.Meta().(*ArmClient).vnetClient
_, err := conn.Delete(resourceGroup, virtualNetworkName, make(chan struct{}))
_, error := conn.Delete(resourceGroup, virtualNetworkName, make(chan struct{}))
err := <-error
if err != nil {
return fmt.Errorf("Bad: Delete on vnetClient: %s", err)
}

View File

@ -163,7 +163,10 @@ type AzureClient struct {
}
func (c *AzureClient) Get() (*Payload, error) {
blob, err := c.blobClient.GetBlob(c.containerName, c.keyName)
containerReference := c.blobClient.GetContainerReference(c.containerName)
blobReference := containerReference.GetBlobReference(c.keyName)
options := &mainStorage.GetBlobOptions{}
blob, err := blobReference.Get(options)
if err != nil {
if storErr, ok := err.(mainStorage.AzureStorageServiceError); ok {
if storErr.Code == "BlobNotFound" {
@ -193,28 +196,38 @@ func (c *AzureClient) Get() (*Payload, error) {
}
func (c *AzureClient) Put(data []byte) error {
headers := map[string]string{
"Content-Type": "application/json",
}
setOptions := &mainStorage.SetBlobPropertiesOptions{}
putOptions := &mainStorage.PutBlobOptions{}
containerReference := c.blobClient.GetContainerReference(c.containerName)
blobReference := containerReference.GetBlobReference(c.keyName)
blobReference.Properties.ContentType = "application/json"
blobReference.Properties.ContentLength = int64(len(data))
if c.leaseID != "" {
headers["x-ms-lease-id"] = c.leaseID
setOptions.LeaseID = c.leaseID
putOptions.LeaseID = c.leaseID
}
return c.blobClient.CreateBlockBlobFromReader(
c.containerName,
c.keyName,
uint64(len(data)),
bytes.NewReader(data),
headers,
)
reader := bytes.NewReader(data)
err := blobReference.CreateBlockBlobFromReader(reader, putOptions)
if err != nil {
return err
}
return blobReference.SetProperties(setOptions)
}
func (c *AzureClient) Delete() error {
headers := map[string]string{}
containerReference := c.blobClient.GetContainerReference(c.containerName)
blobReference := containerReference.GetBlobReference(c.keyName)
options := &mainStorage.DeleteBlobOptions{}
if c.leaseID != "" {
headers["x-ms-lease-id"] = c.leaseID
options.LeaseID = c.leaseID
}
return c.blobClient.DeleteBlob(c.containerName, c.keyName, headers)
return blobReference.Delete(options)
}

View File

@ -67,13 +67,18 @@ func TestAzureClientLease(t *testing.T) {
}
azureClient := client.(*AzureClient)
containerReference := azureClient.blobClient.GetContainerReference(azureClient.containerName)
blobReference := containerReference.GetBlobReference(azureClient.keyName)
// put empty blob so we can acquire lease against it
err = azureClient.blobClient.CreateBlockBlob(azureClient.containerName, azureClient.keyName)
options := &mainStorage.PutBlobOptions{}
err = blobReference.CreateBlockBlob(options)
if err != nil {
t.Fatalf("Error creating blob for leasing: %v", err)
}
_, err = azureClient.blobClient.AcquireLease(azureClient.containerName, azureClient.keyName, -1, leaseID)
leaseOptions := &mainStorage.LeaseOptions{}
_, err = blobReference.AcquireLease(-1, leaseID, leaseOptions)
if err != nil {
t.Fatalf("Error acquiring lease: %v", err)
}
@ -162,7 +167,12 @@ func setup(t *testing.T, conf map[string]string) {
t.Fatalf("Error creating storage client for storage account %q: %s", conf["storage_account_name"], err)
}
blobClient := storageClient.GetBlobService()
_, err = blobClient.CreateContainerIfNotExists(conf["container_name"], mainStorage.ContainerAccessTypePrivate)
containerName := conf["container_name"]
containerReference := blobClient.GetContainerReference(containerName)
options := &mainStorage.CreateContainerOptions{
Access: mainStorage.ContainerAccessTypePrivate,
}
_, err = containerReference.CreateIfNotExists(options)
if err != nil {
t.Fatalf("Couldn't create container with name %s: %s.", conf["container_name"], err)
}

194
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go generated vendored Normal file → Executable file
View File

@ -19,7 +19,7 @@ package cdn
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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.
@ -31,9 +31,6 @@ import (
)
const (
// APIVersion is the version of the Cdn
APIVersion = "2016-10-02"
// DefaultBaseURI is the default URI used for the service Cdn
DefaultBaseURI = "https://management.azure.com"
)
@ -42,7 +39,6 @@ const (
type ManagementClient struct {
autorest.Client
BaseURI string
APIVersion string
SubscriptionID string
}
@ -56,7 +52,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
APIVersion: APIVersion,
SubscriptionID: subscriptionID,
}
}
@ -75,13 +70,15 @@ func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput
req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", nil, "Failure preparing request")
return
}
resp, err := client.CheckNameAvailabilitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckNameAvailability", resp, "Failure sending request")
return
}
result, err = client.CheckNameAvailabilityResponder(resp)
@ -94,8 +91,9 @@ func (client ManagementClient) CheckNameAvailability(checkNameAvailabilityInput
// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
func (client ManagementClient) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput) (*http.Request, error) {
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -127,100 +125,19 @@ func (client ManagementClient) CheckNameAvailabilityResponder(resp *http.Respons
return
}
// CheckResourceUsage check the quota and actual usage of the CDN profiles
// under the given subscription.
func (client ManagementClient) CheckResourceUsage() (result ResourceUsageListResult, err error) {
req, err := client.CheckResourceUsagePreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", nil, "Failure preparing request")
}
resp, err := client.CheckResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure sending request")
}
result, err = client.CheckResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure responding to request")
}
return
}
// CheckResourceUsagePreparer prepares the CheckResourceUsage request.
func (client ManagementClient) CheckResourceUsagePreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CheckResourceUsageSender sends the CheckResourceUsage request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) CheckResourceUsageSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CheckResourceUsageResponder handles the response to the CheckResourceUsage request. The method always
// closes the http.Response Body.
func (client ManagementClient) CheckResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CheckResourceUsageNextResults retrieves the next set of results, if any.
func (client ManagementClient) CheckResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) {
req, err := lastResults.ResourceUsageListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.CheckResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure sending next results request")
}
result, err = client.CheckResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "CheckResourceUsage", resp, "Failure responding to next results request")
}
return
}
// ListOperations lists all of the available CDN REST API operations.
func (client ManagementClient) ListOperations() (result OperationListResult, err error) {
req, err := client.ListOperationsPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", nil, "Failure preparing request")
return
}
resp, err := client.ListOperationsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListOperations", resp, "Failure sending request")
return
}
result, err = client.ListOperationsResponder(resp)
@ -233,8 +150,9 @@ func (client ManagementClient) ListOperations() (result OperationListResult, err
// ListOperationsPreparer prepares the ListOperations request.
func (client ManagementClient) ListOperationsPreparer() (*http.Request, error) {
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -287,3 +205,89 @@ func (client ManagementClient) ListOperationsNextResults(lastResults OperationLi
return
}
// ListResourceUsage check the quota and actual usage of the CDN profiles under
// the given subscription.
func (client ManagementClient) ListResourceUsage() (result ResourceUsageListResult, err error) {
req, err := client.ListResourceUsagePreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing request")
return
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending request")
return
}
result, err = client.ListResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to request")
}
return
}
// ListResourceUsagePreparer prepares the ListResourceUsage request.
func (client ManagementClient) ListResourceUsagePreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListResourceUsageSender sends the ListResourceUsage request. The method will close the
// http.Response Body if it receives an error.
func (client ManagementClient) ListResourceUsageSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResourceUsageResponder handles the response to the ListResourceUsage request. The method always
// closes the http.Response Body.
func (client ManagementClient) ListResourceUsageResponder(resp *http.Response) (result ResourceUsageListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListResourceUsageNextResults retrieves the next set of results, if any.
func (client ManagementClient) ListResourceUsageNextResults(lastResults ResourceUsageListResult) (result ResourceUsageListResult, err error) {
req, err := lastResults.ResourceUsageListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure sending next results request")
}
result, err = client.ListResourceUsageResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ManagementClient", "ListResourceUsage", resp, "Failure responding to next results request")
}
return
}

294
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go generated vendored Normal file → Executable file
View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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.
@ -55,7 +55,9 @@ func NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) Cu
// which is unique globally. customDomainName is name of the custom domain
// within an endpoint. customDomainProperties is properties required to create
// a new custom domain.
func (client CustomDomainsClient) Create(resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client CustomDomainsClient) Create(resourceGroupName string, profileName string, endpointName string, customDomainName string, customDomainProperties CustomDomainParameters, cancel <-chan struct{}) (<-chan CustomDomain, <-chan error) {
resultChan := make(chan CustomDomain, 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},
@ -64,26 +66,40 @@ func (client CustomDomainsClient) Create(resourceGroupName string, profileName s
{TargetValue: customDomainProperties,
Constraints: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "customDomainProperties.CustomDomainPropertiesParameters.HostName", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Create")
errChan <- validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Create")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, customDomainName, customDomainProperties, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", nil, "Failure preparing request")
}
go func() {
var err error
var result CustomDomain
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, customDomainName, customDomainProperties, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure sending request")
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure responding to request")
}
return
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Create", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreatePreparer prepares the Create request.
@ -96,8 +112,9 @@ func (client CustomDomainsClient) CreatePreparer(resourceGroupName string, profi
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -120,13 +137,14 @@ func (client CustomDomainsClient) CreateSender(req *http.Request) (*http.Respons
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result CustomDomain, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -140,32 +158,48 @@ func (client CustomDomainsClient) CreateResponder(resp *http.Response) (result a
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. customDomainName is name of the custom domain
// within an endpoint.
func (client CustomDomainsClient) Delete(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client CustomDomainsClient) Delete(resourceGroupName string, profileName string, endpointName string, customDomainName string, cancel <-chan struct{}) (<-chan CustomDomain, <-chan error) {
resultChan := make(chan CustomDomain, 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Delete")
errChan <- validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "Delete")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, customDomainName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", nil, "Failure preparing request")
}
go func() {
var err error
var result CustomDomain
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, customDomainName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure sending request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure responding to request")
}
return
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
@ -178,8 +212,9 @@ func (client CustomDomainsClient) DeletePreparer(resourceGroupName string, profi
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -200,13 +235,172 @@ func (client CustomDomainsClient) DeleteSender(req *http.Request) (*http.Respons
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
func (client CustomDomainsClient) DeleteResponder(resp *http.Response) (result CustomDomain, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
// DisableCustomHTTPS disable https delivery of the custom domain.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. customDomainName is name of the custom domain
// within an endpoint.
func (client CustomDomainsClient) DisableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS")
}
req, err := client.DisableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", nil, "Failure preparing request")
return
}
resp, err := client.DisableCustomHTTPSSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure sending request")
return
}
result, err = client.DisableCustomHTTPSResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "DisableCustomHTTPS", resp, "Failure responding to request")
}
return
}
// DisableCustomHTTPSPreparer prepares the DisableCustomHTTPS request.
func (client CustomDomainsClient) DisableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"customDomainName": autorest.Encode("path", customDomainName),
"endpointName": autorest.Encode("path", endpointName),
"profileName": autorest.Encode("path", profileName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/disableCustomHttps", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DisableCustomHTTPSSender sends the DisableCustomHTTPS request. The method will close the
// http.Response Body if it receives an error.
func (client CustomDomainsClient) DisableCustomHTTPSSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DisableCustomHTTPSResponder handles the response to the DisableCustomHTTPS request. The method always
// closes the http.Response Body.
func (client CustomDomainsClient) DisableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, 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
}
// EnableCustomHTTPS enable https delivery of the custom domain.
//
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. customDomainName is name of the custom domain
// within an endpoint.
func (client CustomDomainsClient) EnableCustomHTTPS(resourceGroupName string, profileName string, endpointName string, customDomainName string) (result CustomDomain, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS")
}
req, err := client.EnableCustomHTTPSPreparer(resourceGroupName, profileName, endpointName, customDomainName)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", nil, "Failure preparing request")
return
}
resp, err := client.EnableCustomHTTPSSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure sending request")
return
}
result, err = client.EnableCustomHTTPSResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "EnableCustomHTTPS", resp, "Failure responding to request")
}
return
}
// EnableCustomHTTPSPreparer prepares the EnableCustomHTTPS request.
func (client CustomDomainsClient) EnableCustomHTTPSPreparer(resourceGroupName string, profileName string, endpointName string, customDomainName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"customDomainName": autorest.Encode("path", customDomainName),
"endpointName": autorest.Encode("path", endpointName),
"profileName": autorest.Encode("path", profileName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}/enableCustomHttps", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// EnableCustomHTTPSSender sends the EnableCustomHTTPS request. The method will close the
// http.Response Body if it receives an error.
func (client CustomDomainsClient) EnableCustomHTTPSSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// EnableCustomHTTPSResponder handles the response to the EnableCustomHTTPS request. The method always
// closes the http.Response Body.
func (client CustomDomainsClient) EnableCustomHTTPSResponder(resp *http.Response) (result CustomDomain, 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
}
@ -228,13 +422,15 @@ func (client CustomDomainsClient) Get(resourceGroupName string, profileName stri
req, err := client.GetPreparer(resourceGroupName, profileName, endpointName, customDomainName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
@ -255,8 +451,9 @@ func (client CustomDomainsClient) GetPreparer(resourceGroupName string, profileN
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -303,13 +500,15 @@ func (client CustomDomainsClient) ListByEndpoint(resourceGroupName string, profi
req, err := client.ListByEndpointPreparer(resourceGroupName, profileName, endpointName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", nil, "Failure preparing request")
return
}
resp, err := client.ListByEndpointSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.CustomDomainsClient", "ListByEndpoint", resp, "Failure sending request")
return
}
result, err = client.ListByEndpointResponder(resp)
@ -329,8 +528,9 @@ func (client CustomDomainsClient) ListByEndpointPreparer(resourceGroupName strin
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(

35
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/edgenodes.go generated vendored Normal file → Executable file
View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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.
@ -46,13 +46,15 @@ func NewEdgeNodesClientWithBaseURI(baseURI string, subscriptionID string) EdgeNo
func (client EdgeNodesClient) List() (result EdgenodeResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
@ -65,8 +67,9 @@ func (client EdgeNodesClient) List() (result EdgenodeResult, err error) {
// ListPreparer prepares the List request.
func (client EdgeNodesClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -95,3 +98,27 @@ func (client EdgeNodesClient) ListResponder(resp *http.Response) (result Edgenod
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client EdgeNodesClient) ListNextResults(lastResults EdgenodeResult) (result EdgenodeResult, err error) {
req, err := lastResults.EdgenodeResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "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, "cdn.EdgeNodesClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EdgeNodesClient", "List", resp, "Failure responding to next results request")
}
return
}

429
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/endpoints.go generated vendored Normal file → Executable file
View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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.
@ -53,7 +53,9 @@ func NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) Endpoi
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. endpoint is endpoint properties
func (client EndpointsClient) Create(resourceGroupName string, profileName string, endpointName string, endpoint Endpoint, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client EndpointsClient) Create(resourceGroupName string, profileName string, endpointName string, endpoint Endpoint, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) {
resultChan := make(chan Endpoint, 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},
@ -62,26 +64,40 @@ func (client EndpointsClient) Create(resourceGroupName string, profileName strin
{TargetValue: endpoint,
Constraints: []validation.Constraint{{Target: "endpoint.EndpointProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "endpoint.EndpointProperties.Origins", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Create")
errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Create")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, endpoint, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", nil, "Failure preparing request")
}
go func() {
var err error
var result Endpoint
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.CreatePreparer(resourceGroupName, profileName, endpointName, endpoint, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure sending request")
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure responding to request")
}
return
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Create", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreatePreparer prepares the Create request.
@ -93,8 +109,9 @@ func (client EndpointsClient) CreatePreparer(resourceGroupName string, profileNa
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -117,13 +134,14 @@ func (client EndpointsClient) CreateSender(req *http.Request) (*http.Response, e
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client EndpointsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client EndpointsClient) CreateResponder(resp *http.Response) (result Endpoint, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -137,32 +155,48 @@ func (client EndpointsClient) CreateResponder(resp *http.Response) (result autor
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client EndpointsClient) Delete(resourceGroupName string, profileName string, endpointName 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Delete")
errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Delete")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", nil, "Failure preparing request")
}
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, profileName, endpointName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure sending request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure responding to request")
}
return
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
@ -174,8 +208,9 @@ func (client EndpointsClient) DeletePreparer(resourceGroupName string, profileNa
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -224,13 +259,15 @@ func (client EndpointsClient) Get(resourceGroupName string, profileName string,
req, err := client.GetPreparer(resourceGroupName, profileName, endpointName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
@ -250,8 +287,9 @@ func (client EndpointsClient) GetPreparer(resourceGroupName string, profileName
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -297,13 +335,15 @@ func (client EndpointsClient) ListByProfile(resourceGroupName string, profileNam
req, err := client.ListByProfilePreparer(resourceGroupName, profileName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", nil, "Failure preparing request")
return
}
resp, err := client.ListByProfileSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListByProfile", resp, "Failure sending request")
return
}
result, err = client.ListByProfileResponder(resp)
@ -322,8 +362,9 @@ func (client EndpointsClient) ListByProfilePreparer(resourceGroupName string, pr
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -395,13 +436,15 @@ func (client EndpointsClient) ListResourceUsage(resourceGroupName string, profil
req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName, endpointName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", nil, "Failure preparing request")
return
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ListResourceUsage", resp, "Failure sending request")
return
}
result, err = client.ListResourceUsageResponder(resp)
@ -421,8 +464,9 @@ func (client EndpointsClient) ListResourceUsagePreparer(resourceGroupName string
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -487,7 +531,9 @@ func (client EndpointsClient) ListResourceUsageNextResults(lastResults ResourceU
// which is unique globally. contentFilePaths is the path to the content to be
// loaded. Path should be a full URL, e.g. /pictires/city.png' which loads a
// single file
func (client EndpointsClient) LoadContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client EndpointsClient) LoadContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths LoadParameters, cancel <-chan struct{}) (<-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},
@ -495,26 +541,40 @@ func (client EndpointsClient) LoadContent(resourceGroupName string, profileName
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: contentFilePaths,
Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "LoadContent")
errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "LoadContent")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.LoadContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", nil, "Failure preparing request")
}
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.LoadContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", nil, "Failure preparing request")
return
}
resp, err := client.LoadContentSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure sending request")
}
resp, err := client.LoadContentSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure sending request")
return
}
result, err = client.LoadContentResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure responding to request")
}
return
result, err = client.LoadContentResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "LoadContent", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// LoadContentPreparer prepares the LoadContent request.
@ -526,8 +586,9 @@ func (client EndpointsClient) LoadContentPreparer(resourceGroupName string, prof
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -572,7 +633,9 @@ func (client EndpointsClient) LoadContentResponder(resp *http.Response) (result
// purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
// single file, or a directory with a wildcard, e.g. '/pictures/*' which
// removes all folders and files in the directory.
func (client EndpointsClient) PurgeContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client EndpointsClient) PurgeContent(resourceGroupName string, profileName string, endpointName string, contentFilePaths PurgeParameters, 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},
@ -580,26 +643,40 @@ func (client EndpointsClient) PurgeContent(resourceGroupName string, profileName
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: contentFilePaths,
Constraints: []validation.Constraint{{Target: "contentFilePaths.ContentPaths", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "PurgeContent")
errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "PurgeContent")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.PurgeContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", nil, "Failure preparing request")
}
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.PurgeContentPreparer(resourceGroupName, profileName, endpointName, contentFilePaths, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", nil, "Failure preparing request")
return
}
resp, err := client.PurgeContentSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure sending request")
}
resp, err := client.PurgeContentSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure sending request")
return
}
result, err = client.PurgeContentResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure responding to request")
}
return
result, err = client.PurgeContentResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "PurgeContent", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// PurgeContentPreparer prepares the PurgeContent request.
@ -611,8 +688,9 @@ func (client EndpointsClient) PurgeContentPreparer(resourceGroupName string, pro
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -654,32 +732,48 @@ func (client EndpointsClient) PurgeContentResponder(resp *http.Response) (result
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) Start(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client EndpointsClient) Start(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) {
resultChan := make(chan Endpoint, 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Start")
errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Start")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.StartPreparer(resourceGroupName, profileName, endpointName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", nil, "Failure preparing request")
}
go func() {
var err error
var result Endpoint
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.StartPreparer(resourceGroupName, profileName, endpointName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", nil, "Failure preparing request")
return
}
resp, err := client.StartSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure sending request")
}
resp, err := client.StartSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure sending request")
return
}
result, err = client.StartResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure responding to request")
}
return
result, err = client.StartResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Start", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// StartPreparer prepares the Start request.
@ -691,8 +785,9 @@ func (client EndpointsClient) StartPreparer(resourceGroupName string, profileNam
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -713,13 +808,14 @@ func (client EndpointsClient) StartSender(req *http.Request) (*http.Response, er
// StartResponder handles the response to the Start request. The method always
// closes the http.Response Body.
func (client EndpointsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
func (client EndpointsClient) StartResponder(resp *http.Response) (result Endpoint, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -732,32 +828,48 @@ func (client EndpointsClient) StartResponder(resp *http.Response) (result autore
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally.
func (client EndpointsClient) Stop(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client EndpointsClient) Stop(resourceGroupName string, profileName string, endpointName string, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) {
resultChan := make(chan Endpoint, 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Stop")
errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Stop")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.StopPreparer(resourceGroupName, profileName, endpointName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", nil, "Failure preparing request")
}
go func() {
var err error
var result Endpoint
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.StopPreparer(resourceGroupName, profileName, endpointName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", nil, "Failure preparing request")
return
}
resp, err := client.StopSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure sending request")
}
resp, err := client.StopSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure sending request")
return
}
result, err = client.StopResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure responding to request")
}
return
result, err = client.StopResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Stop", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// StopPreparer prepares the Stop request.
@ -769,8 +881,9 @@ func (client EndpointsClient) StopPreparer(resourceGroupName string, profileName
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -791,13 +904,14 @@ func (client EndpointsClient) StopSender(req *http.Request) (*http.Response, err
// StopResponder handles the response to the Stop request. The method always
// closes the http.Response Body.
func (client EndpointsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
func (client EndpointsClient) StopResponder(resp *http.Response) (result Endpoint, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -814,32 +928,48 @@ func (client EndpointsClient) StopResponder(resp *http.Response) (result autores
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. endpointUpdateProperties is endpoint update
// properties
func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client EndpointsClient) Update(resourceGroupName string, profileName string, endpointName string, endpointUpdateProperties EndpointUpdateParameters, cancel <-chan struct{}) (<-chan Endpoint, <-chan error) {
resultChan := make(chan Endpoint, 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Update")
errChan <- validation.NewErrorWithValidationError(err, "cdn.EndpointsClient", "Update")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, endpointUpdateProperties, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", nil, "Failure preparing request")
}
go func() {
var err error
var result Endpoint
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, endpointUpdateProperties, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure sending request")
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure responding to request")
}
return
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "Update", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// UpdatePreparer prepares the Update request.
@ -851,8 +981,9 @@ func (client EndpointsClient) UpdatePreparer(resourceGroupName string, profileNa
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -875,13 +1006,14 @@ func (client EndpointsClient) UpdateSender(req *http.Request) (*http.Response, e
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client EndpointsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -906,13 +1038,15 @@ func (client EndpointsClient) ValidateCustomDomain(resourceGroupName string, pro
req, err := client.ValidateCustomDomainPreparer(resourceGroupName, profileName, endpointName, customDomainProperties)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", nil, "Failure preparing request")
return
}
resp, err := client.ValidateCustomDomainSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.EndpointsClient", "ValidateCustomDomain", resp, "Failure sending request")
return
}
result, err = client.ValidateCustomDomainResponder(resp)
@ -932,8 +1066,9 @@ func (client EndpointsClient) ValidateCustomDomainPreparer(resourceGroupName str
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(

44
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/models.go generated vendored Normal file → Executable file
View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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.
@ -37,6 +37,26 @@ const (
Deleting CustomDomainResourceState = "Deleting"
)
// CustomHTTPSProvisioningState enumerates the values for custom https
// provisioning state.
type CustomHTTPSProvisioningState string
const (
// Disabled specifies the disabled state for custom https provisioning
// state.
Disabled CustomHTTPSProvisioningState = "Disabled"
// Disabling specifies the disabling state for custom https provisioning
// state.
Disabling CustomHTTPSProvisioningState = "Disabling"
// Enabled specifies the enabled state for custom https provisioning state.
Enabled CustomHTTPSProvisioningState = "Enabled"
// Enabling specifies the enabling state for custom https provisioning
// state.
Enabling CustomHTTPSProvisioningState = "Enabling"
// Failed specifies the failed state for custom https provisioning state.
Failed CustomHTTPSProvisioningState = "Failed"
)
// EndpointResourceState enumerates the values for endpoint resource state.
type EndpointResourceState string
@ -209,10 +229,11 @@ type CustomDomainParameters struct {
// CustomDomainProperties is the JSON object that contains the properties of
// the custom domain to create.
type CustomDomainProperties struct {
HostName *string `json:"hostName,omitempty"`
ResourceState CustomDomainResourceState `json:"resourceState,omitempty"`
ValidationData *string `json:"validationData,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
HostName *string `json:"hostName,omitempty"`
ResourceState CustomDomainResourceState `json:"resourceState,omitempty"`
CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"`
ValidationData *string `json:"validationData,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// CustomDomainPropertiesParameters is the JSON object that contains the
@ -256,6 +277,19 @@ type EdgeNodeProperties struct {
type EdgenodeResult struct {
autorest.Response `json:"-"`
Value *[]EdgeNode `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// EdgenodeResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client EdgenodeResult) EdgenodeResultPreparer() (*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)))
}
// Endpoint is cDN endpoint is the entity within a CDN profile containing

78
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/origins.go generated vendored Normal file → Executable file
View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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.
@ -60,13 +60,15 @@ func (client OriginsClient) Get(resourceGroupName string, profileName string, en
req, err := client.GetPreparer(resourceGroupName, profileName, endpointName, originName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
@ -87,8 +89,9 @@ func (client OriginsClient) GetPreparer(resourceGroupName string, profileName st
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -135,13 +138,15 @@ func (client OriginsClient) ListByEndpoint(resourceGroupName string, profileName
req, err := client.ListByEndpointPreparer(resourceGroupName, profileName, endpointName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", nil, "Failure preparing request")
return
}
resp, err := client.ListByEndpointSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "ListByEndpoint", resp, "Failure sending request")
return
}
result, err = client.ListByEndpointResponder(resp)
@ -161,8 +166,9 @@ func (client OriginsClient) ListByEndpointPreparer(resourceGroupName string, pro
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -226,32 +232,48 @@ func (client OriginsClient) ListByEndpointNextResults(lastResults OriginListResu
// the resource group. endpointName is name of the endpoint under the profile
// which is unique globally. originName is name of the origin which is unique
// within the endpoint. originUpdateProperties is origin properties
func (client OriginsClient) Update(resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client OriginsClient) Update(resourceGroupName string, profileName string, endpointName string, originName string, originUpdateProperties OriginUpdateParameters, cancel <-chan struct{}) (<-chan Origin, <-chan error) {
resultChan := make(chan Origin, 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "Update")
errChan <- validation.NewErrorWithValidationError(err, "cdn.OriginsClient", "Update")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, originName, originUpdateProperties, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", nil, "Failure preparing request")
}
go func() {
var err error
var result Origin
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.UpdatePreparer(resourceGroupName, profileName, endpointName, originName, originUpdateProperties, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure sending request")
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure responding to request")
}
return
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.OriginsClient", "Update", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// UpdatePreparer prepares the Update request.
@ -264,8 +286,9 @@ func (client OriginsClient) UpdatePreparer(resourceGroupName string, profileName
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -288,12 +311,13 @@ func (client OriginsClient) UpdateSender(req *http.Request) (*http.Response, err
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client OriginsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client OriginsClient) UpdateResponder(resp *http.Response) (result Origin, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}

216
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/profiles.go generated vendored Normal file → Executable file
View File

@ -14,7 +14,7 @@ package cdn
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
// 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.
@ -52,7 +52,9 @@ func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) Profile
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. profile is profile properties needed to create a new
// profile.
func (client ProfilesClient) Create(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client ProfilesClient) Create(resourceGroupName string, profileName string, profile Profile, cancel <-chan struct{}) (<-chan Profile, <-chan error) {
resultChan := make(chan Profile, 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},
@ -60,26 +62,40 @@ func (client ProfilesClient) Create(resourceGroupName string, profileName string
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
{TargetValue: profile,
Constraints: []validation.Constraint{{Target: "profile.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Create")
errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Create")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.CreatePreparer(resourceGroupName, profileName, profile, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", nil, "Failure preparing request")
}
go func() {
var err error
var result Profile
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.CreatePreparer(resourceGroupName, profileName, profile, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure sending request")
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure responding to request")
}
return
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Create", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreatePreparer prepares the Create request.
@ -90,8 +106,9 @@ func (client ProfilesClient) CreatePreparer(resourceGroupName string, profileNam
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -114,13 +131,14 @@ func (client ProfilesClient) CreateSender(req *http.Request) (*http.Response, er
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client ProfilesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client ProfilesClient) CreateResponder(resp *http.Response) (result Profile, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -134,32 +152,48 @@ func (client ProfilesClient) CreateResponder(resp *http.Response) (result autore
// resourceGroupName is name of the Resource group within the Azure
// subscription. profileName is name of the CDN profile which is unique within
// the resource group.
func (client ProfilesClient) Delete(resourceGroupName string, profileName string, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client ProfilesClient) Delete(resourceGroupName string, profileName string, cancel <-chan struct{}) (<-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 {
return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Delete")
errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Delete")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.DeletePreparer(resourceGroupName, profileName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", nil, "Failure preparing request")
}
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, profileName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure sending request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure responding to request")
}
return
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
@ -170,8 +204,9 @@ func (client ProfilesClient) DeletePreparer(resourceGroupName string, profileNam
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -223,13 +258,15 @@ func (client ProfilesClient) GenerateSsoURI(resourceGroupName string, profileNam
req, err := client.GenerateSsoURIPreparer(resourceGroupName, profileName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", nil, "Failure preparing request")
return
}
resp, err := client.GenerateSsoURISender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "GenerateSsoURI", resp, "Failure sending request")
return
}
result, err = client.GenerateSsoURIResponder(resp)
@ -248,8 +285,9 @@ func (client ProfilesClient) GenerateSsoURIPreparer(resourceGroupName string, pr
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -296,13 +334,15 @@ func (client ProfilesClient) Get(resourceGroupName string, profileName string) (
req, err := client.GetPreparer(resourceGroupName, profileName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
@ -321,8 +361,9 @@ func (client ProfilesClient) GetPreparer(resourceGroupName string, profileName s
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -356,13 +397,15 @@ func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile,
func (client ProfilesClient) List() (result ProfileListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
@ -379,8 +422,9 @@ func (client ProfilesClient) ListPreparer() (*http.Request, error) {
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -449,13 +493,15 @@ func (client ProfilesClient) ListByResourceGroup(resourceGroupName string) (resu
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
@ -473,8 +519,9 @@ func (client ProfilesClient) ListByResourceGroupPreparer(resourceGroupName strin
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -545,13 +592,15 @@ func (client ProfilesClient) ListResourceUsage(resourceGroupName string, profile
req, err := client.ListResourceUsagePreparer(resourceGroupName, profileName)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", nil, "Failure preparing request")
return
}
resp, err := client.ListResourceUsageSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "ListResourceUsage", resp, "Failure sending request")
return
}
result, err = client.ListResourceUsageResponder(resp)
@ -570,8 +619,9 @@ func (client ProfilesClient) ListResourceUsagePreparer(resourceGroupName string,
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -635,32 +685,48 @@ func (client ProfilesClient) ListResourceUsageNextResults(lastResults ResourceUs
// subscription. profileName is name of the CDN profile which is unique within
// the resource group. profileUpdateParameters is profile properties needed to
// update an existing profile.
func (client ProfilesClient) Update(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client ProfilesClient) Update(resourceGroupName string, profileName string, profileUpdateParameters ProfileUpdateParameters, cancel <-chan struct{}) (<-chan Profile, <-chan error) {
resultChan := make(chan Profile, 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 {
return result, validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Update")
errChan <- validation.NewErrorWithValidationError(err, "cdn.ProfilesClient", "Update")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.UpdatePreparer(resourceGroupName, profileName, profileUpdateParameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", nil, "Failure preparing request")
}
go func() {
var err error
var result Profile
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.UpdatePreparer(resourceGroupName, profileName, profileUpdateParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure sending request")
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure responding to request")
}
return
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "cdn.ProfilesClient", "Update", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// UpdatePreparer prepares the Update request.
@ -671,8 +737,9 @@ func (client ProfilesClient) UpdatePreparer(resourceGroupName string, profileNam
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-10-02"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -695,12 +762,13 @@ func (client ProfilesClient) UpdateSender(req *http.Request) (*http.Response, er
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client ProfilesClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = resp
result.Response = autorest.Response{Response: resp}
return
}

35
vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/version.go generated vendored Normal file → Executable file
View File

@ -18,43 +18,12 @@ package cdn
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
const (
major = "8"
minor = "1"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "cdn", "2016-10-02")
}
return userAgent
return "Azure-SDK-For-Go/v10.0.2-beta arm-cdn/2016-10-02"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
return "v10.0.2-beta"
}

45
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go generated vendored Normal file → Executable file
View File

@ -49,13 +49,15 @@ func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string)
func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, name, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
@ -74,8 +76,9 @@ func (client AvailabilitySetsClient) CreateOrUpdatePreparer(resourceGroupName st
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -114,13 +117,15 @@ func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response
func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabilitySetName string) (result OperationStatusResponse, err error) {
req, err := client.DeletePreparer(resourceGroupName, availabilitySetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
@ -139,8 +144,9 @@ func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, av
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -177,13 +183,15 @@ func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (resul
func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) {
req, err := client.GetPreparer(resourceGroupName, availabilitySetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
@ -202,8 +210,9 @@ func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, avail
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -239,13 +248,15 @@ func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result A
func (client AvailabilitySetsClient) List(resourceGroupName string) (result AvailabilitySetListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
@ -263,8 +274,9 @@ func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*ht
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -302,13 +314,15 @@ func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result
func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) {
req, err := client.ListAvailableSizesPreparer(resourceGroupName, availabilitySetName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
return
}
resp, err := client.ListAvailableSizesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request")
return
}
result, err = client.ListAvailableSizesResponder(resp)
@ -327,8 +341,9 @@ func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupNam
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(

5
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go generated vendored Normal file → Executable file
View File

@ -27,9 +27,6 @@ import (
)
const (
// APIVersion is the version of the Compute
APIVersion = "2016-04-30-preview"
// DefaultBaseURI is the default URI used for the service Compute
DefaultBaseURI = "https://management.azure.com"
)
@ -38,7 +35,6 @@ const (
type ManagementClient struct {
autorest.Client
BaseURI string
APIVersion string
SubscriptionID string
}
@ -52,7 +48,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
APIVersion: APIVersion,
SubscriptionID: subscriptionID,
}
}

138
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/images.go generated vendored Normal file → Executable file
View File

@ -48,33 +48,49 @@ func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesCli
// resourceGroupName is the name of the resource group. imageName is the name
// of the image. parameters is parameters supplied to the Create Image
// operation.
func (client ImagesClient) CreateOrUpdate(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (result autorest.Response, err error) {
func (client ImagesClient) CreateOrUpdate(resourceGroupName string, imageName string, parameters Image, cancel <-chan struct{}) (<-chan Image, <-chan error) {
resultChan := make(chan Image, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{
{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 {
return result, validation.NewErrorWithValidationError(err, "compute.ImagesClient", "CreateOrUpdate")
errChan <- validation.NewErrorWithValidationError(err, "compute.ImagesClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, imageName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request")
}
go func() {
var err error
var result Image
defer func() {
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)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", resp, "Failure sending request")
}
resp, err := client.CreateOrUpdateSender(req)
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
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.
@ -85,8 +101,9 @@ func (client ImagesClient) CreateOrUpdatePreparer(resourceGroupName string, imag
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -109,13 +126,14 @@ func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (*http.Respon
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
func (client ImagesClient) CreateOrUpdateResponder(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 = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -125,24 +143,37 @@ func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result
//
// resourceGroupName is the name of the resource group. imageName is the name
// of the image.
func (client ImagesClient) Delete(resourceGroupName string, imageName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, imageName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request")
}
func (client ImagesClient) Delete(resourceGroupName string, imageName 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, imageName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure sending request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure responding to request")
}
return
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
@ -153,8 +184,9 @@ func (client ImagesClient) DeletePreparer(resourceGroupName string, imageName st
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -175,13 +207,14 @@ func (client ImagesClient) DeleteSender(req *http.Request) (*http.Response, erro
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
func (client ImagesClient) 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 = resp
result.Response = autorest.Response{Response: resp}
return
}
@ -192,13 +225,15 @@ func (client ImagesClient) DeleteResponder(resp *http.Response) (result autorest
func (client ImagesClient) Get(resourceGroupName string, imageName string, expand string) (result Image, err error) {
req, err := client.GetPreparer(resourceGroupName, imageName, expand)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
@ -217,8 +252,9 @@ func (client ImagesClient) GetPreparer(resourceGroupName string, imageName strin
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
@ -257,13 +293,15 @@ func (client ImagesClient) GetResponder(resp *http.Response) (result Image, err
func (client ImagesClient) List() (result ImageListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
@ -280,8 +318,9 @@ func (client ImagesClient) ListPreparer() (*http.Request, error) {
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -341,13 +380,15 @@ func (client ImagesClient) ListNextResults(lastResults ImageListResult) (result
func (client ImagesClient) ListByResourceGroup(resourceGroupName string) (result ImageListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
@ -365,8 +406,9 @@ func (client ImagesClient) ListByResourceGroupPreparer(resourceGroupName string)
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(

26
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go generated vendored Normal file → Executable file
View File

@ -107,6 +107,15 @@ const (
HTTPS ProtocolTypes = "Https"
)
// 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"
)
// SettingNames enumerates the values for setting names.
type SettingNames string
@ -783,6 +792,7 @@ type VirtualMachine struct {
Plan *Plan `json:"plan,omitempty"`
*VirtualMachineProperties `json:"properties,omitempty"`
Resources *[]VirtualMachineExtension `json:"resources,omitempty"`
Identity *VirtualMachineIdentity `json:"identity,omitempty"`
}
// VirtualMachineAgentInstanceView is the instance view of the VM Agent running
@ -877,6 +887,13 @@ type VirtualMachineExtensionProperties struct {
InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"`
}
// VirtualMachineIdentity is identity for the virtual machine.
type VirtualMachineIdentity struct {
PrincipalID *string `json:"principalId,omitempty"`
TenantID *string `json:"tenantId,omitempty"`
Type ResourceIdentityType `json:"type,omitempty"`
}
// VirtualMachineImage is describes a Virtual Machine Image.
type VirtualMachineImage struct {
autorest.Response `json:"-"`
@ -959,6 +976,7 @@ type VirtualMachineScaleSet struct {
Sku *Sku `json:"sku,omitempty"`
Plan *Plan `json:"plan,omitempty"`
*VirtualMachineScaleSetProperties `json:"properties,omitempty"`
Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"`
}
// VirtualMachineScaleSetDataDisk is describes a virtual machine scale set data
@ -998,6 +1016,14 @@ type VirtualMachineScaleSetExtensionProperties struct {
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// VirtualMachineScaleSetIdentity is identity for the virtual machine scale
// set.
type VirtualMachineScaleSetIdentity struct {
PrincipalID *string `json:"principalId,omitempty"`
TenantID *string `json:"tenantId,omitempty"`
Type ResourceIdentityType `json:"type,omitempty"`
}
// VirtualMachineScaleSetInstanceView is the instance view of a virtual machine
// scale set.
type VirtualMachineScaleSetInstanceView struct {

9
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usage.go generated vendored Normal file → Executable file
View File

@ -54,13 +54,15 @@ func (client UsageClient) List(location string) (result ListUsagesResult, err er
req, err := client.ListPreparer(location)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
@ -78,8 +80,9 @@ func (client UsageClient) ListPreparer(location string) (*http.Request, error) {
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(

35
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go generated vendored Normal file → Executable file
View File

@ -18,43 +18,12 @@ package compute
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
const (
major = "8"
minor = "1"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "compute", "2016-04-30-preview")
}
return userAgent
return "Azure-SDK-For-Go/v10.0.2-beta arm-compute/2016-04-30-preview"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
return "v10.0.2-beta"
}

View File

@ -46,13 +46,15 @@ func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscript
func (client VirtualMachineExtensionImagesClient) Get(location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) {
req, err := client.GetPreparer(location, publisherName, typeParameter, version)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
@ -73,8 +75,9 @@ func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, p
"version": autorest.Encode("path", version),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -109,13 +112,15 @@ func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Respon
func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) {
req, err := client.ListTypesPreparer(location, publisherName)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
return
}
resp, err := client.ListTypesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request")
return
}
result, err = client.ListTypesResponder(resp)
@ -134,8 +139,9 @@ func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location str
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
@ -171,13 +177,15 @@ func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.
func (client VirtualMachineExtensionImagesClient) ListVersions(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)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
return
}
resp, err := client.ListVersionsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request")
err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request")
return
}
result, err = client.ListVersionsResponder(resp)
@ -197,8 +205,9 @@ func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location
"type": autorest.Encode("path", typeParameter),
}
const APIVersion = "2016-04-30-preview"
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
"api-version": APIVersion,
}
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)

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