putGatewayResponse method

Future<GatewayResponse> putGatewayResponse({
  1. required GatewayResponseType responseType,
  2. required String restApiId,
  3. Map<String, String>? responseParameters,
  4. Map<String, String>? responseTemplates,
  5. String? statusCode,
})

Creates a customization of a GatewayResponse of a specified response type and status code on the given RestApi.

May throw BadRequestException. May throw ConflictException. May throw LimitExceededException. May throw NotFoundException. May throw TooManyRequestsException. May throw UnauthorizedException.

Parameter responseType : The response type of the associated GatewayResponse

Parameter restApiId : The string identifier of the associated RestApi.

Parameter responseParameters : Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.

Parameter responseTemplates : Response templates of the GatewayResponse as a string-to-string map of key-value pairs.

Parameter statusCode : The HTTP status code of the GatewayResponse.

Implementation

Future<GatewayResponse> putGatewayResponse({
  required GatewayResponseType responseType,
  required String restApiId,
  Map<String, String>? responseParameters,
  Map<String, String>? responseTemplates,
  String? statusCode,
}) async {
  final $payload = <String, dynamic>{
    if (responseParameters != null) 'responseParameters': responseParameters,
    if (responseTemplates != null) 'responseTemplates': responseTemplates,
    if (statusCode != null) 'statusCode': statusCode,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/restapis/${Uri.encodeComponent(restApiId)}/gatewayresponses/${Uri.encodeComponent(responseType.value)}',
    exceptionFnMap: _exceptionFns,
  );
  return GatewayResponse.fromJson(response);
}