SourceApiAssociation

class aws_cdk.aws_appsync.SourceApiAssociation(scope, id, *, merged_api, merged_api_execution_role, source_api, description=None, merge_type=None)

Bases: Resource

AppSync SourceApiAssociation which associates an AppSync source API to an AppSync Merged API.

The initial creation of the SourceApiAssociation merges the source API into the Merged API schema.

ExampleMetadata:

infused

Example:

source_api = appsync.GraphqlApi(self, "FirstSourceAPI",
    name="FirstSourceAPI",
    definition=appsync.Definition.from_file(path.join(__dirname, "appsync.merged-api-1.graphql"))
)

imported_merged_api = appsync.GraphqlApi.from_graphql_api_attributes(self, "ImportedMergedApi",
    graphql_api_id="MyApiId",
    graphql_api_arn="MyApiArn"
)

imported_execution_role = iam.Role.from_role_arn(self, "ExecutionRole", "arn:aws:iam::ACCOUNT:role/MyExistingRole")
appsync.SourceApiAssociation(self, "SourceApiAssociation2",
    source_api=source_api,
    merged_api=imported_merged_api,
    merge_type=appsync.MergeType.MANUAL_MERGE,
    merged_api_execution_role=imported_execution_role
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • merged_api (IGraphqlApi) – The merged api to associate.

  • merged_api_execution_role (IRole) – The merged api execution role for adding the access policy for the source api.

  • source_api (IGraphqlApi) – The source api to associate.

  • description (Optional[str]) – The description of the source api association. Default: - None

  • merge_type (Optional[MergeType]) – The merge type for the source. Default: - AUTO_MERGE

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

association

The underlying CFN source api association resource.

association_arn

The association arn.

association_id

The association id.

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

merge_type

The merge type for the source api association.

merged_api

The merged api in the association.

node

The tree node.

source_api

The source api in the association.

stack

The stack in which this resource is defined.

Static Methods

classmethod from_source_api_association_attributes(scope, id, *, association_arn, merged_api, source_api)

Import Appsync Source Api Association from source API, merged api, and merge type.

Parameters:
  • scope (Construct) –

  • id (str) –

  • association_arn (str) – The association arn.

  • merged_api (IGraphqlApi) – The merged api in the association.

  • source_api (IGraphqlApi) – The source api in the association.

Return type:

ISourceApiAssociation

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool