| 1 | import type * as ecrpublic from "@distilled.cloud/aws/ecr-public"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `ecr-public:GetAuthorizationToken` (plus the |
| 7 | * `sts:GetServiceBearerToken` permission the API requires). |
| 8 | * |
| 9 | * Retrieves a registry authorization token (valid for 12 hours) used to |
| 10 | * authenticate `docker push` against `public.ecr.aws`. The token in the |
| 11 | * response is `Redacted` — unwrap it with `Redacted.value` at the point of |
| 12 | * use. Provide the implementation with |
| 13 | * `Effect.provide(AWS.ECRPublic.GetAuthorizationTokenHttp)`. |
| 14 | * |
| 15 | * ### Registry Access |
| 16 | * **Example:** Mint A Registry Auth Token |
| 17 | * ```typescript |
| 18 | * // init — registry-level binding takes no resource |
| 19 | * const getAuthorizationToken = yield* AWS.ECRPublic.GetAuthorizationToken(); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const result = yield* getAuthorizationToken(); |
| 23 | * const token = result.authorizationData?.authorizationToken; // Redacted<string> |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface GetAuthorizationToken extends Binding.Service< |
| 29 | GetAuthorizationToken, |
| 30 | "AWS.ECRPublic.GetAuthorizationToken", |
| 31 | () => Effect.Effect< |
| 32 | () => Effect.Effect< |
| 33 | ecrpublic.GetAuthorizationTokenResponse, |
| 34 | ecrpublic.GetAuthorizationTokenError |
| 35 | > |
| 36 | > |
| 37 | > {} |
| 38 | |
| 39 | export const GetAuthorizationToken = Binding.Service<GetAuthorizationToken>( |
| 40 | "AWS.ECRPublic.GetAuthorizationToken", |
| 41 | ); |