Skip to content

create_partnership async

create_partnership(
    profile_id: ProfileId,
    name: PartnerName,
    email: Email,
    capabilities: PartnershipCapabilities,
    *,
    config_overrides: Optional[Asyncb2biClientConfig] = None,
    phone: Optional[Phone] = None,
    capability_options: Optional[CapabilityOptions] = None,
    client_token: Optional[str] = None,
    tags: Optional[TagList] = None,
) -> CreatePartnershipResponse

Creates a partnership between a customer and a trading partner, based on the supplied parameters. A partnership represents the connection between you and your trading partner. It ties together a profile and one or more trading capabilities.

Parameters:

  • profile_id (ProfileId) –

    Specifies the unique, system-generated identifier for the profile connected to this partnership.

  • name (PartnerName) –

    Specifies a descriptive name for the partnership.

  • email (Email) –

    Specifies the email address associated with this trading partner.

  • phone (Optional[Phone], default: None ) –

    Specifies the phone number associated with the partnership.

  • capabilities (PartnershipCapabilities) –

    Specifies a list of the capabilities associated with this partnership.

  • capability_options (Optional[CapabilityOptions], default: None ) –

    Specify the structure that contains the details for the associated capabilities.

  • client_token (Optional[str], default: None ) –

    Reserved for future use.

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

    Specifies the key-value pairs assigned to ARNs that you can use to group and search for resources by type. You can attach this metadata to resources (capabilities, partnerships, and so on) for any purpose.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    A conflict exception is thrown when you attempt to delete a resource (such as a profile or a capability) that is being used by other resources.

  • InternalServerException –

    This exception is thrown when an error occurs in the Amazon Web Services B2B Data Interchange service.

  • ResourceNotFoundException –

    Occurs when the requested resource does not exist, or cannot be found. In some cases, the resource exists in a region other than the region specified in the API call.

  • ServiceQuotaExceededException –

    Occurs when the calling command attempts to exceed one of the service quotas, for example trying to create a capability when you already have the maximum number of capabilities allowed.

  • ThrottlingException –

    The request was denied due to throttling: the data speed and rendering may be limited depending on various parameters and conditions.

  • ValidationException –

    Occurs when a B2BI object cannot be validated against a request from another object. This exception can be thrown during standard EDI validation or when custom validation rules fail, such as when element length constraints are violated, invalid codes are used in code list validations, or required elements are missing based on configured element requirement rules.

  • UnknownServiceError –

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

Examples:

Sample CreatePartnership call

>>> await client.create_partnership(capabilities=['ca-963a8121e4fc4e348'], client_token='foo', email='[email protected]', name='b2bipartner', phone='5555555555', profile_id='p-60fbc37c87f04fce9', tags=[{'Key': 'sampleKey1', 'Value': 'sampleValue1'}])
Source code in docs_src/capo_b2bi/_services/async_b2bi.py
async def create_partnership(
    self,
    profile_id: "capo_b2bi.types.profile_id.ProfileId",
    name: "capo_b2bi.types.partner_name.PartnerName",
    email: "capo_b2bi.types.email.Email",
    capabilities: "capo_b2bi.types.partnership_capabilities.PartnershipCapabilities",
    *,
    config_overrides: Optional[Asyncb2biClientConfig] = None,
    phone: Optional["capo_b2bi.types.phone.Phone"] = None,
    capability_options: Optional[
        "capo_b2bi.types.capability_options.CapabilityOptions"
    ] = None,
    client_token: Optional[str] = None,
    tags: Optional["capo_b2bi.types.tag_list.TagList"] = None,
) -> "capo_b2bi.types.create_partnership_response.CreatePartnershipResponse":
    """<p>Creates a partnership between a customer and a trading partner, based on the supplied parameters. A partnership represents the connection between you and your trading partner. It ties together a profile and one or more trading capabilities.</p>

    Args:
        profile_id: <p>Specifies the unique, system-generated identifier for the profile connected to this partnership.</p>
        name: <p>Specifies a descriptive name for the partnership.</p>
        email: <p>Specifies the email address associated with this trading partner.</p>
        phone: <p>Specifies the phone number associated with the partnership.</p>
        capabilities: <p>Specifies a list of the capabilities associated with this partnership.</p>
        capability_options: <p>Specify the structure that contains the details for the associated capabilities.</p>
        client_token: <p>Reserved for future use.</p>
        tags: <p>Specifies the key-value pairs assigned to ARNs that you can use to group and search for resources by type. You can attach this metadata to resources (capabilities, partnerships, and so on) for any purpose.</p>

    Raises:
        capo_b2bi.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_b2bi.errors.conflict_exception.ConflictException: <p>A conflict exception is thrown when you attempt to delete a resource (such as a profile or a capability) that is being used by other resources.</p>
        capo_b2bi.errors.internal_server_exception.InternalServerException: <p>This exception is thrown when an error occurs in the Amazon Web Services B2B Data Interchange service.</p>
        capo_b2bi.errors.resource_not_found_exception.ResourceNotFoundException: <p>Occurs when the requested resource does not exist, or cannot be found. In some cases, the resource exists in a region other than the region specified in the API call.</p>
        capo_b2bi.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Occurs when the calling command attempts to exceed one of the service quotas, for example trying to create a capability when you already have the maximum number of capabilities allowed.</p>
        capo_b2bi.errors.throttling_exception.ThrottlingException: <p>The request was denied due to throttling: the data speed and rendering may be limited depending on various parameters and conditions.</p>
        capo_b2bi.errors.validation_exception.ValidationException: <p>Occurs when a B2BI object cannot be validated against a request from another object. This exception can be thrown during standard EDI validation or when custom validation rules fail, such as when element length constraints are violated, invalid codes are used in code list validations, or required elements are missing based on configured element requirement rules.</p>
        capo_b2bi.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Sample CreatePartnership call

        >>> await client.create_partnership(capabilities=['ca-963a8121e4fc4e348'], client_token='foo', email='[email protected]', name='b2bipartner', phone='5555555555', profile_id='p-60fbc37c87f04fce9', tags=[{'Key': 'sampleKey1', 'Value': 'sampleValue1'}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_b2bi.types.create_partnership_request.CreatePartnershipRequest]",
    ) -> AsyncOperationResponse[
        "capo_b2bi.types.create_partnership_response.CreatePartnershipResponse"
    ]:
        import capo_b2bi._operations.b2_bi.create_partnership

        (
            output,
            http_response,
        ) = await capo_b2bi._operations.b2_bi.create_partnership.async_create_partnership(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_b2bi.types.create_partnership_request.CreatePartnershipRequest",
    ) -> dict[str, Any]:
        import capo_b2bi.types.create_partnership_request

        return capo_b2bi.types.create_partnership_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_b2bi.types.create_partnership_response.CreatePartnershipResponse",
    ) -> dict[str, Any]:
        import capo_b2bi.types.create_partnership_response

        return capo_b2bi.types.create_partnership_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreatePartnership",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_b2bi.types.create_partnership_request.CreatePartnershipRequest = {
        "profile_id": profile_id,
        "name": name,
        "email": email,
        "capabilities": capabilities,
    }
    if phone is not None:
        input_["phone"] = phone
    if capability_options is not None:
        input_["capability_options"] = capability_options
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output