Skip to content

Commit

Permalink
Go => 1.22 and lastest cloud.google.com/go/compute version
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasavelin committed Jun 7, 2024
1 parent 3a47821 commit 3ad7b9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/dentech-floss/metadata

go 1.17
go 1.22

require cloud.google.com/go/compute v1.6.1
require cloud.google.com/go/compute v1.27.0
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6m
cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s=
cloud.google.com/go/compute v1.6.1 h1:2sMmt8prCn7DPaG4Pmh0N3Inmc8cT8ae5k1M6VJ9Wqc=
cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU=
cloud.google.com/go/compute v1.27.0/go.mod h1:LG5HwRmWFKM2C5XxHRiNzkLLXW48WwvyVC0mfWsYPOM=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
Expand Down
10 changes: 5 additions & 5 deletions pkg/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ func NewMetadata() *Metadata {
}
}

// Returns the current instance's numeric project ID.
// NumericProjectID - Returns the current instance's numeric project ID.
func (m *Metadata) NumericProjectID() (string, error) {
if m.OnGCP {
return metadata.NumericProjectID()
}
return "", nil
}

// Returns the current VM's numeric instance ID.
// InstanceID - Returns the current VM's numeric instance ID.
func (m *Metadata) InstanceID() (string, error) {
if m.OnGCP {
return metadata.InstanceID()
}
return "", nil
}

// Returns the Cloud Run geographical region.
// Region - Returns the Cloud Run geographical region.
func (m *Metadata) Region() (string, error) {
if m.OnGCP {
return metadata.Get("instance/region")
}
return "", nil
}

// Returns an OIDC token to call another services that can validate an identity token.
// IdentityToken - Returns an OIDC token to call another services that can validate an identity token.
// On Cloud Run, the provided "audience" shall be the URL of the service you want to invoke.
// https://cloud.google.com/run/docs/securing/service-identity#identity_tokens
func (m *Metadata) IdentityToken(audience string) (string, error) {
Expand All @@ -66,7 +66,7 @@ func (m *Metadata) IdentityToken(audience string) (string, error) {
return "", nil
}

// Returns an access token required to call GCP API's with.
// AccessToken - Returns an access token required to call GCP API's with.
// The provided "scopes" shall be a list of the OAuth scopes requested.
// https://cloud.google.com/run/docs/securing/service-identity#access_tokens
func (m *Metadata) AccessToken(scopes []string) (string, error) {
Expand Down

0 comments on commit 3ad7b9e

Please sign in to comment.