Help us shape the future of Go! Take the 2026 Go Developer Survey

gcpregionquery

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 5 Imported by: 0

README

go-gcp-region-query

Retrieves the Google GCP Region name where your VM is currently running in.

Installation:

go get github.com/tigraine/go-gcp-region-query

Usage:

import "github.com/tigraine/go-gcp-region-query"

region, err := gcpregionquery.GetLocalRegion()
if err != nil {
  // You are either not running in a GCP Datacenter or there was a problem calling the API
}
fmt.Println(region) // Example: europe-west1-c

Documentation

Overview

Package gcpregionquery retrieves the Google GCP Region name where your VM is currently running in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstanceName

func GetInstanceName() (string, error)

func GetLocalRegion

func GetLocalRegion() (string, error)

GetLocalRegion returns the local GCP Region with a default Timeout of 1s

func GetLocalRegionWithTimeout

func GetLocalRegionWithTimeout(timeout time.Duration) (string, error)

GetLocalRegionWithTimeout returns the local GCP Region w. a configurable Timeout for the HTTP Request to the GCP Metadata API. Returns the DC name like europe-west1-c.

Types

This section is empty.

Jump to

Keyboard shortcuts

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