Module: AWS::Metadata

Defined in:
lib/aws_metadata.rb,
lib/aws_metadata/version.rb

Constant Summary collapse

VERSION =
"0.2.4"

Class Method Summary collapse

Class Method Details

.aws_identity_stubs_pathString

Set the path to the aws_identity_stubs.yml

Defaults to the config directory in a Rails application, or the file in tests/fixtures/aws_identity_stubs.yml if not in a Rails app.

Returns:



85
86
87
# File 'lib/aws_metadata.rb', line 85

def self.aws_identity_stubs_path
  @aws_identity_stubs_path ||= defined?(Rails) ? Rails.root.join('config') : File.expand_path(File.dirname(__FILE__) + '/../test/fixtures')
end

.aws_identity_stubs_path=(aws_identity_stubs_path) ⇒ String

Set the path to the aws_identity_stubs.yml

Only needs to be set if stub_responses is set to true.

Returns:



76
77
78
# File 'lib/aws_metadata.rb', line 76

def self.aws_identity_stubs_path=(aws_identity_stubs_path)
  @aws_identity_stubs_path = aws_identity_stubs_path
end

.cfn_dev_outputs_pathString

Set the path to the cfn_dev_output.yml file with the keys you have defined as Outputs for your Cloud Formation stack.

Defaults to the config directory in a Rails application.

Returns:



103
104
105
# File 'lib/aws_metadata.rb', line 103

def self.cfn_dev_outputs_path
  @dev_outputs_path ||= defined?(Rails) ? Rails.root.join('config') : ''
end

.cfn_dev_outputs_path=(dev_outputs_path) ⇒ String

Set the path to the cfn_dev_output.yml file with the keys you have defined as Outputs for your Cloud Formation stack.

Only needs to be set if stub_responses is set to true.

Returns:



94
95
96
# File 'lib/aws_metadata.rb', line 94

def self.cfn_dev_outputs_path=(dev_outputs_path)
  @dev_outputs_path = dev_outputs_path
end

.cfn_stack_nameString

The stack name as identified by the Stack Name column in the CloudFormation Section of the AWS console.

Returns:



67
68
69
# File 'lib/aws_metadata.rb', line 67

def self.cfn_stack_name
  @stack_name
end

.cfn_stack_name=(stack_name) ⇒ String

Set the stack name as identified by the Stack Name column in the CloudFormation Section of the AWS console.

Parameters:

  • stack_name

Returns:



60
61
62
# File 'lib/aws_metadata.rb', line 60

def self.cfn_stack_name=(stack_name)
  @stack_name = stack_name
end

.configure {|self| ... } ⇒ void

This method returns an undefined value.

For use in a Rails initializer to set the cfn_stack_name, stub_responses and cfn_dev_outputs_path.

Examples:


AWS::Metadata.configure do |config|
  config.cfn_stack_name = 'your_cfn_stack_name' # As identified by the Stack Name column in the CloudFormation Section of the AWS console.
  config.stub_responses = Rails.env =~ /development|test/
  config.cfn_dev_outputs_path = 'path/to/cfn_dev_output.yml`
end

Yields:

  • (self)


19
20
21
22
# File 'lib/aws_metadata.rb', line 19

def self.configure
  yield self
  AWS::StackOutput.get unless disable_cfn_stack_output
end

.disable_cfn_stack_outputBoolean

The flag whether or not to disable the AWS::StackOutput object and prevent it from loading.

Parameters:

  • stub_responses (Boolean)

Returns:

  • (Boolean)


52
53
54
# File 'lib/aws_metadata.rb', line 52

def self.disable_cfn_stack_output
  @disable_cfn_stack_output
end

.disable_cfn_stack_output=(disable_cfn_stack_output = false) ⇒ Boolean

Set to true to disable the AWS::StackOutput object and prevent it from loading.

Parameters:

  • disable_cfn_stack_output (Boolean) (defaults to: false)

Returns:

  • (Boolean)


44
45
46
# File 'lib/aws_metadata.rb', line 44

def self.disable_cfn_stack_output=(disable_cfn_stack_output = false)
  @disable_cfn_stack_output = disable_cfn_stack_output
end

.stub_responsesBoolean

The flag whether or not to return canned Instance responses and stubbed StackOutput responses from a cfn_dev_output.yml file.

Parameters:

  • stub_responses (Boolean)

Returns:

  • (Boolean)


36
37
38
# File 'lib/aws_metadata.rb', line 36

def self.stub_responses
  @stub_responses
end

.stub_responses=(stub_responses = false) ⇒ Boolean

Set to true to return canned Instance responses and stubbed StackOutput responses from a cfn_dev_output.yml file.

Parameters:

  • stub_responses (Boolean) (defaults to: false)

Returns:

  • (Boolean)


28
29
30
# File 'lib/aws_metadata.rb', line 28

def self.stub_responses=(stub_responses = false)
  @stub_responses = stub_responses
end