Skip to content

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

// init — bind the operation to the connection
const getConnection = yield* AWS.CodeConnections.GetConnection(connection);
// runtime
const { Connection: live } = yield* getConnection();
if (live?.ConnectionStatus !== "AVAILABLE") {
return yield* HttpServerResponse.text("handshake pending", { status: 409 });
}