Class: Chef::Provider::AzureStorageAccount
Instance Method Summary
collapse
#action_handler, #compute_management_client, #network_management_client, #resource_management_client, #resource_manager_endpoint_url, #storage_management_client, #try_azure_operation
Instance Method Details
#create_storage_account ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/chef/provider/azure_storage_account.rb', line 51
def create_storage_account
storage_account = Azure::ARM::Storage::Models::StorageAccountCreateParameters.new
storage_account.location = new_resource.location
storage_account.tags = new_resource.tags
storage_account.properties = Azure::ARM::Storage::Models::StorageAccountPropertiesCreateParameters.new
storage_account.properties.account_type = new_resource.account_type
action_handler.report_progress 'creating Storage Account'
result = storage_management_client.storage_accounts.create(new_resource.resource_group, new_resource.name, storage_account)
Chef::Log.debug(result)
end
|
#does_storage_account_exist ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/chef/provider/azure_storage_account.rb', line 43
def does_storage_account_exist
storage_account_list = storage_management_client.storage_accounts.list_by_resource_group(new_resource.resource_group)
storage_account_list.value.each do |storage_account|
return true if storage_account.name == new_resource.name
end
false
end
|
#update_storage_account ⇒ Object
62
63
64
65
66
|
# File 'lib/chef/provider/azure_storage_account.rb', line 62
def update_storage_account
update_storage_account_tags
update_storage_account_account_type
update_storage_account_custom_domain
end
|
#update_storage_account_account_type ⇒ Object
77
78
79
80
81
82
83
84
|
# File 'lib/chef/provider/azure_storage_account.rb', line 77
def update_storage_account_account_type
storage_account = Azure::ARM::Storage::Models::StorageAccountUpdateParameters.new
storage_account.properties = Azure::ARM::Storage::Models::StorageAccountPropertiesUpdateParameters.new
storage_account.properties.account_type = new_resource.account_type
action_handler.report_progress 'updating Properties'
result = storage_management_client.storage_accounts.update(new_resource.resource_group, new_resource.name, storage_account)
Chef::Log.debug(result)
end
|
#update_storage_account_custom_domain ⇒ Object
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/chef/provider/azure_storage_account.rb', line 86
def update_storage_account_custom_domain
storage_account = Azure::ARM::Storage::Models::StorageAccountUpdateParameters.new
storage_account.properties = Azure::ARM::Storage::Models::StorageAccountPropertiesUpdateParameters.new
custom_domain = Azure::ARM::Storage::Models::CustomDomain.new
custom_domain.name = new_resource.custom_domain
storage_account.properties.custom_domain = custom_domain
action_handler.report_progress 'updating Custom Domain'
result = storage_management_client.storage_accounts.update(new_resource.resource_group, new_resource.name, storage_account)
Chef::Log.debug(result)
end
|
68
69
70
71
72
73
74
75
|
# File 'lib/chef/provider/azure_storage_account.rb', line 68
def update_storage_account_tags
storage_account = Azure::ARM::Storage::Models::StorageAccountUpdateParameters.new
storage_account.tags = new_resource.tags
storage_account.properties = Azure::ARM::Storage::Models::StorageAccountPropertiesUpdateParameters.new
action_handler.report_progress 'updating Tags'
result = storage_management_client.storage_accounts.update(new_resource.resource_group, new_resource.name, storage_account)
Chef::Log.debug(result)
end
|
#whyrun_supported? ⇒ Boolean
8
9
10
|
# File 'lib/chef/provider/azure_storage_account.rb', line 8
def whyrun_supported?
true
end
|