class SourceApiAssociation (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppSync.SourceApiAssociation |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsappsync#SourceApiAssociation |
Java | software.amazon.awscdk.services.appsync.SourceApiAssociation |
Python | aws_cdk.aws_appsync.SourceApiAssociation |
TypeScript (source) | aws-cdk-lib » aws_appsync » SourceApiAssociation |
Implements
IConstruct
, IDependable
, IResource
, ISource
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.
Example
const sourceApi = new appsync.GraphqlApi(this, 'FirstSourceAPI', {
name: 'FirstSourceAPI',
definition: appsync.Definition.fromFile(path.join(__dirname, 'appsync.merged-api-1.graphql')),
});
const importedMergedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(this, 'ImportedMergedApi', {
graphqlApiId: 'MyApiId',
graphqlApiArn: 'MyApiArn',
});
const importedExecutionRole = iam.Role.fromRoleArn(this, 'ExecutionRole', 'arn:aws:iam::ACCOUNT:role/MyExistingRole');
new appsync.SourceApiAssociation(this, 'SourceApiAssociation2', {
sourceApi: sourceApi,
mergedApi: importedMergedApi,
mergeType: appsync.MergeType.MANUAL_MERGE,
mergedApiExecutionRole: importedExecutionRole,
});
Initializer
new SourceApiAssociation(scope: Construct, id: string, props: SourceApiAssociationProps)
Parameters
- scope
Construct
- id
string
- props
Source
Api Association Props
Construct Props
Name | Type | Description |
---|---|---|
merged | IGraphql | The merged api to associate. |
merged | IRole | The merged api execution role for adding the access policy for the source api. |
source | IGraphql | The source api to associate. |
description? | string | The description of the source api association. |
merge | Merge | The merge type for the source. |
mergedApi
Type:
IGraphql
The merged api to associate.
mergedApiExecutionRole
Type:
IRole
The merged api execution role for adding the access policy for the source api.
sourceApi
Type:
IGraphql
The source api to associate.
description?
Type:
string
(optional, default: None)
The description of the source api association.
mergeType?
Type:
Merge
(optional, default: AUTO_MERGE)
The merge type for the source.
Properties
Name | Type | Description |
---|---|---|
association | Cfn | The underlying CFN source api association resource. |
association | string | The association arn. |
association | string | The association id. |
env | Resource | The environment this resource belongs to. |
merge | Merge | The merge type for the source api association. |
merged | IGraphql | The merged api in the association. |
node | Node | The tree node. |
source | IGraphql | The source api in the association. |
stack | Stack | The stack in which this resource is defined. |
association
Type:
Cfn
The underlying CFN source api association resource.
associationArn
Type:
string
The association arn.
associationId
Type:
string
The association id.
env
Type:
Resource
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.
mergeType
Type:
Merge
The merge type for the source api association.
mergedApi
Type:
IGraphql
The merged api in the association.
node
Type:
Node
The tree node.
sourceApi
Type:
IGraphql
The source api in the association.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import Appsync Source Api Association from source API, merged api, and merge type. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
SourceApiAssociationAttributes(scope, id, attrs)
static frompublic static fromSourceApiAssociationAttributes(scope: Construct, id: string, attrs: SourceApiAssociationAttributes): ISourceApiAssociation
Parameters
- scope
Construct
- id
string
- attrs
Source
Api Association Attributes
Returns
Import Appsync Source Api Association from source API, merged api, and merge type.