All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cloudshiftdev.awscdk.services.apigatewayv2.CfnRouteProps.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")

package io.cloudshiftdev.awscdk.services.apigatewayv2

import io.cloudshiftdev.awscdk.IResolvable
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.common.CdkObject
import io.cloudshiftdev.awscdk.common.CdkObjectWrappers
import kotlin.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Unit
import kotlin.collections.List

/**
 * Properties for defining a `CfnRoute`.
 *
 * Example:
 *
 * ```
 * // The code below shows an example of how to instantiate this type.
 * // The values are placeholders you should change.
 * import io.cloudshiftdev.awscdk.services.apigatewayv2.*;
 * Object requestModels;
 * Object requestParameters;
 * CfnRouteProps cfnRouteProps = CfnRouteProps.builder()
 * .apiId("apiId")
 * .routeKey("routeKey")
 * // the properties below are optional
 * .apiKeyRequired(false)
 * .authorizationScopes(List.of("authorizationScopes"))
 * .authorizationType("authorizationType")
 * .authorizerId("authorizerId")
 * .modelSelectionExpression("modelSelectionExpression")
 * .operationName("operationName")
 * .requestModels(requestModels)
 * .requestParameters(requestParameters)
 * .routeResponseSelectionExpression("routeResponseSelectionExpression")
 * .target("target")
 * .build();
 * ```
 *
 * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html)
 */
public interface CfnRouteProps {
  /**
   * The API identifier.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-apiid)
   */
  public fun apiId(): String

  /**
   * Specifies whether an API key is required for the route.
   *
   * Supported only for WebSocket APIs.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-apikeyrequired)
   */
  public fun apiKeyRequired(): Any? = unwrap(this).getApiKeyRequired()

  /**
   * The authorization scopes supported by this route.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-authorizationscopes)
   */
  public fun authorizationScopes(): List = unwrap(this).getAuthorizationScopes() ?:
      emptyList()

  /**
   * The authorization type for the route.
   *
   * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM
   * permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE`
   * for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and
   * `CUSTOM` for using a Lambda authorizer.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-authorizationtype)
   */
  public fun authorizationType(): String? = unwrap(this).getAuthorizationType()

  /**
   * The identifier of the `Authorizer` resource to be associated with this route.
   *
   * The authorizer identifier is generated by API Gateway when you created the authorizer.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-authorizerid)
   */
  public fun authorizerId(): String? = unwrap(this).getAuthorizerId()

  /**
   * The model selection expression for the route.
   *
   * Supported only for WebSocket APIs.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-modelselectionexpression)
   */
  public fun modelSelectionExpression(): String? = unwrap(this).getModelSelectionExpression()

  /**
   * The operation name for the route.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-operationname)
   */
  public fun operationName(): String? = unwrap(this).getOperationName()

  /**
   * The request models for the route.
   *
   * Supported only for WebSocket APIs.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-requestmodels)
   */
  public fun requestModels(): Any? = unwrap(this).getRequestModels()

  /**
   * The request parameters for the route.
   *
   * Supported only for WebSocket APIs.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-requestparameters)
   */
  public fun requestParameters(): Any? = unwrap(this).getRequestParameters()

  /**
   * The route key for the route.
   *
   * For HTTP APIs, the route key can be either `$default` , or a combination of an HTTP method and
   * resource path, for example, `GET /pets` .
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-routekey)
   */
  public fun routeKey(): String

  /**
   * The route response selection expression for the route.
   *
   * Supported only for WebSocket APIs.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-routeresponseselectionexpression)
   */
  public fun routeResponseSelectionExpression(): String? =
      unwrap(this).getRouteResponseSelectionExpression()

  /**
   * The target for the route.
   *
   * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-target)
   */
  public fun target(): String? = unwrap(this).getTarget()

  /**
   * A builder for [CfnRouteProps]
   */
  @CdkDslMarker
  public interface Builder {
    /**
     * @param apiId The API identifier. 
     */
    public fun apiId(apiId: String)

    /**
     * @param apiKeyRequired Specifies whether an API key is required for the route.
     * Supported only for WebSocket APIs.
     */
    public fun apiKeyRequired(apiKeyRequired: Boolean)

    /**
     * @param apiKeyRequired Specifies whether an API key is required for the route.
     * Supported only for WebSocket APIs.
     */
    public fun apiKeyRequired(apiKeyRequired: IResolvable)

    /**
     * @param authorizationScopes The authorization scopes supported by this route.
     */
    public fun authorizationScopes(authorizationScopes: List)

