Class SnapshotName

public sealed class SnapshotName : IResourceName, IEquatable<SnapshotName>

Resource name for the Snapshot resource.

Inheritance

Object > 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
TypeNameDescription
StringprojectId

The Project ID. Must not be null or empty.

StringsnapshotId

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
Boolean

ProjectId

public string ProjectId { get; }

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

Property Value
TypeDescription
String

SnapshotId

public string SnapshotId { get; }

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

Property Value
TypeDescription
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 UnparsedResourceName. Only non-null if this instance contains an unparsed resource name.

Property Value
TypeDescription
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
TypeNameDescription
StringprojectId

The Project ID. Must not be null or empty.

StringsnapshotId

The Snapshot ID. Must not be null or empty.

Returns
TypeDescription
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
TypeNameDescription
StringprojectId

The Project ID. Must not be null or empty.

StringsnapshotId

The Snapshot ID. Must not be null or empty.

Returns
TypeDescription
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
TypeNameDescription
StringprojectId

The Project ID. Must not be null or empty.

StringsnapshotId

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
TypeNameDescription
UnparsedResourceNameunparsedResourceName

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
Int32
Overrides

Parse(String)

public static SnapshotName Parse(string snapshotName)

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

Parameter
TypeNameDescription
StringsnapshotName

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
TypeNameDescription
StringsnapshotName

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

BooleanallowUnparsed

If true will successfully store an unparseable resource name into the UnparsedResource property; otherwise will throw an 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
String

The string representation of the resource name.

Overrides

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
TypeNameDescription
StringsnapshotName

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

SnapshotNameresult

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

Returns
TypeDescription
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
TypeNameDescription
StringsnapshotName

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

BooleanallowUnparsed

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

SnapshotNameresult

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

Returns
TypeDescription
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
TypeNameDescription
SnapshotNamea
SnapshotNameb
Returns
TypeDescription
Boolean

Inequality(SnapshotName, SnapshotName)

public static bool operator !=(SnapshotName a, SnapshotName b)
Parameters
TypeNameDescription
SnapshotNamea
SnapshotNameb
Returns
TypeDescription
Boolean