class Chef::Provisioning::AzureRM::AzureProvider

Public Instance Methods

action_handler() click to toggle source
# File lib/chef/provisioning/azurerm/azure_provider.rb, line 11
def action_handler
  @action_handler ||= Chef::Provisioning::ChefProviderActionHandler.new(self)
end
compute_management_client() click to toggle source
# File lib/chef/provisioning/azurerm/azure_provider.rb, line 29
def compute_management_client
  credentials = Credentials.new.azure_credentials_for_subscription(new_resource.subscription_id)
  client = Azure::ARM::Compute::ComputeManagementClient.new(credentials)
  client.subscription_id = new_resource.subscription_id
  client
end
network_management_client() click to toggle source
# File lib/chef/provisioning/azurerm/azure_provider.rb, line 36
def network_management_client
  credentials = Credentials.new.azure_credentials_for_subscription(new_resource.subscription_id)
  client = Azure::ARM::Network::NetworkManagementClient.new(credentials)
  client.subscription_id = new_resource.subscription_id
  client
end
resource_management_client() click to toggle source
# File lib/chef/provisioning/azurerm/azure_provider.rb, line 15
def resource_management_client
  credentials = Credentials.new.azure_credentials_for_subscription(new_resource.subscription_id)
  client = Azure::ARM::Resources::ResourceManagementClient.new(credentials)
  client.subscription_id = new_resource.subscription_id
  client
end
storage_management_client() click to toggle source
# File lib/chef/provisioning/azurerm/azure_provider.rb, line 22
def storage_management_client
  credentials = Credentials.new.azure_credentials_for_subscription(new_resource.subscription_id)
  client = Azure::ARM::Storage::StorageManagementClient.new(credentials)
  client.subscription_id = new_resource.subscription_id
  client
end
try_azure_operation(description, silently_continue_on_error = false) { || ... } click to toggle source
# File lib/chef/provisioning/azurerm/azure_provider.rb, line 43
def try_azure_operation(description, silently_continue_on_error = false)
  begin
    result = yield
  rescue MsRestAzure::AzureOperationError => operation_error
    unless silently_continue_on_error
      error = operation_error.body['error']
      Chef::Log.error "ERROR #{description} - #{error}"
      raise operation_error
    end
  end

  result
end