Class: AWSCDK::Amplify::CfnApp::CustomRuleProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
amplify/cfn_app.rb

Overview

The CustomRule property type allows you to specify redirects, rewrites, and reverse proxies.

Redirects enable a web app to reroute navigation from one URL to another.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source:, target:, condition: nil, status: nil) ⇒ CustomRuleProperty

Returns a new instance of CustomRuleProperty.

Parameters:

  • source (String)

    The source pattern for a URL rewrite or redirect rule.

  • target (String)

    The target pattern for a URL rewrite or redirect rule.

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

    The condition for a URL rewrite or redirect rule, such as a country code.

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

    The status code for a URL rewrite or redirect rule.



1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'amplify/cfn_app.rb', line 1014

def initialize(source:, target:, condition: nil, status: nil)
  @source = source
  Jsii::Type.check_type(@source, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "source")
  @target = target
  Jsii::Type.check_type(@target, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "target")
  @condition = condition
  Jsii::Type.check_type(@condition, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "condition") unless @condition.nil?
  @status = status
  Jsii::Type.check_type(@status, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "status") unless @status.nil?
end

Instance Attribute Details

#conditionString? (readonly)

The condition for a URL rewrite or redirect rule, such as a country code.



1039
1040
1041
# File 'amplify/cfn_app.rb', line 1039

def condition
  @condition
end

#sourceString (readonly)

The source pattern for a URL rewrite or redirect rule.



1029
1030
1031
# File 'amplify/cfn_app.rb', line 1029

def source
  @source
end

#statusString? (readonly)

The status code for a URL rewrite or redirect rule.

  • 200 - Represents a 200 rewrite rule.
  • 301 - Represents a 301 (moved pemanently) redirect rule. This and all future requests should be directed to the target URL.
  • 302 - Represents a 302 temporary redirect rule.
  • 404 - Represents a 404 redirect rule.
  • 404-200 - Represents a 404 rewrite rule.


1050
1051
1052
# File 'amplify/cfn_app.rb', line 1050

def status
  @status
end

#targetString (readonly)

The target pattern for a URL rewrite or redirect rule.



1034
1035
1036
# File 'amplify/cfn_app.rb', line 1034

def target
  @target
end

Class Method Details

.jsii_propertiesObject



1052
1053
1054
1055
1056
1057
1058
1059
# File 'amplify/cfn_app.rb', line 1052

def self.jsii_properties
  {
    :source => "source",
    :target => "target",
    :condition => "condition",
    :status => "status",
  }
end

Instance Method Details

#to_jsiiObject



1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
# File 'amplify/cfn_app.rb', line 1061

def to_jsii
  result = {}
  result.merge!({
    "source" => @source,
    "target" => @target,
    "condition" => @condition,
    "status" => @status,
  })
  result.compact
end