| 1 | import type * as resourcegroups from "@distilled.cloud/aws/resource-groups"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Group } from "./Group.ts"; |
| 5 | |
| 6 | /** Request for {@link GroupResources} — the group is injected from the binding. */ |
| 7 | export type GroupResourcesRequest = Omit< |
| 8 | resourcegroups.GroupResourcesInput, |
| 9 | "Group" |
| 10 | >; |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `resource-groups:GroupResources`. |
| 14 | * |
| 15 | * Adds the specified resources to the bound {@link Group}. Supported only |
| 16 | * for groups configured with `AWS::ResourceGroups::ApplicationGroup`, |
| 17 | * `AWS::EC2::HostManagement`, or `AWS::EC2::CapacityReservationPool` — |
| 18 | * query-based groups derive membership from their query instead. Grouping |
| 19 | * is asynchronous (application-group members are tagged with |
| 20 | * `awsApplication`): the response reports `Pending` ARNs which |
| 21 | * {@link ListGroupingStatuses} tracks to `SUCCESS`/`FAILED`. The group name |
| 22 | * is injected from the binding; the grant includes the Tagging API |
| 23 | * permissions the membership tagging fans out to (member services may |
| 24 | * additionally require their own `TagResource` permission on the caller). |
| 25 | * Provide the implementation with |
| 26 | * `Effect.provide(AWS.ResourceGroups.GroupResourcesHttp)`. |
| 27 | * ### Managing Group Membership |
| 28 | * **Example:** Add A Resource To An Application Group |
| 29 | * ```typescript |
| 30 | * // init — bind the operation to the group |
| 31 | * const groupResources = yield* AWS.ResourceGroups.GroupResources(group); |
| 32 | * |
| 33 | * // runtime |
| 34 | * const { Succeeded, Pending, Failed } = yield* groupResources({ |
| 35 | * ResourceArns: [resourceArn], |
| 36 | * }); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface GroupResources extends Binding.Service< |
| 42 | GroupResources, |
| 43 | "AWS.ResourceGroups.GroupResources", |
| 44 | ( |
| 45 | group: Group, |
| 46 | ) => Effect.Effect< |
| 47 | ( |
| 48 | request: GroupResourcesRequest, |
| 49 | ) => Effect.Effect< |
| 50 | resourcegroups.GroupResourcesOutput, |
| 51 | resourcegroups.GroupResourcesError |
| 52 | > |
| 53 | > |
| 54 | > {} |
| 55 | export const GroupResources = Binding.Service<GroupResources>( |
| 56 | "AWS.ResourceGroups.GroupResources", |
| 57 | ); |