Class: DrawCloud::Parameter

Inherits:
Base
  • Object
show all
Defined in:
lib/draw_cloud/parameter.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#as_groups, #as_launch_configurations, #deletion_policy, #depends_on, #ec2_instances, #elastic_ips, #gateways, #iam_access_keys, #iam_policies, #iam_users, #mappings, #metadata, #network_acls, #network_interfaces, #outputs, #parameters, #parent, #rdses, #resources, #route_tables, #security_groups, #sns_topics, #subnets, #vpcs, #wait_handles

Instance Method Summary collapse

Methods inherited from Base

#[], #accessor, #add_standard_properties, #create_as_group, #create_as_launch_configuration, #create_ec2_instance, #create_ec2_instance_template, #create_elastic_ip, #create_iam_access_key, #create_iam_policy, #create_iam_user, #create_mapping, #create_network_acl, #create_network_interface, #create_output, #create_parameter, #create_rds, #create_route_table, #create_security_group, #create_service, #create_sns_topic, #create_subnet, #create_vpc, #create_wait_handle, #ref, #resource_name

Methods included from Locations

#arn_s3

Methods included from Utilities

#desplice, #fnbase64, #fngetatt, #fnjoin, #hash_to_tag_array, #region, #resource_style, #splice, #stack_name

Constructor Details

#initialize(name, type, options = {}, &block) ⇒ Parameter

Returns a new instance of Parameter.



27
28
29
30
31
# File 'lib/draw_cloud/parameter.rb', line 27

def initialize(name, type, options={}, &block)
  @name = name
  @type = type
  super(options, &block)
end

Instance Attribute Details

#allowed_patternObject

Returns the value of attribute allowed_pattern.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def allowed_pattern
  @allowed_pattern
end

#allowed_valuesObject

Returns the value of attribute allowed_values.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def allowed_values
  @allowed_values
end

#constraint_descriptionObject

Returns the value of attribute constraint_description.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def constraint_description
  @constraint_description
end

#defaultObject

Returns the value of attribute default.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def default
  @default
end

#descriptionObject

Returns the value of attribute description.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def description
  @description
end

#max_lengthObject

Returns the value of attribute max_length.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def max_length
  @max_length
end

#max_valueObject

Returns the value of attribute max_value.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def max_value
  @max_value
end

#min_lengthObject

Returns the value of attribute min_length.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def min_length
  @min_length
end

#min_valueObject

Returns the value of attribute min_value.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def min_value
  @min_value
end

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def name
  @name
end

#no_echoObject

Returns the value of attribute no_echo.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def no_echo
  @no_echo
end

#typeObject

Returns the value of attribute type.



21
22
23
# File 'lib/draw_cloud/parameter.rb', line 21

def type
  @type
end

Instance Method Details

#load_into_config(config) ⇒ Object



33
34
35
36
# File 'lib/draw_cloud/parameter.rb', line 33

def load_into_config(config)
  config.cf_add_parameter resource_name, self
  super(config)
end

#to_hObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/draw_cloud/parameter.rb', line 38

def to_h
  h = {"Type" => DrawCloud.ref(type)}
  [:type, :default, :no_echo,
   :allowed_values, :max_length, :min_length,
   :max_value, :min_value,
   :constraint_description].each do |prop_str|
    prop = prop_str.intern
    h[resource_style(prop)] = DrawCloud.ref(self.send(prop)) unless self.send(prop).nil?
  end
  if !allowed_pattern.nil?
    h["AllowedPattern"] = case allowed_pattern
                          when Regexp
                            allowed_pattern.source
                          else
                            allowed_pattern.to_s
                          end
  end
  h
end