create method

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

Creates a view over log entries in a log bucket.

A bucket may contain a maximum of 30 views.

request - The metadata request object.

Request parameters:

parent - Required. The bucket in which to create the view "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" For example:"projects/my-project/locations/global/buckets/my-bucket" Value must have pattern ^folders/\[^/\]+/locations/\[^/\]+/buckets/\[^/\]+$.

viewId - Required. A client-assigned identifier such as "my-view". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods.

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

Completes with a LogView.

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

  final url_ = 'v2/' + core.Uri.encodeFull('$parent') + '/views';

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