Class GcePlatformDetails (4.4.0)

public sealed class GcePlatformDetails

Google Compute Engine details.

Inheritance

object > GcePlatformDetails

Namespace

Google.Api.Gax

Assembly

Google.Api.Gax.dll

Constructors

GcePlatformDetails(string, string, string, string)

public GcePlatformDetails(string metadataJson, string projectId, string instanceId, string zoneName)

Construct details of Google Compute Engine

Parameters
NameDescription
metadataJsonstring

The full JSON string retrieved from the metadata server. Must not be null.

projectIdstring

The project ID. Must not be null.

instanceIdstring

The instance ID. Must not be null.

zoneNamestring

The zone name. Must not be null. If this value is in the format

projects/<project-number>/zones/<zone-name>
then Location will return the
<zone-name>
part of this value. If not, Location will throw InvalidOperationException. If this value has been retrived from Google Compute Engine, the it's format will be the one described above.

Properties

InstanceId

public string InstanceId { get; }

The Instance ID of the GCE instance on which this is running. This is never null.

Property Value
TypeDescription
string

Location

public string Location { get; }

The zone name where this GCE instance is running. If ZoneName is in the format

projects/<project-number>/zones/<zone-name>
this value will be the
<zone-name>
part in ZoneName. If ZoneName is in a different format then this getting the value of this property will throw InvalidOperationException.

Property Value
TypeDescription
string

MetadataJson

public string MetadataJson { get; }

The full JSON string retrieved from the metadata server. This is never null.

Property Value
TypeDescription
string

ProjectId

public string ProjectId { get; }

The Project ID under which this GCE instance is running. This is never null.

Property Value
TypeDescription
string

ZoneName

public string ZoneName { get; }

The zone where this GCE instance is running. This is never null. This will be in the format

projects/<project-number>/zones/<zone-name>
id the value has been retrieved from Google Compute Engine.

Property Value
TypeDescription
string

Methods

ToString()

public override string ToString()
Returns
TypeDescription
string
Overrides

TryLoad(string)

public static GcePlatformDetails TryLoad(string metadataJson)

Builds a GcePlatformDetails from the given metadata. This metadata is normally retrieved from the GCE metadata server.

Parameter
NameDescription
metadataJsonstring

JSON metadata, normally retrieved from the GCE metadata server. Must not be null.

Returns
TypeDescription
GcePlatformDetails

A populated GcePlatformDetails if the metadata represents and GCE instance; null otherwise.