diff --git a/builtin/providers/azurerm/config.go b/builtin/providers/azurerm/config.go index 6b24ffab4be8..823f9e48df07 100644 --- a/builtin/providers/azurerm/config.go +++ b/builtin/providers/azurerm/config.go @@ -189,7 +189,7 @@ func (c *Config) getArmClient() (*ArmClient, error) { asc.Sender = autorest.CreateSender(withRequestLogging()) client.availSetClient = asc - uoc := compute.NewUsageOperationsClientWithBaseURI(endpoint, c.SubscriptionID) + uoc := compute.NewUsageClientWithBaseURI(endpoint, c.SubscriptionID) setUserAgent(&uoc.Client) uoc.Authorizer = spt uoc.Sender = autorest.CreateSender(withRequestLogging()) @@ -351,7 +351,7 @@ func (c *Config) getArmClient() (*ArmClient, error) { tc.Sender = autorest.CreateSender(withRequestLogging()) client.tagsClient = tc - rf := resources.NewClientWithBaseURI(endpoint, c.SubscriptionID) + rf := resources.NewGroupClientWithBaseURI(endpoint, c.SubscriptionID) setUserAgent(&rf.Client) rf.Authorizer = spt rf.Sender = autorest.CreateSender(withRequestLogging()) @@ -411,7 +411,7 @@ func (c *Config) getArmClient() (*ArmClient, error) { tmec.Sender = autorest.CreateSender(withRequestLogging()) client.trafficManagerEndpointsClient = tmec - rdc := redis.NewClientWithBaseURI(endpoint, c.SubscriptionID) + rdc := redis.NewGroupClientWithBaseURI(endpoint, c.SubscriptionID) setUserAgent(&rdc.Client) rdc.Authorizer = spt rdc.Sender = autorest.CreateSender(withRequestLogging()) diff --git a/builtin/providers/azurerm/resource_arm_key_vault.go b/builtin/providers/azurerm/resource_arm_key_vault.go index 3dddcd291686..2038f9b03e24 100644 --- a/builtin/providers/azurerm/resource_arm_key_vault.go +++ b/builtin/providers/azurerm/resource_arm_key_vault.go @@ -279,7 +279,7 @@ func expandKeyVaultAccessPolicies(d *schema.ResourceData) *[]keyvault.AccessPoli tenantUUID := uuid.FromStringOrNil(policyRaw["tenant_id"].(string)) policy.TenantID = &tenantUUID - objectUUID := uuid.FromStringOrNil(policyRaw["object_id"].(string)) + objectUUID := policyRaw["object_id"].(string) policy.ObjectID = &objectUUID result = append(result, policy) @@ -313,7 +313,7 @@ func flattenKeyVaultAccessPolicies(policies *[]keyvault.AccessPolicyEntry) []int } policyRaw["tenant_id"] = policy.TenantID.String() - policyRaw["object_id"] = policy.ObjectID.String() + policyRaw["object_id"] = policy.ObjectID policyRaw["key_permissions"] = keyPermissionsRaw policyRaw["secret_permissions"] = secretPermissionsRaw diff --git a/builtin/providers/azurerm/resource_arm_redis_cache.go b/builtin/providers/azurerm/resource_arm_redis_cache.go index 5d5fa0384521..80395026fe08 100644 --- a/builtin/providers/azurerm/resource_arm_redis_cache.go +++ b/builtin/providers/azurerm/resource_arm_redis_cache.go @@ -240,7 +240,7 @@ func resourceArmRedisCacheUpdate(d *schema.ResourceData, meta interface{}) error parameters.RedisConfiguration = redisConfiguration } - _, err := client.Update(resGroup, name, parameters, make(chan struct{})) + _, err := client.Update(resGroup, name, parameters) if err != nil { return err } @@ -344,7 +344,7 @@ func resourceArmRedisCacheDelete(d *schema.ResourceData, meta interface{}) error return nil } -func redisStateRefreshFunc(client redis.Client, resourceGroupName string, sgName string) resource.StateRefreshFunc { +func redisStateRefreshFunc(client redis.GroupClient, resourceGroupName string, sgName string) resource.StateRefreshFunc { return func() (interface{}, string, error) { res, err := client.Get(resourceGroupName, sgName) if err != nil { diff --git a/builtin/providers/azurerm/resource_arm_storage_share.go b/builtin/providers/azurerm/resource_arm_storage_share.go index 826bc9b5ceff..b48b7cf6f0e6 100644 --- a/builtin/providers/azurerm/resource_arm_storage_share.go +++ b/builtin/providers/azurerm/resource_arm_storage_share.go @@ -3,9 +3,7 @@ package azurerm import ( "fmt" "log" - // "strings" "regexp" - "strconv" "github.com/Azure/azure-sdk-for-go/storage" "github.com/hashicorp/terraform/helper/schema" @@ -66,10 +64,18 @@ func resourceArmStorageShareCreate(d *schema.ResourceData, meta interface{}) err metaData := make(map[string]string) // TODO: support MetaData log.Printf("[INFO] Creating share %q in storage account %q", name, storageAccountName) - err = fileClient.CreateShare(name, metaData) + reference := fileClient.GetShareReference(name) + err = reference.Create() + + log.Printf("[INFO] Setting share %q metadata in storage account %q", name, storageAccountName) + reference.Metadata = metaData + reference.SetMetadata() log.Printf("[INFO] Setting share %q properties in storage account %q", name, storageAccountName) - fileClient.SetShareProperties(name, storage.ShareHeaders{Quota: strconv.Itoa(d.Get("quota").(int))}) + reference.Properties = storage.ShareProperties{ + Quota: d.Get("quota").(int), + } + reference.SetProperties() d.SetId(name) return resourceArmStorageShareRead(d, meta) @@ -103,7 +109,8 @@ func resourceArmStorageShareRead(d *schema.ResourceData, meta interface{}) error name := d.Get("name").(string) - url := fileClient.GetShareURL(name) + reference := fileClient.GetShareReference(name) + url := reference.URL() if url == "" { log.Printf("[INFO] URL for %q is empty", name) } @@ -131,7 +138,8 @@ func resourceArmStorageShareExists(d *schema.ResourceData, meta interface{}) (bo name := d.Get("name").(string) log.Printf("[INFO] Checking for existence of share %q.", name) - exists, err := fileClient.ShareExists(name) + reference := fileClient.GetShareReference(name) + exists, err := reference.Exists() if err != nil { return false, fmt.Errorf("Error testing existence of share %q: %s", name, err) } @@ -161,8 +169,10 @@ func resourceArmStorageShareDelete(d *schema.ResourceData, meta interface{}) err name := d.Get("name").(string) - log.Printf("[INFO] Deleting storage file %q", name) - if _, err = fileClient.DeleteShareIfExists(name); err != nil { + reference := fileClient.GetShareReference(name) + err = reference.Create() + + if _, err = reference.DeleteIfExists(); err != nil { return fmt.Errorf("Error deleting storage file %q: %s", name, err) } diff --git a/builtin/providers/azurerm/resource_arm_storage_share_test.go b/builtin/providers/azurerm/resource_arm_storage_share_test.go index b8880e556b3e..87dce068d28c 100644 --- a/builtin/providers/azurerm/resource_arm_storage_share_test.go +++ b/builtin/providers/azurerm/resource_arm_storage_share_test.go @@ -131,9 +131,11 @@ func testAccARMStorageShareDisappears(name string, sS *storage.Share) resource.T return nil } - _, err = fileClient.DeleteShareIfExists(sS.Name) - if err != nil { - return err + reference := fileClient.GetShareReference(sS.Name) + err = reference.Create() + + if _, err = reference.DeleteIfExists(); err != nil { + return fmt.Errorf("Error deleting storage file %q: %s", name, err) } return nil