cloudrun

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

cloudrun is Cloud Run 固有のmetadataを扱う https://cloud.google.com/run/docs/reference/container-contract#env-vars

Index

Constants

View Source
const ConfigurationKey = "K_CONFIGURATION"

ConfigurationKey is Cloud Run Configuration Env Key

View Source
const RevisionKey = "K_REVISION"

RevisionKey is Cloud Run Revision Env Key

View Source
const ServiceKey = "K_SERVICE"

ServiceKey is Cloud Run Service Env Key

Variables

This section is empty.

Functions

func Configuration

func Configuration() (string, error)

Service is return Cloud Run service revision id The name of the Cloud Run configuration that created the revision. Example gcpboxtest

func InstanceID added in v1.16.0

func InstanceID() (string, error)

InstanceID is Cloud Runが動いているWorkerのIDを返す

GCP上で動いていない場合、 $INSTANCE_ID を返す

func NumericProjectID added in v1.16.0

func NumericProjectID() (string, error)

NumericProjectID is return Project Number

GCP上で動いていない場合、$NUMERIC_GOOGLE_CLOUD_PROJECT を返す

func OnCloudRun

func OnCloudRun() bool

OnCloudRun is AppがCloud Runで動いてるかどうか 環境変数見てるだけなので、偽装可能

func OnCloudRunReal

func OnCloudRunReal() bool

OnCloudRunReal is AppがCloudRunで動いてるかどうか 環境変数およびOnGCP()も見てるので、本当にCloud Runで動いてるか

func ProjectID added in v1.16.0

func ProjectID() (string, error)

ProjectID is return ProjectID Example gcpboxtest

GCP上で動いていない場合、$GOOGLE_CLOUD_PROJECT $GCLOUD_PROJECT を返す

func Region added in v1.16.0

func Region() (string, error)

Region is return Cloud Runが動作しているRegionを返す Example asia-northeast1

GCP上で動いていない場合、 $INSTANCE_REGION を返す

func Revision

func Revision() (string, error)

Service is return Cloud Run service revision id Example gcpboxtest-00009-xiz

func Service

func Service() (string, error)

Service is return Cloud Run service id Example gcpboxtest

func ServiceAccountEmail added in v1.16.0

func ServiceAccountEmail() (string, error)

ServiceAccountEmail is default service accountのEmailを返す

GCP上で動いていない場合、 $GCLOUD_SERVICE_ACCOUNT を返す

func ServiceAccountID added in v1.16.0

func ServiceAccountID() (string, error)

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

GCP上で動いていない場合、 $GOOGLE_CLOUD_PROJECT $GCLOUD_PROJECT $GCLOUD_SERVICE_ACCOUNT を見て返す

func ServiceAccountName added in v1.16.0

func ServiceAccountName() (string, error)

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

GCP上で動いていない場合、 $GCLOUD_SERVICE_ACCOUNT を見て返す

func ServiceAccountsDefaultToken added in v1.16.0

func ServiceAccountsDefaultToken() (string, error)

ServiceAccountsDefaultToken is default service accountのAccess Tokenを返す

GCP上で動いていない場合、 $SERVICE_ACCOUNTS_DEFAULT_TOKEN を返す

Types

This section is empty.

Jump to

Keyboard shortcuts

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