Class: Aws::Endpoints::Function Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/endpoints/function.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

Constructor Details

#initialize(fn:, argv:) ⇒ Function

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 Function.

API:

  • private



12
13
14
15
# File 'lib/aws-sdk-core/endpoints/function.rb', line 12

def initialize(fn:, argv:)
  @fn = fn
  @argv = build_argv(argv)
end

Instance Attribute Details

#argvObject (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.

API:

  • private



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

def argv
  @argv
end

#fnObject (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.

API:

  • private



17
18
19
# File 'lib/aws-sdk-core/endpoints/function.rb', line 17

def fn
  @fn
end

Instance Method Details

#call(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.

API:

  • private



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/aws-sdk-core/endpoints/function.rb', line 20

def call(parameters, assigns)
  args = []
  @argv.each do |arg|
    if arg.is_a?(Reference)
      args << arg.resolve(parameters, assigns)
    elsif arg.is_a?(Function)
      args << arg.call(parameters, assigns)
    else
      if arg.is_a?(String)
        arg = Templater.resolve(arg, parameters, assigns)
      end
      args << arg
    end
  end

  case @fn
  when 'isSet'
    Matchers.set?(*args)
  when 'not'
    Matchers.not(*args)
  when 'getAttr'
    Matchers.attr(*args)
  when 'substring'
    Matchers.substring(*args)
  when 'stringEquals'
    Matchers.string_equals?(*args)
  when 'booleanEquals'
    Matchers.boolean_equals?(*args)
  when 'uriEncode'
    Matchers.uri_encode(*args)
  when 'parseURL'
    Matchers.parse_url(*args)
  when 'isValidHostLabel'
    Matchers.valid_host_label?(*args)
  when 'aws.partition'
    Matchers.aws_partition(*args)
  when 'aws.parseArn'
    Matchers.aws_parse_arn(*args)
  when 'aws.isVirtualHostableS3Bucket'
    Matchers.aws_virtual_hostable_s3_bucket?(*args)
  else
    raise "Function not found: #{@fn}"
  end
end