move method
Moves a folder under a new resource parent.
Returns an Operation
which can be used to track the progress of the
folder move workflow. Upon success, the Operation.response
field will be
populated with the moved folder. Upon failure, a FolderOperationError
categorizing the failure cause will be returned - if the failure occurs
synchronously then the FolderOperationError
will be returned in the
Status.details
field. If it occurs asynchronously, then the
FolderOperation will be returned in the Operation.error
field. In
addition, the Operation.metadata
field will be populated with a
FolderOperation
message as an aid to stateless clients. Folder moves
will be rejected if they violate either the naming, height, or fanout
constraints described in the CreateFolder documentation. The caller must
have resourcemanager.folders.move
permission on the folder's current and
proposed new parent.
request
- The metadata request object.
Request parameters:
name
- Required. The resource name of the Folder to move. Must be of the
form folders/{folder_id}
Value must have pattern ^folders/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Operation.
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<Operation> move(
MoveFolderRequest request,
core.String name, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v3/' + core.Uri.encodeFull('$name') + ':move';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}