Class: Skywriter::ResourceProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/skywriter/resource_property.rb,
lib/skywriter/resource_property/ec2/tag.rb,
lib/skywriter/resource_property/ec2/icmp.rb,
lib/skywriter/resource_property/ec2/port_range.rb,
lib/skywriter/resource_property/ec2/mount_point.rb,
lib/skywriter/resource_property/auto_scaling/tag.rb,
lib/skywriter/resource_property/sns/subscription.rb,
lib/skywriter/resource_property/cloud_front/origin.rb,
lib/skywriter/resource_property/redshift/parameter.rb,
lib/skywriter/resource_property/sqs/redrive_policy.rb,
lib/skywriter/resource_property/cloud_front/logging.rb,
lib/skywriter/resource_property/dynamo_db/key_schema.rb,
lib/skywriter/resource_property/dynamo_db/projection.rb,
lib/skywriter/resource_property/ec2/ebs_block_device.rb,
lib/skywriter/resource_property/route53/alias_target.rb,
lib/skywriter/resource_property/cloud_front/s3_origin.rb,
lib/skywriter/resource_property/ec2/network_interface.rb,
lib/skywriter/resource_property/ec2/security_group_rule.rb,
lib/skywriter/resource_property/rds/security_group_rule.rb,
lib/skywriter/resource_property/ec2/block_device_mapping.rb,
lib/skywriter/resource_property/cloud_front/custom_origin.rb,
lib/skywriter/resource_property/cloud_front/cache_behavior.rb,
lib/skywriter/resource_property/cloud_front/forwarded_value.rb,
lib/skywriter/resource_property/cloud_formation/resource_tag.rb,
lib/skywriter/resource_property/cloud_watch/metric_dimension.rb,
lib/skywriter/resource_property/auto_scaling/ebs_block_device.rb,
lib/skywriter/resource_property/elastic_load_balancing/policy.rb,
lib/skywriter/resource_property/dynamo_db/attribute_definition.rb,
lib/skywriter/resource_property/cloud_front/distribution_config.rb,
lib/skywriter/resource_property/dynamo_db/local_secondary_index.rb,
lib/skywriter/resource_property/elastic_beanstalk/source_bundle.rb,
lib/skywriter/resource_property/elastic_load_balancing/listener.rb,
lib/skywriter/resource_property/s3/website_configuration_policy.rb,
lib/skywriter/resource_property/dynamo_db/global_secondary_index.rb,
lib/skywriter/resource_property/dynamo_db/provisioned_throughput.rb,
lib/skywriter/resource_property/ec2/network_interface_attachment.rb,
lib/skywriter/resource_property/ec2/network_interface_group_item.rb,
lib/skywriter/resource_property/elastic_beanstalk/option_setting.rb,
lib/skywriter/resource_property/auto_scaling/block_device_mapping.rb,
lib/skywriter/resource_property/ec2/network_interface_association.rb,
lib/skywriter/resource_property/cloud_front/default_cache_behavior.rb,
lib/skywriter/resource_property/elastic_beanstalk/environment_tier.rb,
lib/skywriter/resource_property/elastic_load_balancing/health_check.rb,
lib/skywriter/resource_property/elastic_beanstalk/source_configuration.rb,
lib/skywriter/resource_property/auto_scaling/notification_configuration.rb,
lib/skywriter/resource_property/elastic_load_balancing/access_logging_policy.rb,
lib/skywriter/resource_property/ec2/network_interface_private_ip_specification.rb,
lib/skywriter/resource_property/elastic_load_balancing/connection_draining_policy.rb,
lib/skywriter/resource_property/elastic_load_balancing/lb_cookie_stickiness_policy.rb,
lib/skywriter/resource_property/elastic_load_balancing/app_cookie_stickiness_policy.rb

Defined Under Namespace

Modules: AutoScaling, CloudFormation, CloudFront, CloudWatch, DynamoDB, EC2, ElasticBeanstalk, ElasticLoadBalancing, RDS, Redshift, Route53, S3, SNS, SQS

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ResourceProperty

Returns a new instance of ResourceProperty.

Parameters:



13
14
15
# File 'lib/skywriter/resource_property.rb', line 13

def initialize(options = {})
  @options = options.freeze
end

Class Method Details

.property(name) ⇒ Object

Declare a ResourceProperty property

Parameters:

  • name (Symbol)

    The property name as it exists in the AWS documentation



6
7
8
# File 'lib/skywriter/resource_property.rb', line 6

def self.property(name)
  property_definitions << PropertyDefinition.new(name)
end

Instance Method Details

#as_jsonHash

Returns a JSON-able hash representing the Resource

Returns:

  • (Hash)

    A JSON-able hash



21
22
23
24
25
26
27
# File 'lib/skywriter/resource_property.rb', line 21

def as_json(*)
  @as_json ||= property_definitions.each_with_object({}) do |property_definition, hash|
    if (value = property_value(property_definition))
      hash[property_definition.name] = value.as_json
    end
  end
end