class Chef::Provider::AzureStorageAccount

Public Instance Methods

create_storage_account() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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
update_storage_account_tags() click to toggle source
# 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?() click to toggle source
# File lib/chef/provider/azure_storage_account.rb, line 8
def whyrun_supported?
  true
end