AWS.CodeConnections reference
Connection
Section titled “Connection”Source:
src/AWS/CodeConnections/Connection.ts
An AWS CodeConnections connection to a source-code provider (GitHub, GitLab, Bitbucket).
A connection is created in the PENDING state. Completing it requires a
one-time OAuth handshake performed manually in the AWS console (the
“Update pending connection” flow) — there is no API to finish the
handshake. Once completed the connection becomes AVAILABLE and can be
referenced by a CodePipeline CodeStarSourceConnection action.
Connection: Creating a Connection
Section titled “Connection: Creating a Connection”const connection = yield* CodeConnections.Connection("GitHub", { providerType: "GitHub",});// connection.connectionStatus === "PENDING"// Complete the handshake in the console before using it in a pipeline.GetConnection
Section titled “GetConnection”Source:
src/AWS/CodeConnections/GetConnection.ts
Runtime binding for codeconnections:GetConnection.
Bind this operation to a Connection to read the connection’s live
state — status (PENDING/AVAILABLE/ERROR), provider type, and owner —
from inside a function runtime. Useful for workloads that gate work on the
connection’s OAuth handshake having been completed. Provide the
implementation with Effect.provide(AWS.CodeConnections.GetConnectionHttp).
GetConnection: Inspecting a Connection
Section titled “GetConnection: Inspecting a Connection”// init — bind the operation to the connectionconst getConnection = yield* AWS.CodeConnections.GetConnection(connection);
// runtimeconst { Connection: live } = yield* getConnection();if (live?.ConnectionStatus !== "AVAILABLE") { return yield* HttpServerResponse.text("handshake pending", { status: 409 });}GetRepositorySyncStatus
Section titled “GetRepositorySyncStatus”Source:
src/AWS/CodeConnections/GetRepositorySyncStatus.ts
Runtime binding for codeconnections:GetRepositorySyncStatus.
Bind this operation to a RepositoryLink to read the latest Git
sync attempt for a branch — its status and the sync events that led to
it — from inside a function runtime. Useful for dashboards that surface
whether a stack is in sync with its repository. Provide the
implementation with
Effect.provide(AWS.CodeConnections.GetRepositorySyncStatusHttp).
GetRepositorySyncStatus: Monitoring Git Sync
Section titled “GetRepositorySyncStatus: Monitoring Git Sync”// init — bind the operation to the repository linkconst getRepositorySyncStatus = yield* AWS.CodeConnections.GetRepositorySyncStatus(link);
// runtimeconst { LatestSync } = yield* getRepositorySyncStatus({ Branch: "main", SyncType: "CFN_STACK_SYNC",});GetResourceSyncStatus
Section titled “GetResourceSyncStatus”Source:
src/AWS/CodeConnections/GetResourceSyncStatus.ts
Runtime binding for codeconnections:GetResourceSyncStatus.
Bind this operation to a SyncConfiguration to read the sync
status of its Amazon Web Services resource — the desired state revision
and the latest successful/attempted syncs — from inside a function
runtime. Provide the implementation with
Effect.provide(AWS.CodeConnections.GetResourceSyncStatusHttp).
GetResourceSyncStatus: Monitoring Git Sync
Section titled “GetResourceSyncStatus: Monitoring Git Sync”// init — bind the operation to the sync configurationconst getResourceSyncStatus = yield* AWS.CodeConnections.GetResourceSyncStatus(sync);
// runtimeconst { LatestSync } = yield* getResourceSyncStatus();GetSyncBlockerSummary
Section titled “GetSyncBlockerSummary”Source:
src/AWS/CodeConnections/GetSyncBlockerSummary.ts
Runtime binding for codeconnections:GetSyncBlockerSummary.
Bind this operation to a SyncConfiguration to read the latest
sync blockers — errors that stop Git sync from converging the resource —
from inside a function runtime. Pair with UpdateSyncBlocker to
resolve them. Provide the implementation with
Effect.provide(AWS.CodeConnections.GetSyncBlockerSummaryHttp).
GetSyncBlockerSummary: Monitoring Git Sync
Section titled “GetSyncBlockerSummary: Monitoring Git Sync”// init — bind the operation to the sync configurationconst getSyncBlockerSummary = yield* AWS.CodeConnections.GetSyncBlockerSummary(sync);
// runtimeconst { SyncBlockerSummary } = yield* getSyncBlockerSummary();const blockers = SyncBlockerSummary.LatestBlockers ?? [];Source:
src/AWS/CodeConnections/Host.ts
An AWS CodeConnections host — the infrastructure representation of a self-managed source provider (GitHub Enterprise Server or GitLab self-managed). One host serves all connections to that provider.
A host is created in the PENDING state. Completing it requires a
one-time setup performed manually in the AWS console — there is no
API to finish the setup. Once completed the host becomes AVAILABLE and
Connections can reference it via hostArn.
Host: Creating a Host
Section titled “Host: Creating a Host”GitHub Enterprise Server Host (created PENDING)
const host = yield* CodeConnections.Host("GHE", { providerType: "GitHubEnterpriseServer", providerEndpoint: "https://ghe.example.com",});// host.hostStatus === "PENDING"// Complete the setup in the console before creating connections on it.Connection on a Host
const connection = yield* CodeConnections.Connection("GHEConn", { providerType: "GitHubEnterpriseServer", hostArn: host.hostArn,});Host: Reaching a Private Endpoint
Section titled “Host: Reaching a Private Endpoint”const host = yield* CodeConnections.Host("PrivateGHE", { providerType: "GitHubEnterpriseServer", providerEndpoint: "https://ghe.internal.example.com", vpcConfiguration: { vpcId: vpc.vpcId, subnetIds: [subnetA.subnetId, subnetB.subnetId], securityGroupIds: [securityGroup.securityGroupId], },});ListConnections
Section titled “ListConnections”Source:
src/AWS/CodeConnections/ListConnections.ts
Runtime binding for codeconnections:ListConnections.
An account-level operation (no connection argument) that enumerates the
account’s connections, optionally filtered by provider type or host.
Useful for governance sweeps that audit which source providers are wired
up. Provide the implementation with
Effect.provide(AWS.CodeConnections.ListConnectionsHttp).
ListConnections: Inspecting a Connection
Section titled “ListConnections: Inspecting a Connection”// init — account-level binding takes no resourceconst listConnections = yield* AWS.CodeConnections.ListConnections();
// runtimeconst result = yield* listConnections({ ProviderTypeFilter: "GitHub" });const names = (result.Connections ?? []).map((c) => c.ConnectionName);ListHosts
Section titled “ListHosts”Source:
src/AWS/CodeConnections/ListHosts.ts
Runtime binding for codeconnections:ListHosts.
An account-level operation (no host argument) that enumerates the
account’s hosts — the self-managed provider endpoints (GitHub Enterprise
Server, GitLab self-managed) that connections attach to. Useful for
governance sweeps that audit which provider endpoints are registered.
Provide the implementation with
Effect.provide(AWS.CodeConnections.ListHostsHttp).
ListHosts: Inspecting a Host
Section titled “ListHosts: Inspecting a Host”// init — account-level binding takes no resourceconst listHosts = yield* AWS.CodeConnections.ListHosts();
// runtimeconst result = yield* listHosts();const urls = (result.Hosts ?? []).map((h) => h.ProviderEndpoint);ListRepositoryLinks
Section titled “ListRepositoryLinks”Source:
src/AWS/CodeConnections/ListRepositoryLinks.ts
Runtime binding for codeconnections:ListRepositoryLinks.
An account-level operation (no repository-link argument) that enumerates
the account’s repository links — the Git-sync attachments between a
connection and a specific provider repository. Useful for sync dashboards
that discover which repositories are wired up before drilling into their
sync status. Provide the implementation with
Effect.provide(AWS.CodeConnections.ListRepositoryLinksHttp).
ListRepositoryLinks: Monitoring Git Sync
Section titled “ListRepositoryLinks: Monitoring Git Sync”// init — account-level binding takes no resourceconst listRepositoryLinks = yield* AWS.CodeConnections.ListRepositoryLinks();
// runtimeconst result = yield* listRepositoryLinks();const repos = (result.RepositoryLinks ?? []).map((l) => l.RepositoryName);ListRepositorySyncDefinitions
Section titled “ListRepositorySyncDefinitions”Source:
src/AWS/CodeConnections/ListRepositorySyncDefinitions.ts
Runtime binding for codeconnections:ListRepositorySyncDefinitions.
Bind this operation to a RepositoryLink to enumerate the sync
definitions Git sync tracks for the link — branch, directory, and target
per definition. Provide the implementation with
Effect.provide(AWS.CodeConnections.ListRepositorySyncDefinitionsHttp).
ListRepositorySyncDefinitions: Monitoring Git Sync
Section titled “ListRepositorySyncDefinitions: Monitoring Git Sync”// init — bind the operation to the repository linkconst listRepositorySyncDefinitions = yield* AWS.CodeConnections.ListRepositorySyncDefinitions(link);
// runtimeconst { RepositorySyncDefinitions } = yield* listRepositorySyncDefinitions({ SyncType: "CFN_STACK_SYNC" });ListSyncConfigurations
Section titled “ListSyncConfigurations”Source:
src/AWS/CodeConnections/ListSyncConfigurations.ts
Runtime binding for codeconnections:ListSyncConfigurations.
Bind this operation to a RepositoryLink to enumerate the sync
configurations attached to the link — which AWS resources Git sync keeps
converged from the linked repository. Provide the implementation with
Effect.provide(AWS.CodeConnections.ListSyncConfigurationsHttp).
ListSyncConfigurations: Monitoring Git Sync
Section titled “ListSyncConfigurations: Monitoring Git Sync”// init — bind the operation to the repository linkconst listSyncConfigurations = yield* AWS.CodeConnections.ListSyncConfigurations(link);
// runtimeconst { SyncConfigurations } = yield* listSyncConfigurations({ SyncType: "CFN_STACK_SYNC" });RepositoryLink
Section titled “RepositoryLink”Source:
src/AWS/CodeConnections/RepositoryLink.ts
An AWS CodeConnections repository link — associates a connection with a specific external Git repository so Git sync can monitor and sync changes (e.g. CloudFormation git sync).
Requires a connection in the AVAILABLE state; the connection’s OAuth
handshake is a one-time manual console step.
RepositoryLink: Linking a Repository
Section titled “RepositoryLink: Linking a Repository”Link a GitHub Repository
const link = yield* CodeConnections.RepositoryLink("Repo", { connectionArn: connection.connectionArn, ownerId: "my-github-org", repositoryName: "my-repo",});Encrypted Repository Link
const link = yield* CodeConnections.RepositoryLink("Repo", { connectionArn: connection.connectionArn, ownerId: "my-github-org", repositoryName: "my-repo", encryptionKeyArn: key.keyArn,});SyncConfiguration
Section titled “SyncConfiguration”Source:
src/AWS/CodeConnections/SyncConfiguration.ts
An AWS CodeConnections sync configuration — connects a repository link’s branch + deployment file to an Amazon Web Services resource so Git sync keeps the resource updated from the repository (CloudFormation stack sync).
SyncConfiguration: Syncing a CloudFormation Stack
Section titled “SyncConfiguration: Syncing a CloudFormation Stack”Stack Sync from a Repository Link
const sync = yield* CodeConnections.SyncConfiguration("StackSync", { branch: "main", configFile: "deployments/stack-deployment.yaml", repositoryLinkId: link.repositoryLinkId, resourceName: "my-stack", roleArn: gitSyncRole.roleArn,});Sync Only on Deployment-File Changes
const sync = yield* CodeConnections.SyncConfiguration("StackSync", { branch: "main", configFile: "deployments/stack-deployment.yaml", repositoryLinkId: link.repositoryLinkId, resourceName: "my-stack", roleArn: gitSyncRole.roleArn, triggerResourceUpdateOn: "FILE_CHANGE", pullRequestComment: "DISABLED",});UpdateSyncBlocker
Section titled “UpdateSyncBlocker”Source:
src/AWS/CodeConnections/UpdateSyncBlocker.ts
Runtime binding for codeconnections:UpdateSyncBlocker.
Bind this operation to a SyncConfiguration to resolve a sync
blocker (discovered via GetSyncBlockerSummary) so Git sync can
resume converging the resource. Provide the implementation with
Effect.provide(AWS.CodeConnections.UpdateSyncBlockerHttp).
UpdateSyncBlocker: Monitoring Git Sync
Section titled “UpdateSyncBlocker: Monitoring Git Sync”// init — bind the operation to the sync configurationconst updateSyncBlocker = yield* AWS.CodeConnections.UpdateSyncBlocker(sync);
// runtimeyield* updateSyncBlocker({ Id: blocker.Id, ResolvedReason: "stack drift corrected manually",});