Class SnapshotName (2.3.0)

public sealed class SnapshotName : IResourceName, IEquatable<SnapshotName>

Resource name for the Snapshot resource.

Inheritance

System.Object > SnapshotName

Implements

Google.Api.Gax.IResourceName, System.IEquatable<SnapshotName>

Namespace

Google.Cloud.PubSub.V1

Assembly

Google.Cloud.PubSub.V1.dll

Constructors

SnapshotName(String, String)

public SnapshotName(string projectId, string snapshotId)

Constructs a new instance of a SnapshotName class from the component parts of pattern projects/{project}/snapshots/{snapshot}

Parameters
NameDescription
projectIdSystem.String

The Project ID. Must not be null or empty.

snapshotIdSystem.String

The Snapshot ID. Must not be null or empty.

Properties

IsKnownPattern

public bool IsKnownPattern { get; }

Whether this instance contains a resource name with a known pattern.

Property Value
TypeDescription
System.Boolean

ProjectId

public string ProjectId { get; }

The Project ID. Will not be null, unless this instance contains an unparsed resource name.

Property Value
TypeDescription
System.String

SnapshotId

public string SnapshotId { get; }

The Snapshot ID. Will not be null, unless this instance contains an unparsed resource name.

Property Value
TypeDescription
System.String

Type

public SnapshotName.ResourceNameType Type { get; }

The SnapshotName.ResourceNameType of the contained resource name.

Property Value
TypeDescription
SnapshotName.ResourceNameType

UnparsedResource

public UnparsedResourceName UnparsedResource { get; }

The contained Google.Api.Gax.UnparsedResourceName. Only non-null if this instance contains an unparsed resource name.

Property Value
TypeDescription
Google.Api.Gax.UnparsedResourceName

Methods

Format(String, String)

public static string Format(string projectId, string snapshotId)

Formats the IDs into the string representation of this SnapshotName with pattern projects/{project}/snapshots/{snapshot}.

Parameters
NameDescription
projectIdSystem.String

The Project ID. Must not be null or empty.

snapshotIdSystem.String

The Snapshot ID. Must not be null or empty.

Returns
TypeDescription
System.String

The string representation of this SnapshotName with pattern projects/{project}/snapshots/{snapshot}.

FormatProjectSnapshot(String, String)

public static string FormatProjectSnapshot(string projectId, string snapshotId)

Formats the IDs into the string representation of this SnapshotName with pattern projects/{project}/snapshots/{snapshot}.

Parameters
NameDescription
projectIdSystem.String

The Project ID. Must not be null or empty.

snapshotIdSystem.String

The Snapshot ID. Must not be null or empty.

Returns
TypeDescription
System.String

The string representation of this SnapshotName with pattern projects/{project}/snapshots/{snapshot}.

FromProjectSnapshot(String, String)

public static SnapshotName FromProjectSnapshot(string projectId, string snapshotId)

Creates a SnapshotName with the pattern projects/{project}/snapshots/{snapshot}.

Parameters
NameDescription
projectIdSystem.String

The Project ID. Must not be null or empty.

snapshotIdSystem.String

The Snapshot ID. Must not be null or empty.

Returns
TypeDescription
SnapshotName

A new instance of SnapshotName constructed from the provided ids.

FromUnparsed(UnparsedResourceName)

public static SnapshotName FromUnparsed(UnparsedResourceName unparsedResourceName)

Creates a SnapshotName containing an unparsed resource name.

Parameter
NameDescription
unparsedResourceNameGoogle.Api.Gax.UnparsedResourceName

The unparsed resource name. Must not be null.

Returns
TypeDescription
SnapshotName

A new instance of SnapshotName containing the provided unparsedResourceName .

GetHashCode()

public override int GetHashCode()

Returns a hash code for this resource name.

Returns
TypeDescription
System.Int32
Overrides
System.Object.GetHashCode()

Parse(String)

public static SnapshotName Parse(string snapshotName)

Parses the given resource name string into a new SnapshotName instance.

Parameter
NameDescription
snapshotNameSystem.String

The resource name in string form. Must not be null.

Returns
TypeDescription
SnapshotName

The parsed SnapshotName if successful.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/snapshots/{snapshot}

Parse(String, Boolean)

public static SnapshotName Parse(string snapshotName, bool allowUnparsed)

Parses the given resource name string into a new SnapshotName instance; optionally allowing an unparseable resource name.

Parameters
NameDescription
snapshotNameSystem.String

The resource name in string form. Must not be null.

allowUnparsedSystem.Boolean

If true will successfully store an unparseable resource name into the UnparsedResource property; otherwise will throw an System.ArgumentException if an unparseable resource name is specified.

Returns
TypeDescription
SnapshotName

The parsed SnapshotName if successful.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/snapshots/{snapshot}
Or may be in any format if allowUnparsed is true.

ToString()

public override string ToString()

The string representation of the resource name.

Returns
TypeDescription
System.String

The string representation of the resource name.

Overrides
System.Object.ToString()

TryParse(String, out SnapshotName)

public static bool TryParse(string snapshotName, out SnapshotName result)

Tries to parse the given resource name string into a new SnapshotName instance.

Parameters
NameDescription
snapshotNameSystem.String

The resource name in string form. Must not be null.

resultSnapshotName

When this method returns, the parsed SnapshotName, or null if parsing failed.

Returns
TypeDescription
System.Boolean

true if the name was parsed successfully; false otherwise.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/snapshots/{snapshot}

TryParse(String, Boolean, out SnapshotName)

public static bool TryParse(string snapshotName, bool allowUnparsed, out SnapshotName result)

Tries to parse the given resource name string into a new SnapshotName instance; optionally allowing an unparseable resource name.

Parameters
NameDescription
snapshotNameSystem.String

The resource name in string form. Must not be null.

allowUnparsedSystem.Boolean

If true will successfully store an unparseable resource name into the UnparsedResource property; otherwise will throw an System.ArgumentException if an unparseable resource name is specified.

resultSnapshotName

When this method returns, the parsed SnapshotName, or null if parsing failed.

Returns
TypeDescription
System.Boolean

true if the name was parsed successfully; false otherwise.

Remarks

To parse successfully, the resource name must be formatted as one of the following:

  • projects/{project}/snapshots/{snapshot}
Or may be in any format if allowUnparsed is true.

Operators

Equality(SnapshotName, SnapshotName)

public static bool operator ==(SnapshotName a, SnapshotName b)
Parameters
NameDescription
aSnapshotName
bSnapshotName
Returns
TypeDescription
System.Boolean

Inequality(SnapshotName, SnapshotName)

public static bool operator !=(SnapshotName a, SnapshotName b)
Parameters
NameDescription
aSnapshotName
bSnapshotName
Returns
TypeDescription
System.Boolean