    /**
     * @param authorizationScopes The authorization scopes supported by this route.
     */
    public fun authorizationScopes(vararg authorizationScopes: String)

    /**
     * @param authorizationType The authorization type for the route.
     * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM
     * permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE`
     * for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and
     * `CUSTOM` for using a Lambda authorizer.
     */
    public fun authorizationType(authorizationType: String)

    /**
     * @param authorizerId The identifier of the `Authorizer` resource to be associated with this
     * route.
     * The authorizer identifier is generated by API Gateway when you created the authorizer.
     */
    public fun authorizerId(authorizerId: String)

    /**
     * @param modelSelectionExpression The model selection expression for the route.
     * Supported only for WebSocket APIs.
     */
    public fun modelSelectionExpression(modelSelectionExpression: String)

    /**
     * @param operationName The operation name for the route.
     */
    public fun operationName(operationName: String)

    /**
     * @param requestModels The request models for the route.
     * Supported only for WebSocket APIs.
     */
    public fun requestModels(requestModels: Any)

    /**
     * @param requestParameters The request parameters for the route.
     * Supported only for WebSocket APIs.
     */
    public fun requestParameters(requestParameters: Any)

    /**
     * @param routeKey The route key for the route. 
     * For HTTP APIs, the route key can be either `$default` , or a combination of an HTTP method
     * and resource path, for example, `GET /pets` .
     */
    public fun routeKey(routeKey: String)

    /**
     * @param routeResponseSelectionExpression The route response selection expression for the
     * route.
     * Supported only for WebSocket APIs.
     */
    public fun routeResponseSelectionExpression(routeResponseSelectionExpression: String)

    /**
     * @param target The target for the route.
     */
    public fun target(target: String)
  }

  private class BuilderImpl : Builder {
    private val cdkBuilder: software.amazon.awscdk.services.apigatewayv2.CfnRouteProps.Builder =
        software.amazon.awscdk.services.apigatewayv2.CfnRouteProps.builder()

    /**
     * @param apiId The API identifier. 
     */
    override fun apiId(apiId: String) {
      cdkBuilder.apiId(apiId)
    }

    /**
     * @param apiKeyRequired Specifies whether an API key is required for the route.
     * Supported only for WebSocket APIs.
     */
    override fun apiKeyRequired(apiKeyRequired: Boolean) {
      cdkBuilder.apiKeyRequired(apiKeyRequired)
    }

    /**
     * @param apiKeyRequired Specifies whether an API key is required for the route.
     * Supported only for WebSocket APIs.
     */
    override fun apiKeyRequired(apiKeyRequired: IResolvable) {
      cdkBuilder.apiKeyRequired(apiKeyRequired.let(IResolvable.Companion::unwrap))
    }

    /**
     * @param authorizationScopes The authorization scopes supported by this route.
     */
    override fun authorizationScopes(authorizationScopes: List) {
      cdkBuilder.authorizationScopes(authorizationScopes)
    }

    /**
     * @param authorizationScopes The authorization scopes supported by this route.
     */
    override fun authorizationScopes(vararg authorizationScopes: String): Unit =
        authorizationScopes(authorizationScopes.toList())

    /**
     * @param authorizationType The authorization type for the route.
     * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM
     * permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE`
     * for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and
     * `CUSTOM` for using a Lambda authorizer.
     */
    override fun authorizationType(authorizationType: String) {
      cdkBuilder.authorizationType(authorizationType)
    }

    /**
     * @param authorizerId The identifier of the `Authorizer` resource to be associated with this
     * route.
     * The authorizer identifier is generated by API Gateway when you created the authorizer.
     */
    override fun authorizerId(authorizerId: String) {
      cdkBuilder.authorizerId(authorizerId)
    }

    /**
     * @param modelSelectionExpression The model selection expression for the route.
     * Supported only for WebSocket APIs.
     */
    override fun modelSelectionExpression(modelSelectionExpression: String) {
      cdkBuilder.modelSelectionExpression(modelSelectionExpression)
    }

    /**
     * @param operationName The operation name for the route.
     */
    override fun operationName(operationName: String) {
      cdkBuilder.operationName(operationName)
    }

    /**
     * @param requestModels The request models for the route.
     * Supported only for WebSocket APIs.
     */
    override fun requestModels(requestModels: Any) {
      cdkBuilder.requestModels(requestModels)
    }

