1import * as sns from "@distilled.cloud/aws/sns";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Topic } from "./Topic.ts";
5
6export interface GetTopicAttributesRequest extends Omit<
7 sns.GetTopicAttributesInput,
8 "TopicArn"
9> {}
10
11/**
12 * Runtime binding for `sns:GetTopicAttributes`.
13 *
14 * Bind this operation to a {@link Topic} inside a function runtime to read
15 * the topic's raw attribute map (policy, delivery status, KMS key, etc.).
16 * The binding grants the host function `sns:GetTopicAttributes` on the
17 * topic. Provide the `GetTopicAttributesHttp` layer on the Function to
18 * implement the binding.
19 * ### Reading Topic Attributes
20 * **Example:** Read a Topic's Attributes
21 * ```typescript
22 * // init (provide SNS.GetTopicAttributesHttp on the Function)
23 * const getTopicAttributes = yield* SNS.GetTopicAttributes(topic);
24 *
25 * // runtime
26 * const response = yield* getTopicAttributes();
27 * const displayName = response.Attributes?.DisplayName;
28 * ```
29 *
30 * @binding
31 */
32export interface GetTopicAttributes extends Binding.Service<
33 GetTopicAttributes,
34 "AWS.SNS.GetTopicAttributes",
35 (
36 topic: Topic,
37 ) => Effect.Effect<
38 (
39 request?: GetTopicAttributesRequest,
40 ) => Effect.Effect<
41 sns.GetTopicAttributesResponse,
42 sns.GetTopicAttributesError
43 >
44 >
45> {}
46
47export const GetTopicAttributes = Binding.Service<GetTopicAttributes>(
48 "AWS.SNS.GetTopicAttributes",
49);