Skip to content
v2.277.0

GraphqlApiAttributes Struct ​

Attributes for GraphQL imports.

Example ​

ts
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,
});
python
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
)
java
GraphqlApi sourceApi = GraphqlApi.Builder.create(this, "FirstSourceAPI")
        .name("FirstSourceAPI")
        .definition(Definition.fromFile(join(__dirname, "appsync.merged-api-1.graphql")))
        .build();

IGraphqlApi importedMergedApi = GraphqlApi.fromGraphqlApiAttributes(this, "ImportedMergedApi", GraphqlApiAttributes.builder()
        .graphqlApiId("MyApiId")
        .graphqlApiArn("MyApiArn")
        .build());

IRole importedExecutionRole = Role.fromRoleArn(this, "ExecutionRole", "arn:aws:iam::ACCOUNT:role/MyExistingRole");
SourceApiAssociation.Builder.create(this, "SourceApiAssociation2")
        .sourceApi(sourceApi)
        .mergedApi(importedMergedApi)
        .mergeType(MergeType.MANUAL_MERGE)
        .mergedApiExecutionRole(importedExecutionRole)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var sourceApi = new GraphqlApi(this, "FirstSourceAPI", new GraphqlApiProps {
    Name = "FirstSourceAPI",
    Definition = Definition.FromFile(Join(__dirname, "appsync.merged-api-1.graphql"))
});

var importedMergedApi = GraphqlApi.FromGraphqlApiAttributes(this, "ImportedMergedApi", new GraphqlApiAttributes {
    GraphqlApiId = "MyApiId",
    GraphqlApiArn = "MyApiArn"
});

var importedExecutionRole = Role.FromRoleArn(this, "ExecutionRole", "arn:aws:iam::ACCOUNT:role/MyExistingRole");
new SourceApiAssociation(this, "SourceApiAssociation2", new SourceApiAssociationProps {
    SourceApi = sourceApi,
    MergedApi = importedMergedApi,
    MergeType = MergeType.MANUAL_MERGE,
    MergedApiExecutionRole = importedExecutionRole
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
sourceApi := appsync.NewGraphqlApi(this, jsii.String("FirstSourceAPI"), &GraphqlApiProps{
	Name: jsii.String("FirstSourceAPI"),
	Definition: appsync.Definition_FromFile(path.join(__dirname, jsii.String("appsync.merged-api-1.graphql"))),
})

importedMergedApi := appsync.GraphqlApi_FromGraphqlApiAttributes(this, jsii.String("ImportedMergedApi"), &GraphqlApiAttributes{
	GraphqlApiId: jsii.String("MyApiId"),
	GraphqlApiArn: jsii.String("MyApiArn"),
})

importedExecutionRole := iam.Role_FromRoleArn(this, jsii.String("ExecutionRole"), jsii.String("arn:aws:iam::ACCOUNT:role/MyExistingRole"))
appsync.NewSourceApiAssociation(this, jsii.String("SourceApiAssociation2"), &SourceApiAssociationProps{
	SourceApi: sourceApi,
	MergedApi: importedMergedApi,
	MergeType: appsync.MergeType_MANUAL_MERGE,
	MergedApiExecutionRole: importedExecutionRole,
})

Properties ​

graphqlApiArnoptionalstringgraphql_api_arnoptionalstrgraphqlApiArnoptionalStringGraphqlApiArnoptionalstringGraphqlApiArnoptional*string #
the arn for the GraphQL Api.

Default: autogenerated arn

graphqlApiIdstringgraphql_api_idstrgraphqlApiIdStringGraphqlApiIdstringGraphqlApiId*string required #
a unique AWS AppSync GraphQL API identifier i.e. 'lxz775lwdrgcndgz3nurvac7oa'.
graphQLEndpointArnoptionalstringgraph_ql_endpoint_arnoptionalstrgraphQLEndpointArnoptionalStringGraphQLEndpointArnoptionalstringGraphQLEndpointArnoptional*string #
The GraphQl endpoint arn for the GraphQL API.

Default: none, required to construct event rules from imported APIs

modesoptionalAuthorizationType[]modesoptionaltyping.List[AuthorizationType]modesoptionalList<AuthorizationType>ModesoptionalAuthorizationType[]Modesoptional*[]AuthorizationType #
The Authorization Types for this GraphQL Api.

Default: none, required to construct event rules from imported APIs

visibilityoptionalVisibilityvisibilityoptionalVisibilityvisibilityoptionalVisibilityVisibilityoptionalVisibilityVisibilityoptionalVisibility = GLOBAL #
The GraphQl API visibility.