create
Creates a permission for a file or shared drive.
Synopsis
Implements the API documented at https://developers.google.com/drive/api/v3/reference/permissions/create
gsm permissions create [flags]
Options
--allowFileDiscovery Whether the permission allows the file to be discovered through search.
This is only applicable for permissions of type domain or anyone.
--domain string The domain to which this permission refers.
--emailAddress string The email address of the user or group to which this permission refers.
--emailMessage string A plain text custom message to include in the notification email
--fields string Fields allows partial responses to be retrieved.
See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
--fileId string Id of the file or drive
-h, --help help for create
--moveToNewOwnersRoot This parameter only takes effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item.
When set to true, the item is moved to the new owner's My Drive root folder and all prior parents removed.
however, the file will be added to the new owner's My Drive root folder, unless it is already in the new owner's My Drive.
--role string The role granted by this permission.
While new values may be supported in the future, the following are currently allowed:
[owner|organizer|fileOrganizer|writer|commenter|reader]
--sendNotificationEmail Whether to send a notification email when sharing to users or groups.
This defaults to true for users and groups, and is not allowed for other requests.
It must not be disabled for ownership transfers.
--transferOwnership Whether to transfer ownership to the specified user and downgrade the current owner to a writer.
This parameter is required as an acknowledgement of the side effect.
--type string The type of the grantee.
[user|group|domain|anyone].
When creating a permission, if type is user or group, you must provide an emailAddress for the user or group.
When type is domain, you must provide a domain.
There isn't extra information required for a anyone type.
--useDomainAdminAccess Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
--view string Indicates the view for this permission.
Only populated for permissions that belong to a view. published is the only supported value.
Options inherited from parent commands
--compressOutput By default, GSM outputs "pretty" (indented) objects. By setting this flag, GSM's output will be compressed. This may or may not improve performance in scripts.
--config string config file (default is $HOME/.config/gsm/.gsm.yaml)
--delay int This delay (plus a random jitter between 0 and 50) will be applied after every command to avoid reaching quota and rate limits. Set to 0 to disable.
--dwdSubject string Specify a subject used for DWD impersonation (overrides value in config file)
--log string Set the path of the log file. Default is either ~/gsm.log or defined in your config file
--maxElapsedTime int This is the maximum total time that will be spent retrying a request in minutes. (default 15)
--maxRetryInterval int This is the maximum interval that will be used between retry attempts in seconds. (default 320)
--redirectPort int This is the TCP port on which GSM will create web server if you authenticate with a user account for the first time. This is necessary for the OAuth flow. See https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_loopback (default 8081)
--retryOn ints Specify the HTTP error code(s) that GSM should retry on. Note that GSM will always retry on HTTP 403 errors that indicate a quota / rate limit error
--streamOutput Setting this flag will cause GSM to output slice values to stdout one by one, instead of one large object
SEE ALSO
- gsm permissions - Manage file and drive permissions (Part of Drive API)
- gsm permissions create batch - Batch creates permissions for files or shared drives using a CSV file as input.
- gsm permissions create recursive - Recursively grant a permissions to a folder and all of its children.