Class: CloudFormer::Resource

Inherits:
Object
  • Object
show all
Includes:
HasPropertiesAndAttributes, MakesJson
Defined in:
lib/cloud_former/resources/resource.rb

Direct Known Subclasses

AutoScaling::AutoScalingGroup, AutoScaling::LaunchConfiguration, AutoScaling::LifecycleHook, AutoScaling::ScalingPolicy, CloudFormation::Stack, CloudFormation::WaitCondition, CloudFormation::WaitConditionHandle, CloudFront::Distribution, CloudTrail::Trail, CloudWatch::Alarm, DirectoryService::MicrosoftAD, DirectoryService::SimpleAD, EC2::CustomerGateway, EC2::DHCPOptions, EC2::EIP, EC2::EIPAssociation, EC2::Instance, EC2::InternetGateway, EC2::NetworkAcl, EC2::NetworkAclEntry, EC2::NetworkInterface, EC2::NetworkInterfaceAttachment, EC2::Route, EC2::RouteTable, EC2::SecurityGroup, EC2::SecurityGroupEgress, EC2::SecurityGroupIngress, EC2::Subnet, EC2::SubnetNetworkAclAssociation, EC2::SubnetRouteTableAssociation, EC2::VPC, EC2::VPCDHCPOptionsAssociation, EC2::VPCEndpoint, EC2::VPCGatewayAttachment, EC2::VPCPeeringConnection, EC2::VPNConnection, EC2::VPNConnectionRoute, EC2::VPNGateway, EC2::VPNGatewayRoutePropagation, EC2::Volume, EC2::VolumeAttachment, EFS::FileSystem, EFS::MountTarget, ElastiCache::CacheCluster, ElastiCache::ParameterGroup, ElastiCache::SecurityGroup, ElastiCache::SecurityGroupIngress, ElastiCache::SubnetGroup, ElasticBeanstalk::Application, ElasticBeanstalk::ApplicationVersion, ElasticBeanstalk::ConfigurationTemplate, ElasticBeanstalk::Environment, ElasticLoadBalancing::LoadBalancer, IAM::AccessKey, IAM::Group, IAM::InstanceProfile, IAM::Policy, IAM::Role, IAM::User, IAM::UserToGroupAddition, Kinesis::Stream, Lambda::EventSourceMapping, Lambda::Function, Lambda::Permission, CloudFormer::RDS::DBInstance, CloudFormer::RDS::DBParameterGroup, CloudFormer::RDS::DBSecurityGroup, CloudFormer::RDS::DBSubnetGroup, CloudFormer::Redshift::Cluster, CloudFormer::Redshift::ClusterParameterGroup, CloudFormer::Redshift::ClusterSecurityGroup, CloudFormer::Redshift::ClusterSecurityGroupIngress, CloudFormer::Redshift::ClusterSubnetGroup, CloudFormer::Route53::HostedZone, CloudFormer::Route53::RecordSet, CloudFormer::Route53::RecordSetGroup, S3::Bucket, SNS::Topic, SQS::Queue, SQS::QueuePolicy

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MakesJson

#dump_json, included

Methods included from HasPropertiesAndAttributes

included, #nested_resources, #resource_tree

Constructor Details

#initialize(name = nil, &block) ⇒ Resource

Returns a new instance of Resource.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cloud_former/resources/resource.rb', line 16

def initialize(name = nil, &block)
  @name = name
  @metadata_items = []
  @aws_type = self.class.name.sub('CloudFormer', 'AWS')
  if block_given?
    self.instance_eval(&block)
  end
  if @name.nil? || @name.empty?
    raise ArgumentError, "Attempting to create a resource of type #{self.class.name} with no name"
  end
end

Instance Attribute Details

#aws_typeObject (readonly)

Returns the value of attribute aws_type.



9
10
11
# File 'lib/cloud_former/resources/resource.rb', line 9

def aws_type
  @aws_type
end

#metadata_itemsObject (readonly)

Returns the value of attribute metadata_items.



10
11
12
# File 'lib/cloud_former/resources/resource.rb', line 10

def 
  @metadata_items
end

Instance Method Details

#add_metadata(metadata) ⇒ Object



32
33
34
# File 'lib/cloud_former/resources/resource.rb', line 32

def ()
  @metadata_items << 
end

#get_nameObject



28
29
30
# File 'lib/cloud_former/resources/resource.rb', line 28

def get_name
  @name
end