Class: Aws::Glacier::Resource
- Inherits:
-
Object
- Object
- Aws::Glacier::Resource
- Defined in:
- lib/aws-sdk-glacier/resource.rb
Overview
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)
Actions collapse
Associations collapse
Instance Method Summary collapse
- #client ⇒ Client
-
#initialize(options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
Instance Method Details
#account(id) ⇒ Account
63 64 65 66 67 68 |
# File 'lib/aws-sdk-glacier/resource.rb', line 63 def account(id) Account.new( id: id, client: @client ) end |
#create_vault(options = {}) ⇒ Vault
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/aws-sdk-glacier/resource.rb', line 47 def create_vault( = {}) = .merge(account_id: "-") Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_vault() end Vault.new( account_id: [:account_id], name: [:vault_name], client: @client ) end |
#vaults(options = {}) ⇒ Vault::Collection
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/aws-sdk-glacier/resource.rb', line 75 def vaults( = {}) batches = Enumerator.new do |y| = .merge(account_id: "-") resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.list_vaults() end resp.each_page do |page| batch = [] page.data.vault_list.each do |v| batch << Vault.new( account_id: [:account_id], name: v.vault_name, data: v, client: @client ) end y.yield(batch) end end Vault::Collection.new(batches) end |