Skip to content

Commit

Permalink
provider/azurerm: Bump AzureRM SDK to v8.0.1-beta (#11866)
Browse files Browse the repository at this point in the history
* provider/azurerm: Bump AzureRM SDK to v8.0.1-beta

* provider/azurerm: Renaming SDK packages as per MSFT updates

* Bump azurerm sdk 8.0.1 (#12076)

* Updating the constructors to match the updated types

* Updating the Redis Client name

* ObjectID is now a string

* Updating to match the new Storage API specs
  • Loading branch information
stack72 authored Feb 23, 2017
1 parent e0e3692 commit 05e87be
Show file tree
Hide file tree
Showing 94 changed files with 3,382 additions and 2,423 deletions.
12 changes: 6 additions & 6 deletions builtin/providers/azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type ArmClient struct {
rivieraClient *riviera.Client

availSetClient compute.AvailabilitySetsClient
usageOpsClient compute.UsageOperationsClient
usageOpsClient compute.UsageClient
vmExtensionImageClient compute.VirtualMachineExtensionImagesClient
vmExtensionClient compute.VirtualMachineExtensionsClient
vmScaleSetClient compute.VirtualMachineScaleSetsClient
Expand Down Expand Up @@ -76,7 +76,7 @@ type ArmClient struct {
providers resources.ProvidersClient
resourceGroupClient resources.GroupsClient
tagsClient resources.TagsClient
resourceFindClient resources.Client
resourceFindClient resources.GroupClient

jobsClient scheduler.JobsClient
jobsCollectionsClient scheduler.JobCollectionsClient
Expand All @@ -86,7 +86,7 @@ type ArmClient struct {

deploymentsClient resources.DeploymentsClient

redisClient redis.Client
redisClient redis.GroupClient

trafficManagerProfilesClient trafficmanager.ProfilesClient
trafficManagerEndpointsClient trafficmanager.EndpointsClient
Expand Down Expand Up @@ -191,7 +191,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())
Expand Down Expand Up @@ -359,7 +359,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())
Expand Down Expand Up @@ -419,7 +419,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())
Expand Down
4 changes: 2 additions & 2 deletions builtin/providers/azurerm/resource_arm_key_vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions builtin/providers/azurerm/resource_arm_redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down
26 changes: 18 additions & 8 deletions builtin/providers/azurerm/resource_arm_storage_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}

Expand Down
8 changes: 5 additions & 3 deletions builtin/providers/azurerm/resource_arm_storage_share_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
90 changes: 86 additions & 4 deletions vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 27 additions & 27 deletions vendor/github.com/Azure/azure-sdk-for-go/arm/cdn/customdomains.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 05e87be

Please sign in to comment.