listgroups

package
v0.0.18-rc18 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package listgroups extract all groups from a GCI directory using the Admin SDK API

Triggered by

Cloud Scheduler Job, through PubSub messages.

Instances

few, one per directory customer ID.

Output

PubSub messages to a dedicated topic formated like Cloud Asset Inventory feed messages.

Cardinality

- one-several: one extraction job is scalled into x queries.

- x = (number of domains in GCI directory) x (36 email prefixes).

- email prefixes: a..z 0..9.

Automatic retrying

Yes.

Is recurssive

Yes.

Required environment variables

- GCIADMINUSERTOIMPERSONATE email of the Google Cloud Identity super admin to impersonate

- DIRECTORYCUSTOMERID Directory customer identifier. see gcloud organizations list

- INPUTTOPICNAME name of the PubSub topic used to trigger it self in recursive mode

- KEYJSONFILENAME name for the service account JSON file containig the key to authenticate against CGI

- OUTPUTTOPICNAME name of the PubSub topic where to deliver feed messages

- SERVICEACCOUNTNAME name of the service account used to asscess GCI

Implementation example

package p
import (
    "context"

    "github.com/BrunoReboul/ram/services/listgroups"
    "github.com/BrunoReboul/ram/utilities/ram"
)
var global listgroups.Global
var ctx = context.Background()

// EntryPoint is the function to be executed for each cloud function occurence
func EntryPoint(ctxEvent context.Context, PubSubMessage ram.PubSubMessage) error {
    return listgroups.EntryPoint(ctxEvent, PubSubMessage, &global)
}

func init() {
    listgroups.Initialize(ctx, &global)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntryPoint

func EntryPoint(ctxEvent context.Context, PubSubMessage ram.PubSubMessage, global *Global) error

EntryPoint is the function to be executed for each cloud function occurence

func Initialize

func Initialize(ctx context.Context, global *Global)

Initialize is to be executed in the init() function of the cloud function to optimize the cold start

Types

type Global

type Global struct {
	// contains filtered or unexported fields
}

Global structure for global variables to optimize the cloud function performances

type Settings

type Settings struct {
	Domain      string `json:"domain"`
	EmailPrefix string `json:"emailPrefix"`
}

Settings from PubSub triggering event

Jump to

Keyboard shortcuts

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