class TerraspacePluginAzurerm::Interfaces::Backend::StorageContainer

Public Instance Methods

create() click to toggle source
# File lib/terraspace_plugin_azurerm/interfaces/backend/storage_container.rb, line 5
def create
  if exist?
    logger.debug "Storage Container #{@container_name} already exists"
  else
    create_storage_container
  end
end
create_storage_container() click to toggle source
# File lib/terraspace_plugin_azurerm/interfaces/backend/storage_container.rb, line 22
def create_storage_container
  logger.info "Creating Storage Container #{@container_name}..."
  blob_container = BlobContainer.new
  blob_container.name = @container_name
  blob_containers.create(@resource_group_name, @storage_account_name, @container_name, blob_container)
end
exist?() click to toggle source
# File lib/terraspace_plugin_azurerm/interfaces/backend/storage_container.rb, line 13
def exist?
  begin
    blob_containers.get(@resource_group_name, @storage_account_name, @container_name)
    true
  rescue MsRestAzure::AzureOperationError => e
    e.message.include?("The specified container does not exist") ? false : raise
  end
end