Class: AWSCDK::S3::CfnBucket::RedirectRuleProperty

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

Overview

Specifies how requests are redirected.

In the event of an error, you can specify a different error code to return.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host_name: nil, http_redirect_code: nil, protocol: nil, replace_key_prefix_with: nil, replace_key_with: nil) ⇒ RedirectRuleProperty

Returns a new instance of RedirectRuleProperty.

Parameters:

  • 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 (String, nil) (defaults to: nil)

    Protocol to use when redirecting requests.

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

    The object key prefix to use in the redirect request.

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

    The specific object key to use in the redirect request.



3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
# File 's3/cfn_bucket.rb', line 3220

def initialize(host_name: nil, http_redirect_code: nil, protocol: nil, replace_key_prefix_with: nil, replace_key_with: 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("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "protocol") unless @protocol.nil?
  @replace_key_prefix_with = replace_key_prefix_with
  Jsii::Type.check_type(@replace_key_prefix_with, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "replaceKeyPrefixWith") unless @replace_key_prefix_with.nil?
  @replace_key_with = replace_key_with
  Jsii::Type.check_type(@replace_key_with, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "replaceKeyWith") unless @replace_key_with.nil?
end

Instance Attribute Details

#host_nameString? (readonly)

The host name to use in the redirect request.



3237
3238
3239
# File 's3/cfn_bucket.rb', line 3237

def host_name
  @host_name
end

#http_redirect_codeString? (readonly)

The HTTP redirect code to use on the response.

Not required if one of the siblings is present.



3244
3245
3246
# File 's3/cfn_bucket.rb', line 3244

def http_redirect_code
  @http_redirect_code
end

#protocolString? (readonly)

Protocol to use when redirecting requests.

The default is the protocol that is used in the original request.



3251
3252
3253
# File 's3/cfn_bucket.rb', line 3251

def protocol
  @protocol
end

#replace_key_prefix_withString? (readonly)

The object key prefix to use in the redirect request.

For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/ , you can set a condition block with KeyPrefixEquals set to docs/ and in the Redirect set ReplaceKeyPrefixWith to /documents . Not required if one of the siblings is present. Can be present only if ReplaceKeyWith is not provided.

Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints .



3260
3261
3262
# File 's3/cfn_bucket.rb', line 3260

def replace_key_prefix_with
  @replace_key_prefix_with
end

#replace_key_withString? (readonly)

The specific object key to use in the redirect request.

For example, redirect request to error.html . Not required if one of the siblings is present. Can be present only if ReplaceKeyPrefixWith is not provided.

Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints .



3269
3270
3271
# File 's3/cfn_bucket.rb', line 3269

def replace_key_with
  @replace_key_with
end

Class Method Details

.jsii_propertiesObject



3271
3272
3273
3274
3275
3276
3277
3278
3279
# File 's3/cfn_bucket.rb', line 3271

def self.jsii_properties
  {
    :host_name => "hostName",
    :http_redirect_code => "httpRedirectCode",
    :protocol => "protocol",
    :replace_key_prefix_with => "replaceKeyPrefixWith",
    :replace_key_with => "replaceKeyWith",
  }
end

Instance Method Details

#to_jsiiObject



3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
# File 's3/cfn_bucket.rb', line 3281

def to_jsii
  result = {}
  result.merge!({
    "hostName" => @host_name,
    "httpRedirectCode" => @http_redirect_code,
    "protocol" => @protocol,
    "replaceKeyPrefixWith" => @replace_key_prefix_with,
    "replaceKeyWith" => @replace_key_with,
  })
  result.compact
end