| 1 | import type * as iam from "@distilled.cloud/aws/iam"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `iam:GetContextKeysForPrincipalPolicy` — list the |
| 7 | * condition context keys referenced by all policies attached to an existing |
| 8 | * IAM user, group, or role, so a principal simulation can be primed with the |
| 9 | * right `ContextEntries`. |
| 10 | * |
| 11 | * The principal (`PolicySourceArn`) is chosen per request, so the binding |
| 12 | * takes no arguments and grants `iam:GetContextKeysForPrincipalPolicy` on |
| 13 | * `*`. Provide the implementation with |
| 14 | * `Effect.provide(AWS.IAM.GetContextKeysForPrincipalPolicyHttp)`. |
| 15 | * |
| 16 | * ### Simulating Policies |
| 17 | * **Example:** Discover a Role's Context Keys |
| 18 | * ```typescript |
| 19 | * // init |
| 20 | * const getContextKeys = yield* IAM.GetContextKeysForPrincipalPolicy(); |
| 21 | * |
| 22 | * // runtime |
| 23 | * const { ContextKeyNames } = yield* getContextKeys({ |
| 24 | * PolicySourceArn: roleArn, |
| 25 | * }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GetContextKeysForPrincipalPolicy extends Binding.Service< |
| 31 | GetContextKeysForPrincipalPolicy, |
| 32 | "AWS.IAM.GetContextKeysForPrincipalPolicy", |
| 33 | () => Effect.Effect< |
| 34 | ( |
| 35 | request: iam.GetContextKeysForPrincipalPolicyRequest, |
| 36 | ) => Effect.Effect< |
| 37 | iam.GetContextKeysForPolicyResponse, |
| 38 | iam.GetContextKeysForPrincipalPolicyError |
| 39 | > |
| 40 | > |
| 41 | > {} |
| 42 | export const GetContextKeysForPrincipalPolicy = |
| 43 | Binding.Service<GetContextKeysForPrincipalPolicy>( |
| 44 | "AWS.IAM.GetContextKeysForPrincipalPolicy", |
| 45 | ); |