JSPM

@aws-sdk/client-codestar-connections

3.888.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2787
  • Score
    100M100P100Q129867F
  • License Apache-2.0

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

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aws-sdk/client-codestar-connections) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @aws-sdk/client-codestar-connections

    Description

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

    AWS CodeStar Connections

    This Amazon Web Services CodeStar Connections API Reference provides descriptions and usage examples of the operations and data types for the Amazon Web Services CodeStar Connections API. You can use the connections API to work with connections and installations.

    Connections 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.

    When you create a connection, the console initiates a third-party connection handshake. Installations 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.

    When you want to create a connection to an installed provider type such as GitHub Enterprise Server, you create a host for your connections.

    You can work with connections by calling:

    • CreateConnection, which creates a uniquely named connection that can be referenced by services such as CodePipeline.

    • DeleteConnection, which deletes the specified connection.

    • GetConnection, which returns information about the connection, including the connection status.

    • ListConnections, which lists the connections associated with your account.

    You can work with hosts by calling:

    • CreateHost, which creates a host that represents the infrastructure where your provider is installed.

    • DeleteHost, which deletes the specified host.

    • GetHost, which returns information about the host, including the setup status.

    • ListHosts, which lists the hosts associated with your account.

    You can work with tags in Amazon Web Services CodeStar Connections by calling the following:

    • ListTagsForResource, which gets information about Amazon Web Services tags for a specified Amazon Resource Name (ARN) in Amazon Web Services CodeStar Connections.

    • TagResource, which adds or updates tags for a resource in Amazon Web Services CodeStar Connections.

    • UntagResource, which removes tags for a resource in Amazon Web Services CodeStar Connections.

    For information about how to use Amazon Web Services CodeStar Connections, see the Developer Tools User Guide.

    Installing

    To install this package, simply type add or install @aws-sdk/client-codestar-connections using your favorite package manager:

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

    Getting Started

    Import

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

    // ES5 example
    const { CodeStarConnectionsClient, ListHostsCommand } = require("@aws-sdk/client-codestar-connections");
    // ES6+ example
    import { CodeStarConnectionsClient, ListHostsCommand } from "@aws-sdk/client-codestar-connections";

    Usage

    To send a request, you:

    • Initiate client with configuration (e.g. credentials, region).
    • Initiate command with input parameters.
    • Call send operation on client with command object as input.
    • If you are using a custom http handler, you may call destroy() to close open connections.
    // a client can be shared by different commands.
    const client = new CodeStarConnectionsClient({ region: "REGION" });
    
    const params = {
      /** input parameters */
    };
    const command = new ListHostsCommand(params);

    Async/await

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

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

    Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.

    Promises

    You can also use Promise chaining to execute send operation.

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

    Promises can also be called using .catch() and .finally() as follows:

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

    Callbacks

    We do not recommend using callbacks because of callback hell, but they are supported by the send operation.

    // callbacks.
    client.send(command, (err, data) => {
      // process err and data.
    });

    v2 compatible style

    The client can also send requests using v2 compatible style. However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post on modular packages in AWS SDK for JavaScript

    import * as AWS from "@aws-sdk/client-codestar-connections";
    const client = new AWS.CodeStarConnections({ 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.
    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).

    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;
       * }
       */
    }

    Getting Help

    Please use these community resources for getting help. We use the 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-codestar-connections 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)

    CreateConnection

    Command API Reference / Input / Output

    CreateHost

    Command API Reference / Input / Output

    CreateRepositoryLink

    Command API Reference / Input / Output

    CreateSyncConfiguration

    Command API Reference / Input / Output

    DeleteConnection

    Command API Reference / Input / Output

    DeleteHost

    Command API Reference / Input / Output

    DeleteRepositoryLink

    Command API Reference / Input / Output

    DeleteSyncConfiguration

    Command API Reference / Input / Output

    GetConnection

    Command API Reference / Input / Output

    GetHost

    Command API Reference / Input / Output

    GetRepositoryLink

    Command API Reference / Input / Output

    GetRepositorySyncStatus

    Command API Reference / Input / Output

    GetResourceSyncStatus

    Command API Reference / Input / Output

    GetSyncBlockerSummary

    Command API Reference / Input / Output

    GetSyncConfiguration

    Command API Reference / Input / Output

    ListConnections

    Command API Reference / Input / Output

    ListHosts

    Command API Reference / Input / Output

    ListRepositoryLinks

    Command API Reference / Input / Output

    ListRepositorySyncDefinitions

    Command API Reference / Input / Output

    ListSyncConfigurations

    Command API Reference / Input / Output

    ListTagsForResource

    Command API Reference / Input / Output

    TagResource

    Command API Reference / Input / Output

    UntagResource

    Command API Reference / Input / Output

    UpdateHost

    Command API Reference / Input / Output

    UpdateRepositoryLink

    Command API Reference / Input / Output

    UpdateSyncBlocker

    Command API Reference / Input / Output

    UpdateSyncConfiguration

    Command API Reference / Input / Output