Back to Aws Sdk Js V3

@aws-sdk/client-codeconnections

clients/client-codeconnections/README.md

3.1043.021.4 KB
Original Source
<!-- generated file, do not edit directly -->

@aws-sdk/client-codeconnections

Description

AWS SDK for JavaScript CodeConnections Client for Node.js, Browser and React Native.

<fullname>AWS CodeConnections</fullname>

<p>This Amazon Web Services CodeConnections API Reference provides descriptions and usage examples of the operations and data types for the Amazon Web Services CodeConnections API. You can use the connections API to work with connections and installations.</p> <p> <i>Connections</i> are configurations that you use to connect Amazon Web Services resources to external code repositories. Each connection is a resource that can be given to services such as CodePipeline to connect to a third-party repository such as Bitbucket. For example, you can add the connection in CodePipeline so that it triggers your pipeline when a code change is made to your third-party code repository. Each connection is named and associated with a unique ARN that is used to reference the connection.</p> <p>When you create a connection, the console initiates a third-party connection handshake. <i>Installations</i> are the apps that are used to conduct this handshake. For example, the installation for the Bitbucket provider type is the Bitbucket app. When you create a connection, you can choose an existing installation or create one.</p> <p>When you want to create a connection to an installed provider type such as GitHub Enterprise Server, you create a <i>host</i> for your connections.</p> <p>You can work with connections by calling:</p> <ul> <li> <p> <a>CreateConnection</a>, which creates a uniquely named connection that can be referenced by services such as CodePipeline.</p> </li> <li> <p> <a>DeleteConnection</a>, which deletes the specified connection.</p> </li> <li> <p> <a>GetConnection</a>, which returns information about the connection, including the connection status.</p> </li> <li> <p> <a>ListConnections</a>, which lists the connections associated with your account.</p> </li> </ul> <p>You can work with hosts by calling:</p> <ul> <li> <p> <a>CreateHost</a>, which creates a host that represents the infrastructure where your provider is installed.</p> </li> <li> <p> <a>DeleteHost</a>, which deletes the specified host.</p> </li> <li> <p> <a>GetHost</a>, which returns information about the host, including the setup status.</p> </li> <li> <p> <a>ListHosts</a>, which lists the hosts associated with your account.</p> </li> </ul> <p>You can work with tags in Amazon Web Services CodeConnections by calling the following:</p> <ul> <li> <p> <a>ListTagsForResource</a>, which gets information about Amazon Web Services tags for a specified Amazon Resource Name (ARN) in Amazon Web Services CodeConnections.</p> </li> <li> <p> <a>TagResource</a>, which adds or updates tags for a resource in Amazon Web Services CodeConnections.</p> </li> <li> <p> <a>UntagResource</a>, which removes tags for a resource in Amazon Web Services CodeConnections.</p> </li> </ul> <p>For information about how to use Amazon Web Services CodeConnections, see the <a href="https://docs.aws.amazon.com/dtconsole/latest/userguide/welcome-connections.html">Developer Tools User Guide</a>.</p>

Installing

To install this package, use the CLI of your favorite package manager:

  • npm install @aws-sdk/client-codeconnections
  • yarn add @aws-sdk/client-codeconnections
  • pnpm add @aws-sdk/client-codeconnections

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the CodeConnectionsClient and the commands you need, for example ListHostsCommand:

js
// ES5 example
const { CodeConnectionsClient, ListHostsCommand } = require("@aws-sdk/client-codeconnections");
ts
// ES6+ example
import { CodeConnectionsClient, ListHostsCommand } from "@aws-sdk/client-codeconnections";

Usage

To send a request:

  • Instantiate a client with configuration (e.g. credentials, region).
  • Instantiate a command with input parameters.
  • Call the send operation on the client, providing the command object as input.
js
const client = new CodeConnectionsClient({ region: "REGION" });

const params = { /** input parameters */ };
const command = new ListHostsCommand(params);

Async/await

We recommend using the await operator to wait for the promise returned by send operation as follows:

js
// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Promises

You can also use Promise chaining.

js
client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });

Aggregated client

The aggregated client class is exported from the same package, but without the "Client" suffix.

CodeConnections extends CodeConnectionsClient and additionally supports all operations, waiters, and paginators as methods. This style may be familiar to you from the AWS SDK for JavaScript v2.

If you are bundling the AWS SDK, we recommend using only the bare-bones client (CodeConnectionsClient). More details are in the blog post on modular packages in AWS SDK for JavaScript.

ts
import { CodeConnections } from "@aws-sdk/client-codeconnections";

const client = new CodeConnections({ region: "REGION" });

// async/await.
try {
  const data = await client.listHosts(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listHosts(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks (not recommended).
client.listHosts(params, (err, data) => {
  // process err and data.
});

Troubleshooting

When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).

js
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

See also docs/ERROR_HANDLING.

Getting Help

Please use these community resources for getting help. We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-codeconnections package is updated. To contribute to client you can check our generate clients scripts.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

<details> <summary> CreateConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateHost </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateRepositoryLink </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateSyncConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteHost </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteRepositoryLink </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteSyncConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetConnection </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetHost </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetRepositoryLink </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetRepositorySyncStatus </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetResourceSyncStatus </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetSyncBlockerSummary </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetSyncConfiguration </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListConnections </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListHosts </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListRepositoryLinks </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListRepositorySyncDefinitions </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListSyncConfigurations </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListTagsForResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> TagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UntagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateHost </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateRepositoryLink </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateSyncBlocker </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateSyncConfiguration </summary>

Command API Reference / Input / Output

</details>