GoSpace Manager

Version v0.11.0

Manage Google Workspace resources using a developer-friendly CLI written in Go

Examples

!!!!THIS IS NOT A COMPLETE LIST OF ALL AVAILABLE COMMANDS!!!!

These are just some examples of what you can do with GSM.

For a complete list of all commands, please take a look at the command overview.

Admin SDK

Create a new user

gsm users insert --givenName Jane --familyName Doe --primaryEmail jane@doe.org --password adjskdjao8G! --organizations "name=Doe Inc.;department=Some Department;type=work;primary=true"

Delete a user

gsm users delete --userKey jane@doe.org

Sign out a user on all devices

gsm users signOut --userKey jane@doe.org

Change a group setting

gsm groupSettings patch --groupUniqueId group@domain.org --allowExternalMembers true

gsm groupSettings patch --groupUniqueId group@domain.org --archiveOnly true --whoCanPostMessage NONE_CAN_POST

Clear a user’s primary calendar

gsm calendars clear --calendarId primary --dwdSubject user@example.org

groupsCi (Cloud Identity Beta API)

The Cloud Identity API is currently in beta.
Many features are only available to Cloud Identity Premium customers!

New Dynamic Group

gsm groupsCi create --parent customers/{my_customer_id} --id group@example.org --labels "cloudidentity.googleapis.com/groups.discussion_forum" --displayName "All Engineers" --description "This group contains all engineers" --queries "resourceType=USER;query=user.organizations.exists(org, org.department=='engineering')"

Make Group A Security Group

gsm groupsCi patch --email group@example.org --updateMask labels --labels "cloudidentity.googleapis.com groups.security,cloudidentity.googleapis.com/groups.discussion_forum"

Drive API

List all Shared Drives

gsm drives list --useDomainAdminAccess

Download or export a file from drive

gsm files download --fileId <fileId>

Note that this works only for non-Google files. To export a Google file, see use

gsm files export --fileId <fileId> --mimeType <mimeType>

For exmaple, to export a Doc to .docx, use

gsm files export --fileId <fileId> --mimeType application/vnd.openxmlformats-officedocument.wordprocessingml.document

This will download a file to your local system with the same name as the file in Drive. You need to change the file extention manually.

Gmail API

Create a Gmail delegation

This command needs to be run as the user who creates the delegate. If you are using DWD, make sure that you either have the correct subject in your config, or that you set the --dwdSubject flag like so in the example:

gsm delegates create --delegateEmail user1@example.org --dwdSubject user2@example.org

This will create a delegation so that user1 will be able to access user2’s inbox.

Send an email

gsm messages send --to "recipient@somedomain.org" --subject "Some Subject" --body "Very important message!"

Note that this command does not require enabling insecure apps or setting up an application password.

Shared Contacts API

There are two things that are noteworthy for this API

  • All commands require the domain to be set
  • The API uses XML by default, but you can use the --json flag to change the output the JSON

List all Domain Shared Contacts

gsm sharedContacts list --domain example.org

Create a new Domain Shared Contact

gsm sharedContacts create --givenName Jane --familyName Doe --email "address=jane@doe.net;primary=true;label=work;displayName=Jane Doe" --organization "orgName=Some Company;orgDepartment=Some Department" --domain example.org

Sheets API

You can upload CSV files to Google Sheets with GSM. You can upload multiple CSV files when creating a sheet and each CSV file will be its own tab:

gsm spreadsheets create --title "My New Sheet" --csvFileToUpload "title=CSV1;path=./csv1.csv" --csvFileToUpload "title=CSV2;path=./csv2.csv"

SEE ALSO