Socket
Socket
Sign inDemoInstall

@aws-sdk/client-codecommit

Package Overview
Dependencies
Maintainers
5
Versions
395
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-codecommit

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


Version published
Weekly downloads
217K
increased by0.91%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-codecommit?

@aws-sdk/client-codecommit is a part of the AWS SDK for JavaScript, which allows developers to interact with AWS CodeCommit, a fully managed source control service that makes it easy for teams to host secure and scalable Git repositories. This package provides methods to perform various operations on CodeCommit repositories, such as creating, updating, and deleting repositories, managing branches, and handling commits and pull requests.

What are @aws-sdk/client-codecommit's main functionalities?

Create Repository

This feature allows you to create a new repository in AWS CodeCommit. The code sample demonstrates how to initialize the CodeCommit client, create a command to create a repository, and send the command to AWS.

const { CodeCommitClient, CreateRepositoryCommand } = require('@aws-sdk/client-codecommit');

const client = new CodeCommitClient({ region: 'us-west-2' });
const command = new CreateRepositoryCommand({
  repositoryName: 'MyNewRepo',
  repositoryDescription: 'This is my new repository'
});

client.send(command).then(
  (data) => console.log(data),
  (error) => console.error(error)
);

List Repositories

This feature allows you to list all repositories in your AWS CodeCommit account. The code sample shows how to initialize the client, create a command to list repositories, and send the command to AWS.

const { CodeCommitClient, ListRepositoriesCommand } = require('@aws-sdk/client-codecommit');

const client = new CodeCommitClient({ region: 'us-west-2' });
const command = new ListRepositoriesCommand({});

client.send(command).then(
  (data) => console.log(data.repositories),
  (error) => console.error(error)
);

Get Repository

This feature allows you to retrieve information about a specific repository. The code sample demonstrates how to initialize the client, create a command to get repository details, and send the command to AWS.

const { CodeCommitClient, GetRepositoryCommand } = require('@aws-sdk/client-codecommit');

const client = new CodeCommitClient({ region: 'us-west-2' });
const command = new GetRepositoryCommand({
  repositoryName: 'MyExistingRepo'
});

client.send(command).then(
  (data) => console.log(data.repositoryMetadata),
  (error) => console.error(error)
);

Create Branch

This feature allows you to create a new branch in a repository. The code sample shows how to initialize the client, create a command to create a branch, and send the command to AWS.

const { CodeCommitClient, CreateBranchCommand } = require('@aws-sdk/client-codecommit');

const client = new CodeCommitClient({ region: 'us-west-2' });
const command = new CreateBranchCommand({
  repositoryName: 'MyRepo',
  branchName: 'new-branch',
  commitId: 'commit-id'
});

client.send(command).then(
  (data) => console.log('Branch created successfully'),
  (error) => console.error(error)
);

Create Pull Request

This feature allows you to create a pull request in a repository. The code sample demonstrates how to initialize the client, create a command to create a pull request, and send the command to AWS.

const { CodeCommitClient, CreatePullRequestCommand } = require('@aws-sdk/client-codecommit');

const client = new CodeCommitClient({ region: 'us-west-2' });
const command = new CreatePullRequestCommand({
  title: 'My Pull Request',
  description: 'This is a pull request',
  targets: [
    {
      repositoryName: 'MyRepo',
      sourceReference: 'source-branch',
      destinationReference: 'destination-branch'
    }
  ]
});

client.send(command).then(
  (data) => console.log(data.pullRequest),
  (error) => console.error(error)
);

Other packages similar to @aws-sdk/client-codecommit

FAQs

Package last updated on 22 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc