Class: AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction
- Includes:
- IListenerAction
- Defined in:
- elastic_load_balancingv2/network_listener_action.rb
Overview
What to do when a client makes a request to a listener.
Some actions can be combined with other ones (specifically, you can perform authentication before serving the request).
Multiple actions form a linked chain; the chain must always terminate in a (weighted)forward, fixedResponse or redirect action.
If an action supports chaining, the next action can be indicated
by passing it in the next property.
Class Method Summary collapse
-
.forward(target_groups, options = nil) ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction
Forward to one or more Target Groups.
- .jsii_overridable_methods ⇒ Object
-
.weighted_forward(target_groups, options = nil) ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction
Forward to one or more Target Groups which are weighted differently.
Instance Method Summary collapse
- #_next ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction?
-
#bind(scope, listener) ⇒ void
Called when the action is being used in a listener.
-
#initialize(default_action_json, _next = nil) ⇒ NetworkListenerAction
constructor
Create an instance of NetworkListenerAction.
-
#render_actions ⇒ Array<AWSCDK::ElasticLoadBalancingv2::CfnListener::ActionProperty>
Render the listener default actions in this chain.
-
#render_rule_actions ⇒ Array<AWSCDK::ElasticLoadBalancingv2::CfnListenerRule::ActionProperty>
Render the listener rule actions in this chain.
-
#renumber(actions) ⇒ Array<AWSCDK::ElasticLoadBalancingv2::CfnListener::ActionProperty>
Renumber the "order" fields in the actions array.
Constructor Details
#initialize(default_action_json, _next = nil) ⇒ NetworkListenerAction
Create an instance of NetworkListenerAction.
The default class should be good enough for most cases and should be created by using one of the static factory functions, but allow overriding to make sure we allow flexibility for the future.
26 27 28 29 30 31 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 26 def initialize(default_action_json, _next = nil) default_action_json = default_action_json.is_a?(Hash) ? ::AWSCDK::ElasticLoadBalancingv2::CfnListener::ActionProperty.new(**default_action_json.transform_keys(&:to_sym)) : default_action_json Jsii::Type.check_type(default_action_json, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5DZm5MaXN0ZW5lci5BY3Rpb25Qcm9wZXJ0eSJ9")), "defaultActionJson") Jsii::Type.check_type(_next, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5OZXR3b3JrTGlzdGVuZXJBY3Rpb24ifQ==")), "next") unless _next.nil? Jsii::Object.instance_method(:initialize).bind(self).call(default_action_json, _next) end |
Class Method Details
.forward(target_groups, options = nil) ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction
Forward to one or more Target Groups.
48 49 50 51 52 53 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 48 def self.forward(target_groups, = nil) Jsii::Type.check_type(target_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lbGFzdGljbG9hZGJhbGFuY2luZ3YyLklOZXR3b3JrVGFyZ2V0R3JvdXAifSwia2luZCI6ImFycmF5In19")), "targetGroups") = .is_a?(Hash) ? ::AWSCDK::ElasticLoadBalancingv2::NetworkForwardOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5OZXR3b3JrRm9yd2FyZE9wdGlvbnMifQ==")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_elasticloadbalancingv2.NetworkListenerAction", "forward", [target_groups, ]) end |
.jsii_overridable_methods ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 33 def self.jsii_overridable_methods { :_next => { kind: :property, name: "next", is_optional: true }, :bind => { kind: :method, name: "bind", is_optional: false }, :render_actions => { kind: :method, name: "renderActions", is_optional: false }, :render_rule_actions => { kind: :method, name: "renderRuleActions", is_optional: false }, :renumber => { kind: :method, name: "renumber", is_optional: false }, } end |
.weighted_forward(target_groups, options = nil) ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction
Forward to one or more Target Groups which are weighted differently.
60 61 62 63 64 65 66 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 60 def self.weighted_forward(target_groups, = nil) target_groups = target_groups.is_a?(Array) ? target_groups.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ElasticLoadBalancingv2::NetworkWeightedTargetGroup.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : target_groups Jsii::Type.check_type(target_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lbGFzdGljbG9hZGJhbGFuY2luZ3YyLk5ldHdvcmtXZWlnaHRlZFRhcmdldEdyb3VwIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "targetGroups") = .is_a?(Hash) ? ::AWSCDK::ElasticLoadBalancingv2::NetworkForwardOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5OZXR3b3JrRm9yd2FyZE9wdGlvbnMifQ==")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_elasticloadbalancingv2.NetworkListenerAction", "weightedForward", [target_groups, ]) end |
Instance Method Details
#_next ⇒ AWSCDK::ElasticLoadBalancingv2::NetworkListenerAction?
69 70 71 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 69 def _next() jsii_get_property("next") end |
#bind(scope, listener) ⇒ void
This method returns an undefined value.
Called when the action is being used in a listener.
78 79 80 81 82 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 78 def bind(scope, listener) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(listener, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JTmV0d29ya0xpc3RlbmVyUmVmIn0=")), "listener") jsii_call_method("bind", [scope, listener]) end |
#render_actions ⇒ Array<AWSCDK::ElasticLoadBalancingv2::CfnListener::ActionProperty>
Render the listener default actions in this chain.
87 88 89 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 87 def render_actions() jsii_call_method("renderActions", []) end |
#render_rule_actions ⇒ Array<AWSCDK::ElasticLoadBalancingv2::CfnListenerRule::ActionProperty>
Render the listener rule actions in this chain.
94 95 96 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 94 def render_rule_actions() jsii_call_method("renderRuleActions", []) end |
#renumber(actions) ⇒ Array<AWSCDK::ElasticLoadBalancingv2::CfnListener::ActionProperty>
Renumber the "order" fields in the actions array.
We don't number for 0 or 1 elements, but otherwise number them 1...#actions so ELB knows about the right order.
Do this in NetworkListenerAction instead of in Listener so that we give
users the opportunity to override by subclassing and overriding render_actions.
108 109 110 111 112 |
# File 'elastic_load_balancingv2/network_listener_action.rb', line 108 def renumber(actions) actions = actions.is_a?(Array) ? actions.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ElasticLoadBalancingv2::CfnListener::ActionProperty.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : actions Jsii::Type.check_type(actions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lbGFzdGljbG9hZGJhbGFuY2luZ3YyLkNmbkxpc3RlbmVyLkFjdGlvblByb3BlcnR5In0sImtpbmQiOiJhcnJheSJ9fQ==")), "actions") jsii_call_method("renumber", [actions]) end |