Documentation ¶
Index ¶
- Constants
- Variables
- func AppEngineDeploymentID() (string, error)
- func AppEngineEnv() (string, error)
- func AppEngineInstance() (string, error)
- func AppEngineMemoryMB() (string, error)
- func AppEngineRuntime() (string, error)
- func AppEngineService() (string, error)
- func AppEngineVersion() (string, error)
- func ExtractionRegion(metaZone string) (string, error)
- func ExtractionZone(metaZone string) (string, error)
- func GetInstanceAttribute(key string) (string, error)
- func GetProjectAttribute(key string) (string, error)
- func NewErrInvalidArgument(message string, kv map[string]interface{}, err error) error
- func NewErrNotFound(message string, kv map[string]interface{}, err error) error
- func OnGCP() bool
- func ProjectID() (string, error)
- func Region() (string, error)
- func ServiceAccountEmail() (string, error)
- func ServiceAccountID() (string, error)
- func ServiceAccountName() (string, error)
- func Zone() (string, error)
- type Error
Constants ¶
const AppEngineDeploymentIDKey = "GAE_DEPLOYMENT_ID"
AppEngineDeploymentIDKey is App Engine Deployment ID Key
const AppEngineEnvKey = "GAE_ENV"
AppEngineEnvKey is App Engine Env Env Key
const AppEngineInstanceKey = "GAE_INSTANCE"
AppEngineInstanceKey is App Engine Instance Env Key
const AppEngineMemoryMBKey = "GAE_MEMORY_MB"
AppEngineMemoryMBKey is App Engine Memory MB Env Key
const AppEngineRuntimeKey = "GAE_RUNTIME"
AppEngineRuntimeKey is App Engine Runtime Env Key
const AppEngineServiceKey = "GAE_SERVICE"
AppEngineServiceKey is App Engine Service Env Key
const AppEngineVersionKey = "GAE_VERSION"
AppEngineVersionKey is App Engine Version Env Key
Variables ¶
var ErrInvalidArgument = &Error{ Code: "InvalidArgument", Message: "invalid argument", KV: map[string]interface{}{}, }
ErrInvalidArgument is 引数がおかしい時に返す
var ErrNotFound = &Error{ Code: "NotFound", Message: "not found", KV: map[string]interface{}{}, }
ErrNotFound is 見つからなかった時に返す
Functions ¶
func AppEngineDeploymentID ¶
AppEngineDeploymentID is return deployment id The ID of the current deployment. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables
func AppEngineEnv ¶
AppEngineEnv is return env The App Engine environment. Set to standard. https://cloud.google.com/appengine/docs/standard/go/runtime#environment_variables
func AppEngineInstance ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
ExtractionRegion is Metadata Serverから取得する projects/[NUMERIC_PROJECT_ID]/zones/[ZONE] 形式の文字列から、Region部分を取り出す
func ExtractionZone ¶
ExtractionZone is Metadata Serverから取得する projects/[NUMERIC_PROJECT_ID]/zones/[ZONE] 形式の文字列から、Zone部分を取り出す
func GetInstanceAttribute ¶
GetInstanceAttribute is Instance Metadataを取得する GCP以外で動いている時は、環境変数を取得する
func GetProjectAttribute ¶
GetProjectAttribute is Project Metadataを取得する GCP以外で動いている時は、環境変数を取得する
func NewErrInvalidArgument ¶ added in v1.15.0
NewErrInvalidArgument is return ErrInvalidArgument
func NewErrNotFound ¶ added in v1.15.0
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 ¶
ProjectID is Return current GCP ProjectID GCP上で動いている場合は、Project Metadataから取得し、そうでなければ、環境変数から取得する
func ServiceAccountEmail ¶
ServiceAccountEmail is Return current Service Account Email GCP上で動いている場合は、Metadataから取得し、そうでなければ、環境変数から取得する
func ServiceAccountID ¶ added in v1.2.0
ServiceAccountID is Return current Service Account ID fmt "projects/$PROJECT_ID/serviceAccounts/$SERVICE_ACCOUNT_EMAIL"
func ServiceAccountName ¶ added in v1.2.0
ServiceAccountName is Return current Service Account Name ServiceAccountEmailの@より前の部分を返す