setDefault method

Designates a version to be the default for the model.

The default version is used for prediction requests made against the model that don't specify a version. The first version to be created for a model is automatically set as the default. You must make any subsequent changes to the default version setting manually using this method.

request - The metadata request object.

Request parameters:

name - Required. The name of the version to make the default for the model. You can get the names of all the versions of a model by calling projects.models.versions.list. Value must have pattern ^projects/\[^/\]+/models/\[^/\]+/versions/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleCloudMlV1Version.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<GoogleCloudMlV1Version> setDefault(
  GoogleCloudMlV1SetDefaultVersionRequest request,
  core.String name, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':setDefault';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return GoogleCloudMlV1Version.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}