Class: Aws::Endpoints::EndpointRule Private

Inherits:
Rule
  • Object
show all
Defined in:
lib/aws-sdk-core/endpoints/endpoint_rule.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is deprecated. It is used by the Runtime endpoint resolution approach. It has been replaced by a code generated approach in each service gem. It can be removed in a new major version. It has to exist because old service gems can use a new core version. # @api private

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Rule

#resolve_value

Constructor Details

#initialize(type: 'endpoint', conditions:, endpoint:, documentation: nil) ⇒ EndpointRule

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of EndpointRule.



11
12
13
14
15
16
17
# File 'lib/aws-sdk-core/endpoints/endpoint_rule.rb', line 11

def initialize(type: 'endpoint', conditions:, endpoint:,
               documentation: nil)
  @type = type
  @conditions = Condition.from_json(conditions)
  @endpoint = endpoint
  @documentation = documentation
end

Instance Attribute Details

#conditionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/aws-sdk-core/endpoints/endpoint_rule.rb', line 20

def conditions
  @conditions
end

#documentationObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
# File 'lib/aws-sdk-core/endpoints/endpoint_rule.rb', line 22

def documentation
  @documentation
end

#endpointObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/aws-sdk-core/endpoints/endpoint_rule.rb', line 21

def endpoint
  @endpoint
end

#typeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/aws-sdk-core/endpoints/endpoint_rule.rb', line 19

def type
  @type
end

Instance Method Details

#match(parameters, assigned = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
29
30
31
32
# File 'lib/aws-sdk-core/endpoints/endpoint_rule.rb', line 24

def match(parameters, assigned = {})
  assigns = assigned.dup
  matched = conditions.all? do |condition|
    output = condition.match?(parameters, assigns)
    assigns = assigns.merge(condition.assigned) if condition.assign
    output
  end
  resolved_endpoint(parameters, assigns) if matched
end

#resolved_endpoint(parameters, assigns) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/aws-sdk-core/endpoints/endpoint_rule.rb', line 34

def resolved_endpoint(parameters, assigns)
  Endpoint.new(
    url: resolve_value(@endpoint['url'], parameters, assigns),
    properties: resolve_properties(
      @endpoint['properties'] || {},
      parameters,
      assigns
    ),
    headers: resolve_headers(parameters, assigns)
  )
end