class Aws::Glacier::Resource
This class provides a resource oriented interface for Glacier
. To create a resource object:
resource = Aws::Glacier::Resource.new(region: 'us-west-2')
You can supply a client object with custom configuration that will be used for all resource operations. If you do not pass `:client`, a default client will be constructed.
client = Aws::Glacier::Client.new(region: 'us-west-2') resource = Aws::Glacier::Resource.new(client: client)
Public Class Methods
new(options = {})
click to toggle source
@param options ({}) @option options [Client] :client
# File lib/aws-sdk-glacier/resource.rb, line 27 def initialize(options = {}) @client = options[:client] || Client.new(options) end
Public Instance Methods
account(id)
click to toggle source
@param [String] id @return [Account]
# File lib/aws-sdk-glacier/resource.rb, line 61 def account(id) Account.new( id: id, client: @client ) end
client()
click to toggle source
@return [Client]
# File lib/aws-sdk-glacier/resource.rb, line 32 def client @client end
create_vault(options = {})
click to toggle source
@example Request syntax with placeholder values
vault = glacier.create_vault({ vault_name: "string", # required })
@param [Hash] options ({}) @option options [required, String] :vault_name
The name of the vault.
@return [Vault]
# File lib/aws-sdk-glacier/resource.rb, line 47 def create_vault(options = {}) options = options.merge(account_id: "-") @client.create_vault(options) Vault.new( account_id: options[:account_id], name: options[:vault_name], client: @client ) end
vaults(options = {})
click to toggle source
@example Request syntax with placeholder values
glacier.vaults()
@param [Hash] options ({}) @return [Vault::Collection]
# File lib/aws-sdk-glacier/resource.rb, line 73 def vaults(options = {}) batches = Enumerator.new do |y| options = options.merge(account_id: "-") resp = @client.list_vaults(options) resp.each_page do |page| batch = [] page.data.vault_list.each do |v| batch << Vault.new( account_id: options[:account_id], name: v.vault_name, data: v, client: @client ) end y.yield(batch) end end Vault::Collection.new(batches) end