Class: AWSCDK::APIGatewayv2::HttpAPIProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
api_gatewayv2/http_api_props.rb

Overview

Properties to initialize an instance of HttpApi.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_name: nil, cors_preflight: nil, create_default_stage: nil, default_authorization_scopes: nil, default_authorizer: nil, default_domain_mapping: nil, default_integration: nil, description: nil, disable_execute_api_endpoint: nil, ip_address_type: nil, route_selection_expression: nil) ⇒ HttpAPIProps

Returns a new instance of HttpAPIProps.

Parameters:

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

    Name for the HTTP API resource.

  • cors_preflight (AWSCDK::APIGatewayv2::CorsPreflightOptions, nil) (defaults to: nil)

    Specifies a CORS configuration for an API.

  • create_default_stage (Boolean, nil) (defaults to: nil)

    Whether a default stage and deployment should be automatically created.

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

    Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route.

  • default_authorizer (AWSCDK::APIGatewayv2::IHttpRouteAuthorizer, nil) (defaults to: nil)

    Default Authorizer applied to all routes in the gateway.

  • default_domain_mapping (AWSCDK::APIGatewayv2::DomainMappingOptions, nil) (defaults to: nil)

    Configure a custom domain with the API mapping resource to the HTTP API.

  • default_integration (AWSCDK::APIGatewayv2::HttpRouteIntegration, nil) (defaults to: nil)

    An integration that will be configured on the catch-all route ($default).

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

    The description of the API.

  • disable_execute_api_endpoint (Boolean, nil) (defaults to: nil)

    Specifies whether clients can invoke your API using the default endpoint.

  • ip_address_type (AWSCDK::APIGatewayv2::IPAddressType, nil) (defaults to: nil)

    The IP address types that can invoke the API.

  • route_selection_expression (Boolean, nil) (defaults to: nil)

    Whether to set the default route selection expression for the API.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'api_gatewayv2/http_api_props.rb', line 18

