site

package
v0.0.0-...-9994f1b Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package site contains site local constants for the shivas

Index

Constants

View Source
const Major = 7

Major is the Major version number

View Source
const Minor = 2

Minor is the Minor version number

View Source
const Patch = 0

Patch is the PAtch version number

Variables

View Source
var (
	// OSLikeNamespaces are namespaces that store primarily chromeos data.
	// This includes a separate partner namespace which stores chromeos data.
	OSLikeNamespaces = []string{ufsUtil.OSNamespace, ufsUtil.OSPartnerNamespace}
	// AllNamespaces contain all namespaces UFS considers valid.
	AllNamespaces = ufsUtil.ValidClientNamespaceStr()
)
View Source
var CipdInstalledPath = "go.chromium.org/infra/shivas/"

CipdInstalledPath is the installed path for shivas package.

View Source
var DefaultAuthOptions = chromeinfra.SetDefaultAuthOptions(auth.Options{
	Scopes:     GetAuthScopes(DefaultAuthScopes),
	SecretsDir: SecretsDir(),
})

DefaultAuthOptions is an auth.Options struct prefilled with chrome-infra defaults.

View Source
var DefaultAuthScopes = []string{auth.OAuthScopeEmail, "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/cloud-platform"}

DefaultAuthScopes is the default scopes for shivas login

View Source
var VersionNumber = fmt.Sprintf("%d.%d.%d", Major, Minor, Patch)

VersionNumber is the version number for the tool. It follows the Semantic Versioning Specification (http://semver.org) and the format is: "MAJOR.MINOR.0+BUILD_TIME". We can ignore the PATCH part (i.e. it's always 0) to make the maintenance work easier. We can also print out the build time (e.g. 20060102150405) as the METADATA when show version to users.

Functions

func Contains

func Contains(arr []string, str string) bool

Contains determines if `arr` has the element `str` as one of it's elements

func DefaultPRPCOptions

func DefaultPRPCOptions(e EnvFlags) *prpc.Options

DefaultPRPCOptions is used for PRPC clients. If it is nil, the default value is used. See prpc.Options for details.

This is provided so it can be overridden for testing.

func GetAuthScopes

func GetAuthScopes(defaultScopes []string) []string

GetAuthScopes get environment scopes if set Otherwise, return default scopes

func ProdDefaultPRPCOptions

func ProdDefaultPRPCOptions() *prpc.Options

ProdDefaultPRPCOptions returns UFS PRPC client options for the prod project

func SecretsDir

func SecretsDir() string

SecretsDir customizes the location for auth-related secrets.

Types

type CommonFlags

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

CommonFlags controls some commonly-used CLI flags.

func (*CommonFlags) Register

func (f *CommonFlags) Register(fl *flag.FlagSet)

Register sets up the common flags.

func (*CommonFlags) Verbose

func (f *CommonFlags) Verbose() bool

Verbose returns if the command is set to verbose mode.

type EnvFlags

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

EnvFlags controls selection of the environment: either prod (default) or dev.

func (EnvFlags) Env

func (f EnvFlags) Env() Environment

Env returns the environment, either dev or prod.

func (EnvFlags) Namespace

func (f EnvFlags) Namespace(validNSList []string, defaultNS string) (string, error)

Namespace returns the namespace and validates the namespace is: 1) nonempty 2) a namespace that UFS expects 3) a namespace the command expects

Supports default namespaces if defaultNS != "". These will be returned if no value is passed via flag or env var

func (*EnvFlags) Register

func (f *EnvFlags) Register(fl *flag.FlagSet)

Register sets up the -dev argument.

type Environment

type Environment struct {
	AdminService           string
	InventoryService       string
	UnifiedFleetService    string
	SwarmingService        string
	SwarmingServiceAccount string
	LogdogService          string
	QueenService           string
}

Environment contains environment specific values.

func Dev

func Dev(isLocal bool) Environment

Dev is the environment for dev.

func Prod

func Prod(isLocal bool) Environment

Prod is the environment for prod.

type OutputFlags

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

OutputFlags controls output-related CLI flags.

func (*OutputFlags) Full

func (f *OutputFlags) Full() bool

Full returns if the full format of output is logged in tsv format (without title)

func (*OutputFlags) JSON

func (f *OutputFlags) JSON() bool

JSON returns if the output is logged in json format

func (*OutputFlags) NoEmit

func (f *OutputFlags) NoEmit() bool

NoEmit returns if output json should NOT print/emit unpopulated fields

func (*OutputFlags) Register

func (f *OutputFlags) Register(fl *flag.FlagSet)

Register sets up the output flags.

func (*OutputFlags) Tsv

func (f *OutputFlags) Tsv() bool

Tsv returns if the output is logged in tsv format (without title)

Jump to

Keyboard shortcuts

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