Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #136 from rapid7/support-s3-bucket-configuration-t…
Browse files Browse the repository at this point in the history
…ypes

Support s3 bucket configuration types
  • Loading branch information
erran-r7 authored Jun 27, 2016
2 parents 95f9cf9 + f4b2d1c commit 027b1ac
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/convection/model/template/resource/aws_s3_bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class S3Bucket < Resource
property :notification_configuration, 'NotificationConfiguration'
property :versioning_configuration, 'VersioningConfiguration'

def cors_configuration(&block)
config = ResourceProperty::S3CorsConfiguration.new(self)
config.instance_exec(&block) if block
properties['CorsConfiguration'].set(config)
end

def cors_configurationm(*args)
warn 'DEPRECATED: "cors_configurationm" is deprecated. Please use "cors_configuration" instead. https://github.com/rapid7/convection/pull/135'
cors_configuration(*args)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require_relative '../resource_property'

module Convection
module Model
class Template
class ResourceProperty
# Represents an {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors.html
# Amazon S3 Cors Configuration}
class S3CorsConfiguration < ResourceProperty
property :cors_rules, 'CorsRules', :type => :list

def cors_rule(&block)
cors_rule = ResourceProperty::S3CorsConfigurationRule.new(self)
cors_rule.instance_exec(&block) if block
cors_rules << cors_rule
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require_relative '../resource_property'

module Convection
module Model
class Template
class ResourceProperty
# Represents an {http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors-corsrule.html
# Amazon S3 Cors Configuration Rule}
class S3CorsConfigurationRule < ResourceProperty
property :allowed_headers, 'AllowedHeaders', :type => :list
property :allowed_methods, 'AllowedMethods', :type => :list
property :allowed_origins, 'AllowedOrigins', :type => :list
property :exposed_headers, 'ExposedHeaders', :type => :list
property :id, 'Id'
property :max_age, 'MaxAge'
end
end
end
end
end

0 comments on commit 027b1ac

Please sign in to comment.