HttpRouteSpecOptions

class aws_cdk.aws_appmesh.HttpRouteSpecOptions(*, priority=None, weighted_targets, match=None, retry_policy=None, timeout=None)

Bases: RouteSpecOptionsBase

Properties specific for HTTP Based Routes.

Parameters:
  • 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

  • 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

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=Duration.seconds(1)
        )
    )
)

Attributes

match

The criterion for determining a request match for this Route.

Default:
  • matches on ‘/’

priority

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

retry_policy

The retry policy.

Default:
  • no retry policy

timeout

An object that represents a http timeout.

Default:
  • None

weighted_targets

List of targets that traffic is routed to when a request matches the route.