convection 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7df0e0d70cd75c415fb550986ac932dae753491
4
- data.tar.gz: 1e1370a620549179546a43e0d3cf5825852d22bf
3
+ metadata.gz: 7ea7304cc3667575f15d9af18104110d9d749a38
4
+ data.tar.gz: 9330e23087406535c02596271153d5f860b1aed4
5
5
  SHA512:
6
- metadata.gz: b3bc109dcb60b96e909ba73394d8629aec00ad3396ec767f00575b2c741606b24f32c0f0a9ca0c5cd0248597766ffafada8f0f443b40b0b39a09969b82f0f092
7
- data.tar.gz: c1879026ac0a27b6949cd71f4e6a74d7f676edf339c994694f010194068529e6f2978d10785461f54df3958f38af99bfec2d9467b55141f97d968778a9bacdb7
6
+ metadata.gz: f62380a06e7467618b5e25e4d6f158ee1bc465cc69d584d05bb845558a229c22637cf480a3e72610863b582fb388ebb04430dbc11327e139023bec13566b33d8
7
+ data.tar.gz: ff9ffa5c1a66547f6d8aae4f9afc62f02a95f984a65368a18b86c652d0bf623a9328d3291cf67972b5f3111939325d6c17464070809f3ae18caf4bcf25a2796a
@@ -268,6 +268,7 @@ module Convection
268
268
  alias_method :push, :set
269
269
 
270
270
  def render
271
+ return default if value.nil? || value.empty?
271
272
  value.map do |val|
272
273
  next val.reference if val.is_a?(Resource)
273
274
  val.respond_to?(:render) ? val.render : val
