You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Glacier::Account

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb

Defined Under Namespace

Classes: Collection

Actions collapse

Associations collapse

Read-Only Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, options = {}) ⇒ Account #initialize(options = {}) ⇒ Account

Returns a new instance of Account

Overloads:

  • #initialize(id, options = {}) ⇒ Account

    Parameters:

    • id (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ Account

    Options Hash (options):

    • :id (required, String)
    • :client (Client)


19
20
21
22
23
24
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb', line 19

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @id = extract_id(args, options)
  @data = Aws::EmptyStructure.new
  @client = options.delete(:client) || Client.new(options)
end

Instance Method Details

#clientClient

Returns:



36
37
38
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb', line 36

def client
  @client
end

#create_vault(options = {}) ⇒ Vault

Examples:

Request syntax with placeholder values


vault = .create_vault({
  vault_name: "string", # required
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :vault_name (required, String)

    The name of the vault.

Returns:



72
73
74
75
76
77
78
79
80
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb', line 72

def create_vault(options = {})
  options = options.merge(account_id: @id)
  resp = @client.create_vault(options)
  Vault.new(
    account_id: @id,
    name: options[:vault_name],
    client: @client
  )
end

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



57
58
59
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb', line 57

def data_loaded?
  !!@data
end

#idString

Returns:

  • (String)


29
30
31
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb', line 29

def id
  @id
end

#vault(name) ⇒ Vault

Parameters:

  • name (String)

Returns:



86
87
88
89
90
91
92
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb', line 86

def vault(name)
  Vault.new(
    account_id: @id,
    name: name,
    client: @client
  )
end

#vaults(options = {}) ⇒ Vault::Collection

Examples:

Request syntax with placeholder values


.vaults()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'gems/aws-sdk-glacier/lib/aws-sdk-glacier/account.rb', line 99

def vaults(options = {})
  batches = Enumerator.new do |y|
    options = options.merge(account_id: @id)
    resp = @client.list_vaults(options)
    resp.each_page do |page|
      batch = []
      page.data.vault_list.each do |v|
        batch << Vault.new(
          account_id: @id,
          name: v.vault_name,
          data: v,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Vault::Collection.new(batches)
end