Class: AWSCDK::APIGatewayv2Authorizers::HttpLambdaAuthorizerProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
api_gatewayv2_authorizers/http_lambda_authorizer_props.rb

Overview

Properties to initialize HttpTokenAuthorizer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authorizer_name: nil, identity_source: nil, response_types: nil, results_cache_ttl: nil, role: nil) ⇒ HttpLambdaAuthorizerProps

Returns a new instance of HttpLambdaAuthorizerProps.

Parameters:

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

    Friendly authorizer name.

  • identity_source (Array<String>, nil) (defaults to: nil)

    The identity source for which authorization is requested.

  • response_types (Array<AWSCDK::APIGatewayv2Authorizers::HttpLambdaResponseType>, nil) (defaults to: nil)

    The types of responses the lambda can return.

  • results_cache_ttl (AWSCDK::Duration, nil) (defaults to: nil)

    How long APIGateway should cache the results.

  • role (AWSCDK::Interfaces::AWSIAM::IRoleRef, nil) (defaults to: nil)

    The IAM role that the API Gateway service assumes while invoking the authorizer.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 12

def initialize(authorizer_name: nil, identity_source: nil, response_types: nil, results_cache_ttl: nil, role: nil)
  @authorizer_name = authorizer_name
  Jsii::Type.check_type(@authorizer_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "authorizerName") unless @authorizer_name.nil?
  @identity_source = identity_source
  Jsii::Type.check_type(@identity_source, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "identitySource") unless @identity_source.nil?
  @response_types = response_types
  Jsii::Type.check_type(@response_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5djJfYXV0aG9yaXplcnMuSHR0cExhbWJkYVJlc3BvbnNlVHlwZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "responseTypes") unless @response_types.nil?
  @results_cache_ttl = results_cache_ttl
  Jsii::Type.check_type(@results_cache_ttl, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "resultsCacheTtl") unless @results_cache_ttl.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSVJvbGVSZWYifQ==")), "role") unless @role.nil?
end

Instance Attribute Details

#authorizer_nameString? (readonly)

Note:

Default: - same value as id passed in the constructor.

Friendly authorizer name.

Returns:

  • (String, nil)


29
30
31
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 29

def authorizer_name
  @authorizer_name
end

#identity_sourceArray<String>? (readonly)

Note:

Default: ['$request.header.Authorization']

The identity source for which authorization is requested.

Returns:

  • (Array<String>, nil)


34
35
36
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 34

def identity_source
  @identity_source
end

#response_typesArray<AWSCDK::APIGatewayv2Authorizers::HttpLambdaResponseType>? (readonly)

Note:

Default: [HttpLambdaResponseType.IAM]

The types of responses the lambda can return.

If HttpLambdaResponseType.SIMPLE is included then response format 2.0 will be used.



43
44
45
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 43

def response_types
  @response_types
end

#results_cache_ttlAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(5)

How long APIGateway should cache the results.

Max 1 hour. Disable caching by setting this to Duration.seconds(0).

Returns:



51
52
53
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 51

def results_cache_ttl
  @results_cache_ttl
end

#roleAWSCDK::Interfaces::AWSIAM::IRoleRef? (readonly)

Note:

Default: - No role

The IAM role that the API Gateway service assumes while invoking the authorizer.

Supported only for REQUEST authorizers.



58
59
60
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 58

def role
  @role
end

Class Method Details

.jsii_propertiesObject



60
61
62
63
64
65
66
67
68
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 60

def self.jsii_properties
  {
    :authorizer_name => "authorizerName",
    :identity_source => "identitySource",
    :response_types => "responseTypes",
    :results_cache_ttl => "resultsCacheTtl",
    :role => "role",
  }
end

Instance Method Details

#to_jsiiObject



70
71
72
73
74
75
76
77
78
79
80
# File 'api_gatewayv2_authorizers/http_lambda_authorizer_props.rb', line 70

def to_jsii
  result = {}
  result.merge!({
    "authorizerName" => @authorizer_name,
    "identitySource" => @identity_source,
    "responseTypes" => @response_types,
    "resultsCacheTtl" => @results_cache_ttl,
    "role" => @role,
  })
  result.compact
end