@@ -0,0 +1,64 @@
1
+ require_relative '../resource'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class Resource
7
+ ##
8
+ # AWS::CloudFront::Distribution
9
+ #
10
+ # Creates an Amazon CloudFront web distribution. See
11
+ # {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution.html AWS::CloudFront::Distribution}.
12
+ #
13
+ # == Example
14
+ #
15
+ # cloudfront_distribution 'MySiteWebsite' do
16
+ # config do
17
+ # cname 'mysite.example.com'
18
+ # default_root_object 'index.html'
19
+ # price_class 'PriceClass_100'
20
+ # default_cache_behavior do
21
+ # forwarded_values do
22
+ # query_string false
23
+ # end
24
+ # target_origin 's3-mysite-bucket'
25
+ # viewer_protocol_policy 'redirect-to-https'
26
+ # end
27
+ # origin do
28
+ # id 's3-mysite-bucket'
29
+ # domain_name "mysite.example.com.s3-website-#{stack.region}.amazonaws.com"
30
+ # custom_origin do
31
+ # protocol_policy 'http-only'
32
+ # end
33
+ # end
34
+ # viewer_certificate do
35
+ # iam_certificate 'EXAMPLECERTID'
36
+ # minimum_protocol_version 'TLSv1'
37
+ # ssl_support_method 'sni-only'
38
+ # end
39
+ # end
40
+ # end
41
+ #
42
+ class CloudFrontDistribution < Resource
43
+ include Model::Mixin::Taggable
44
+
45
+ type 'AWS::CloudFront::Distribution', :cloudfront_distribution
46
+ property :config, 'DistributionConfig'
47
+
48
+ # Append a network interface to network_interfaces
49
+ def config(&block)
50
+ config = ResourceProperty::CloudFrontDistributionConfig.new(self)
51
+ config.instance_exec(&block) if block
52
+ properties['DistributionConfig'].set(config)
53
+ end
54
+
55
+ def render(*args)
56
+ super.tap do |resource|
57
+ render_tags(resource)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,29 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cachebehavior.html
8
+ # CloudFront DistributionConfig CacheBehavior Embedded Property Type}
9
+ class CloudFrontCacheBehavior < ResourceProperty
10
+ property :allowed_methods, 'AllowedMethods', :type => :list, :default => %w(HEAD GET)
11
+ property :cached_methods, 'CachedMethods', :type => :list
12
+ property :forwarded_values, 'ForwardedValues'
13
+ property :min_ttl, 'MinTTL'
14
+ property :path_pattern, 'PathPattern', :default => '*'
15
+ property :smooth_streaming, 'SmoothStreaming'
16
+ property :target_origin, 'TargetOriginId'
17
+ property :trusted_signer, 'TrustedSigners', :type => :list
18
+ property :viewer_protocol_policy, 'ViewerProtocolPolicy', :default => 'allow-all'
19
+
20
+ def forwarded_values(&block)
21
+ values = ResourceProperty::CloudFrontForwardedValues.new(self)
22
+ values.instance_exec(&block) if block
23
+ properties['ForwardedValues'].set(values)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-customerrorresponse.html
8
+ # CloudFront DistributionConfig Restrictions GeoRestriction Embedded Property Type}
9
+ class CloudFrontCustomErrorResponse < ResourceProperty
10
+ property :min_ttl, 'ErrorCachingMinTTL'
11
+ property :error_code, 'ErrorCode'
12
+ property :response_code, 'ResponseCode'
13
+ property :response_page_path, 'ResponsePagePath'
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-customorigin.html
8
+ # CloudFront DistributionConfig Origin S3Origin Embedded Property Type}
9
+ class CloudFrontCustomOrigin < ResourceProperty
10
+ property :http_port, 'HTTPPort', :default => 80
11
+ property :https_port, 'HTTPSPort', :default => 443
12
+ property :protocol_policy, 'OriginProtocolPolicy'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-defaultcachebehavior.html
8
+ # CloudFront DefaultCacheBehavior Embedded Property Type}
9
+ class CloudFrontDefaultCacheBehavior < ResourceProperty
10
+ property :allowed_methods, 'AllowedMethods', :type => :list, :default => %w(HEAD GET)
11
+ property :cached_methods, 'CachedMethods', :type => :list
12
+ property :forwarded_values, 'ForwardedValues'
13
+ property :min_ttl, 'MinTTL'
14
+ property :smooth_streaming, 'SmoothStreaming'
15
+ property :target_origin, 'TargetOriginId'
16
+ property :trusted_signer, 'TrustedSigners', :type => :list
17
+ property :viewer_protocol_policy, 'ViewerProtocolPolicy', :default => 'allow-all'
18
+
19
+ def forwarded_values(&block)
20
+ values = ResourceProperty::CloudFrontForwardedValues.new(self)
21
+ values.instance_exec(&block) if block
22
+ properties['ForwardedValues'].set(values)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,69 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig.html
8
+ # CloudFront DistributionConfig Embedded Property Type}
9
+ class CloudFrontDistributionConfig < ResourceProperty
10
+ # NOTE: we avoid overloading Ruby's alias here by using cname
11
+ property :cname, 'Aliases', :type => :list
12
+ property :cache_behaviors, 'CacheBehaviors', :type => :list
13
+ property :comment, 'Comment'
14
+ property :custom_error_responses, 'CustomErrorResponses', :type => :array
15
+ property :default_cache_behavior, 'DefaultCacheBehavior'
16
+ property :default_root_object, 'DefaultRootObject'
17
+ property :enabled, 'Enabled', :default => true
18
+ property :logging, 'Logging'
19
+ property :origins, 'Origins', :type => :list
20
+ property :price_class, 'PriceClass'
21
+ property :restrictions, 'Restrictions'
22
+ property :viewer_certificate, 'ViewerCertificate'
23
+
24
+ def cache_behavior(&block)
25
+ behavior = ResourceProperty::CloudFrontCacheBehavior.new(self)
26
+ behavior.instance_exec(&block) if block
27
+ cache_behaviors << behavior
28
+ end
29
+
30
+ def custom_error_response(&block)
31
+ response = ResourceProperty::CloudFrontCustomErrorResponse.new(self)
32
+ response.instance_exec(&block) if block
33
+ custom_error_responses << response
34
+ end
35
+
36
+ def default_cache_behavior(&block)
37
+ behavior = ResourceProperty::CloudFrontDefaultCacheBehavior.new(self)
38
+ behavior.instance_exec(&block) if block
39
+ properties['DefaultCacheBehavior'].set(behavior)
40
+ end
41
+
42
+ def logging(&block)
43
+ logging = ResourceProperty::CloudFrontLogging.new(self)
44
+ logging.instance_exec(&block) if block
45
+ properties['Logging'].set(logging)
46
+ end
47
+
48
+ def origin(&block)
49
+ origin = ResourceProperty::CloudFrontOrigin.new(self)
50
+ origin.instance_exec(&block) if block
51
+ origins << origin
52
+ end
53
+
54
+ def restrictions(&block)
55
+ restrictions = ResourceProperty::CloudFrontRestrictions.new(self)
56
+ restrictions.instance_exec(&block) if block
57
+ properties['Restrictions'].set(restrictions)
58
+ end
59
+
60
+ def viewer_certificate(&block)
61
+ cert = ResourceProperty::CloudFrontViewerCertificate.new(self)
62
+ cert.instance_exec(&block) if block
63
+ properties['ViewerCertificate'].set(cert)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues.html
8
+ # CloudFront ForwardedValues Embedded Property Type}
9
+ class CloudFrontForwardedValues < ResourceProperty
10
+ property :headers, 'Headers', :type => :list
11
+ property :query_string, 'QueryString', :default => false
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions-georestriction.html
8
+ # CloudFront DistributionConfig Restrictions GeoRestriction Embedded Property Type}
9
+ class CloudFrontGeoRestriction < ResourceProperty
10
+ property :locations, 'Locations', :type => :array
11
+ property :type, 'RestrictionType'
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-logging.html
8
+ # CloudFront Logging Embedded Property Type}
9
+ class CloudFrontLogging < ResourceProperty
10
+ property :bucket, 'Bucket'
11
+ property :include_cookies, 'IncludeCookies'
12
+ property :prefix, 'Prefix'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-origin.html
8
+ # CloudFront Origin Embedded Property Type}
9
+ class CloudFrontOrigin < ResourceProperty
10
+ property :custom_origin, 'CustomOriginConfig'
11
+ property :domain_name, 'DomainName'
12
+ property :id, 'Id'
13
+ property :origin_path, 'OriginPath'
14
+ property :s3_origin, 'S3OriginConfig'
15
+
16
+ def custom_origin(&block)
17
+ origin = ResourceProperty::CloudFrontCustomOrigin.new(self)
18
+ origin.instance_exec(&block) if block
19
+ properties['CustomOriginConfig'].set(origin)
20
+ end
21
+
22
+ def s3_origin(&block)
23
+ origin = ResourceProperty::CloudFrontS3Origin.new(self)
24
+ origin.instance_exec(&block) if block
25
+ properties['S3OriginConfig'].set(origin)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-restrictions.html
8
+ # CloudFront DistributionConfiguration Restrictions Embedded Property Type}
9
+ class CloudFrontRestrictions < ResourceProperty
10
+ property :geo, 'GeoRestriction'
11
+
12
+ def geo(&block)
13
+ restriction = ResourceProperty::CloudFrontGeoRestriction.new(self)
14
+ restriction.instance_exec(&block) if block
15
+ properties['GeoRestriction'].set(restriction)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-s3origin.html
8
+ # CloudFront DistributionConfig Origin S3Origin Embedded Property Type}
9
+ class CloudFrontS3Origin < ResourceProperty
10
+ property :access_identity, 'OriginAccessIdentity'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../resource_property'
2
+
3
+ module Convection
4
+ module Model
5
+ class Template
6
+ class ResourceProperty
7
+ # Represents a {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distributionconfig-viewercertificate.html
8
+ # CloudFront DistributionConfiguration ViewerCertificate Embedded Property Type}
9
+ class CloudFrontViewerCertificate < ResourceProperty
10
+ property :use_default, 'CloudFrontDefaultCertificate'
11
+ property :iam_certificate, 'IamCertificateId'
12
+ property :minimum_protocol_version, 'MinimumProtocolVersion'
13
+ property :ssl_support_method, 'SslSupportMethod'
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Manero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-01 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -378,6 +378,7 @@ files:
378
378
  - lib/convection/model/template/resource/aws_auto_scaling_launch_configuration.rb
