AssociateExternalConnectionCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CodeartifactClient, AssociateExternalConnectionCommand } from "@aws-sdk/client-codeartifact"; // ES Modules import
// const { CodeartifactClient, AssociateExternalConnectionCommand } = require("@aws-sdk/client-codeartifact"); // CommonJS import
const client = new CodeartifactClient(config);
const input = { // AssociateExternalConnectionRequest
  domain: "STRING_VALUE", // required
  domainOwner: "STRING_VALUE",
  repository: "STRING_VALUE", // required
  externalConnection: "STRING_VALUE", // required
};
const command = new AssociateExternalConnectionCommand(input);
const response = await client.send(command);
// { // AssociateExternalConnectionResult
//   repository: { // RepositoryDescription
//     name: "STRING_VALUE",
//     administratorAccount: "STRING_VALUE",
//     domainName: "STRING_VALUE",
//     domainOwner: "STRING_VALUE",
//     arn: "STRING_VALUE",
//     description: "STRING_VALUE",
//     upstreams: [ // UpstreamRepositoryInfoList
//       { // UpstreamRepositoryInfo
//         repositoryName: "STRING_VALUE",
//       },
//     ],
//     externalConnections: [ // RepositoryExternalConnectionInfoList
//       { // RepositoryExternalConnectionInfo
//         externalConnectionName: "STRING_VALUE",
//         packageFormat: "npm" || "pypi" || "maven" || "nuget" || "generic" || "ruby" || "swift" || "cargo",
//         status: "Available",
//       },
//     ],
//     createdTime: new Date("TIMESTAMP"),
//   },
// };

AssociateExternalConnectionCommand Input

Parameter
Type
Description
domain
Required
string | undefined

The name of the domain that contains the repository.

externalConnection
Required
string | undefined

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.

repository
Required
string | undefined

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

domainOwner
string | undefined

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

AssociateExternalConnectionCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
repository
RepositoryDescription | undefined

Information about the connected repository after processing the request.

Throws

Name
Fault
Details
AccessDeniedException
client

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

ConflictException
client

The operation did not succeed because prerequisites are not met.

InternalServerException
server

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

ResourceNotFoundException
client

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

ServiceQuotaExceededException
client

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

ThrottlingException
client

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

ValidationException
client

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

CodeartifactServiceException
Base exception class for all service exceptions from Codeartifact service.