Class: Fog::AWS::ElasticBeanstalk::Version

Inherits:
Model
  • Object
show all
Defined in:
lib/rackspace-fog/aws/models/beanstalk/version.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ Version

Returns a new instance of Version.



16
17
18
# File 'lib/rackspace-fog/aws/models/beanstalk/version.rb', line 16

def initialize(attributes={})
  super
end

Instance Method Details

#destroy(delete_source_bundle = nil) ⇒ Object



38
39
40
41
42
# File 'lib/rackspace-fog/aws/models/beanstalk/version.rb', line 38

def destroy(delete_source_bundle = nil)
  requires :label, :application_name
  connection.delete_application_version(application_name, label, delete_source_bundle)
  true
end

#environmentsObject

Returns environments running this version



30
31
32
33
34
35
36
# File 'lib/rackspace-fog/aws/models/beanstalk/version.rb', line 30

def environments
  requires :label, :application_name
  connection.environments.all({
                            'ApplicationName' => application_name,
                            'VersionLabel' => label
                        })
end

#eventsObject

Return events related to this version



21
22
23
24
25
26
27
# File 'lib/rackspace-fog/aws/models/beanstalk/version.rb', line 21

def events
  requires :label, :application_name
  connection.events.all({
                            'ApplicationName' => application_name,
                            'VersionLabel' => label
                        })
end

#saveObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rackspace-fog/aws/models/beanstalk/version.rb', line 44

def save
  requires :label, :application_name

  options = {
      'ApplicationName' => application_name,
      'AutoCreateApplication' => auto_create_application,
      'Description' => description,
      'SourceBundle' => source_bundle,
      'VersionLabel' => label
  }
  options.delete_if {|key, value| value.nil?}

  data = connection.create_application_version(options).body['CreateApplicationVersionResult']['ApplicationVersion']
  merge_attributes(data)
  true
end

#updateObject

Updates the version label with the current property values. Currently only updates description



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rackspace-fog/aws/models/beanstalk/version.rb', line 62

def update
  requires :label, :application_name

  options = {
      'ApplicationName' => application_name,
      'Description' => description,
      'VersionLabel' => label
  }
  options.delete_if {|key, value| value.nil?}

  data = connection.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']
  merge_attributes(data)
end