def initialize(api_name: nil, cors_preflight: nil, create_default_stage: nil, default_authorization_scopes: nil, default_authorizer: nil, default_domain_mapping: nil, default_integration: nil, description: nil, disable_execute_api_endpoint: nil, ip_address_type: nil, route_selection_expression: nil)
  @api_name = api_name
  Jsii::Type.check_type(@api_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "apiName") unless @api_name.nil?
  @cors_preflight = cors_preflight.is_a?(Hash) ? ::AWSCDK::APIGatewayv2::CorsPreflightOptions.new(**cors_preflight.transform_keys(&:to_sym)) : cors_preflight
  Jsii::Type.check_type(@cors_preflight, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLkNvcnNQcmVmbGlnaHRPcHRpb25zIn0=")), "corsPreflight") unless @cors_preflight.nil?
  @create_default_stage = create_default_stage
  Jsii::Type.check_type(@create_default_stage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "createDefaultStage") unless @create_default_stage.nil?
  @default_authorization_scopes = default_authorization_scopes
  Jsii::Type.check_type(@default_authorization_scopes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "defaultAuthorizationScopes") unless @default_authorization_scopes.nil?
  @default_authorizer = default_authorizer
  Jsii::Type.check_type(@default_authorizer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLklIdHRwUm91dGVBdXRob3JpemVyIn0=")), "defaultAuthorizer") unless @default_authorizer.nil?
  @default_domain_mapping = default_domain_mapping.is_a?(Hash) ? ::AWSCDK::APIGatewayv2::DomainMappingOptions.new(**default_domain_mapping.transform_keys(&:to_sym)) : default_domain_mapping
  Jsii::Type.check_type(@default_domain_mapping, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLkRvbWFpbk1hcHBpbmdPcHRpb25zIn0=")), "defaultDomainMapping") unless @default_domain_mapping.nil?
  @default_integration = default_integration
  Jsii::Type.check_type(@default_integration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLkh0dHBSb3V0ZUludGVncmF0aW9uIn0=")), "defaultIntegration") unless @default_integration.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @disable_execute_api_endpoint = disable_execute_api_endpoint
  Jsii::Type.check_type(@disable_execute_api_endpoint, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableExecuteApiEndpoint") unless @disable_execute_api_endpoint.nil?
  @ip_address_type = ip_address_type
  Jsii::Type.check_type(@ip_address_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLklwQWRkcmVzc1R5cGUifQ==")), "ipAddressType") unless @ip_address_type.nil?
  @route_selection_expression = route_selection_expression
  Jsii::Type.check_type(@route_selection_expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "routeSelectionExpression") unless @route_selection_expression.nil?
end

Instance Attribute Details

#api_nameString? (readonly)

Note:

Default: - id of the HttpApi construct.

Name for the HTTP API resource.

Returns:

  • (String, nil)


47
48
49
# File 'api_gatewayv2/http_api_props.rb', line 47

def api_name
  @api_name
end

#cors_preflightAWSCDK::APIGatewayv2::CorsPreflightOptions? (readonly)

Note:

Default: - CORS disabled.

Specifies a CORS configuration for an API.



53
54
55
# File 'api_gatewayv2/http_api_props.rb', line 53

def cors_preflight
  @cors_preflight
end

#create_default_stageBoolean? (readonly)

Note:

Default: true

Whether a default stage and deployment should be automatically created.

Returns:

  • (Boolean, nil)


58
59
60
# File 'api_gatewayv2/http_api_props.rb', line 58

def create_default_stage
  @create_default_stage
end

#default_authorization_scopesArray<String>? (readonly)

Note:

Default: - no default authorization scopes

Default OIDC scopes attached to all routes in the gateway, unless explicitly configured on the route.

The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation.

Returns:

  • (Array<String>, nil)


65
66
67
# File 'api_gatewayv2/http_api_props.rb', line 65

def default_authorization_scopes
  @default_authorization_scopes
end

#default_authorizerAWSCDK::APIGatewayv2::IHttpRouteAuthorizer? (readonly)

Note:

Default: - no default authorizer

Default Authorizer applied to all routes in the gateway.



70
71
72
# File 'api_gatewayv2/http_api_props.rb', line 70

def default_authorizer
  @default_authorizer
end

#default_domain_mappingAWSCDK::APIGatewayv2::DomainMappingOptions? (readonly)

Note:

Default: - no default domain mapping configured. meaningless if createDefaultStage is false.

Configure a custom domain with the API mapping resource to the HTTP API.



75
76
77
# File 'api_gatewayv2/http_api_props.rb', line 75

def default_domain_mapping
  @default_domain_mapping
end

#default_integrationAWSCDK::APIGatewayv2::HttpRouteIntegration? (readonly)

Note:

Default: - none

An integration that will be configured on the catch-all route ($default).



80
81
82
# File 'api_gatewayv2/http_api_props.rb', line 80

def default_integration
  @default_integration
end

#descriptionString? (readonly)

Note:

Default: - none

The description of the API.

Returns:

  • (String, nil)


85
86
87
# File 'api_gatewayv2/http_api_props.rb', line 85

def description
  @description
end

#disable_execute_api_endpointBoolean? (readonly)

Note:

Default: false execute-api endpoint enabled.

Specifies whether clients can invoke your API using the default endpoint.

By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. Set this to true if you would like clients to use your custom domain name.

Returns:

  • (Boolean, nil)


94
95
96
# File 'api_gatewayv2/http_api_props.rb', line 94

def disable_execute_api_endpoint
  @disable_execute_api_endpoint
end

#ip_address_typeAWSCDK::APIGatewayv2::IPAddressType? (readonly)

Note:

Default: undefined - AWS default is IPV4

The IP address types that can invoke the API.



100
101
102
# File 'api_gatewayv2/http_api_props.rb', line 100

def ip_address_type
  @ip_address_type
end

#route_selection_expressionBoolean? (readonly)

Note:

Default: false

Whether to set the default route selection expression for the API.

When enabled, "$AWSCDK::APIGatewayv2::HttpAPIProps.requestrequest.method $AWSCDK::APIGatewayv2::HttpAPIProps.requestrequest.path" is set as the default route selection expression.

Returns:

  • (Boolean, nil)


107
108
109
# File 'api_gatewayv2/http_api_props.rb', line 107

def route_selection_expression
  @route_selection_expression
end

Class Method Details

.jsii_propertiesObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'api_gatewayv2/http_api_props.rb', line 109

def self.jsii_properties
  {
    :api_name => "apiName",
    :cors_preflight => "corsPreflight",
    :create_default_stage => "createDefaultStage",
    :default_authorization_scopes => "defaultAuthorizationScopes",
    :default_authorizer => "defaultAuthorizer",
    :default_domain_mapping => "defaultDomainMapping",
    :default_integration => "defaultIntegration",
    :description => "description",
    :disable_execute_api_endpoint => "disableExecuteApiEndpoint",
    :ip_address_type => "ipAddressType",
    :route_selection_expression => "routeSelectionExpression",
  }
end

Instance Method Details

#to_jsiiObject



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'api_gatewayv2/http_api_props.rb', line 125

def to_jsii
  result = {}
  result.merge!({
    "apiName" => @api_name,
    "corsPreflight" => @cors_preflight,
    "createDefaultStage" => @create_default_stage,
    "defaultAuthorizationScopes" => @default_authorization_scopes,
    "defaultAuthorizer" => @default_authorizer,
    "defaultDomainMapping" => @default_domain_mapping,
    "defaultIntegration" => @default_integration,
    "description" => @description,
    "disableExecuteApiEndpoint" => @disable_execute_api_endpoint,
    "ipAddressType" => @ip_address_type,
    "routeSelectionExpression" => @route_selection_expression,
  })
  result.compact
end