Skip to content

create_link_routing_rule

create_link_routing_rule(
    client_token: str,
    gateway_id: GatewayId,
    link_id: LinkId,
    priority: RulePriority,
    conditions: RuleCondition,
    *,
    config_overrides: Optional[RTBFabricClientConfig] = None,
    tags: Optional[TagsMap] = None,
) -> CreateLinkRoutingRuleResponse

Creates a routing rule for a link.

Routing rules use priority-based evaluation where lower priority numbers are evaluated first. Each rule specifies conditions that must all match for the rule to apply.

Parameters:

  • client_token (str) –

    Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value.

    If you don't provide this value, then Amazon Web Services generates a random one for you.

    If you retry the operation with the same clientToken, but with different parameters, the retry fails with an IdempotentParameterMismatch error.

  • gateway_id (GatewayId) –

    The unique identifier of the gateway.

  • link_id (LinkId) –

    The unique identifier of the link.

  • priority (RulePriority) –

    The priority of the routing rule. Lower numbers are evaluated first. Valid values are 1 to 1000. Priority must be unique among non-deleted rules within a link.

  • conditions (RuleCondition) –

    The conditions for the routing rule. All specified fields must match for the rule to apply. At least one condition field must be set.

  • tags (Optional[TagsMap], default: None ) –

    A map of the key-value pairs of the tag or tags to assign to the resource.

Raises:

  • AccessDeniedException –

    The request could not be completed because you do not have sufficient access to perform this action.

  • ConflictException –

    The request could not be completed because of a conflict in the current state of the resource.

  • InternalServerException –

    The request could not be completed because of an internal server error. Try your call again.

  • ResourceNotFoundException –

    The request could not be completed because the resource does not exist.

  • ServiceQuotaExceededException –

    The request could not be completed because you exceeded a service quota.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The request could not be completed because it fails satisfy the constraints specified by the service.

  • UnknownServiceError –

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

Examples:

Create a link routing rule Create a routing rule with host header and path prefix conditions

>>> client.create_link_routing_rule(gateway_id='rtb-gw-12345678', link_id='link-87654321', priority=10, conditions={'hostHeader': 'api.customer.com', 'pathPrefix': '/openrtb/'}, client_token='550e8400-e29b-41d4-a716-446655440000')
Source code in docs_src/capo_rtbfabric/_services/rtb_fabric.py
def create_link_routing_rule(
    self,
    client_token: str,
    gateway_id: "capo_rtbfabric.types.gateway_id.GatewayId",
    link_id: "capo_rtbfabric.types.link_id.LinkId",
    priority: "capo_rtbfabric.types.rule_priority.RulePriority",
    conditions: "capo_rtbfabric.types.rule_condition.RuleCondition",
    *,
    config_overrides: Optional[RTBFabricClientConfig] = None,
    tags: Optional["capo_rtbfabric.types.tags_map.TagsMap"] = None,
) -> "capo_rtbfabric.types.create_link_routing_rule_response.CreateLinkRoutingRuleResponse":
    """<p>Creates a routing rule for a link.</p> <p>Routing rules use priority-based evaluation where lower priority numbers are evaluated first. Each rule specifies conditions that must all match for the rule to apply.</p>

    Args:
        client_token: <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value</a>.</p> <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p> <p>If you retry the operation with the same <code>clientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
        gateway_id: <p>The unique identifier of the gateway.</p>
        link_id: <p>The unique identifier of the link.</p>
        priority: <p>The priority of the routing rule. Lower numbers are evaluated first. Valid values are 1 to 1000. Priority must be unique among non-deleted rules within a link.</p>
        conditions: <p>The conditions for the routing rule. All specified fields must match for the rule to apply. At least one condition field must be set.</p>
        tags: <p>A map of the key-value pairs of the tag or tags to assign to the resource.</p>

    Raises:
        capo_rtbfabric.errors.access_denied_exception.AccessDeniedException: <p>The request could not be completed because you do not have sufficient access to perform this action.</p>
        capo_rtbfabric.errors.conflict_exception.ConflictException: <p>The request could not be completed because of a conflict in the current state of the resource.</p>
        capo_rtbfabric.errors.internal_server_exception.InternalServerException: <p>The request could not be completed because of an internal server error. Try your call again.</p>
        capo_rtbfabric.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request could not be completed because the resource does not exist.</p>
        capo_rtbfabric.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request could not be completed because you exceeded a service quota.</p>
        capo_rtbfabric.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_rtbfabric.errors.validation_exception.ValidationException: <p>The request could not be completed because it fails satisfy the constraints specified by the service.</p>
        capo_rtbfabric.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create a link routing rule
        Create a routing rule with host header and path prefix conditions

        >>> client.create_link_routing_rule(gateway_id='rtb-gw-12345678', link_id='link-87654321', priority=10, conditions={'hostHeader': 'api.customer.com', 'pathPrefix': '/openrtb/'}, client_token='550e8400-e29b-41d4-a716-446655440000')
    """

    def _handler(
        req: "OperationRequest[capo_rtbfabric.types.create_link_routing_rule_request.CreateLinkRoutingRuleRequest]",
    ) -> OperationResponse[
        "capo_rtbfabric.types.create_link_routing_rule_response.CreateLinkRoutingRuleResponse"
    ]:
        import capo_rtbfabric._operations.rtb_fabric.create_link_routing_rule

        output, http_response = (
            capo_rtbfabric._operations.rtb_fabric.create_link_routing_rule.create_link_routing_rule(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLinkRoutingRule")
    )
    input_: capo_rtbfabric.types.create_link_routing_rule_request.CreateLinkRoutingRuleRequest = {
        "client_token": client_token,
        "gateway_id": gateway_id,
        "link_id": link_id,
        "priority": priority,
        "conditions": conditions,
    }
    if tags is not None:
        input_["tags"] = tags

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