PutRepositoryTriggersCommand

Replaces all triggers for a repository. Used to create or delete triggers.

Example Syntax

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

import { CodeCommitClient, PutRepositoryTriggersCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, PutRepositoryTriggersCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // PutRepositoryTriggersInput
  repositoryName: "STRING_VALUE", // required
  triggers: [ // RepositoryTriggersList // required
    { // RepositoryTrigger
      name: "STRING_VALUE", // required
      destinationArn: "STRING_VALUE", // required
      customData: "STRING_VALUE",
      branches: [ // BranchNameList
        "STRING_VALUE",
      ],
      events: [ // RepositoryTriggerEventList // required
        "all" || "updateReference" || "createReference" || "deleteReference",
      ],
    },
  ],
};
const command = new PutRepositoryTriggersCommand(input);
const response = await client.send(command);
// { // PutRepositoryTriggersOutput
//   configurationId: "STRING_VALUE",
// };

PutRepositoryTriggersCommand Input

Parameter
Type
Description
repositoryName
Required
string | undefined

The name of the repository where you want to create or update the trigger.

triggers
Required
RepositoryTrigger[] | undefined

The JSON block of configuration information for each trigger.

PutRepositoryTriggersCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
configurationId
string | undefined

The system-generated unique ID for the create or update operation.

Throws

Name
Fault
Details
EncryptionIntegrityChecksFailedException
server

An encryption integrity check failed.

EncryptionKeyAccessDeniedException
client

An encryption key could not be accessed.

EncryptionKeyDisabledException
client

The encryption key is disabled.

EncryptionKeyNotFoundException
client

No encryption key was found.

EncryptionKeyUnavailableException
client

The encryption key is not available.

InvalidRepositoryNameException
client

A specified repository name is not valid.

This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.

InvalidRepositoryTriggerBranchNameException
client

One or more branch names specified for the trigger is not valid.

InvalidRepositoryTriggerCustomDataException
client

The custom data provided for the trigger is not valid.

InvalidRepositoryTriggerDestinationArnException
client

The Amazon Resource Name (ARN) for the trigger is not valid for the specified destination. The most common reason for this error is that the ARN does not meet the requirements for the service type.

InvalidRepositoryTriggerEventsException
client

One or more events specified for the trigger is not valid. Check to make sure that all events specified match the requirements for allowed events.

InvalidRepositoryTriggerNameException
client

The name of the trigger is not valid.

InvalidRepositoryTriggerRegionException
client

The Amazon Web Services Region for the trigger target does not match the Amazon Web Services Region for the repository. Triggers must be created in the same Amazon Web Services Region as the target for the trigger.

MaximumBranchesExceededException
client

The number of branches for the trigger was exceeded.

MaximumRepositoryTriggersExceededException
client

The number of triggers allowed for the repository was exceeded.

RepositoryDoesNotExistException
client

The specified repository does not exist.

RepositoryNameRequiredException
client

A repository name is required, but was not specified.

RepositoryTriggerBranchNameListRequiredException
client

At least one branch name is required, but was not specified in the trigger configuration.

RepositoryTriggerDestinationArnRequiredException
client

A destination ARN for the target service for the trigger is required, but was not specified.

RepositoryTriggerEventsListRequiredException
client

At least one event for the trigger is required, but was not specified.

RepositoryTriggerNameRequiredException
client

A name for the trigger is required, but was not specified.

RepositoryTriggersListRequiredException
client

The list of triggers for the repository is required, but was not specified.

CodeCommitServiceException
Base exception class for all service exceptions from CodeCommit service.