startCodegenJob method

Future<StartCodegenJobResponse> startCodegenJob({
  1. required String appId,
  2. required StartCodegenJobData codegenJobToCreate,
  3. required String environmentName,
  4. String? clientToken,
})

Starts a code generation job for a specified Amplify app and backend environment.

May throw InternalServerException. May throw InvalidParameterException. May throw ThrottlingException.

Parameter appId : The unique ID for the Amplify app.

Parameter codegenJobToCreate : The code generation job resource configuration.

Parameter environmentName : The name of the backend environment that is a part of the Amplify app.

Parameter clientToken : The idempotency token used to ensure that the code generation job request completes only once.

Implementation

Future<StartCodegenJobResponse> startCodegenJob({
  required String appId,
  required StartCodegenJobData codegenJobToCreate,
  required String environmentName,
  String? clientToken,
}) async {
  final $query = <String, List<String>>{
    if (clientToken != null) 'clientToken': [clientToken],
  };
  final response = await _protocol.sendRaw(
    payload: codegenJobToCreate,
    method: 'POST',
    requestUri:
        '/app/${Uri.encodeComponent(appId)}/environment/${Uri.encodeComponent(environmentName)}/codegen-jobs',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return StartCodegenJobResponse(
    entity: CodegenJob.fromJson($json),
  );
}