Class: AWSCDK::ElasticLoadBalancingv2::RedirectOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
elastic_load_balancingv2/redirect_options.rb

Overview

Options for ListenerAction.redirect().

A URI consists of the following components: protocol://hostname:port/path?query. You must modify at least one of the following components to avoid a redirect loop: protocol, hostname, port, or path. Any components that you do not modify retain their original values.

You can reuse URI components using the following reserved keywords:

  • #{protocol}
  • #{host}
  • #{port}
  • #{path} (the leading "/" is removed)
  • #{query}

For example, you can change the path to "/new/##path", the hostname to "example.##host", or the query to "##query&value=xyz".

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host: nil, path: nil, permanent: nil, port: nil, protocol: nil, query: nil) ⇒ RedirectOptions

Returns a new instance of RedirectOptions.

Parameters:

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

    The hostname.

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

    The absolute path, starting with the leading "/".

  • permanent (Boolean, nil) (defaults to: nil)

    The HTTP redirect code.

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

    The port.

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

    The protocol.

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

    The query parameters, URL-encoded when necessary, but not percent-encoded.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'elastic_load_balancingv2/redirect_options.rb', line 29

def initialize(host: nil, path: nil, permanent: nil, port: nil, protocol: nil, query: nil)
  @host = host
  Jsii::Type.check_type(@host, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "host") unless @host.nil?
  @path = path
  Jsii::Type.check_type(@path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path") unless @path.nil?
  @permanent = permanent
  Jsii::Type.check_type(@permanent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "permanent") unless @permanent.nil?
  @port = port
  Jsii::Type.check_type(@port, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "port") unless @port.nil?
  @protocol = protocol
  Jsii::Type.check_type(@protocol, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "protocol") unless @protocol.nil?
  @query = query
  Jsii::Type.check_type(@query, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "query") unless @query.nil?
end

Instance Attribute Details

#hostString? (readonly)

Note:

Default: - No change

The hostname.

This component is not percent-encoded. The hostname can contain ##host.

Returns:

  • (String, nil)


50
51
52
# File 'elastic_load_balancingv2/redirect_options.rb', line 50

def host
  @host
end

#pathString? (readonly)

Note:

Default: - No change

The absolute path, starting with the leading "/".

This component is not percent-encoded. The path can contain ##host, ##path, and ##port.

Returns:

  • (String, nil)


57
58
59
# File 'elastic_load_balancingv2/redirect_options.rb', line 57

def path
  @path
end

#permanentBoolean? (readonly)

Note:

Default: false

The HTTP redirect code.

The redirect is either permanent (HTTP 301) or temporary (HTTP 302).

Returns:

  • (Boolean, nil)


64
65
66
# File 'elastic_load_balancingv2/redirect_options.rb', line 64

def permanent
  @permanent
end

#portString? (readonly)

Note:

Default: - No change

The port.

You can specify a value from 1 to 65535 or ##port.

Returns:

  • (String, nil)


71
72
73
# File 'elastic_load_balancingv2/redirect_options.rb', line 71

def port
  @port
end

#protocolString? (readonly)

Note:

Default: - No change

The protocol.

You can specify HTTP, HTTPS, or ##protocol. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.

Returns:

  • (String, nil)


78
79
80
# File 'elastic_load_balancingv2/redirect_options.rb', line 78

def protocol
  @protocol
end

#queryString? (readonly)

Note:

Default: - No change

The query parameters, URL-encoded when necessary, but not percent-encoded.

Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.

Returns:

  • (String, nil)


85
86
87
# File 'elastic_load_balancingv2/redirect_options.rb', line 85

def query
  @query
end

Class Method Details

.jsii_propertiesObject



87
88
89
90
91
92
93
94
95
96
# File 'elastic_load_balancingv2/redirect_options.rb', line 87

def self.jsii_properties
  {
    :host => "host",
    :path => "path",
    :permanent => "permanent",
    :port => "port",
    :protocol => "protocol",
    :query => "query",
  }
end

Instance Method Details

#to_jsiiObject



98
99
100
101
102
103
104
105
106
107
108
109
# File 'elastic_load_balancingv2/redirect_options.rb', line 98

def to_jsii
  result = {}
  result.merge!({
    "host" => @host,
    "path" => @path,
    "permanent" => @permanent,
    "port" => @port,
    "protocol" => @protocol,
    "query" => @query,
  })
  result.compact
end