config

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaName              = "gman"
	PasswordHashCustomField = "passwordHash"
)
View Source
const (
	// WhoCanContactOwner
	GroupOptionAllManagersCanContact     = "ALL_MANAGERS_CAN_CONTACT"
	GroupOptionAllMembersCanContact      = "ALL_MEMBERS_CAN_CONTACT"
	GroupOptionAllInDomainCanContact     = "ALL_IN_DOMAIN_CAN_CONTACT"
	GroupOptionAnyoneCanContact          = "ANYONE_CAN_CONTACT"
	GroupOptionWhoCanContactOwnerDefault = GroupOptionAllInDomainCanContact

	// WhoCanViewMembership
	GroupOptionAllManagersCanViewMembership = "ALL_MANAGERS_CAN_VIEW"
	GroupOptionAllMembersCanViewMembership  = "ALL_MEMBERS_CAN_VIEW"
	GroupOptionAllInDomainCanViewMembership = "ALL_IN_DOMAIN_CAN_VIEW"
	GroupOptionWhoCanViewMembershipDefault  = GroupOptionAllMembersCanViewMembership

	// WhoCanApproveMembers
	GroupOptionAllManagersCanApproveMembers = "ALL_MANAGERS_CAN_APPROVE"
	GroupOptionAllOwnersCanApproveMembers   = "ALL_OWNERS_CAN_APPROVE"
	GroupOptionAllMembersCanApproveMembers  = "ALL_MEMBERS_CAN_APPROVE"
	GroupOptionNoneCanApproveMembers        = "NONE_CAN_APPROVE"
	GroupOptionWhoCanApproveMembersDefault  = GroupOptionAllManagersCanApproveMembers

	// WhoCanPostMessage
	GroupOptionNoneCanPostMessage        = "NONE_CAN_POST"
	GroupOptionAllOwnersCanPostMessage   = "ALL_OWNERS_CAN_POST"
	GroupOptionAllManagersCanPostMessage = "ALL_MANAGERS_CAN_POST"
	GroupOptionAllMembersCanPostMessage  = "ALL_MEMBERS_CAN_POST"
	GroupOptionAllInDomainCanPostMessage = "ALL_IN_DOMAIN_CAN_POST"
	GroupOptionAnyoneCanPostMessage      = "ANYONE_CAN_POST"
	GroupOptionWhoCanPostMessageDefault  = GroupOptionAllMembersCanPostMessage

	// WhoCanJoin
	GroupOptionInvitedCanJoin     = "INVITED_CAN_JOIN"
	GroupOptionCanRequestToJoin   = "CAN_REQUEST_TO_JOIN"
	GroupOptionAllInDomainCanJoin = "ALL_IN_DOMAIN_CAN_JOIN"
	GroupOptionAnyoneCanJoin      = "ANYONE_CAN_JOIN"
	GroupOptionWhoCanJoinDefault  = GroupOptionInvitedCanJoin

	// membership roles
	MemberRoleOwner   = "OWNER"
	MemberRoleManager = "MANAGER"
	MemberRoleMember  = "MEMBER"
)

Variables

View Source
var AllLicenses = []License{
	{
		ProductId: "Google-Apps",
		SkuId:     "1010020027",
		Name:      "GoogleWorkspaceBusinessStarter",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "1010020028",
		Name:      "GoogleWorkspaceBusinessStandard",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "1010020025",
		Name:      "GoogleWorkspaceBusinessPlus",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "1010060003",
		Name:      "GoogleWorkspaceEnterpriseEssentials",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "1010020026",
		Name:      "GoogleWorkspaceEnterpriseStandard",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "1010020020",
		Name:      "GoogleWorkspaceEnterprisePlus",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "1010060001",
		Name:      "GoogleWorkspaceEssentials",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "Google-Apps-Unlimited",
		Name:      "GSuiteBusiness",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "Google-Apps-For-Business",
		Name:      "GSuiteBasic",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "Google-Apps-Lite",
		Name:      "GSuiteLite",
	},

	{
		ProductId: "Google-Apps",
		SkuId:     "Google-Apps-For-Postini",
		Name:      "GoogleAppsMessageSecurity",
	},

	{
		ProductId: "101031",
		SkuId:     "1010310002",
		Name:      "GSuiteEnterpriseForEducation",
	},

	{
		ProductId: "101031",
		SkuId:     "1010310003",
		Name:      "GSuiteEnterpriseForEducationStudent",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-20GB",
		Name:      "GoogleDriveStorage20GB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-50GB",
		Name:      "GoogleDriveStorage50GB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-200GB",
		Name:      "GoogleDriveStorage200GB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-400GB",
		Name:      "GoogleDriveStorage400GB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-1TB",
		Name:      "GoogleDriveStorage1TB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-2TB",
		Name:      "GoogleDriveStorage2TB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-4TB",
		Name:      "GoogleDriveStorage4TB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-8TB",
		Name:      "GoogleDriveStorage8TB",
	},

	{
		ProductId: "Google-Drive-storage",
		SkuId:     "Google-Drive-storage-16TB",
		Name:      "GoogleDriveStorage16TB",
	},

	{
		ProductId: "Google-Vault",
		SkuId:     "Google-Vault",
		Name:      "GoogleVault",
	},

	{
		ProductId: "Google-Vault",
		SkuId:     "Google-Vault-Former-Employee",
		Name:      "GoogleVaultFormerEmployee",
	},

	{
		ProductId: "101001",
		SkuId:     "1010010001",
		Name:      "CloudIdentity",
	},

	{
		ProductId: "101005",
		SkuId:     "1010050001",
		Name:      "CloudIdentityPremium",
	},

	{
		ProductId: "101033",
		SkuId:     "1010330003",
		Name:      "GoogleVoiceStarter",
	},

	{
		ProductId: "101033",
		SkuId:     "1010330004",
		Name:      "GoogleVoiceStandard",
	},

	{
		ProductId: "101033",
		SkuId:     "1010330002",
		Name:      "GoogleVoicePremier",
	},
}

list of available GSuite Licenses

Functions

func HashPassword added in v0.6.0

func HashPassword(password string) string

HashPassword returns an shortened hash for the given password; the hash is not meant to validate password inputs, but only to compare if the passwords have changed

func SaveToFile

func SaveToFile(config *Config, filename string) error

func ToGSuiteGroup added in v0.5.0

func ToGSuiteGroup(group *Group) (*directoryv1.Group, *groupssettingsv1.Groups)

func ToGSuiteGroupMember added in v0.5.0

func ToGSuiteGroupMember(member *Member, gsuiteMember *directoryv1.Member) *directoryv1.Member

func ToGSuiteOrgUnit added in v0.5.0

func ToGSuiteOrgUnit(orgUnit *OrgUnit) *directoryv1.OrgUnit

func ToGSuiteUser added in v0.5.0

func ToGSuiteUser(user *User, enableInsecurePasswords bool) *directoryv1.User

func ValidateLicenses added in v0.5.0

func ValidateLicenses(licenses []License) []error

Types

type Config

type Config struct {
	Organization string    `yaml:"organization"`
	OrgUnits     []OrgUnit `yaml:"orgUnits,omitempty"`
	Users        []User    `yaml:"users,omitempty"`
	Groups       []Group   `yaml:"groups,omitempty"`
	Licenses     []License `yaml:"licenses,omitempty"`
}

func LoadFromFile

func LoadFromFile(filename string) (*Config, error)

func (*Config) DefaultGroups added in v0.5.0

func (c *Config) DefaultGroups() error

func (*Config) DefaultOrgUnits added in v0.5.0

func (c *Config) DefaultOrgUnits() error

func (*Config) DefaultUsers added in v0.5.0

func (c *Config) DefaultUsers() error

func (*Config) Sort added in v0.5.0

func (c *Config) Sort()

func (*Config) UndefaultGroups added in v0.5.0

func (c *Config) UndefaultGroups() error

func (*Config) UndefaultOrgUnits added in v0.5.0

func (c *Config) UndefaultOrgUnits() error

func (*Config) UndefaultUsers added in v0.5.0

func (c *Config) UndefaultUsers() error

func (*Config) ValidateGroups added in v0.0.6

func (c *Config) ValidateGroups() []error

func (*Config) ValidateOrgUnits added in v0.0.6

func (c *Config) ValidateOrgUnits() []error

func (*Config) ValidateUsers added in v0.0.6

func (c *Config) ValidateUsers() []error

type CustomSchema added in v0.6.0

type CustomSchema struct {
	PasswordHash string `json:"passwordHash"`
}

func GetUserSchema added in v0.6.0

func GetUserSchema(user *directoryv1.User) *CustomSchema

type Employee added in v0.5.0

type Employee struct {
	EmployeeID   string `yaml:"id,omitempty"`
	Department   string `yaml:"department,omitempty"`
	JobTitle     string `yaml:"jobTitle,omitempty"`
	Type         string `yaml:"type,omitempty"`
	CostCenter   string `yaml:"costCenter,omitempty"`
	ManagerEmail string `yaml:"managerEmail,omitempty"`
}

func (*Employee) Empty added in v0.5.0

func (e *Employee) Empty() bool

type Group added in v0.5.0

type Group struct {
	Name                 string   `yaml:"name"`
	Email                string   `yaml:"email"`
	Description          string   `yaml:"description,omitempty"`
	WhoCanContactOwner   string   `yaml:"whoCanContactOwner,omitempty"`
	WhoCanViewMembership string   `yaml:"whoCanViewMembers,omitempty"`
	WhoCanApproveMembers string   `yaml:"whoCanApproveMembers,omitempty"`
	WhoCanPostMessage    string   `yaml:"whoCanPostMessage,omitempty"`
	WhoCanJoin           string   `yaml:"whoCanJoin,omitempty"`
	AllowExternalMembers bool     `yaml:"allowExternalMembers,omitempty"`
	IsArchived           bool     `yaml:"isArchived,omitempty"`
	Members              []Member `yaml:"members,omitempty"`
}

func ToConfigGroup added in v0.5.0

func ToConfigGroup(gsuiteGroup *directoryv1.Group, settings *groupssettingsv1.Groups, members []*directoryv1.Member) (Group, error)

func (*Group) Sort added in v0.5.0

func (g *Group) Sort()

type License added in v0.5.0

type License struct {
	Name      string `yaml:"name"`
	ProductId string `yaml:"productId"`
	SkuId     string `yaml:"skuId"`
}

type Location added in v0.5.0

type Location struct {
	Building     string `yaml:"building,omitempty"`
	Floor        string `yaml:"floor,omitempty"`
	FloorSection string `yaml:"floorSection,omitempty"`
}

func (*Location) Empty added in v0.5.0

func (l *Location) Empty() bool

type Member added in v0.5.0

type Member struct {
	Email string `yaml:"email"`
	Role  string `yaml:"role,omitempty"`
}

func ToConfigGroupMember added in v0.5.0

func ToConfigGroupMember(gsuiteMember *directoryv1.Member) Member

type OrgUnit added in v0.5.0

type OrgUnit struct {
	Name              string `yaml:"name"`
	Description       string `yaml:"description,omitempty"`
	ParentOrgUnitPath string `yaml:"parentOrgUnitPath,omitempty"`
	BlockInheritance  bool   `yaml:"blockInheritance,omitempty"`
}

func ToConfigOrgUnit added in v0.5.0

func ToConfigOrgUnit(orgUnit *directoryv1.OrgUnit) OrgUnit

type User added in v0.5.0

type User struct {
	FirstName     string   `yaml:"givenName"`
	LastName      string   `yaml:"familyName"`
	PrimaryEmail  string   `yaml:"primaryEmail"`
	Aliases       []string `yaml:"aliases,omitempty"`
	Phones        []string `yaml:"phones,omitempty"`
	RecoveryPhone string   `yaml:"recoveryPhone,omitempty"`
	RecoveryEmail string   `yaml:"recoveryEmail,omitempty"`
	OrgUnitPath   string   `yaml:"orgUnitPath,omitempty"`
	Licenses      []string `yaml:"licenses,omitempty"`
	Employee      Employee `yaml:"employeeInfo,omitempty"`
	Location      Location `yaml:"location,omitempty"`
	Address       string   `yaml:"address,omitempty"`
	Password      string   `yaml:"password,omitempty"`
}

func ToConfigUser added in v0.5.0

func ToConfigUser(gsuiteUser *directoryv1.User, userLicenses []License) (User, error)

func (*User) Sort added in v0.5.0

func (u *User) Sort()

Jump to

Keyboard shortcuts

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