Class: Convection::Model::Template::ResourceProperty

Inherits:
Object
  • Object
show all
Includes:
DSL::Helpers
Defined in:
lib/convection/model/template/resource_property.rb,
lib/convection/model/template/resource_property/aws_ec2_mount_point.rb,
lib/convection/model/template/resource_property/aws_cloudfront_origin.rb,
lib/convection/model/template/resource_property/aws_lambda_vpc_config.rb,
lib/convection/model/template/resource_property/aws_cloudfront_logging.rb,
lib/convection/model/template/resource_property/aws_events_rule_target.rb,
lib/convection/model/template/resource_property/aws_lambda_environment.rb,
lib/convection/model/template/resource_property/aws_cloudfront_s3origin.rb,
lib/convection/model/template/resource_property/aws_route53_geolocation.rb,
lib/convection/model/template/resource_property/aws_lambda_function_code.rb,
lib/convection/model/template/resource_property/aws_route53_alias_target.rb,
lib/convection/model/template/resource_property/aws_ec2_network_interface.rb,
lib/convection/model/template/resource_property/aws_s3_cors_configuration.rb,
lib/convection/model/template/resource_property/aws_cloudfront_customorigin.rb,
lib/convection/model/template/resource_property/aws_cloudfront_restrictions.rb,
lib/convection/model/template/resource_property/aws_cloudfront_cachebehavior.rb,
lib/convection/model/template/resource_property/aws_ec2_block_device_mapping.rb,
lib/convection/model/template/resource_property/aws_ec2_iam_instance_profile.rb,
lib/convection/model/template/resource_property/aws_s3_website_configuration.rb,
lib/convection/model/template/resource_property/aws_cloudfront_georestriction.rb,
lib/convection/model/template/resource_property/aws_cloudfront_forwardedvalues.rb,
lib/convection/model/template/resource_property/aws_elbv2_listener_rule_action.rb,
lib/convection/model/template/resource_property/aws_elbv2_target_group_matcher.rb,
lib/convection/model/template/resource_property/aws_s3_cors_configuration_rule.rb,
lib/convection/model/template/resource_property/aws_elbv2_listener_certificates.rb,
lib/convection/model/template/resource_property/aws_cloudfront_viewercertificate.rb,
lib/convection/model/template/resource_property/aws_ec2_block_store_block_device.rb,
lib/convection/model/template/resource_property/aws_elbv2_target_group_attribute.rb,
lib/convection/model/template/resource_property/aws_s3_replication_configuration.rb,
lib/convection/model/template/resource_property/aws_api_gateway_api_key_stage_key.rb,
lib/convection/model/template/resource_property/aws_elbv2_listener_default_action.rb,
lib/convection/model/template/resource_property/aws_elbv2_listener_rule_condition.rb,
lib/convection/model/template/resource_property/aws_elbv2_load_balancer_attribute.rb,
lib/convection/model/template/resource_property/aws_api_gateway_method_integration.rb,
lib/convection/model/template/resource_property/aws_cloudfront_customerrorresponse.rb,
lib/convection/model/template/resource_property/aws_cloudfront_distribution_config.rb,
lib/convection/model/template/resource_property/aws_cloudfront_defaultcachebehavior.rb,
lib/convection/model/template/resource_property/aws_api_gateway_rest_api_s3_location.rb,
lib/convection/model/template/resource_property/aws_api_gateway_usage_plan_api_stage.rb,
lib/convection/model/template/resource_property/aws_elasticsearch_domain_ebs_options.rb,
lib/convection/model/template/resource_property/aws_elasticsearch_domain_vpc_options.rb,
lib/convection/model/template/resource_property/aws_s3_replication_configuration_rule.rb,
lib/convection/model/template/resource_property/aws_api_gateway_method_method_response.rb,
lib/convection/model/template/resource_property/aws_cloudfront_forwardedvalues_cookies.rb,
lib/convection/model/template/resource_property/aws_ec2_spot_fleet_request_config_data.rb,
lib/convection/model/template/resource_property/aws_elbv2_load_balancer_subnet_mapping.rb,
lib/convection/model/template/resource_property/aws_lambda_function_dead_letter_config.rb,
lib/convection/model/template/resource_property/aws_api_gateway_usage_plan_quota_settings.rb,
lib/convection/model/template/resource_property/aws_elasticsearch_domain_advanced_options.rb,
lib/convection/model/template/resource_property/aws_elasticsearch_domain_snapshot_options.rb,
lib/convection/model/template/resource_property/aws_elbv2_target_group_target_description.rb,
lib/convection/model/template/resource_property/aws_s3_website_configuration_routing_rule.rb,
lib/convection/model/template/resource_property/aws_api_gateway_deployment_stage_description.rb,
lib/convection/model/template/resource_property/aws_api_gateway_usage_plan_throttle_settings.rb,
lib/convection/model/template/resource_property/aws_api_gateway_deployment_stage_method_setting.rb,
lib/convection/model/template/resource_property/aws_s3_replication_configuration_rule_destination.rb,
lib/convection/model/template/resource_property/aws_elasticsearch_domain_elasticsearch_cluster_config.rb,
lib/convection/model/template/resource_property/aws_s3_website_configuration_redirect_all_requests_to.rb,
lib/convection/model/template/resource_property/aws_api_gateway_method_integration_integration_response.rb,
lib/convection/model/template/resource_property/aws_s3_website_configuration_routing_rule_redirect_rule.rb,
lib/convection/model/template/resource_property/aws_elasticache_replication_group_node_group_configuration.rb,
lib/convection/model/template/resource_property/aws_api_gateway_deployment_stage_description_method_setting.rb,
lib/convection/model/template/resource_property/aws_certificate_manager_certificate_domain_validation_option.rb,
lib/convection/model/template/resource_property/aws_ec2_spot_fleet_request_config_data_launch_specifications.rb,
lib/convection/model/template/resource_property/aws_s3_website_configuration_routing_rule_routing_rule_condition.rb,
lib/convection/model/template/resource_property/aws_ec2_spot_fleet_request_config_data_launch_specifications_security_groups.rb,
lib/convection/model/template/resource_property/aws_ec2_spot_fleet_request_config_data_launch_specifications_network_interface.rb,
lib/convection/model/template/resource_property/aws_ec2_spot_fleet_request_config_data_launch_specifications_block_device_mapping.rb,
lib/convection/model/template/resource_property/aws_ec2_spot_fleet_request_config_data_launch_specifications_block_device_mapping_ebs.rb

