Class: AWSCDK::AppSync::AuthorizationMode

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
app_sync/authorization_mode.rb

Overview

Interface to specify default or additional authorization(s).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authorization_type:, api_key_config: nil, lambda_authorizer_config: nil, open_id_connect_config: nil, user_pool_config: nil) ⇒ AuthorizationMode

Returns a new instance of AuthorizationMode.

Parameters:



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

def initialize(authorization_type:, api_key_config: nil, lambda_authorizer_config: nil, open_id_connect_config: nil, user_pool_config: nil)
  @authorization_type = authorization_type
  Jsii::Type.check_type(@authorization_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwc3luYy5BdXRob3JpemF0aW9uVHlwZSJ9")), "authorizationType")
  @api_key_config = api_key_config.is_a?(Hash) ? ::AWSCDK::AppSync::APIKeyConfig.new(**api_key_config.transform_keys(&:to_sym)) : api_key_config
  Jsii::Type.check_type(@api_key_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwc3luYy5BcGlLZXlDb25maWcifQ==")), "apiKeyConfig") unless @api_key_config.nil?
  @lambda_authorizer_config = lambda_authorizer_config.is_a?(Hash) ? ::AWSCDK::AppSync::LambdaAuthorizerConfig.new(**lambda_authorizer_config.transform_keys(&:to_sym)) : lambda_authorizer_config
  Jsii::Type.check_type(@lambda_authorizer_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwc3luYy5MYW1iZGFBdXRob3JpemVyQ29uZmlnIn0=")), "lambdaAuthorizerConfig") unless @lambda_authorizer_config.nil?
  @open_id_connect_config = open_id_connect_config.is_a?(Hash) ? ::AWSCDK::AppSync::OpenIdConnectConfig.new(**open_id_connect_config.transform_keys(&:to_sym)) : open_id_connect_config
  Jsii::Type.check_type(@open_id_connect_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwc3luYy5PcGVuSWRDb25uZWN0Q29uZmlnIn0=")), "openIdConnectConfig") unless @open_id_connect_config.nil?
  @user_pool_config = user_pool_config.is_a?(Hash) ? ::AWSCDK::AppSync::UserPoolConfig.new(**user_pool_config.transform_keys(&:to_sym)) : user_pool_config
  Jsii::Type.check_type(@user_pool_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBwc3luYy5Vc2VyUG9vbENvbmZpZyJ9")), "userPoolConfig") unless @user_pool_config.nil?
end

Instance Attribute Details

#api_key_configAWSCDK::AppSync::APIKeyConfig? (readonly)

Note:

Default: - name: 'DefaultAPIKey' | description: 'Default API Key created by CDK'

If authorizationType is AuthorizationType.API_KEY, this option can be configured.



35
36
37
# File 'app_sync/authorization_mode.rb', line 35

def api_key_config
  @api_key_config
end

#authorization_typeAWSCDK::AppSync::AuthorizationType (readonly)

Note:

Default: - AuthorizationType.API_KEY

One of possible four values AppSync supports.



30
31
32
# File 'app_sync/authorization_mode.rb', line 30

def authorization_type
  @authorization_type
end

#lambda_authorizer_configAWSCDK::AppSync::LambdaAuthorizerConfig? (readonly)

Note:

Default: - none

If authorizationType is AuthorizationType.LAMBDA, this option is required.



40
41
42
# File 'app_sync/authorization_mode.rb', line 40

def lambda_authorizer_config
  @lambda_authorizer_config
end

#open_id_connect_configAWSCDK::AppSync::OpenIdConnectConfig? (readonly)

Note:

Default: - none

If authorizationType is AuthorizationType.OIDC, this option is required.



45
46
47
# File 'app_sync/authorization_mode.rb', line 45

def open_id_connect_config
  @open_id_connect_config
end

#user_pool_configAWSCDK::AppSync::UserPoolConfig? (readonly)

Note:

Default: - none

If authorizationType is AuthorizationType.USER_POOL, this option is required.



50
51
52
# File 'app_sync/authorization_mode.rb', line 50

def user_pool_config
  @user_pool_config
end

Class Method Details

.jsii_propertiesObject



52
53
54
55
56
57
58
59
60
# File 'app_sync/authorization_mode.rb', line 52

def self.jsii_properties
  {
    :authorization_type => "authorizationType",
    :api_key_config => "apiKeyConfig",
    :lambda_authorizer_config => "lambdaAuthorizerConfig",
    :open_id_connect_config => "openIdConnectConfig",
    :user_pool_config => "userPoolConfig",
  }
end

Instance Method Details

#to_jsiiObject



62
63
64
65
66
67
68
69
70
71
72
# File 'app_sync/authorization_mode.rb', line 62

def to_jsii
  result = {}
  result.merge!({
    "authorizationType" => @authorization_type,
    "apiKeyConfig" => @api_key_config,
    "lambdaAuthorizerConfig" => @lambda_authorizer_config,
    "openIdConnectConfig" => @open_id_connect_config,
    "userPoolConfig" => @user_pool_config,
  })
  result.compact
end