cfnlego 0.2.3 → 0.2.4

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: a73210d1edecefe180200a5b35175cd20dcd6eed
4
- data.tar.gz: 188a759d8a8a41041c8a724ae5ee84abe5aaed6b
3
+ metadata.gz: 045b995960dbb3dfbc92966a3513c00b7c7e6cd5
4
+ data.tar.gz: 8cd3b967b7c16eade3c454329a96ea58201c2b31
5
5
  SHA512:
6
- metadata.gz: 1003b1383eebfb365dbde220b73d0ddfd8e4021c3054951cd7cda432ee0351754e1d9bd0d39e33d0ab04900c2ca3256e5bbc69111a21f2d9d65be93773a9231e
7
- data.tar.gz: 512c4ac1604fa401d75080b407983e94353d8665a5f22b38944c543ac902a066a6132e09b3665dbc0d77711fd980610e10c76536dcfff9b44d576c5c67561f7b
6
+ metadata.gz: 16d0fcff5285be3fede0786d151cb14d744cb9a79d61b232ce26a66fcab5f278b3fcdc66825cee71435a71bf89bbbf755446e6a3d65ba24b6d0506df51a2b2c8
7
+ data.tar.gz: 29155bab069d1977e82dc16f0fc3ea64c8fa989e637d4304c88669bf0fb922b5d200517a3ca05002d851ad5039d82a608be26dde4e7c335e5bf4c0b3a28fef35
data/bin/cfnlego CHANGED
@@ -59,6 +59,10 @@ options[:resources].each do |r|
59
59
  end
60
60
  end
61
61
 
62
- puts pretty_string Cfnlego::CloudFormation.new(resources).render,
63
- indent_token: options[:indent_token],
64
- indent_count: options[:indent_count]
62
+ begin
63
+ puts pretty_string Cfnlego::CloudFormation.new(resources).render,
64
+ indent_token: options[:indent_token],
65
+ indent_count: options[:indent_count]
66
+ rescue RuntimeError => e
67
+ $stderr.puts "Error: #{e.message}"
68
+ end
@@ -21,13 +21,15 @@ module Cfnlego
21
21
 
22
22
  # example AutoScaling::AutoScalingGroup
23
23
  def type2file
24
- @file ||= "#{File.realpath(File.dirname(__FILE__))}/resources/#{@type.gsub(/::/, "/")}.yaml"
24
+ @file ||= "#{File.realpath(File.dirname(__FILE__))}/resources/#{@type.gsub(/::/, File::SEPARATOR)}.yaml"
25
25
  end
26
26
 
27
27
  def definition
28
- @definition ||= YAML.load_file(type2file)
29
- rescue
30
- $stderr.puts "unknown #{@type}, no matching definition found"
28
+ if File::exists?(type2file)
29
+ @definition ||= YAML.load_file(type2file)
30
+ else
31
+ raise RuntimeError, "unknown #{@type}, no matching definition found"
32
+ end
31
33
  end
32
34
  end
33
35
  end
