Class AppSyncHttpDataSource
An AppSync datasource backed by a http endpoint.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AppSyncHttpDataSource : AppSyncBackedDataSource, IGrantable
Syntax (vb)
Public Class AppSyncHttpDataSource Inherits AppSyncBackedDataSource Implements IGrantable
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.APIGateway;
var api = new EventApi(this, "EventApiHttp", new EventApiProps {
ApiName = "HttpEventApi"
});
var randomApi = new RestApi(this, "RandomApi");
var randomRoute = randomApi.Root.AddResource("random");
randomRoute.AddMethod("GET", new MockIntegration(new IntegrationOptions {
IntegrationResponses = new [] { new IntegrationResponse {
StatusCode = "200",
ResponseTemplates = new Dictionary<string, string> {
{ "application/json", "my-random-value" }
}
} },
PassthroughBehavior = PassthroughBehavior.NEVER,
RequestTemplates = new Dictionary<string, string> {
{ "application/json", "{ \"statusCode\": 200 }" }
}
}), new MethodOptions {
MethodResponses = new [] { new MethodResponse { StatusCode = "200" } }
});
var dataSource = api.AddHttpDataSource("httpsource", $"https://{randomApi.restApiId}.execute-api.{this.region}.amazonaws.com");
Synopsis
Constructors
| AppSyncHttpDataSource(Construct, string, IAppSyncHttpDataSourceProps) | An AppSync datasource backed by a http endpoint. |
Constructors
AppSyncHttpDataSource(Construct, string, IAppSyncHttpDataSourceProps)
An AppSync datasource backed by a http endpoint.
public AppSyncHttpDataSource(Construct scope, string id, IAppSyncHttpDataSourceProps props)
Parameters
- scope Construct
- id string
- props IAppSyncHttpDataSourceProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.APIGateway;
var api = new EventApi(this, "EventApiHttp", new EventApiProps {
ApiName = "HttpEventApi"
});
var randomApi = new RestApi(this, "RandomApi");
var randomRoute = randomApi.Root.AddResource("random");
randomRoute.AddMethod("GET", new MockIntegration(new IntegrationOptions {
IntegrationResponses = new [] { new IntegrationResponse {
StatusCode = "200",
ResponseTemplates = new Dictionary<string, string> {
{ "application/json", "my-random-value" }
}
} },
PassthroughBehavior = PassthroughBehavior.NEVER,
RequestTemplates = new Dictionary<string, string> {
{ "application/json", "{ \"statusCode\": 200 }" }
}
}), new MethodOptions {
MethodResponses = new [] { new MethodResponse { StatusCode = "200" } }
});
var dataSource = api.AddHttpDataSource("httpsource", $"https://{randomApi.restApiId}.execute-api.{this.region}.amazonaws.com");