| 1 | import * as appintegrations from "@distilled.cloud/aws/appintegrations"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import * as Output from "../../Output.ts"; |
| 4 | import { makeAppIntegrationsHttpBinding } from "./BindingHttp.ts"; |
| 5 | import type { DataIntegration } from "./DataIntegration.ts"; |
| 6 | import { ListDataIntegrationAssociations } from "./ListDataIntegrationAssociations.ts"; |
| 7 | |
| 8 | /** |
| 9 | * HTTP implementation of {@link ListDataIntegrationAssociations}. At deploy |
| 10 | * time it grants `app-integrations:ListDataIntegrationAssociations` on the |
| 11 | * data integration (and its `data-integration-association/*` children); at |
| 12 | * runtime it calls the AppIntegrations API with the host Function's |
| 13 | * credentials, injecting the data integration's id. Provide this layer on |
| 14 | * the Function using the binding. |
| 15 | */ |
| 16 | export const ListDataIntegrationAssociationsHttp = Layer.effect( |
| 17 | ListDataIntegrationAssociations, |
| 18 | makeAppIntegrationsHttpBinding({ |
| 19 | name: "ListDataIntegrationAssociations", |
| 20 | operation: appintegrations.listDataIntegrationAssociations, |
| 21 | requestKey: "DataIntegrationIdentifier", |
| 22 | identifier: (integration: DataIntegration) => integration.dataIntegrationId, |
| 23 | iamActions: ["app-integrations:ListDataIntegrationAssociations"], |
| 24 | resources: (integration, { region, accountId }) => [ |
| 25 | Output.interpolate`${integration.dataIntegrationArn}`, |
| 26 | Output.interpolate`arn:aws:app-integrations:${region}:${accountId}:data-integration-association/${integration.dataIntegrationId}/*`, |
| 27 | ], |
| 28 | }), |
| 29 | ); |