create method

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

Creates a log bucket that can be used to store log entries.

After a bucket has been created, the bucket's location cannot be changed.

request - The metadata request object.

Request parameters:

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

bucketId - Required. A client-assigned identifier such as "my-bucket". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods. Bucket identifiers must start with an alphanumeric character.

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

Completes with a LogBucket.

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

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

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