RouteSpec

class aws_cdk.aws_appmesh.RouteSpec

Bases: object

Used to generate specs with different protocols for a RouteSpec.

ExampleMetadata:

infused

Example:

# router: appmesh.VirtualRouter
# node: appmesh.VirtualNode


router.add_route("route-http2-retry",
    route_spec=appmesh.RouteSpec.http2(
        weighted_targets=[appmesh.WeightedTarget(virtual_node=node)],
        retry_policy=appmesh.HttpRetryPolicy(
            # Retry if the connection failed
            tcp_retry_events=[appmesh.TcpRetryEvent.CONNECTION_ERROR],
            # Retry if HTTP responds with a gateway error (502, 503, 504)
            http_retry_events=[appmesh.HttpRetryEvent.GATEWAY_ERROR],
            # Retry five times
            retry_attempts=5,
            # Use a 1 second timeout per retry
            retry_timeout=cdk.Duration.seconds(1)
        )
    )
)

Methods

abstract bind(scope)

Called when the RouteSpec type is initialized.

Can be used to enforce mutual exclusivity with future properties

Parameters:

scope (Construct) –

Return type:

RouteSpecConfig

Static Methods

classmethod grpc(*, match, weighted_targets, retry_policy=None, timeout=None, priority=None)

Creates a GRPC Based RouteSpec.

Parameters:
  • match (Union[GrpcRouteMatch, Dict[str, Any]]) – The criterion for determining a request match for this Route.

  • weighted_targets (Sequence[Union[WeightedTarget, Dict[str, Any]]]) – List of targets that traffic is routed to when a request matches the route.

  • retry_policy (Union[GrpcRetryPolicy, Dict[str, Any], None]) – The retry policy. Default: - no retry policy

  • timeout (Union[GrpcTimeout, Dict[str, Any], None]) – An object that represents a grpc timeout. Default: - None

  • priority (Union[int, float, None]) – The priority for the route. When a Virtual Router has multiple routes, route match is performed in the order of specified value, where 0 is the highest priority, and first matched route is selected. Default: - no particular priority

Return type:

RouteSpec

classmethod http(*, weighted_targets, match=None, retry_policy=None, timeout=None, priority=None)

Creates an HTTP Based RouteSpec.

Parameters:
  • weighted_targets (Sequence[Union[WeightedTarget, Dict[str, Any]]]) – List of targets that traffic is routed to when a request matches the route.

  • match (Union[HttpRouteMatch, Dict[str, Any], None]) – The criterion for determining a request match for this Route. Default: - matches on ‘/’

  • retry_policy (Union[HttpRetryPolicy, Dict[str, Any], None]) – The retry policy. Default: - no retry policy

  • timeout (Union[HttpTimeout, Dict[str, Any], None]) – An object that represents a http timeout. Default: - None

  • priority (Union[int, float, None]) – The priority for the route. When a Virtual Router has multiple routes, route match is performed in the order of specified value, where 0 is the highest priority, and first matched route is selected. Default: - no particular priority

Return type:

RouteSpec

classmethod http2(*, weighted_targets, match=None, retry_policy=None, timeout=None, priority=None)

Creates an HTTP2 Based RouteSpec.

Parameters:
  • weighted_targets (Sequence[Union[WeightedTarget, Dict[str, Any]]]) – List of targets that traffic is routed to when a request matches the route.

  • match (Union[HttpRouteMatch, Dict[str, Any], None]) – The criterion for determining a request match for this Route. Default: - matches on ‘/’

  • retry_policy (Union[HttpRetryPolicy, Dict[str, Any], None]) – The retry policy. Default: - no retry policy

  • timeout (Union[HttpTimeout, Dict[str, Any], None]) – An object that represents a http timeout. Default: - None

  • priority (Union[int, float, None]) – The priority for the route. When a Virtual Router has multiple routes, route match is performed in the order of specified value, where 0 is the highest priority, and first matched route is selected. Default: - no particular priority

Return type:

RouteSpec

classmethod tcp(*, weighted_targets, timeout=None, priority=None)

Creates a TCP Based RouteSpec.

Parameters:
  • weighted_targets (Sequence[Union[WeightedTarget, Dict[str, Any]]]) – List of targets that traffic is routed to when a request matches the route.

  • timeout (Union[TcpTimeout, Dict[str, Any], None]) – An object that represents a tcp timeout. Default: - None

  • priority (Union[int, float, None]) – The priority for the route. When a Virtual Router has multiple routes, route match is performed in the order of specified value, where 0 is the highest priority, and first matched route is selected. Default: - no particular priority

Return type:

RouteSpec