@@ -0,0 +1,113 @@
1
+ AWS::S3::Bucket:
2
+ Properties:
3
+ AccessControl: |
4
+ "AuthenticatedRead | AwsExecRead | BucketOwnerRead | BucketOwnerFullControl | LogDeliveryWrite | Private | PublicRead | PublicReadWrite"
5
+ BucketName: "\"a-bucket\""
6
+ CorsConfiguration: |
7
+ {
8
+ "CorsRules" => [
9
+ {
10
+ "AllowedHeaders" => ["Headers that are specified in the Access-Control-Request-Headers header. These headers are allowed in a preflight OPTIONS request. In response to any preflight OPTIONS request, Amazon S3 returns any requested headers that are allowed."],
11
+ "AllowedMethods" => ["The valid values are GET, PUT, HEAD, POST, and DELETE."],
12
+ "AllowedOrigins" => ["An origin that you allow to send cross-domain requests."],
13
+ "ExposedHeaders" => ["One or more headers in the response that are accessible to client applications (for example, from a JavaScript XMLHttpRequest object)."],
14
+ "Id" => "A unique identifier for this rule. The value cannot be more than 255 characters.",
15
+ "MaxAge" => "The time in seconds that your browser is to cache the preflight response for the specified resource."
16
+ }
17
+ ]
18
+ }
19
+ LifecycleConfiguration: |
20
+ {
21
+ "Rules" => [
22
+ {
23
+ "ExpirationDate" => "Indicates when objects are deleted from Amazon S3 and Amazon Glacier. The date value must be in ISO 8601 format. The time is always midnight UTC. If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time. You must specify at least one of the following properties: ExpirationDate, ExpirationInDays, NoncurrentVersionExpirationInDays, NoncurrentVersionTransition, or Transition.",
24
+ "ExpirationInDays" => "Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier. If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.",
25
+ "Id" => "A unique identifier for this rule. The value cannot be more than 255 characters.",
26
+ "NoncurrentVersionExpirationInDays" => "For buckets with versioning enabled (or suspended), specifies the time, in days, between when a new version of the object is uploaded to the bucket and when old versions of the object expire. When object versions expire, Amazon S3 permanently deletes them. If you specify a transition and expiration time, the expiration time must be later than the transition time.",
27
+ "NoncurrentVersionTransition" => "For buckets with versioning enabled (or suspended), specifies when non-current objects transition to a specified storage class. If you specify a transition and expiration time, the expiration time must be later than the transition time.",
28
+ "Prefix" => "Object key prefix that identifies one or more objects to which this rule applies.",
29
+ "Status" => "Specify either Enabled or Disabled.",
30
+ "Transition" => "Specifies when an object transitions to a specified storage class. If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time."
31
+ }
32
+ ]
33
+ }
34
+ LoggingConfiguration: |
35
+ {
36
+ "DestinationBucketName" => "The name of an Amazon S3 bucket where Amazon S3 store server access log files.",
37
+ "LogFilePrefix" => "A prefix for the all log object keys. If you store log files from multiple Amazon S3 buckets in a single bucket, you can use a prefix to distinguish which log files came from which bucket."
38
+ }
39
+ NotificationConfiguration: |
40
+ {
41
+ "LambdaConfigurations" => [
42
+ {
43
+ "Event" => "s3:ObjectCreated:* s3:ObjectCreated:Put s3:ObjectCreated:Post s3:ObjectCreated:Copy s3:ObjectCreated:CompleteMultipartUpload s3:ObjectRemoved:* s3:ObjectRemoved:Delete s3:ObjectRemoved:DeleteMarkerCreated s3:ReducedRedundancyLostObject",
44
+ "Filter" => {
45
+ "S3Key" => "Amazon S3 filtering rules that describe for which object key names to send notifications."
46
+ },
47
+ "Function" => "The Amazon Resource Name (ARN) of the Lambda function that Amazon S3 invokes when the specified event type occurs."
48
+ }
49
+ ],
50
+ "QueueConfigurations" => [
51
+ {
52
+ "Event" => "s3:ObjectCreated:* s3:ObjectCreated:Put s3:ObjectCreated:Post s3:ObjectCreated:Copy s3:ObjectCreated:CompleteMultipartUpload s3:ObjectRemoved:* s3:ObjectRemoved:Delete s3:ObjectRemoved:DeleteMarkerCreated s3:ReducedRedundancyLostObject",
53
+ "Filter" => {
54
+ "S3Key" => "Amazon S3 filtering rules that describe for which object key names to send notifications.",
55
+ "Queue" => "The Amazon Resource Name (ARN) of the Amazon SQS queue that Amazon S3 publishes messages to when the specified event type occurs."
56
+ }
57
+ }
58
+ ],
59
+ "TopicConfigurations" => [
60
+ {
61
+ "Event" => "s3:ObjectCreated:* s3:ObjectCreated:Put s3:ObjectCreated:Post s3:ObjectCreated:Copy s3:ObjectCreated:CompleteMultipartUpload s3:ObjectRemoved:* s3:ObjectRemoved:Delete s3:ObjectRemoved:DeleteMarkerCreated s3:ReducedRedundancyLostObject",
62
+ "Filter" => {
63
+ "S3Key" => "Amazon S3 filtering rules that describe for which object key names to send notifications.",
64
+ "Topic" => "The Amazon SNS topic to which Amazon S3 reports the specified events."
65
+ }
66
+ }
67
+ ]
68
+ }
69
+ ReplicationConfiguration: |
70
+ {
71
+ "Role" => "The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that Amazon S3 assumes when replicating objects.",
72
+ "Rules" => [
73
+ {
74
+ "Destination" => {
75
+ "Bucket" => "The Amazon resource name (ARN) of an S3 bucket where Amazon S3 stores replicated objects. ",
76
+ "StorageClass" => "By default, Amazon S3 uses the storage class of the source object to create object replica. STANDARD | STANDARD_IA | REDUCED_REDUNDANCY"
77
+ },
78
+ "Id" => "A unique identifier for the rule. If you don't specify a value, AWS CloudFormation generates a random ID.",
79
+ "Prefix" => "An object prefix. This rule applies to all Amazon S3 objects with this prefix. To specify all objects in an S3 bucket, specify an empty string.",
80
+ "Status" => "Enabled | Disabled"
81
+ }
82
+ ]
83
+ }
84
+ Tags: |
85
+ [
86
+ {
87
+ "Key" => "Contact",
88
+ "Value" => "your-email@mybe.com"
89
+ }
90
+ ]
91
+ VersioningConfiguration: |
92
+ {
93
+ "Status" => "Enabled | Disabled"
94
+ }
95
+ WebsiteConfiguration: |
96
+ {
97
+ "ErrorDocument" => "The name of the error document for the website.",
98
+ "IndexDocument" => "The name of the index document for the website.",
99
+ "RedirectAllRequestsTo" => {
100
+ "HostName" => "Name of the host where requests are redirected.",
101
+ "Protocol" => "Protocol to use (http or https) when redirecting requests. The default is the protocol that is used in the original request."
102
+ },
103
+ "RoutingRules" => [
104
+ {
105
+ "RedirectRule" => "Redirect requests to another host, to another page, or with another protocol.",
106
+ "RoutingRuleCondition" => {
107
+ "HttpErrorCodeReturnedEquals" => "Applies this redirect if the error code equals this value in the event of an error.",
108
+ "KeyPrefixEquals" => "The object key name prefix when the redirect is applied. For example, to redirect requests for ExamplePage.html, set the key prefix to ExamplePage.html. To redirect request for all pages with the prefix docs/, set the key prefix to docs/, which identifies all objects in the docs/ folder."
109
+ }
110
+ }
111
+ ]
112
+ }
113
+
@@ -1,3 +1,3 @@
1
1
  module Cfnlego
2
- VERSION='0.2.3'
2
+ VERSION='0.2.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfnlego
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Yung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-17 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-beautify
@@ -128,6 +128,7 @@ files:
128
128
  - lib/cfnlego/resources/AWS/Route53/HostedZone.yaml
129
129
  - lib/cfnlego/resources/AWS/Route53/RecordSet.yaml
130
130
  - lib/cfnlego/resources/AWS/Route53/RecordSetGroup.yaml
131
+ - lib/cfnlego/resources/AWS/S3/Bucket.yaml
131
132
  - lib/cfnlego/resources/AWS/SNS/Topic.yaml
132
133
  - lib/cfnlego/resources/AWS/SNS/TopicPolicy.yaml
133
134
  - lib/cfnlego/version.rb