class IamResource
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppSync.IamResource |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsappsync#IamResource |
Java | software.amazon.awscdk.services.appsync.IamResource |
Python | aws_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.IGraphqlApi;
api.grant(role, appsync.IamResource.custom('types/Mutation/fields/updateExample'), 'appsync:GraphQL');
Methods
Name | Description |
---|---|
resource | 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 of | Generate the resource names given a type and fields. |
resourceArns(api)
public resourceArns(api: GraphqlApiBase): string[]
Parameters
- api
Graphql
— The GraphQL API to give permissions.Api Base
Returns
string[]
Return the Resource ARN.
static all()
public static all(): IamResource
Returns
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
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
Generate the resource names given a type and fields.