updateFunction method
Updates a Function object.
May throw BadRequestException.
May throw ConcurrentModificationException.
May throw InternalFailureException.
May throw NotFoundException.
May throw UnauthorizedException.
Parameter apiId :
The GraphQL API ID.
Parameter dataSourceName :
The Function DataSource name.
Parameter functionId :
The function ID.
Parameter name :
The Function name.
Parameter code :
The function code that contains the request and response
functions. When code is used, the runtime is required. The
runtime value must be APPSYNC_JS.
Parameter description :
The Function description.
Parameter functionVersion :
The version of the request mapping template. Currently, the
supported value is 2018-05-29. Note that when using VTL and mapping
templates, the functionVersion is required.
Parameter maxBatchSize :
The maximum batching size for a resolver.
Parameter requestMappingTemplate :
The Function request mapping template. Functions support only
the 2018-05-29 version of the request mapping template.
Parameter responseMappingTemplate :
The Function request mapping template.
Implementation
Future<UpdateFunctionResponse> updateFunction({
required String apiId,
required String dataSourceName,
required String functionId,
required String name,
String? code,
String? description,
String? functionVersion,
int? maxBatchSize,
String? requestMappingTemplate,
String? responseMappingTemplate,
AppSyncRuntime? runtime,
SyncConfig? syncConfig,
}) async {
_s.validateNumRange(
'maxBatchSize',
maxBatchSize,
0,
2000,
);
final $payload = <String, dynamic>{
'dataSourceName': dataSourceName,
'name': name,
if (code != null) 'code': code,
if (description != null) 'description': description,
if (functionVersion != null) 'functionVersion': functionVersion,
if (maxBatchSize != null) 'maxBatchSize': maxBatchSize,
if (requestMappingTemplate != null)
'requestMappingTemplate': requestMappingTemplate,
if (responseMappingTemplate != null)
'responseMappingTemplate': responseMappingTemplate,
if (runtime != null) 'runtime': runtime,
if (syncConfig != null) 'syncConfig': syncConfig,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/v1/apis/${Uri.encodeComponent(apiId)}/functions/${Uri.encodeComponent(functionId)}',
exceptionFnMap: _exceptionFns,
);
return UpdateFunctionResponse.fromJson(response);
}