Skip to main content

This is an AWS CDK Construct to create a new AWS Codeartifact Domain and one or more Repositories

Project description

cdk-codeartifact

CDK Construct to create an AWS Codeartifact repository. Construct combines creating both Domain and one or more Repositories into one construct and also provides an enumerated type for public external connections.

There are some additional validations built-in to ensure the construct will deploy correctly:

  • Naming convention checks for Codeartifact Domain Name.
  • Naming convention checks for Codeartifact Repository Name.
  • Passing in more than 1 external repository will throw an error - only 1 external repository is supported by Codeartifact.

External Connection Type

When adding an External Connection to your CodeArtifact repository ensure to make use of the ExternalRepository type to define the public external repository comnnection.

export enum ExternalRepository {
  NPM = 'public:npmjs',
  PYPI = 'public:pypi',
  MAVEN_CENTRAL = 'public:msven-central',
  MAVEN_GOOGLE_ANDROID = 'public:maven-googleandroid',
  MAVEN_GRADLE_PLUGINS = 'public:maven-gradleplugins',
  MAVEN_COMMONSWARE = 'public:maven-commonsware',
  NUGET = 'public:nuget-org'
}

Currently this construct has been published as an NPM package.

Installation and Usage

Typescript

Installation

$ npm install --save cdk-codeartifact

Usage for CDK V2

import { App, Stack, StackProps } from 'aws-cdk-lib';
import { CodeArtifact, ExternalRepository } from 'cdk-codeartifact';
import { Construct } from 'constructs';

export class MyStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps = {}) {
    super(scope, id, props);

    new CodeArtifact(this, id, {
      domainName: 'test-domain',
      repositories: [{
        repositoryName: 'test-repo',
        externalConnections: [ExternalRepository.NPM],
      },
      {
        repositoryName: 'test-repo2',
        externalConnections: [ExternalRepository.PYPI],
      }],
    });
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk-codeartifact-0.0.8.tar.gz (36.4 kB view hashes)

Uploaded Source

Built Distribution

cdk_codeartifact-0.0.8-py3-none-any.whl (34.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page