updatedatastore

package
v0.0.0-...-e34edbc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 9 Imported by: 0

README

gsuitemdm Cloud Function updatedatastore

A cloud Function component of the gsuitemdm package that updates mobile device data in Google Datastore with the latest mobile device data from the Admin SDK as well as any local device-specific notes that may be stored in the Google Sheet.

The updatedatastore API is used by the mdmtool command line utility.

HOW-TO Configure updatedatastore

updatedatastore uses a .yaml file containing several environment variables the cloud function reads during app startup. These environment variables point the app to the shared master cloud function configuration and API key that are stored as Secret Manager secrets. An example .yaml file for updatedatastore:

APPNAME: updatedatastore
SM_APIKEY_ID: projects/12334567890/secrets/gsuitemdm_apikey
SM_CONFIG_ID: projects/12334567890/secrets/gsuitemdm_conf

HOW-TO Deploy updatedatastore

$ gcloud functions deploy UpdateDatastore \
  --runtime go111 \
  --trigger-http \
  --env-vars-file env_updatedatastore.yaml 

HOW-TO Use updatedatastore

API

Example expected JSON to update Google Datastore with fresh mobile device data:

{
	"key": "0123456789"
}

Example command line using curl and the above JSON to update Google Datastore with fresh movbile device data:

$ curl -X POST -d '{"key": "0123456789"}' \
  https://us-central1-<YOURGCPPROJECTNAME>.cloudfunctions.net/UpdateDatastore

It is recommended that Google Cloud Scheduler be used to schedule automatic calls to updatedatastore, for example:

$ gcloud scheduler jobs list
ID                   LOCATION     SCHEDULE (TZ)                      TARGET_TYPE  STATE
UpdateDatastore      us-central1  */5 * * * * (America/Los_Angeles)  HTTP         ENABLED
mdmtool

Fresh mobile device data can be downloaded and updated in Google Datastore by running mdmtool's updatedb command:

$ mdmtool updatedb
Updating Datastore...  done.
updatedatastore Success

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateDatastore

func UpdateDatastore(w http.ResponseWriter, r *http.Request)

Update Google Datastore with fresh mobile device data from the Admin SDK and the Google Sheet

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL