Skip to content

associate_external_connection async

associate_external_connection(
    domain: DomainName,
    repository: RepositoryName,
    external_connection: ExternalConnectionName,
    *,
    config_overrides: Optional[AsynccodeartifactClientConfig] = None,
    domain_owner: Optional[AccountId] = None,
) -> AssociateExternalConnectionResult

Adds an existing external connection to a repository. One external connection is allowed per repository.

A repository can have one or more upstream repositories, or an external connection.

Parameters:

  • domain (DomainName) –

    The name of the domain that contains the repository.

  • domain_owner (Optional[AccountId], default: None ) –

    The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

  • repository (RepositoryName) –

    The name of the repository to which the external connection is added.

  • external_connection (ExternalConnectionName) –

    The name of the external connection to add to the repository. The following values are supported:

    • public:npmjs - for the npm public repository.

    • public:nuget-org - for the NuGet Gallery.

    • public:pypi - for the Python Package Index.

    • public:maven-central - for Maven Central.

    • public:maven-googleandroid - for the Google Android repository.

    • public:maven-gradleplugins - for the Gradle plugins repository.

    • public:maven-commonsware - for the CommonsWare Android repository.

    • public:maven-clojars - for the Clojars repository.

    • public:ruby-gems-org - for RubyGems.org.

    • public:crates-io - for Crates.io.

Raises:

  • AccessDeniedException –

    The operation did not succeed because of an unauthorized access attempt.

  • ConflictException –

    The operation did not succeed because prerequisites are not met.

  • InternalServerException –

    The operation did not succeed because of an error that occurred inside CodeArtifact.

  • ResourceNotFoundException –

    The operation did not succeed because the resource requested is not found in the service.

  • ServiceQuotaExceededException –

    The operation did not succeed because it would have exceeded a service limit for your account.

  • ThrottlingException –

    The operation did not succeed because too many requests are sent to the service.

  • ValidationException –

    The operation did not succeed because a parameter in the request was sent with an invalid value.

  • UnknownServiceError –

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

Source code in docs_src/capo_codeartifact/_services/async_codeartifact.py
async def associate_external_connection(
    self,
    domain: "capo_codeartifact.types.domain_name.DomainName",
    repository: "capo_codeartifact.types.repository_name.RepositoryName",
    external_connection: "capo_codeartifact.types.external_connection_name.ExternalConnectionName",
    *,
    config_overrides: Optional[AsynccodeartifactClientConfig] = None,
    domain_owner: Optional["capo_codeartifact.types.account_id.AccountId"] = None,
) -> "capo_codeartifact.types.associate_external_connection_result.AssociateExternalConnectionResult":
    """<p>Adds an existing external connection to a repository. One external connection is allowed per repository.</p> <note> <p>A repository can have one or more upstream repositories, or an external connection.</p> </note>

    Args:
        domain: <p>The name of the domain that contains the repository.</p>
        domain_owner: <p> The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces. </p>
        repository: <p> The name of the repository to which the external connection is added. </p>
        external_connection: <p> The name of the external connection to add to the repository. The following values are supported: </p> <ul> <li> <p> <code>public:npmjs</code> - for the npm public repository. </p> </li> <li> <p> <code>public:nuget-org</code> - for the NuGet Gallery. </p> </li> <li> <p> <code>public:pypi</code> - for the Python Package Index. </p> </li> <li> <p> <code>public:maven-central</code> - for Maven Central. </p> </li> <li> <p> <code>public:maven-googleandroid</code> - for the Google Android repository. </p> </li> <li> <p> <code>public:maven-gradleplugins</code> - for the Gradle plugins repository. </p> </li> <li> <p> <code>public:maven-commonsware</code> - for the CommonsWare Android repository. </p> </li> <li> <p> <code>public:maven-clojars</code> - for the Clojars repository. </p> </li> <li> <p> <code>public:ruby-gems-org</code> - for RubyGems.org. </p> </li> <li> <p> <code>public:crates-io</code> - for Crates.io. </p> </li> </ul>

    Raises:
        capo_codeartifact.errors.access_denied_exception.AccessDeniedException: <p> The operation did not succeed because of an unauthorized access attempt. </p>
        capo_codeartifact.errors.conflict_exception.ConflictException: <p> The operation did not succeed because prerequisites are not met. </p>
        capo_codeartifact.errors.internal_server_exception.InternalServerException: <p> The operation did not succeed because of an error that occurred inside CodeArtifact. </p>
        capo_codeartifact.errors.resource_not_found_exception.ResourceNotFoundException: <p> The operation did not succeed because the resource requested is not found in the service. </p>
        capo_codeartifact.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> The operation did not succeed because it would have exceeded a service limit for your account. </p>
        capo_codeartifact.errors.throttling_exception.ThrottlingException: <p> The operation did not succeed because too many requests are sent to the service. </p>
        capo_codeartifact.errors.validation_exception.ValidationException: <p> The operation did not succeed because a parameter in the request was sent with an invalid value. </p>
        capo_codeartifact.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codeartifact.types.associate_external_connection_request.AssociateExternalConnectionRequest]",
    ) -> AsyncOperationResponse[
        "capo_codeartifact.types.associate_external_connection_result.AssociateExternalConnectionResult"
    ]:
        import capo_codeartifact._operations.code_artifact_control_plane_service.associate_external_connection

        (
            output,
            http_response,
        ) = await capo_codeartifact._operations.code_artifact_control_plane_service.associate_external_connection.async_associate_external_connection(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateExternalConnection")
    )
    input_: capo_codeartifact.types.associate_external_connection_request.AssociateExternalConnectionRequest = {
        "domain": domain,
        "repository": repository,
        "external_connection": external_connection,
    }
    if domain_owner is not None:
        input_["domain_owner"] = domain_owner

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