Overview

Base class for Resource Property Types

Direct Known Subclasses

ApiGatewayApiKeyStageKey, ApiGatewayDeploymentStageDescription, ApiGatewayDeploymentStageDescriptionMethodSetting, ApiGatewayMethodIntegration, ApiGatewayMethodIntegrationIntegrationResponse, ApiGatewayMethodMethodResponse, ApiGatewayRestApiS3Location, ApiGatewayStageMethodSetting, ApiGatewayUsagePlanApiStage, ApiGatewayUsagePlanQuotaSettings, ApiGatewayUsagePlanThrottleSettings, CertificateManagerCertificateDomainValidationOption, CloudFrontCacheBehavior, CloudFrontCustomErrorResponse, CloudFrontCustomOrigin, CloudFrontDefaultCacheBehavior, CloudFrontDistributionConfig, CloudFrontForwardedValues, CloudFrontForwardedValuesCookies, CloudFrontGeoRestriction, CloudFrontLogging, CloudFrontOrigin, CloudFrontRestrictions, CloudFrontS3Origin, CloudFrontViewerCertificate, EC2BlockDeviceMapping, EC2BlockStoreBlockDevice, EC2MountPoint, EC2NetworkInterface, EC2SpotFleetRequestConfigData, EC2SpotFleetRequestConfigDataLaunchSpecifications, EC2SpotFleetRequestConfigDataLaunchSpecificationsBlockDeviceMapping, EC2SpotFleetRequestConfigDataLaunchSpecificationsBlockDeviceMappingEbs, EC2SpotFleetRequestConfigDataLaunchSpecificationsIamInstanceProfile, EC2SpotFleetRequestConfigDataLaunchSpecificationsNetworkInterface, EC2SpotFleetRequestConfigDataLaunchSpecificationsSecurityGroups, ELBV2ListenerCertificates, ELBV2ListenerDefaultAction, ELBV2ListenerRuleAction, ELBV2ListenerRuleCondition, ELBV2LoadBalancerAttribute, ELBV2LoadBalancerSubnetMapping, ELBV2TargetGroupAttribute, ELBV2TargetGroupMatcher, ELBV2TargetGroupTargetDescription, ElasticacheReplicationGroupNodeGroupConfiguration, ElasticsearchDomainAdvancedOptions, ElasticsearchDomainEBSOptions, ElasticsearchDomainElasticsearchClusterConfig, ElasticsearchDomainSnapshotOptions, ElasticsearchDomainVPCOptions, EventsRuleTarget, LambdaEnvironment, LambdaFunctionCode, LambdaFunctionDeadLetterConfig, LambdaVpcConfig, Route53AliasTarget, Route53GeoLocation, S3CorsConfiguration, S3CorsConfigurationRule, S3ReplicationConfiguration, S3ReplicationConfigurationRule, S3ReplicationConfigurationRuleDestination, S3WebsiteConfiguration, S3WebsiteConfigurationRedirectAllRequestsTo, S3WebsiteConfigurationRoutingRule, S3WebsiteConfigurationRoutingRuleRedirectRule

Defined Under Namespace

