ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 290 - DVA-C02 discussion

Report
Export

A developer is updating an Amazon API Gateway REST API to have a mock endpoint. The developer wants to update the integration request mapping template so the endpoint will respond to mock integration requests with specific HTTP status codes based on various conditions.

A.

{ if( $input.params('integration') == 'mock' ) 'statusCode': 404 else 'statusCode': 500 end }

Answers
A.

{ if( $input.params('integration') == 'mock' ) 'statusCode': 404 else 'statusCode': 500 end }

B.

{ if( $input.params('scope') == 'internal' ) 'statusCode': 200 else 'statusCode': 500 end }

Answers
B.

{ if( $input.params('scope') == 'internal' ) 'statusCode': 200 else 'statusCode': 500 end }

C.

{ if( $input.path('integration') ) 'statusCode': 200 else 'statusCode':404 end }

Answers
C.

{ if( $input.path('integration') ) 'statusCode': 200 else 'statusCode':404 end }

D.

{ if( $context.integration.status ) 'statusCode': 200 else 'statusCode': 500 end }

Answers
D.

{ if( $context.integration.status ) 'statusCode': 200 else 'statusCode': 500 end }

Suggested answer: D

Explanation:

Comprehensive Detailed Step by Step Explanation with All AWS Developer

Reference:

In this scenario, the developer is configuring a mock integration in API Gateway. The integration request mapping template allows you to map the incoming request data to a format that the API expects. For mock integration, it's common to return specific HTTP status codes based on the conditions.

Using $context.integration.status: The $context.integration.status variable refers to the status of the API Gateway integration, which is useful for generating responses based on the condition. Option D correctly uses this variable to determine the HTTP status code, returning 200 for a successful mock request or 500 for a failure.

Alternatives:

Options A, B, and C do not use the correct context variables for handling mock integrations. These options would not return the correct status codes based on the actual integration status.

API Gateway Mapping Templates and Accessing Context Variables

asked 23/10/2024
Nathan Phelan
48 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first