    /**
     * @param requestParameters The request parameters for the route.
     * Supported only for WebSocket APIs.
     */
    override fun requestParameters(requestParameters: Any) {
      cdkBuilder.requestParameters(requestParameters)
    }

    /**
     * @param routeKey The route key for the route. 
     * For HTTP APIs, the route key can be either `$default` , or a combination of an HTTP method
     * and resource path, for example, `GET /pets` .
     */
    override fun routeKey(routeKey: String) {
      cdkBuilder.routeKey(routeKey)
    }

    /**
     * @param routeResponseSelectionExpression The route response selection expression for the
     * route.
     * Supported only for WebSocket APIs.
     */
    override fun routeResponseSelectionExpression(routeResponseSelectionExpression: String) {
      cdkBuilder.routeResponseSelectionExpression(routeResponseSelectionExpression)
    }

    /**
     * @param target The target for the route.
     */
    override fun target(target: String) {
      cdkBuilder.target(target)
    }

    public fun build(): software.amazon.awscdk.services.apigatewayv2.CfnRouteProps =
        cdkBuilder.build()
  }

  private class Wrapper(
    cdkObject: software.amazon.awscdk.services.apigatewayv2.CfnRouteProps,
  ) : CdkObject(cdkObject),
      CfnRouteProps {
    /**
     * The API identifier.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-apiid)
     */
    override fun apiId(): String = unwrap(this).getApiId()

    /**
     * Specifies whether an API key is required for the route.
     *
     * Supported only for WebSocket APIs.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-apikeyrequired)
     */
    override fun apiKeyRequired(): Any? = unwrap(this).getApiKeyRequired()

    /**
     * The authorization scopes supported by this route.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-authorizationscopes)
     */
    override fun authorizationScopes(): List = unwrap(this).getAuthorizationScopes() ?:
        emptyList()

    /**
     * The authorization type for the route.
     *
     * For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM
     * permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE`
     * for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and
     * `CUSTOM` for using a Lambda authorizer.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-authorizationtype)
     */
    override fun authorizationType(): String? = unwrap(this).getAuthorizationType()

    /**
     * The identifier of the `Authorizer` resource to be associated with this route.
     *
     * The authorizer identifier is generated by API Gateway when you created the authorizer.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-authorizerid)
     */
    override fun authorizerId(): String? = unwrap(this).getAuthorizerId()

    /**
     * The model selection expression for the route.
     *
     * Supported only for WebSocket APIs.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-modelselectionexpression)
     */
    override fun modelSelectionExpression(): String? = unwrap(this).getModelSelectionExpression()

    /**
     * The operation name for the route.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-operationname)
     */
    override fun operationName(): String? = unwrap(this).getOperationName()

    /**
     * The request models for the route.
     *
     * Supported only for WebSocket APIs.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-requestmodels)
     */
    override fun requestModels(): Any? = unwrap(this).getRequestModels()

    /**
     * The request parameters for the route.
     *
     * Supported only for WebSocket APIs.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-requestparameters)
     */
    override fun requestParameters(): Any? = unwrap(this).getRequestParameters()

    /**
     * The route key for the route.
     *
     * For HTTP APIs, the route key can be either `$default` , or a combination of an HTTP method
     * and resource path, for example, `GET /pets` .
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-routekey)
     */
    override fun routeKey(): String = unwrap(this).getRouteKey()

    /**
     * The route response selection expression for the route.
     *
     * Supported only for WebSocket APIs.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-routeresponseselectionexpression)
     */
    override fun routeResponseSelectionExpression(): String? =
        unwrap(this).getRouteResponseSelectionExpression()

    /**
     * The target for the route.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html#cfn-apigatewayv2-route-target)
     */
    override fun target(): String? = unwrap(this).getTarget()
  }

  public companion object {
    public operator fun invoke(block: Builder.() -> Unit = {}): CfnRouteProps {
      val builderImpl = BuilderImpl()
      return Wrapper(builderImpl.apply(block).build())
    }

    internal fun wrap(cdkObject: software.amazon.awscdk.services.apigatewayv2.CfnRouteProps):
        CfnRouteProps = CdkObjectWrappers.wrap(cdkObject) as? CfnRouteProps ?: Wrapper(cdkObject)

    internal fun unwrap(wrapped: CfnRouteProps):
        software.amazon.awscdk.services.apigatewayv2.CfnRouteProps = (wrapped as
        CdkObject).cdkObject as software.amazon.awscdk.services.apigatewayv2.CfnRouteProps
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy