| 1 | import type * as quicksight from "@distilled.cloud/aws/quicksight"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Dashboard } from "./Dashboard.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link GenerateEmbedUrlForAnonymousUser}. `AwsAccountId` is |
| 8 | * injected from the bound dashboard's ARN; `Namespace`, |
| 9 | * `AuthorizedResourceArns`, and `ExperienceConfiguration` default to the |
| 10 | * `default` namespace and the bound dashboard when omitted. |
| 11 | */ |
| 12 | export interface GenerateEmbedUrlForAnonymousUserRequest extends Omit< |
| 13 | quicksight.GenerateEmbedUrlForAnonymousUserRequest, |
| 14 | | "AwsAccountId" |
| 15 | | "Namespace" |
| 16 | | "AuthorizedResourceArns" |
| 17 | | "ExperienceConfiguration" |
| 18 | > { |
| 19 | /** |
| 20 | * The QuickSight namespace the anonymous session belongs to. |
| 21 | * @default "default" |
| 22 | */ |
| 23 | Namespace?: string; |
| 24 | |
| 25 | /** |
| 26 | * The ARNs the anonymous session is authorized to access. |
| 27 | * @default the bound dashboard's ARN |
| 28 | */ |
| 29 | AuthorizedResourceArns?: string[]; |
| 30 | |
| 31 | /** |
| 32 | * The Quick Sight experience to embed. |
| 33 | * @default the bound dashboard |
| 34 | */ |
| 35 | ExperienceConfiguration?: quicksight.AnonymousUserEmbeddingExperienceConfiguration; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Runtime binding for `quicksight:GenerateEmbedUrlForAnonymousUser`. |
| 40 | * |
| 41 | * Generates a single-use embed URL for an anonymous (unregistered) visitor, |
| 42 | * defaulting the authorized resources and embedded experience to the bound |
| 43 | * {@link Dashboard}. Requires a QuickSight account with session-capacity |
| 44 | * pricing. Provide the implementation with |
| 45 | * `Effect.provide(AWS.QuickSight.GenerateEmbedUrlForAnonymousUserHttp)`. |
| 46 | * ### Embedding Dashboards |
| 47 | * **Example:** Embed The Bound Dashboard Anonymously |
| 48 | * ```typescript |
| 49 | * // init — bind the operation to the dashboard |
| 50 | * const generateEmbedUrl = |
| 51 | * yield* AWS.QuickSight.GenerateEmbedUrlForAnonymousUser(dashboard); |
| 52 | * |
| 53 | * // runtime — namespace, authorized ARNs, and experience default to the dashboard |
| 54 | * const { EmbedUrl } = yield* generateEmbedUrl({ |
| 55 | * SessionLifetimeInMinutes: 60, |
| 56 | * }); |
| 57 | * ``` |
| 58 | * |
| 59 | * @binding |
| 60 | */ |
| 61 | export interface GenerateEmbedUrlForAnonymousUser extends Binding.Service< |
| 62 | GenerateEmbedUrlForAnonymousUser, |
| 63 | "AWS.QuickSight.GenerateEmbedUrlForAnonymousUser", |
| 64 | ( |
| 65 | dashboard: Dashboard, |
| 66 | ) => Effect.Effect< |
| 67 | ( |
| 68 | request?: GenerateEmbedUrlForAnonymousUserRequest, |
| 69 | ) => Effect.Effect< |
| 70 | quicksight.GenerateEmbedUrlForAnonymousUserResponse, |
| 71 | quicksight.GenerateEmbedUrlForAnonymousUserError |
| 72 | > |
| 73 | > |
| 74 | > {} |
| 75 | export const GenerateEmbedUrlForAnonymousUser = |
| 76 | Binding.Service<GenerateEmbedUrlForAnonymousUser>( |
| 77 | "AWS.QuickSight.GenerateEmbedUrlForAnonymousUser", |
| 78 | ); |