Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Debug = &DebugParameters{}
var Help = &HelpParameters{}
Functions ¶
func AddStore ¶
func AddStore(store ParameterStore)
AddStore adds a ParameterStore to be initialized in the next Parse() call. This function is expected to be called from init()
func ResetStore ¶
func ResetStore()
ResetStore removes all stores registered from AddStore. This function is for testing.
Types ¶
type AuthParameters ¶
type AuthParameters struct { // AccessToken is the token used for GCP related requests. AccessToken *string // DisableMetadataServer // If this flag is set, KHI won't try to get access token from metadata server. DisableMetadataServer *bool // FixedProjectID is a GCP project ID prefilled in the form. User won't be able to edit it from the form. FixedProjectID *string // QuotaProjectID is a GCP project ID used as the quota project. This is useful when user wants to use KHI against a project with another project with larger logging read quota. QuotaProjectID *string // OAuthClientID is the client ID used for getting access tokens via OAuth. OAuthClientID *string // OAuthClientSecret is the client secret used for getting access tokens via OAuth. OAuthClientSecret *string // OAuthRedirectURI is the callback URL for OAuth. This must be provided as full qualified URL. OAuthRedirectURI *string // OAuthRedirectTargetServingPath is the path to serve the callback target. OAuthRedirectTargetServingPath *string // OAuthStateSuffix is the suffix added to the state parameter in OAuth. The state will be generated in the format of `<random-string><suffix>`. OAuthStateSuffix *string }
var Auth *AuthParameters = &AuthParameters{}
func (*AuthParameters) GetOAuthConfig ¶
func (a *AuthParameters) GetOAuthConfig() *oauth2.Config
GetOAuthConfig returns the *oauth2.Config constructed from the given parameter.
func (*AuthParameters) OAuthEnabled ¶
func (a *AuthParameters) OAuthEnabled() bool
OAuthEnabled returns if the oauth based access token resolution is enabled or not.
func (*AuthParameters) PostProcess ¶
func (a *AuthParameters) PostProcess() error
PostProcess implements ParameterStore.
func (*AuthParameters) Prepare ¶
func (a *AuthParameters) Prepare() error
Prepare implements ParameterStore.
type CommonParameters ¶
type CommonParameters struct { // DataDestinationFolder is the folder path where the final khi file to be stored for serving. DataDestinationFolder *string // TemporaryFolder is the folder path where be used as a working directory to generate the final khi file. TemporaryFolder *string // Version is the flag to show the version name and exit. Version *bool }
var Common *CommonParameters = &CommonParameters{}
func (*CommonParameters) PostProcess ¶
func (c *CommonParameters) PostProcess() error
PostProcess implements ParameterStore.
func (*CommonParameters) Prepare ¶
func (c *CommonParameters) Prepare() error
Prepare implements ParameterStore.
type DebugParameters ¶
type DebugParameters struct { // Profiler decides if KHI uses CloudProfiler or not. Profiler *bool // ProfilerService is the service name given to CloudProfiler. ProfilerService *string // ProfilerProject is the GCP project ID where the profiler sends the data to. ProfilerProject *string // Verbose // If this flag is set, KHI prints verbose logs. Verbose *bool // NoColor // If this flag is set, KHI prints logs without color. NoColor *bool }
DebugParameters is the ParameterStore for debug purpose parameters.
func (*DebugParameters) PostProcess ¶
func (d *DebugParameters) PostProcess() error
PostProcess implements ParameterStore.
func (*DebugParameters) Prepare ¶
func (d *DebugParameters) Prepare() error
Prepare implements ParameterStore.
type HelpParameters ¶
type HelpParameters struct { // Help // If this parameter is set, KHI exits with printing the usage. Help *bool }
func (*HelpParameters) PostProcess ¶
func (h *HelpParameters) PostProcess() error
func (*HelpParameters) Prepare ¶
func (h *HelpParameters) Prepare() error
type JobParameters ¶
type JobParameters struct { // JobMode // If this flag is set, KHI run as job mode and doesn't serve as a web server. JobMode *bool // InspectionType is the inspection type used in the job mode. Inspection types are defined in `inspection-type.go` in multiple directory. Check them for more details. InspectionType *string // InspectionFeatures is comma separated feature list to query. InspectionFeatures *string // InspectionValues is the JSON represented parameters. InspectionValues *string // ExportDestination is the destination file path of KHI file written after the query. ExportDestination *string }
var Job *JobParameters = &JobParameters{}
func (*JobParameters) PostProcess ¶
func (j *JobParameters) PostProcess() error
PostProcess implements ParameterStore.
func (*JobParameters) Prepare ¶
func (j *JobParameters) Prepare() error
Prepare implements ParameterStore.
type ParameterStore ¶
type ParameterStore interface { // Prepare initialize settings for reading parameters with `flag` package. Prepare() error // PostProcess override parsed parameters depending on the other parsed parameters. PostProcess() error }
ParameterStore parses subset of parameters given to KHI program.
type ServerParameters ¶
type ServerParameters struct { // ViewerMode limits the KHI feature to query logs with the backend. When it is true, KHI is only serve the frontend to open KHI files. ViewerMode *bool // Port is the port number where KHI server listens. Port *int // Host is the host address where KHI server serves. Host *string // BasePath specifies the base address of API endpoints. This path always ends with `/`. BasePath *string // FrontendResourceBasePath is another base address only for frontend assets. If this value is not set, this uses the BasePath value by default. FrontendResourceBasePath *string // FrontendAssetFolder is the root folder of the assets used in frontend including index.html. FrontendAssetFolder *string }
var Server *ServerParameters = &ServerParameters{}
func (*ServerParameters) PostProcess ¶
func (s *ServerParameters) PostProcess() error
PostProcess implements ParameterStore.
func (*ServerParameters) Prepare ¶
func (s *ServerParameters) Prepare() error
Prepare implements ParameterStore.