insert method

Future<Bucket> insert(
  1. Bucket request,
  2. String project, {
  3. String? predefinedAcl,
  4. String? predefinedDefaultObjectAcl,
  5. String? projection,
  6. String? userProject,
  7. String? $fields,
})

Creates a new bucket.

request - The metadata request object.

Request parameters:

project - A valid API project identifier.

predefinedAcl - Apply a predefined set of access controls to this bucket. Possible string values are:

  • "authenticatedRead" : Project team owners get OWNER access, and allAuthenticatedUsers get READER access.
  • "private" : Project team owners get OWNER access.
  • "projectPrivate" : Project team members get access according to their roles.
  • "publicRead" : Project team owners get OWNER access, and allUsers get READER access.
  • "publicReadWrite" : Project team owners get OWNER access, and allUsers get WRITER access.

predefinedDefaultObjectAcl - Apply a predefined set of default object access controls to this bucket. Possible string values are:

  • "authenticatedRead" : Object owner gets OWNER access, and allAuthenticatedUsers get READER access.
  • "bucketOwnerFullControl" : Object owner gets OWNER access, and project team owners get OWNER access.
  • "bucketOwnerRead" : Object owner gets OWNER access, and project team owners get READER access.
  • "private" : Object owner gets OWNER access.
  • "projectPrivate" : Object owner gets OWNER access, and project team members get access according to their roles.
  • "publicRead" : Object owner gets OWNER access, and allUsers get READER access.

projection - Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full. Possible string values are:

  • "full" : Include all properties.
  • "noAcl" : Omit owner, acl and defaultObjectAcl properties.

userProject - The project to be billed for this request.

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

Completes with a Bucket.

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<Bucket> insert(
  Bucket request,
  core.String project, {
  core.String? predefinedAcl,
  core.String? predefinedDefaultObjectAcl,
  core.String? projection,
  core.String? userProject,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'project': [project],
    if (predefinedAcl != null) 'predefinedAcl': [predefinedAcl],
    if (predefinedDefaultObjectAcl != null)
      'predefinedDefaultObjectAcl': [predefinedDefaultObjectAcl],
    if (projection != null) 'projection': [projection],
    if (userProject != null) 'userProject': [userProject],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'b';

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