aws-cdk-lib.aws_appsync.IamResource

class IamResource

LanguageType name
.NETAmazon.CDK.AWS.AppSync.IamResource
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappsync#IamResource
Javasoftware.amazon.awscdk.services.appsync.IamResource
Pythonaws_cdk.aws_appsync.IamResource
TypeScript (source)aws-cdk-lib » aws_appsync » IamResource

A class used to generate resource arns for AppSync.

Example

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

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

Methods

NameDescription
resourceArns(api)Return the Resource ARN.
static all()Generate the resource names that accepts all types: *.
static custom(...arns)Generate the resource names given custom arns.
static ofType(type, ...fields)Generate the resource names given a type and fields.

resourceArns(api)

public resourceArns(api: GraphqlApi): string[]

Parameters

  • api GraphqlApi — The GraphQL API to give permissions.

Returns

  • string[]

Return the Resource ARN.


static all()

public static all(): IamResource

Returns

  • IamResource

Generate the resource names that accepts all types: *.


static custom(...arns)

public static custom(...arns: string[]): IamResource

Parameters

  • arns string — The custom arns that need to be permissioned.

Returns

  • IamResource

Generate the resource names given custom arns.


static ofType(type, ...fields)

public static ofType(type: string, ...fields: string[]): IamResource

Parameters

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

Returns

  • IamResource

Generate the resource names given a type and fields.