Class: AWSCDK::S3::RoutingRule

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
s3/routing_rule.rb

Overview

Rule that define when a redirect is applied and the redirect behavior.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(condition: nil, host_name: nil, http_redirect_code: nil, protocol: nil, replace_key: nil) ⇒ RoutingRule

Returns a new instance of RoutingRule.

Parameters:

  • condition (AWSCDK::S3::RoutingRuleCondition, nil) (defaults to: nil)

    Specifies a condition that must be met for the specified redirect to apply.

  • host_name (String, nil) (defaults to: nil)

    The host name to use in the redirect request.

  • http_redirect_code (String, nil) (defaults to: nil)

    The HTTP redirect code to use on the response.

  • protocol (AWSCDK::S3::RedirectProtocol, nil) (defaults to: nil)

    Protocol to use when redirecting requests.

  • replace_key (AWSCDK::S3::ReplaceKey, nil) (defaults to: nil)

    Specifies the object key prefix to use in the redirect request.



14
15
16
17
18
19
20
21
22
23
24
25
# File 's3/routing_rule.rb', line 14

def initialize(condition: nil, host_name: nil, http_redirect_code: nil, protocol: nil, replace_key: nil)
  @condition = condition.is_a?(Hash) ? ::AWSCDK::S3::RoutingRuleCondition.new(**condition.transform_keys(&:to_sym)) : condition
  Jsii::Type.check_type(@condition, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuUm91dGluZ1J1bGVDb25kaXRpb24ifQ==")), "condition") unless @condition.nil?
  @host_name = host_name
  Jsii::Type.check_type(@host_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hostName") unless @host_name.nil?
  @http_redirect_code = http_redirect_code
  Jsii::Type.check_type(@http_redirect_code, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "httpRedirectCode") unless @http_redirect_code.nil?
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuUmVkaXJlY3RQcm90b2NvbCJ9")), "protocol") unless @protocol.nil?
  @replace_key = replace_key
  Jsii::Type.check_type(@replace_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuUmVwbGFjZUtleSJ9")), "replaceKey") unless @replace_key.nil?
end

Instance Attribute Details

#conditionAWSCDK::S3::RoutingRuleCondition? (readonly)

Note:

Default: - No condition

Specifies a condition that must be met for the specified redirect to apply.



31
32
33
# File 's3/routing_rule.rb', line 31

def condition
  @condition
end

#host_nameString? (readonly)

Note:

Default: - The host name used in the original request.

The host name to use in the redirect request.

Returns:

  • (String, nil)


36
37
38
# File 's3/routing_rule.rb', line 36

def host_name
  @host_name
end

#http_redirect_codeString? (readonly)

Note:

Default: "301" - Moved Permanently

The HTTP redirect code to use on the response.

Returns:

  • (String, nil)


41
42
43
# File 's3/routing_rule.rb', line 41

def http_redirect_code
  @http_redirect_code
end

#protocolAWSCDK::S3::RedirectProtocol? (readonly)

Note:

Default: - The protocol used in the original request.

Protocol to use when redirecting requests.



46
47
48
# File 's3/routing_rule.rb', line 46

def protocol
  @protocol
end

#replace_keyAWSCDK::S3::ReplaceKey? (readonly)

Note:

Default: - The key will not be replaced

Specifies the object key prefix to use in the redirect request.

Returns:



51
52
53
# File 's3/routing_rule.rb', line 51

def replace_key
  @replace_key
end

Class Method Details

.jsii_propertiesObject



53
54
55
56
57
58
59
60
61
# File 's3/routing_rule.rb', line 53

def self.jsii_properties
  {
    :condition => "condition",
    :host_name => "hostName",
    :http_redirect_code => "httpRedirectCode",
    :protocol => "protocol",
    :replace_key => "replaceKey",
  }
end

Instance Method Details

#to_jsiiObject



63
64
65
66
67
68
69
70
71
72
73
# File 's3/routing_rule.rb', line 63

def to_jsii
  result = {}
  result.merge!({
    "condition" => @condition,
    "hostName" => @host_name,
    "httpRedirectCode" => @http_redirect_code,
    "protocol" => @protocol,
    "replaceKey" => @replace_key,
  })
  result.compact
end