class AppSyncHttpDataSource (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AppSync.AppSyncHttpDataSource |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsappsync#AppSyncHttpDataSource |
Java | software.amazon.awscdk.services.appsync.AppSyncHttpDataSource |
Python | aws_cdk.aws_appsync.AppSyncHttpDataSource |
TypeScript (source) | aws-cdk-lib » aws_appsync » AppSyncHttpDataSource |
Implements
IConstruct, IDependable, IGrantable
An AppSync datasource backed by a http endpoint.
Example
import * as apigw from 'aws-cdk-lib/aws-apigateway';
const api = new appsync.EventApi(this, 'EventApiHttp', {
apiName: 'HttpEventApi',
});
const randomApi = new apigw.RestApi(this, 'RandomApi');
const randomRoute = randomApi.root.addResource('random');
randomRoute.addMethod('GET', new apigw.MockIntegration({
integrationResponses: [{
statusCode: '200',
responseTemplates: {
'application/json': 'my-random-value',
},
}],
passthroughBehavior: apigw.PassthroughBehavior.NEVER,
requestTemplates: {
'application/json': '{ "statusCode": 200 }',
},
}), {
methodResponses: [{ statusCode: '200' }],
});
const dataSource = api.addHttpDataSource('httpsource', `https://${randomApi.restApiId}.execute-api.${this.region}.amazonaws.com`);
Initializer
new AppSyncHttpDataSource(scope: Construct, id: string, props: AppSyncHttpDataSourceProps)
Parameters
- scope
Construct - id
string - props
AppSync Http Data Source Props
Construct Props
| Name | Type | Description |
|---|---|---|
| api | IApi | The API to attach this data source to. |
| endpoint | string | The http endpoint. |
| authorization | App | The authorization config in case the HTTP endpoint requires authorization. |
| description? | string | The description of the data source. |
| name? | string | The name of the data source. |
| service | IRole | The IAM service role to be assumed by AppSync to interact with the data source. |
api
Type:
IApi
The API to attach this data source to.
endpoint
Type:
string
The http endpoint.
authorizationConfig?
Type:
App
(optional, default: none)
The authorization config in case the HTTP endpoint requires authorization.
description?
Type:
string
(optional, default: None)
The description of the data source.
name?
Type:
string
(optional, default: id of data source)
The name of the data source.
The only allowed pattern is: {[_A-Za-z][_0-9A-Za-z]*}. Any invalid characters will be automatically removed.
serviceRole?
Type:
IRole
(optional, default: Create a new role)
The IAM service role to be assumed by AppSync to interact with the data source.
Properties
| Name | Type | Description |
|---|---|---|
| grant | IPrincipal | The principal of the data source to be IGrantable. |
| name | string | The name of the data source. |
| node | Node | The tree node. |
| resource | Cfn | The underlying CFN data source resource. |
grantPrincipal
Type:
IPrincipal
The principal of the data source to be IGrantable.
name
Type:
string
The name of the data source.
node
Type:
Node
The tree node.
resource
Type:
Cfn
The underlying CFN data source resource.
Methods
| Name | Description |
|---|---|
| to | Returns a string representation of this construct. |
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.

.NET
Go
Java
Python
TypeScript (