# IamResource

A class used to generate resource arns for AppSync.

- Source: [`aws-appsync/lib/graphqlapi-base.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi-base.ts#L70)
- Type last changed: v2.131.0 · 1 Mar 2024

## Example

```ts
const role = new iam.Role(this, 'Role', {
  assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
});
declare const api: appsync.IGraphqlApi;

api.grant(role, appsync.IamResource.custom('types/Mutation/fields/updateExample'), 'appsync:GraphQL');
```

## Methods

- `all(): IamResource // chainable` (static) — Generate the resource names that accepts all types: `*`.

- `custom(...arns: string[]): IamResource // chainable` (static) — Generate the resource names given custom arns.

  **Parameters**

  - `arns` — The custom arns that need to be permissioned.

- `ofType(type: string, ...fields: string[]): IamResource // chainable` (static) — Generate the resource names given a type and fields.

  **Parameters**

  - `type` — The type that needs to be allowed.
  - `fields` — The fields that need to be allowed, if empty grant permissions to ALL fields.

- `resourceArns(api: GraphqlApiBase): string[]` — Return the Resource ARN.

  **Parameters**

  - `api` — The GraphQL API to give permissions.