379
379
  - lib/convection/model/template/resource/aws_auto_scaling_scaling_policy.rb
380
380
  - lib/convection/model/template/resource/aws_cloud_watch_alarm.rb
381
+ - lib/convection/model/template/resource/aws_cloudfront_distribution.rb
381
382
  - lib/convection/model/template/resource/aws_ec2_instance.rb
382
383
  - lib/convection/model/template/resource/aws_ec2_internet_gateway.rb
383
384
  - lib/convection/model/template/resource/aws_ec2_network_acl.rb
@@ -416,6 +417,18 @@ files:
416
417
  - lib/convection/model/template/resource/aws_sqs_queue.rb
417
418
  - lib/convection/model/template/resource/aws_sqs_queue_policy.rb
418
419
  - lib/convection/model/template/resource_property.rb
420
+ - lib/convection/model/template/resource_property/aws_cloudfront_cachebehavior.rb
421
+ - lib/convection/model/template/resource_property/aws_cloudfront_customerrorresponse.rb
422
+ - lib/convection/model/template/resource_property/aws_cloudfront_customorigin.rb
423
+ - lib/convection/model/template/resource_property/aws_cloudfront_defaultcachebehavior.rb
424
+ - lib/convection/model/template/resource_property/aws_cloudfront_distribution_config.rb
425
+ - lib/convection/model/template/resource_property/aws_cloudfront_forwardedvalues.rb
426
+ - lib/convection/model/template/resource_property/aws_cloudfront_georestriction.rb
427
+ - lib/convection/model/template/resource_property/aws_cloudfront_logging.rb
428
+ - lib/convection/model/template/resource_property/aws_cloudfront_origin.rb
429
+ - lib/convection/model/template/resource_property/aws_cloudfront_restrictions.rb
430
+ - lib/convection/model/template/resource_property/aws_cloudfront_s3origin.rb
431
+ - lib/convection/model/template/resource_property/aws_cloudfront_viewercertificate.rb
419
432
  - lib/convection/model/template/resource_property/aws_ec2_network_interface.rb
420
433
  - lib/convection/version.rb
421
434
  - test/convection/model/test_conditions.rb