Show / Hide Table of Contents

Class GcePlatformDetails

Google Compute Engine details.

Inheritance
System.Object
GcePlatformDetails
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api.Gax
Assembly: Google.Api.Gax.dll
Syntax
public sealed class GcePlatformDetails

Constructors

GcePlatformDetails(String, String, String, String)

Construct details of Google Compute Engine

Declaration
public GcePlatformDetails(string metadataJson, string projectId, string instanceId, string zoneName)
Parameters
Type Name Description
System.String metadataJson

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

System.String projectId

The project ID. Must not be null.

System.String instanceId

The instance ID. Must not be null.

System.String zoneName

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 System.InvalidOperationException. If this value has been retrived from Google Compute Engine, the it's format will be the one described above.

Properties

InstanceId

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

Declaration
public string InstanceId { get; }
Property Value
Type Description
System.String

Location

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 System.InvalidOperationException.

Declaration
public string Location { get; }
Property Value
Type Description
System.String

MetadataJson

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

Declaration
public string MetadataJson { get; }
Property Value
Type Description
System.String

ProjectId

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

Declaration
public string ProjectId { get; }
Property Value
Type Description
System.String

ZoneName

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.

Declaration
public string ZoneName { get; }
Property Value
Type Description
System.String

Methods

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

TryLoad(String)

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

Declaration
public static GcePlatformDetails TryLoad(string metadataJson)
Parameters
Type Name Description
System.String metadataJson

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

Returns
Type Description
GcePlatformDetails

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

Back to top