Skip to content

create_link

create_link(
    gateway_id: GatewayId,
    peer_gateway_id: GatewayId,
    log_settings: LinkLogSettings,
    *,
    config_overrides: Optional[RTBFabricClientConfig] = None,
    attributes: Optional[LinkAttributes] = None,
    http_responder_allowed: Optional[bool] = None,
    tags: Optional[TagsMap] = None,
    timeout_in_millis: Optional[LinkTimeoutInMillis] = None,
) -> CreateLinkResponse

Creates a new link between gateways.

Establishes a connection that allows gateways to communicate and exchange bid requests and responses.

Parameters:

  • gateway_id (GatewayId) –

    The unique identifier of the gateway.

  • peer_gateway_id (GatewayId) –

    The unique identifier of the peer gateway.

  • attributes (Optional[LinkAttributes], default: None ) –

    Attributes of the link.

  • http_responder_allowed (Optional[bool], default: None ) –

    Boolean to specify if an HTTP responder is allowed.

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

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

  • log_settings (LinkLogSettings) –

    Application log settings for the link. This value is required. Under applicationLogs.sampling, the errorLog and filterLog fields set the percentage of eligible events to log. Valid values range from 0 through 100. To turn off application logs, set both fields to 0, as in {"applicationLogs":{"sampling":{"errorLog":0,"filterLog":0}}}.

  • timeout_in_millis (Optional[LinkTimeoutInMillis], default: None ) –

    The timeout value in milliseconds.

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 standard link between gateways Creates a new link between two RTB applications. Requires peerGatewayId to specify the target gateway.

>>> client.create_link(gateway_id='rtb-gw-12345678', peer_gateway_id='rtb-gw-87654321', log_settings={'applicationLogs': {'sampling': {'errorLog': 100.0, 'filterLog': 0.0}}})
Source code in docs_src/capo_rtbfabric/_services/rtb_fabric.py
def create_link(
    self,
    gateway_id: "capo_rtbfabric.types.gateway_id.GatewayId",
    peer_gateway_id: "capo_rtbfabric.types.gateway_id.GatewayId",
    log_settings: "capo_rtbfabric.types.link_log_settings.LinkLogSettings",
    *,
    config_overrides: Optional[RTBFabricClientConfig] = None,
    attributes: Optional[
        "capo_rtbfabric.types.link_attributes.LinkAttributes"
    ] = None,
    http_responder_allowed: Optional[bool] = None,
    tags: Optional["capo_rtbfabric.types.tags_map.TagsMap"] = None,
    timeout_in_millis: Optional[
        "capo_rtbfabric.types.link_timeout_in_millis.LinkTimeoutInMillis"
    ] = None,
) -> "capo_rtbfabric.types.create_link_response.CreateLinkResponse":
    """<p>Creates a new link between gateways.</p> <p>Establishes a connection that allows gateways to communicate and exchange bid requests and responses.</p>

    Args:
        gateway_id: <p>The unique identifier of the gateway.</p>
        peer_gateway_id: <p>The unique identifier of the peer gateway.</p>
        attributes: <p>Attributes of the link.</p>
        http_responder_allowed: <p>Boolean to specify if an HTTP responder is allowed.</p>
        tags: <p>A map of the key-value pairs of the tag or tags to assign to the resource.</p>
        log_settings: <p>Application log settings for the link. This value is required. Under <code>applicationLogs.sampling</code>, the <code>errorLog</code> and <code>filterLog</code> fields set the percentage of eligible events to log. Valid values range from <code>0</code> through <code>100</code>. To turn off application logs, set both fields to <code>0</code>, as in <code>{"applicationLogs":{"sampling":{"errorLog":0,"filterLog":0}}}</code>.</p>
        timeout_in_millis: <p>The timeout value in milliseconds.</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 standard link between gateways
        Creates a new link between two RTB applications. Requires peerGatewayId to specify the target gateway.

        >>> client.create_link(gateway_id='rtb-gw-12345678', peer_gateway_id='rtb-gw-87654321', log_settings={'applicationLogs': {'sampling': {'errorLog': 100.0, 'filterLog': 0.0}}})
    """

    def _handler(
        req: "OperationRequest[capo_rtbfabric.types.create_link_request.CreateLinkRequest]",
    ) -> OperationResponse[
        "capo_rtbfabric.types.create_link_response.CreateLinkResponse"
    ]:
        import capo_rtbfabric._operations.rtb_fabric.create_link

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLink")
    )
    input_: capo_rtbfabric.types.create_link_request.CreateLinkRequest = {
        "gateway_id": gateway_id,
        "peer_gateway_id": peer_gateway_id,
        "log_settings": log_settings,
    }
    if attributes is not None:
        input_["attributes"] = attributes
    if http_responder_allowed is not None:
        input_["http_responder_allowed"] = http_responder_allowed
    if tags is not None:
        input_["tags"] = tags
    if timeout_in_millis is not None:
        input_["timeout_in_millis"] = timeout_in_millis

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