This repository has been archived by the owner on Oct 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from rapid7/add-s3-website
Add S3 Website Configuration and properties
- Loading branch information
Showing
8 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ attic | |
|
||
*.swp | ||
*.swo | ||
*.gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
lib/convection/model/template/resource_property/aws_s3_website_configuration.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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-websiteconfiguration.html | ||
# Amazon S3 Website Configuration} | ||
class S3WebsiteConfiguration < ResourceProperty | ||
property :error_document, 'ErrorDocument' | ||
property :index_document, 'IndexDocument' | ||
property :redirect_all_reqs_to, 'RedirectAllRequestsTo' | ||
property :routing_rules, 'RoutingRules', :type => :list | ||
|
||
def redirect_all_requests_to(&block) | ||
redirect_to = ResourceProperty::S3WebsiteConfigurationRedirectAllRequestsTo.new(self) | ||
redirect_to.instance_exec(&block) if block | ||
properties['RedirectAllRequestsTo'].set(redirect_to) | ||
end | ||
|
||
def routing_rule(&block) | ||
routing_rule = ResourceProperty::S3WebsiteConfigurationRoutingRule.new(self) | ||
routing_rule.instance_exec(&block) if block | ||
routing_rules << routing_rule | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
...model/template/resource_property/aws_s3_website_configuration_redirect_all_requests_to.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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-websiteconfiguration-redirectallrequeststo.html | ||
# Amazon S3 Website Configuration Redirect All Requests To} | ||
class S3WebsiteConfigurationRedirectAllRequestsTo < ResourceProperty | ||
property :host_name, 'HostName' | ||
property :protocol, 'Protocol' | ||
end | ||
end | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
lib/convection/model/template/resource_property/aws_s3_website_configuration_routing_rule.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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-websiteconfiguration-routingrules.html | ||
# Amazon S3 Website Configuration Routing Rule} | ||
class S3WebsiteConfigurationRoutingRule < ResourceProperty | ||
property :redirect_rul, 'RedirectRule' | ||
property :routing_rule_cond, 'RoutingRuleCondition' | ||
|
||
def redirect_rule(&block) | ||
redr = ResourceProperty::S3WebsiteConfigurationRoutingRuleRedirectRule.new(self) | ||
redr.instance_exec(&block) if block | ||
properties['RedirectRule'].set(redr) | ||
end | ||
|
||
def routing_rule_condition(&block) | ||
cond = ResourceProperty::S3WebsiteConfigurationRoutingRuleRoutingRuleCondition.new(self) | ||
cond.instance_exec(&block) if block | ||
properties['RoutingRuleCondition'].set(cond) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
19 changes: 19 additions & 0 deletions
19
...del/template/resource_property/aws_s3_website_configuration_routing_rule_redirect_rule.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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-websiteconfiguration-routingrules-redirectrule.html | ||
# Amazon S3 Website Configuration Routing Rule Redirect Rule} | ||
class S3WebsiteConfigurationRoutingRuleRedirectRule < ResourceProperty | ||
property :host_name, 'HostName' | ||
property :http_redirect_code, 'HttpRedirectCode' | ||
property :protocol, 'Protocol' | ||
property :replace_key_prefix_with, 'ReplaceKeyPrefixWith' | ||
property :replace_key_with, 'ReplaceKeyWith' | ||
end | ||
end | ||
end | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
...ate/resource_property/aws_s3_website_configuration_routing_rule_routing_rule_condition.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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-websiteconfiguration-routingrules-routingrulecondition.html | ||
# Amazon S3 Website Configuration Routing Rule Routing Rule Condition} | ||
class S3WebsiteConfigurationRoutingRule < ResourceProperty | ||
property :http_error_code_returned_equals, 'HttpErrorCodeReturnedEquals' | ||
property :key_prefix_equals, 'KeyPrefixEquals' | ||
end | ||
end | ||
end | ||
end | ||
end |