| 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:GetContextKeysForCustomPolicy` — list the condition |
| 7 | * context keys (`aws:username`, `aws:SourceIp`, …) referenced by a set of |
| 8 | * candidate policy documents, so a simulation can be primed with the right |
| 9 | * `ContextEntries`. |
| 10 | * |
| 11 | * The policies are supplied as strings per request, so the binding takes no |
| 12 | * arguments and grants `iam:GetContextKeysForCustomPolicy` on `*`. Provide the |
| 13 | * implementation with `Effect.provide(AWS.IAM.GetContextKeysForCustomPolicyHttp)`. |
| 14 | * |
| 15 | * ### Simulating Policies |
| 16 | * **Example:** Discover a Policy's Context Keys |
| 17 | * ```typescript |
| 18 | * // init |
| 19 | * const getContextKeys = yield* IAM.GetContextKeysForCustomPolicy(); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { ContextKeyNames } = yield* getContextKeys({ |
| 23 | * PolicyInputList: [policyJson], |
| 24 | * }); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface GetContextKeysForCustomPolicy extends Binding.Service< |
| 30 | GetContextKeysForCustomPolicy, |
| 31 | "AWS.IAM.GetContextKeysForCustomPolicy", |
| 32 | () => Effect.Effect< |
| 33 | ( |
| 34 | request: iam.GetContextKeysForCustomPolicyRequest, |
| 35 | ) => Effect.Effect< |
| 36 | iam.GetContextKeysForPolicyResponse, |
| 37 | iam.GetContextKeysForCustomPolicyError |
| 38 | > |
| 39 | > |
| 40 | > {} |
| 41 | export const GetContextKeysForCustomPolicy = |
| 42 | Binding.Service<GetContextKeysForCustomPolicy>( |
| 43 | "AWS.IAM.GetContextKeysForCustomPolicy", |
| 44 | ); |