metadata

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AppEngineDeploymentIDKey = "GAE_DEPLOYMENT_ID"

AppEngineDeploymentIDKey is App Engine Deployment ID Key

View Source
const AppEngineEnvKey = "GAE_ENV"

AppEngineEnvKey is App Engine Env Env Key

View Source
const AppEngineInstanceKey = "GAE_INSTANCE"

AppEngineInstanceKey is App Engine Instance Env Key

View Source
const AppEngineMemoryMBKey = "GAE_MEMORY_MB"

AppEngineMemoryMBKey is App Engine Memory MB Env Key

View Source
const AppEngineRuntimeKey = "GAE_RUNTIME"

AppEngineRuntimeKey is App Engine Runtime Env Key

View Source
const AppEngineServiceKey = "GAE_SERVICE"

AppEngineServiceKey is App Engine Service Env Key

View Source
const AppEngineVersionKey = "GAE_VERSION"

AppEngineVersionKey is App Engine Version Env Key

Variables

View Source
var ErrInvalidArgument = &Error{
	Code:    "InvalidArgument",
	Message: "invalid argument",
	KV:      map[string]interface{}{},
}

ErrInvalidArgument is 引数がおかしい時に返す

View Source
var ErrNotFound = &Error{
	Code:    "NotFound",
	Message: "not found",
	KV:      map[string]interface{}{},
}

ErrNotFound is 見つからなかった時に返す

Functions

func AppEngineDeploymentID

func AppEngineDeploymentID() (string, error)

AppEngineDeploymentID is return deployment id The ID of the current deployment. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables

func AppEngineEnv

func AppEngineEnv() (string, error)

AppEngineEnv is return env The App Engine environment. Set to standard. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables

func AppEngineInstance

func AppEngineInstance() (string, error)

AppEngineInstance is return version id The ID of the instance on which your service is currently running. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables

func AppEngineMemoryMB

func AppEngineMemoryMB() (string, error)

AppEngineMemoryMB is return MemoryMB The amount of memory available to the application process, in MB. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables

func AppEngineRuntime

func AppEngineRuntime() (string, error)

AppEngineRuntime is return runtime The runtime specified in your app.yaml file. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables

func AppEngineService

func AppEngineService() (string, error)

AppEngineService is return service id The service name specified in your app.yaml file. If no service name is specified, it is set to default. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables

func AppEngineVersion

func AppEngineVersion() (string, error)

AppEngineVersion is return version id The current version label of your service. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables

func ExtractionRegion

func ExtractionRegion(metaZone string) (string, error)

ExtractionRegion is Metadata Serverから取得する projects/[NUMERIC_PROJECT_ID]/zones/[ZONE] 形式の文字列から、Region部分を取り出す

func ExtractionZone

func ExtractionZone(metaZone string) (string, error)

ExtractionZone is Metadata Serverから取得する projects/[NUMERIC_PROJECT_ID]/zones/[ZONE] 形式の文字列から、Zone部分を取り出す

func GetInstanceAttribute

func GetInstanceAttribute(key string) (string, error)

GetInstanceAttribute is Instance Metadataを取得する GCP以外で動いている時は、環境変数を取得する

func GetProjectAttribute

func GetProjectAttribute(key string) (string, error)

GetProjectAttribute is Project Metadataを取得する GCP以外で動いている時は、環境変数を取得する

func NewErrInvalidArgument added in v1.15.0

func NewErrInvalidArgument(message string, kv map[string]interface{}, err error) error

NewErrInvalidArgument is return ErrInvalidArgument

func NewErrNotFound added in v1.15.0

func NewErrNotFound(message string, kv map[string]interface{}, err error) error

NewErrNotFound is return ErrNotFound

func OnGCP

func OnGCP() bool

OnGCP is GCP上で動いているかどうかを返す GCP上と判断されるか確認したのは以下 Google App Engine Standard for Go 1.11 Google Compute Engine Google Kubernetes Engine

func ProjectID

func ProjectID() (string, error)

ProjectID is Return current GCP ProjectID GCP上で動いている場合は、Project Metadataから取得し、そうでなければ、環境変数から取得する

func Region

func Region() (string, error)

Region is Appが動いているRegionを取得する

func ServiceAccountEmail

func ServiceAccountEmail() (string, error)

ServiceAccountEmail is Return current Service Account Email GCP上で動いている場合は、Metadataから取得し、そうでなければ、環境変数から取得する

func ServiceAccountID added in v1.2.0

func ServiceAccountID() (string, error)

ServiceAccountID is Return current Service Account ID fmt "projects/$PROJECT_ID/serviceAccounts/$SERVICE_ACCOUNT_EMAIL"

func ServiceAccountName added in v1.2.0

func ServiceAccountName() (string, error)

ServiceAccountName is Return current Service Account Name ServiceAccountEmailの@より前の部分を返す

func Zone

func Zone() (string, error)

Zone is Appが動いているZoneを取得する

Types

type Error

type Error struct {
	Code    string
	Message string
	KV      map[string]interface{}
	// contains filtered or unexported fields
}

Error is Error情報を保持する struct

func (*Error) Error added in v1.15.0

func (e *Error) Error() string

Error is error interface func

func (*Error) Is added in v1.15.0

func (e *Error) Is(target error) bool

Is is err equal check

func (*Error) Unwrap added in v1.15.0

func (e *Error) Unwrap() error

Unwrap is return unwrap error

Jump to

Keyboard shortcuts

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