Class: Fog::AWS::ElasticBeanstalk::Template

Inherits:
Model
  • Object
show all
Defined in:
lib/rackspace-fog/aws/models/beanstalk/template.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 = {}) ⇒ Template

Returns a new instance of Template.



20
21
22
# File 'lib/rackspace-fog/aws/models/beanstalk/template.rb', line 20

def initialize(attributes={})
  super
end

Instance Method Details

#destroyObject



34
35
36
37
38
# File 'lib/rackspace-fog/aws/models/beanstalk/template.rb', line 34

def destroy
  requires :name, :application_name
  connection.delete_configuration_template(application_name, name)
  true
end

#modify(new_attributes) ⇒ Object



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

def modify(new_attributes)
  requires :name, :application_name

  options = {
      'ApplicationName' => application_name,
      'Description' => new_attributes[:description],
      'OptionSettings' => new_attributes[:option_settings],
      'TemplateName' => name
  }
  options.delete_if {|key, value| value.nil?}

  data = connection.update_configuration_template(options).body['UpdateConfigurationTemplateResult']
  merge_attributes(data)
  true
end

#optionsObject

Returns an array of options that may be set on this template



25
26
27
28
29
30
31
32
# File 'lib/rackspace-fog/aws/models/beanstalk/template.rb', line 25

def options
  requires :name, :application_name
  data = connection.describe_configuration_options({
      'ApplicationName' => application_name,
      'TemplateName' => name
                                            })
  data.body['DescribeConfigurationOptionsResult']['Options']
end

#saveObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rackspace-fog/aws/models/beanstalk/template.rb', line 40

def save
  requires :name, :application_name

  options = {
      'ApplicationName' => application_name,
      'Description' => description,
      'EnvironmentId' => environment_id,
      'OptionSettings' => option_settings,
      'SolutionStackName' => solution_stack_name,
      'SourceConfiguration' => source_configuration,
      'TemplateName' => name
  }
  options.delete_if {|key, value| value.nil?}

  data = connection.create_configuration_template(options).body['CreateConfigurationTemplateResult']
  merge_attributes(data)
  true
end