# SourceApiAssociationProps

Properties for SourceApiAssociation which associates an AppSync Source API with an AppSync Merged API.

Used as props by: [SourceApiAssociation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.SourceApiAssociation.html)

- Source: [`aws-appsync/lib/source-api-association.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appsync/lib/source-api-association.ts#L76)
- Type last changed: v2.97.0 · 22 Sep 2023

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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
});
```

Golang:

```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

- `description`: string = None — The description of the source api association.

- `mergedApi`: [IGraphqlApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.IGraphqlApi.html) (required) — The merged api to associate.

- `mergedApiExecutionRole`: [IRole](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) (required) — The merged api execution role for adding the access policy for the source api.

- `mergeType`: [MergeType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.MergeType.html) = AUTO_MERGE — The merge type for the source.

- `sourceApi`: [IGraphqlApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.IGraphqlApi.html) (required) — The source api to associate.
