GraphQLApi

class aws_cdk.aws_appsync.GraphQLApi(scope, id, *, name, schema_definition, authorization_config=None, log_config=None, schema_definition_file=None)

Bases: aws_cdk.core.Construct

An AppSync GraphQL API.

stability :stability: experimental

__init__(scope, id, *, name, schema_definition, authorization_config=None, log_config=None, schema_definition_file=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • name (str) – the name of the GraphQL API.

  • schema_definition (SchemaDefinition) – GraphQL schema definition. Specify how you want to define your schema. SchemaDefinition.CODE allows schema definition through CDK SchemaDefinition.FILE allows schema definition through schema.graphql file

  • authorization_config (Optional[AuthorizationConfig]) – Optional authorization configuration. Default: - API Key authorization

  • log_config (Optional[LogConfig]) – Logging configuration for this api. Default: - None

  • schema_definition_file (Optional[str]) – File containing the GraphQL schema definition. You have to specify a definition or a file containing one. Default: - Use schemaDefinition

stability :stability: experimental

Return type

None

Methods

add_dynamo_db_data_source(name, description, table)

add a new DynamoDB data source to this API.

Parameters
  • name (str) – The name of the data source.

  • description (str) – The description of the data source.

  • table (ITable) – The DynamoDB table backing this data source [disable-awslint:ref-via-interface].

stability :stability: experimental

Return type

DynamoDbDataSource

add_http_data_source(name, description, endpoint)

add a new http data source to this API.

Parameters
  • name (str) – The name of the data source.

  • description (str) – The description of the data source.

  • endpoint (str) – The http endpoint.

stability :stability: experimental

Return type

HttpDataSource

add_lambda_data_source(name, description, lambda_function)

add a new Lambda data source to this API.

Parameters
  • name (str) – The name of the data source.

  • description (str) – The description of the data source.

  • lambda_function (IFunction) – The Lambda function to call to interact with this data source.

stability :stability: experimental

Return type

LambdaDataSource

add_none_data_source(name, description)

add a new dummy data source to this API.

Parameters
  • name (str) – The name of the data source.

  • description (str) – The description of the data source.

stability :stability: experimental

Return type

NoneDataSource

grant(grantee, resources, *actions)

Adds an IAM policy statement associated with this GraphQLApi to an IAM principal’s policy.

Parameters
  • grantee (IGrantable) – The principal.

  • resources (IamResource) – The set of resources to allow (i.e. …:[region]:[accountId]:apis/GraphQLId/…).

  • actions (str) – The actions that should be granted to the principal (i.e. appsync:graphql ).

stability :stability: experimental

Return type

Grant

grant_mutation(grantee, *fields)

Adds an IAM policy statement for Mutation access to this GraphQLApi to an IAM principal’s policy.

Parameters
  • grantee (IGrantable) – The principal.

  • fields (str) – The fields to grant access to that are Mutations (leave blank for all).

stability :stability: experimental

Return type

Grant

grant_query(grantee, *fields)

Adds an IAM policy statement for Query access to this GraphQLApi to an IAM principal’s policy.

Parameters
  • grantee (IGrantable) – The principal.

  • fields (str) – The fields to grant access to that are Queries (leave blank for all).

stability :stability: experimental

Return type

Grant

grant_subscription(grantee, *fields)

Adds an IAM policy statement for Subscription access to this GraphQLApi to an IAM principal’s policy.

Parameters
  • grantee (IGrantable) – The principal.

  • fields (str) – The fields to grant access to that are Subscriptions (leave blank for all).

stability :stability: experimental

Return type

Grant

to_string()

Returns a string representation of this construct.

Return type

str

update_definition(definition)

Sets schema defintiion to input if schema mode is configured with SchemaDefinition.CODE.

Parameters

definition (str) – string that is the graphql representation of schema.

stability :stability: experimental

Return type

None

Attributes

api_id

the id of the GraphQL API.

stability :stability: experimental

Return type

str

api_key

the configured API key, if present.

stability :stability: experimental

Return type

Optional[str]

arn

the ARN of the API.

stability :stability: experimental

Return type

str

graph_ql_url

the URL of the endpoint created by AppSync.

stability :stability: experimental

Return type

str

name

the name of the API.

stability :stability: experimental

Return type

str

node

The construct tree node associated with this construct.

Return type

ConstructNode

schema

underlying CFN schema resource.

stability :stability: experimental

Return type

CfnGraphQLSchema

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool