auth

package
v0.0.0-...-c0ffb5f Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchPermanentToken

func FetchPermanentToken(token string) (string, error)

FetchPermanentToken fetches a Permanent token from the Auth API using the provided access token

func IsLoggedIn

func IsLoggedIn() bool

IsLoggedIn checks if the user is logged in with the CLI and if the saved permanent token is valid

Types

type Organization

type Organization struct {
	ID          string `json:"organization_id"`
	Name        string `json:"name"`
	UserName    string `json:"user_name"`
	UID         string `json:"uid"`
	UserID      string `json:"id"`
	UserEmail   string `json:"user_email"`
	Pending     bool   `json:"pending"`
	Owner       bool   `json:"owner"`
	CreatedDate struct {
		Seconds     int64 `json:"_seconds"`
		NanoSeconds int64 `json:"nano_seconds"`
	} `json:"created_date"`
}

Organization models a Platformer Organization

func GetOrganizationIDFromName

func GetOrganizationIDFromName(orgName string) (*Organization, error)

GetOrganizationIDFromName returns the *Organization from a given name

type OrganizationList

type OrganizationList map[string]Organization

OrganizationList is a map of organizations by Name

func LoadOrganizationList

func LoadOrganizationList() (OrganizationList, error)

LoadOrganizationList fetches a list of organizations for the logged in user and also reads the currently selected org from the local config (and validates if the currently selected org is still valid)

func (OrganizationList) Names

func (o OrganizationList) Names() []string

Names returns the names of the organizations

type Project

type Project struct {
	ID    string `json:"projectId"`
	Name  string `json:"projectName"`
	Roles []struct {
		CollectionID string   `json:"collection_id"`
		RolesID      []string `json:"roles_id"`
	} `json:"roles"`
	IsProjectOwner bool `json:"isProjectOwner"`
}

Project models a Platformer Project

func GetProjectIDFromName

func GetProjectIDFromName(orgID string, projectName string) (*Project, error)

GetProjectIDFromName returns the *Project from a given name and an Organization ID

type ProjectList

type ProjectList map[string]Project

ProjectList is a map of Projects by name

func LoadProjectList

func LoadProjectList(organizationID string) (ProjectList, error)

LoadProjectList loads a list of Projects for the given organization

func LoadProjectsFromDefaultOrFlag

func LoadProjectsFromDefaultOrFlag(orgFlag string) (orgName string, projectList ProjectList, err error)

LoadProjectsFromDefaultOrFlag loads the projects for either the provided orgFlag or the default organization. The returned error will be of type cli.Error Note: If orgFlag is provided it will not use the saved default organization.

func (ProjectList) Names

func (p ProjectList) Names() []string

Names returns the names of the projects

Jump to

Keyboard shortcuts

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