Class: Fog::AWS::Glacier::Job

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/glacier/job.rb

Constant Summary collapse

ARCHIVE =
'archive-retrieval'
INVENTORY =
'inventory-retrieval'

Instance Method Summary collapse

Instance Method Details

#get_output(options = {}) ⇒ Object

pass :range => 1..1234 to only retrieve those bytes pass :io => f to stream the response to that tio



46
47
48
49
50
51
52
# File 'lib/fog/aws/models/glacier/job.rb', line 46

def get_output(options={})
  if io = options.delete(:io)
    options = options.merge :response_block => lambda {|chunk, remaining_bytes, total_bytes| io.write chunk}
  end
  options['Range'] = options.delete :range
  service.get_job_output(vault.id, id, options)
end

#ready?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/fog/aws/models/glacier/job.rb', line 27

def ready?
  completed
end

#saveObject



31
32
33
34
35
36
37
38
# File 'lib/fog/aws/models/glacier/job.rb', line 31

def save
  requires :vault, :type
  specification = {'Type' => type, 'ArchiveId' => archive_id, 'Format' => format, 'Description' => description, 'SNSTopic' => sns_topic}.reject{|k,v| v.nil?}

  data = service.initiate_job(vault.id, specification)
  self.id = data.headers['x-amz-job-id']
  reload
end

#vaultObject



40
41
42
# File 'lib/fog/aws/models/glacier/job.rb', line 40

def vault
  @vault
end