gke

package module
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: GPL-3.0 Imports: 18 Imported by: 2

Documentation

Overview

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright © 2020 A. Jensen <jensen.aaro@gmail.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const RequestContextKey = requestContextKey(`gkeRequestContextKey`)

Variables

View Source
var (
	LogGke bool
	LogStd bool
)

Functions

func AliveContext added in v0.0.24

func AliveContext() (context.Context, context.CancelFunc)

AliveContext returns a context that is used to communicate a shutdown to various parts of an application.

func Do added in v0.0.24

func Do(f func(context.Context) error)

func InstanceID added in v0.0.24

func InstanceID() string

func InstanceName added in v0.0.16

func InstanceName() string

func NewServer added in v0.0.10

func NewServer(ctx context.Context, handler http.Handler, lg Logger) (*http.Server, error)

func OnGCE added in v0.0.16

func OnGCE() bool

func WaitForCleanup added in v0.0.24

func WaitForCleanup(timeout time.Duration) error

Types

type LogClient

type LogClient struct {
	log.Client
}

func NewLogClient

func NewLogClient(ctx context.Context) (LogClient, func(), error)

func (LogClient) Logger

func (lc LogClient) Logger(logId string, opts ...logging.LoggerOption) Logger

type Logger added in v0.0.3

type Logger struct {
	log.Logger
}

func (Logger) Alert added in v0.0.24

func (l Logger) Alert(args ...interface{})

func (Logger) AlertErr added in v0.0.24

func (l Logger) AlertErr(err error) error

func (Logger) Alertf added in v0.0.24

func (l Logger) Alertf(format string, args ...interface{}) string

func (Logger) Critical added in v0.0.24

func (l Logger) Critical(args ...interface{})

func (Logger) CriticalErr added in v0.0.24

func (l Logger) CriticalErr(err error) error

func (Logger) Criticalf added in v0.0.24

func (l Logger) Criticalf(format string, args ...interface{}) string

func (Logger) Debug added in v0.0.24

func (l Logger) Debug(args ...interface{})

func (Logger) DebugErr added in v0.0.24

func (l Logger) DebugErr(err error) error

func (Logger) Debugf added in v0.0.24

func (l Logger) Debugf(format string, args ...interface{}) string

func (Logger) Default added in v0.0.24

func (l Logger) Default(args ...interface{})

func (Logger) DefaultErr added in v0.0.24

func (l Logger) DefaultErr(err error) error

func (Logger) Defaultf added in v0.0.24

func (l Logger) Defaultf(format string, args ...interface{}) string

func (Logger) Emergency added in v0.0.24

func (l Logger) Emergency(args ...interface{})

func (Logger) EmergencyErr added in v0.0.24

func (l Logger) EmergencyErr(err error) error

func (Logger) Emergencyf added in v0.0.24

func (l Logger) Emergencyf(format string, args ...interface{}) string

func (Logger) Error added in v0.0.3

func (l Logger) Error(args ...interface{})

func (Logger) ErrorErr added in v0.0.7

func (l Logger) ErrorErr(err error) error

func (Logger) Errorf added in v0.0.3

func (l Logger) Errorf(format string, args ...interface{}) string

func (Logger) Info added in v0.0.24

func (l Logger) Info(args ...interface{})

func (Logger) InfoErr added in v0.0.7

func (l Logger) InfoErr(err error) error

func (Logger) Infof added in v0.0.3

func (l Logger) Infof(format string, args ...interface{}) string

func (Logger) Notice added in v0.0.24

func (l Logger) Notice(args ...interface{})

func (Logger) NoticeErr added in v0.0.7

func (l Logger) NoticeErr(err error) error

func (Logger) Noticef added in v0.0.3

func (l Logger) Noticef(format string, args ...interface{}) string

func (Logger) StandardLogger added in v0.0.12

func (l Logger) StandardLogger(severity logging.Severity) *stdlog.Logger

func (Logger) Warning added in v0.0.24

func (l Logger) Warning(args ...interface{})

func (Logger) WarningErr added in v0.0.24

func (l Logger) WarningErr(err error) error

func (Logger) Warningf added in v0.0.24

func (l Logger) Warningf(format string, args ...interface{}) string

type MetadataType added in v0.0.24

type MetadataType struct {
	OnGCE              bool
	ProjectID          string
	InstanceID         string
	InstanceName       string
	ExternalIP         string
	InternalIP         string
	Hostname           string
	Zone               string
	InstanceTags       []string
	InstanceAttributes map[string]string
	ProjectAttributes  map[string]string
}

func Metadata added in v0.0.24

func Metadata() *MetadataType

type StorageClient added in v0.0.12

type StorageClient interface {
	HMACKeyHandle(projectID, accessID string) *storage.HMACKeyHandle
	CreateHMACKey(ctx context.Context, projectID, serviceAccountEmail string, opts ...storage.HMACKeyOption) (*storage.HMACKey, error)
	ListHMACKeys(ctx context.Context, projectID string, opts ...storage.HMACKeyOption) *storage.HMACKeysIterator
	ServiceAccount(ctx context.Context, projectID string) (string, error)
	Bucket(name string) *storage.BucketHandle
	Buckets(ctx context.Context, projectID string) *storage.BucketIterator
}

func NewStorageClient added in v0.0.12

func NewStorageClient(ctx context.Context) (StorageClient, func(), error)

Directories

Path Synopsis
internal
log

Jump to

Keyboard shortcuts

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