Vijayanath Antwort ist eine einfache Art und Weise zu erreichen, was erforderlich ist.
Wenn Sie es in einer programmatisch Art und Weise und ohne die Notwendigkeit zu tun, wollen die stageVariables
von der Konsole zu ändern dann würde ich vorschlagen Swagger API Integration über die Bühne Variablen zu handhaben.
Sie erreichen dies die json Vorlagen wie hier definiert - AWS labs Swagger Api und durch die folgenden Zeilen unter x-amazon-apigateway-integration
Zugabe
"requestTemplates": {
"application/json": "#set($inputRoot = $input.path('$')) \n{ \n \"version\" : \"$stageVariables.version\" \n}"
}
So ist die gesamte JSON-Datei wäre:
"x-amazon-apigateway-auth" : {
"type" : "aws_iam"
},
"x-amazon-apigateway-integration" : {
"type" : "aws",
"uri" : "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:MY_ACCT_ID:function:helloWorld/invocations",
"httpMethod" : "POST",
"credentials" : "arn:aws:iam::MY_ACCT_ID:role/lambda_exec_role",
"requestTemplates": {
"application/json": "#set($inputRoot = $input.path('$')) \n{ \n \"version\" : \"$stageVariables.version\" \n}"
},
"requestParameters" : {
"integration.request.path.integrationPathParam" : "method.request.querystring.latitude",
"integration.request.querystring.integrationQueryParam" : "method.request.querystring.longitude"
},
"cacheNamespace" : "cache-namespace",
"cacheKeyParameters" : [],
"responses" : {
"2\\d{2}" : {
"statusCode" : "200",
"responseParameters" : {
"method.response.header.test-method-response-header" : "integration.response.header.integrationResponseHeaderParam1"
},
"responseTemplates" : {
"application/json" : "json 200 response template",
"application/xml" : "xml 200 response template"
}
},
"default" : {
"statusCode" : "400",
"responseParameters" : {
"method.response.header.test-method-response-header" : "'static value'"
},
"responseTemplates" : {
"application/json" : "json 400 response template",
"application/xml" : "xml 400 response template"
}
}
}
}
Haben Sie versucht, Überprüfung der Inhalt von 'context' Objekt? – Can
@Can Wie mache ich das? Ich bin mit Scala noch relativ neu. – Vaulstein