Experimental
@aws-cdk/aws-pipes-targets-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
ApiGatewayTargetParameters Struct
API Gateway REST API target properties.
| Stability | Experimental |
|---|---|
| Source | lib/api-gateway.ts |
Example
ts
declare const sourceQueue: sqs.Queue;
const fn = new lambda.Function( this, 'MyFunc', {
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_LATEST,
code: lambda.Code.fromInline( 'exports.handler = e => {}' ),
});
const restApi = new api.LambdaRestApi( this, 'MyRestAPI', { handler: fn } );
const apiTarget = new targets.ApiGatewayTarget(restApi, {
inputTransformation: pipes.InputTransformation.fromObject({ body: "👀" }),
});
const pipe = new pipes.Pipe(this, 'Pipe', {
source: new SqsSource(sourceQueue),
target: apiTarget,
});
python
# source_queue: sqs.Queue
fn = lambda_.Function(self, "MyFunc",
handler="index.handler",
runtime=lambda_.Runtime.NODEJS_LATEST,
code=lambda_.Code.from_inline("exports.handler = e => {}")
)
rest_api = api.LambdaRestApi(self, "MyRestAPI", handler=fn)
api_target = targets.ApiGatewayTarget(rest_api,
input_transformation=pipes.InputTransformation.from_object({"body": "👀"})
)
pipe = pipes.Pipe(self, "Pipe",
source=SqsSource(source_queue),
target=api_target
)
java
Queue sourceQueue;
Function fn = Function.Builder.create(this, "MyFunc")
.handler("index.handler")
.runtime(Runtime.NODEJS_LATEST)
.code(Code.fromInline("exports.handler = e => {}"))
.build();
LambdaRestApi restApi = LambdaRestApi.Builder.create(this, "MyRestAPI").handler(fn).build();
ApiGatewayTarget apiTarget = ApiGatewayTarget.Builder.create(restApi)
.inputTransformation(InputTransformation.fromObject(Map.of("body", "👀")))
.build();
Pipe pipe = Pipe.Builder.create(this, "Pipe")
.source(new SqsSource(sourceQueue))
.target(apiTarget)
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Pipes.Targets.Alpha
Queue sourceQueue;
var fn = new Function(this, "MyFunc", new FunctionProps {
Handler = "index.handler",
Runtime = Runtime.NODEJS_LATEST,
Code = Code.FromInline("exports.handler = e => {}")
});
var restApi = new LambdaRestApi(this, "MyRestAPI", new LambdaRestApiProps { Handler = fn });
var apiTarget = new ApiGatewayTarget(restApi, new ApiGatewayTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "👀" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = apiTarget
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipestargetsalpha/v2
var sourceQueue Queue
fn := lambda.NewFunction(this, jsii.String("MyFunc"), &FunctionProps{
Handler: jsii.String("index.handler"),
Runtime: lambda.Runtime_NODEJS_LATEST(),
Code: lambda.Code_FromInline(jsii.String("exports.handler = e => {}")),
})
restApi := api.NewLambdaRestApi(this, jsii.String("MyRestAPI"), &LambdaRestApiProps{
Handler: fn,
})
apiTarget := targets.NewApiGatewayTarget(restApi, &ApiGatewayTargetParameters{
InputTransformation: pipes.InputTransformation_FromObject(map[string]interface{}{
"body": jsii.String("👀"),
}),
})
pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
Source: awscdkpipessourcesalpha.NewSqsSource(sourceQueue),
Target: apiTarget,
})
Properties
headerParametersoptional{ [key: string]: string }header_parametersoptionaltyping.Mapping[str, str]headerParametersoptionalMap<String, String>HeaderParametersoptionalIDictionary<string, string>HeaderParametersoptional*map[string]*string = none #The headers to send as part of the request invoking the API Gateway REST API.
inputTransformationoptionalIInputTransformationinput_transformationoptionalIInputTransformationinputTransformationoptionalIInputTransformationInputTransformationoptionalIInputTransformationInputTransformationoptionalIInputTransformation = none #The input transformation to apply to the message before sending it to the target.
methodoptionalstringmethodoptionalstrmethodoptionalStringMethodoptionalstringMethodoptional*string #The method for API Gateway resource.
Default: '*' - ANY
The path for the API Gateway resource.
pathParameterValuesoptionalstring[]path_parameter_valuesoptionaltyping.List[str]pathParameterValuesoptionalList<String>PathParameterValuesoptionalstring[]PathParameterValuesoptional*[]*string = none #The path parameter values used to populate the API Gateway REST API path wildcards ("*").
queryStringParametersoptional{ [key: string]: string }query_string_parametersoptionaltyping.Mapping[str, str]queryStringParametersoptionalMap<String, String>QueryStringParametersoptionalIDictionary<string, string>QueryStringParametersoptional*map[string]*string = none #The query string keys/values that need to be sent as part of request invoking the API Gateway REST API.
The deployment stage for the API Gateway resource.
Default: the value of deploymentStage.stageName of target API Gateway resource.