insert method
Creates a new empty dataset.
request
- The metadata request object.
Request parameters:
projectId
- Required. Project ID of the new dataset
Value must have pattern ^\[^/\]+$
.
accessPolicyVersion
- Optional. The version of the provided access
policy schema. Valid values are 0, 1, and 3. Requests specifying an
invalid value will be rejected. This version refers to the schema version
of the access policy and not the version of access policy. This field's
value can be equal or more than the access policy schema provided in the
request. For example, * Requests with conditional access policy binding in
datasets must specify version 3. * But dataset with no conditional role
bindings in access policy may specify any valid value or leave the field
unset. If unset or if 0 or 1 value is used for dataset with conditional
bindings, request will be rejected. This field will be mapped to IAM
Policy version (https://cloud.google.com/iam/docs/policies#versions) and
will be used to set policy in IAM.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Dataset.
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<Dataset> insert(
Dataset request,
core.String projectId, {
core.int? accessPolicyVersion,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (accessPolicyVersion != null)
'accessPolicyVersion': ['${accessPolicyVersion}'],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'projects/' + core.Uri.encodeFull('$projectId') + '/datasets';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Dataset.fromJson(response_ as core.Map<core.String, core.dynamic>);
}