create method

Future<GoogleCloudAiplatformV1MetadataSchema> create(
  1. GoogleCloudAiplatformV1MetadataSchema request,
  2. String parent, {
  3. String? metadataSchemaId,
  4. String? $fields,
})

Creates a MetadataSchema.

request - The metadata request object.

Request parameters:

parent - Required. The resource name of the MetadataStore where the MetadataSchema should be created. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore} Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/metadataStores/\[^/\]+$.

metadataSchemaId - The {metadata_schema} portion of the resource name with the format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/metadataSchemas/{metadataschema} If not provided, the MetadataStore's ID will be a UUID generated by the service. Must be 4-128 characters in length. Valid characters are /a-z-/. Must be unique across all MetadataSchemas in the parent Location. (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the caller can't view the preexisting MetadataSchema.)

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

Completes with a GoogleCloudAiplatformV1MetadataSchema.

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<GoogleCloudAiplatformV1MetadataSchema> create(
  GoogleCloudAiplatformV1MetadataSchema request,
  core.String parent, {
  core.String? metadataSchemaId,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (metadataSchemaId != null) 'metadataSchemaId': [metadataSchemaId],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/metadataSchemas';

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