sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ SNS/ SetTopicAttributes.ts

import * as sns from "@distilled.cloud/aws/sns";
import * as Binding from "alchemy/Binding";
import * as Effect from "effect/Effect";
import type { Topic } from "./Topic.ts";

export interface SetTopicAttributesRequest extends Omit<sns.SetTopicAttributesInput, "TopicArn"> {}

/**
 * Runtime binding for `sns:SetTopicAttributes`.
 *
 * Bind this operation to a {@link Topic} inside a function runtime to set a
 * single topic attribute by name. The binding grants the host function
 * `sns:SetTopicAttributes` on the topic. Provide the
 * `SetTopicAttributesHttp` layer on the Function to implement the binding.
 * ### Updating Topic Attributes
 * **Example:** Set a Topic's Display Name
 * ```typescript
 * // init (provide SNS.SetTopicAttributesHttp on the Function)
 * const setTopicAttributes = yield* SNS.SetTopicAttributes(topic);
 *
 * // runtime
 * yield* setTopicAttributes({
 *   AttributeName: "DisplayName",
 *   AttributeValue: "order-events",
 * });
 * ```
 *
 * @binding
 */
export interface SetTopicAttributes extends Binding.Service<
  SetTopicAttributes,
  "AWS.SNS.SetTopicAttributes",
  (
    topic: Topic,
  ) => Effect.Effect<
    (
      request: SetTopicAttributesRequest,
    ) => Effect.Effect<sns.SetTopicAttributesResponse, sns.SetTopicAttributesError>
  >
> {}

export const SetTopicAttributes = Binding.Service<SetTopicAttributes>("AWS.SNS.SetTopicAttributes");