Skip to content

update_route

update_route(
    api_id: __string,
    route_id: __string,
    *,
    config_overrides: Optional[ApiGatewayV2ClientConfig] = None,
    api_key_required: Optional[__boolean] = None,
    authorization_scopes: Optional[AuthorizationScopes] = None,
    authorization_type: Optional[AuthorizationType] = None,
    authorizer_id: Optional[Id] = None,
    model_selection_expression: Optional[SelectionExpression] = None,
    operation_name: Optional[StringWithLengthBetween1And64] = None,
    request_models: Optional[RouteModels] = None,
    request_parameters: Optional[RouteParameters] = None,
    route_key: Optional[SelectionKey] = None,
    route_response_selection_expression: Optional[SelectionExpression] = None,
    target: Optional[StringWithLengthBetween1And128] = None,
) -> UpdateRouteResult

Updates a Route.

Parameters:

  • api_id (__string) –

    The API identifier.

  • api_key_required (Optional[__boolean], default: None ) –

    Specifies whether an API key is required for the route. Supported only for WebSocket APIs.

  • authorization_scopes (Optional[AuthorizationScopes], default: None ) –

    The authorization scopes supported by this route.

  • authorization_type (Optional[AuthorizationType], default: None ) –

    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.

  • authorizer_id (Optional[Id], default: None ) –

    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.

  • model_selection_expression (Optional[SelectionExpression], default: None ) –

    The model selection expression for the route. Supported only for WebSocket APIs.

  • operation_name (Optional[StringWithLengthBetween1And64], default: None ) –

    The operation name for the route.

  • request_models (Optional[RouteModels], default: None ) –

    The request models for the route. Supported only for WebSocket APIs.

  • request_parameters (Optional[RouteParameters], default: None ) –

    The request parameters for the route. Supported only for WebSocket APIs.

  • route_id (__string) –

    The route ID.

  • route_key (Optional[SelectionKey], default: None ) –

    The route key for the route.

  • route_response_selection_expression (Optional[SelectionExpression], default: None ) –

    The route response selection expression for the route. Supported only for WebSocket APIs.

  • target (Optional[StringWithLengthBetween1And128], default: None ) –

    The target for the route.

Raises:

  • BadRequestException –

    The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

  • NotFoundException –

    The resource specified in the request was not found. See the message field for more information.

  • TooManyRequestsException –

    A limit has been exceeded. See the accompanying error message for details.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_apigatewayv2/_services/api_gateway_v2.py
def update_route(
    self,
    api_id: "capo_apigatewayv2.types.__string.__string",
    route_id: "capo_apigatewayv2.types.__string.__string",
    *,
    config_overrides: Optional[ApiGatewayV2ClientConfig] = None,
    api_key_required: Optional[
        "capo_apigatewayv2.types.__boolean.__boolean"
    ] = None,
    authorization_scopes: Optional[
        "capo_apigatewayv2.types.authorization_scopes.AuthorizationScopes"
    ] = None,
    authorization_type: Optional[
        "capo_apigatewayv2.types.authorization_type.AuthorizationType"
    ] = None,
    authorizer_id: Optional["capo_apigatewayv2.types.id.Id"] = None,
    model_selection_expression: Optional[
        "capo_apigatewayv2.types.selection_expression.SelectionExpression"
    ] = None,
    operation_name: Optional[
        "capo_apigatewayv2.types.string_with_length_between1_and64.StringWithLengthBetween1And64"
    ] = None,
    request_models: Optional[
        "capo_apigatewayv2.types.route_models.RouteModels"
    ] = None,
    request_parameters: Optional[
        "capo_apigatewayv2.types.route_parameters.RouteParameters"
    ] = None,
    route_key: Optional[
        "capo_apigatewayv2.types.selection_key.SelectionKey"
    ] = None,
    route_response_selection_expression: Optional[
        "capo_apigatewayv2.types.selection_expression.SelectionExpression"
    ] = None,
    target: Optional[
        "capo_apigatewayv2.types.string_with_length_between1_and128.StringWithLengthBetween1And128"
    ] = None,
) -> "capo_apigatewayv2.types.update_route_result.UpdateRouteResult":
    """<p>Updates a Route.</p>

    Args:
        api_id: <p>The API identifier.</p>
        api_key_required: <p>Specifies whether an API key is required for the route. Supported only for WebSocket APIs.</p>
        authorization_scopes: <p>The authorization scopes supported by this route.</p>
        authorization_type: <p>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.</p>
        authorizer_id: <p>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.</p>
        model_selection_expression: <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
        operation_name: <p>The operation name for the route.</p>
        request_models: <p>The request models for the route. Supported only for WebSocket APIs.</p>
        request_parameters: <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
        route_id: <p>The route ID.</p>
        route_key: <p>The route key for the route.</p>
        route_response_selection_expression: <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
        target: <p>The target for the route.</p>

    Raises:
        capo_apigatewayv2.errors.bad_request_exception.BadRequestException: <p>The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.not_found_exception.NotFoundException: <p>The resource specified in the request was not found. See the message field for more information.</p>
        capo_apigatewayv2.errors.too_many_requests_exception.TooManyRequestsException: <p>A limit has been exceeded. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_apigatewayv2.types.update_route_request.UpdateRouteRequest]",
    ) -> OperationResponse[
        "capo_apigatewayv2.types.update_route_result.UpdateRouteResult"
    ]:
        import capo_apigatewayv2._operations.api_gateway_v2.update_route

        output, http_response = (
            capo_apigatewayv2._operations.api_gateway_v2.update_route.update_route(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateRoute")
    )
    input_: capo_apigatewayv2.types.update_route_request.UpdateRouteRequest = {
        "api_id": api_id,
        "route_id": route_id,
    }
    if api_key_required is not None:
        input_["api_key_required"] = api_key_required
    if authorization_scopes is not None:
        input_["authorization_scopes"] = authorization_scopes
    if authorization_type is not None:
        input_["authorization_type"] = authorization_type
    if authorizer_id is not None:
        input_["authorizer_id"] = authorizer_id
    if model_selection_expression is not None:
        input_["model_selection_expression"] = model_selection_expression
    if operation_name is not None:
        input_["operation_name"] = operation_name
    if request_models is not None:
        input_["request_models"] = request_models
    if request_parameters is not None:
        input_["request_parameters"] = request_parameters
    if route_key is not None:
        input_["route_key"] = route_key
    if route_response_selection_expression is not None:
        input_["route_response_selection_expression"] = (
            route_response_selection_expression
        )
    if target is not None:
        input_["target"] = target

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output