updateBuild method

Future<UpdateBuildOutput> updateBuild({
  1. required String buildId,
  2. String? name,
  3. String? version,
})

Updates metadata in a build resource, including the build name and version. To update the metadata, specify the build ID to update and provide the new values. If successful, a build object containing the updated metadata is returned.

Learn more

Upload a Custom Server Build

Related operations

May throw UnauthorizedException. May throw InvalidRequestException. May throw NotFoundException. May throw InternalServiceException.

Parameter buildId : A unique identifier for a build to update. You can use either the build ID or ARN value.

Parameter name : A descriptive label that is associated with a build. Build names do not need to be unique.

Parameter version : Version information that is associated with a build or script. Version strings do not need to be unique.

Implementation

Future<UpdateBuildOutput> updateBuild({
  required String buildId,
  String? name,
  String? version,
}) async {
  ArgumentError.checkNotNull(buildId, 'buildId');
  _s.validateStringLength(
    'name',
    name,
    1,
    1024,
  );
  _s.validateStringLength(
    'version',
    version,
    1,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.UpdateBuild'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BuildId': buildId,
      if (name != null) 'Name': name,
      if (version != null) 'Version': version,
    },
  );

  return UpdateBuildOutput.fromJson(jsonResponse.body);
}