Classes: ApiGatewayApiKeyStageKey, ApiGatewayDeploymentStageDescription, ApiGatewayDeploymentStageDescriptionMethodSetting, ApiGatewayMethodIntegration, ApiGatewayMethodIntegrationIntegrationResponse, ApiGatewayMethodMethodResponse, ApiGatewayRestApiS3Location, ApiGatewayStageMethodSetting, ApiGatewayUsagePlanApiStage, ApiGatewayUsagePlanQuotaSettings, ApiGatewayUsagePlanThrottleSettings, CertificateManagerCertificateDomainValidationOption, CloudFrontCacheBehavior, CloudFrontCustomErrorResponse, CloudFrontCustomOrigin, CloudFrontDefaultCacheBehavior, CloudFrontDistributionConfig, CloudFrontForwardedValues, CloudFrontForwardedValuesCookies, CloudFrontGeoRestriction, CloudFrontLogging, CloudFrontOrigin, CloudFrontRestrictions, CloudFrontS3Origin, CloudFrontViewerCertificate, EC2BlockDeviceMapping, EC2BlockStoreBlockDevice, EC2MountPoint, EC2NetworkInterface, EC2SpotFleetRequestConfigData, EC2SpotFleetRequestConfigDataLaunchSpecifications, EC2SpotFleetRequestConfigDataLaunchSpecificationsBlockDeviceMapping, EC2SpotFleetRequestConfigDataLaunchSpecificationsBlockDeviceMappingEbs, EC2SpotFleetRequestConfigDataLaunchSpecificationsIamInstanceProfile, EC2SpotFleetRequestConfigDataLaunchSpecificationsNetworkInterface, EC2SpotFleetRequestConfigDataLaunchSpecificationsSecurityGroups, ELBV2ListenerCertificates, ELBV2ListenerDefaultAction, ELBV2ListenerRuleAction, ELBV2ListenerRuleCondition, ELBV2LoadBalancerAttribute, ELBV2LoadBalancerSubnetMapping, ELBV2TargetGroupAttribute, ELBV2TargetGroupMatcher, ELBV2TargetGroupTargetDescription, ElasticacheReplicationGroupNodeGroupConfiguration, ElasticsearchDomainAdvancedOptions, ElasticsearchDomainEBSOptions, ElasticsearchDomainElasticsearchClusterConfig, ElasticsearchDomainSnapshotOptions, ElasticsearchDomainVPCOptions, EventsRuleTarget, LambdaEnvironment, LambdaFunctionCode, LambdaFunctionDeadLetterConfig, LambdaVpcConfig, Route53AliasTarget, Route53GeoLocation, S3CorsConfiguration, S3CorsConfigurationRule, S3ReplicationConfiguration, S3ReplicationConfigurationRule, S3ReplicationConfigurationRuleDestination, S3WebsiteConfiguration, S3WebsiteConfigurationRedirectAllRequestsTo, S3WebsiteConfigurationRoutingRule, S3WebsiteConfigurationRoutingRuleRedirectRule

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DSL::Helpers

#camel_case, included, method_name, #screaming_snake_case, #snake_case

Methods included from DSL::IntrinsicFunctions

#base64, #find_in_map, #fn_and, #fn_equals, #fn_if, #fn_import_value, #fn_not, #fn_or, #fn_ref, #fn_sub, #get_att, #get_azs, included, #join, mixers, #select

Constructor Details

#initialize(parent) ⇒ ResourceProperty

Returns a new instance of ResourceProperty.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/convection/model/template/resource_property.rb', line 31

def initialize(parent)
  @template = parent.template
  @exist = false

  ## Instantiate properties
  @properties = Model::Collection.new
  resource = self
  resource.class.properties.each do |_, property|
    @properties[property.property_name] = property.instance(resource)
  end
end

Instance Attribute Details

#existObject (readonly) Also known as: exist?

Returns the value of attribute exist.



28
29
30
# File 'lib/convection/model/template/resource_property.rb', line 28

def exist
  @exist
end

#propertiesObject (readonly)

Returns the value of attribute properties.



27
28
29
# File 'lib/convection/model/template/resource_property.rb', line 27

def properties
  @properties
end

#templateObject (readonly)

Resource Property Instance Methods



26
27
28
# File 'lib/convection/model/template/resource_property.rb', line 26

def template
  @template
end

Class Method Details

.attach_method(name, &block) ⇒ Object



16
17
18
# File 'lib/convection/model/template/resource_property.rb', line 16

def attach_method(name, &block)
  define_method(name, &block)
end

.propertiesObject



7
8
9
# File 'lib/convection/model/template/resource_property.rb', line 7

def properties
  @properties ||= {}
end

.property(accesor, property_name, options = {}) ⇒ Object



11
12
13
14
# File 'lib/convection/model/template/resource_property.rb', line 11

def property(accesor, property_name, options = {})
  properties[accesor] = Resource::Property.create(accesor, property_name, options)
  properties[accesor].attach(self)
end

Instance Method Details

#property(key, *value) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/convection/model/template/resource_property.rb', line 43

def property(key, *value)
  return properties[key].value if value.empty?

  ## Define a property instance on the fly
  properties[key] = ScalarPropertyInstance.new(self) unless properties.include?(key)
  properties[key].set(*value)
end

#renderObject



51
52
53
# File 'lib/convection/model/template/resource_property.rb', line 51

def render
  properties.map(true, &:render)
end