Cloud Resource Manager v3 API - Class TagKeyName (2.2.0)

public sealed class TagKeyName : IResourceName, IEquatable<TagKeyName>

Reference documentation and code samples for the Cloud Resource Manager v3 API class TagKeyName.

Resource name for the TagKey resource.

Inheritance

object > TagKeyName

Namespace

Google.Cloud.ResourceManager.V3

Assembly

Google.Cloud.ResourceManager.V3.dll

Constructors

TagKeyName(string)

public TagKeyName(string tagKeyId)

Constructs a new instance of a TagKeyName class from the component parts of pattern tagKeys/{tag_key}

Parameter
NameDescription
tagKeyIdstring

The TagKey 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
bool

TagKeyId

public string TagKeyId { get; }

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

Property Value
TypeDescription
string

Type

public TagKeyName.ResourceNameType Type { get; }

The TagKeyName.ResourceNameType of the contained resource name.

Property Value
TypeDescription
TagKeyNameResourceNameType

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)

public static string Format(string tagKeyId)

Formats the IDs into the string representation of this TagKeyName with pattern tagKeys/{tag_key}.

Parameter
NameDescription
tagKeyIdstring

The TagKey ID. Must not be null or empty.

Returns
TypeDescription
string

The string representation of this TagKeyName with pattern tagKeys/{tag_key}.

FormatTagKey(string)

public static string FormatTagKey(string tagKeyId)

Formats the IDs into the string representation of this TagKeyName with pattern tagKeys/{tag_key}.

Parameter
NameDescription
tagKeyIdstring

The TagKey ID. Must not be null or empty.

Returns
TypeDescription
string

The string representation of this TagKeyName with pattern tagKeys/{tag_key}.

FromTagKey(string)

public static TagKeyName FromTagKey(string tagKeyId)

Creates a TagKeyName with the pattern tagKeys/{tag_key}.

Parameter
NameDescription
tagKeyIdstring

The TagKey ID. Must not be null or empty.

Returns
TypeDescription
TagKeyName

A new instance of TagKeyName constructed from the provided ids.

FromUnparsed(UnparsedResourceName)

public static TagKeyName FromUnparsed(UnparsedResourceName unparsedResourceName)

Creates a TagKeyName containing an unparsed resource name.

Parameter
NameDescription
unparsedResourceNameUnparsedResourceName

The unparsed resource name. Must not be null.

Returns
TypeDescription
TagKeyName

A new instance of TagKeyName containing the provided unparsedResourceName.

GetHashCode()

public override int GetHashCode()

Returns a hash code for this resource name.

Returns
TypeDescription
int
Overrides

Parse(string)

public static TagKeyName Parse(string tagKeyName)

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

Parameter
NameDescription
tagKeyNamestring

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

Returns
TypeDescription
TagKeyName

The parsed TagKeyName if successful.

Remarks

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

  • tagKeys/{tag_key}

Parse(string, bool)

public static TagKeyName Parse(string tagKeyName, bool allowUnparsed)

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

Parameters
NameDescription
tagKeyNamestring

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

allowUnparsedbool

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
TagKeyName

The parsed TagKeyName if successful.

Remarks

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

  • tagKeys/{tag_key}
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 TagKeyName)

public static bool TryParse(string tagKeyName, out TagKeyName result)

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

Parameters
NameDescription
tagKeyNamestring

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

resultTagKeyName

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

Returns
TypeDescription
bool

true if the name was parsed successfully; false otherwise.

Remarks

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

  • tagKeys/{tag_key}

TryParse(string, bool, out TagKeyName)

public static bool TryParse(string tagKeyName, bool allowUnparsed, out TagKeyName result)

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

Parameters
NameDescription
tagKeyNamestring

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

allowUnparsedbool

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.

resultTagKeyName

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

Returns
TypeDescription
bool

true if the name was parsed successfully; false otherwise.

Remarks

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

  • tagKeys/{tag_key}
Or may be in any format if allowUnparsed is true.

Operators

operator ==(TagKeyName, TagKeyName)

public static bool operator ==(TagKeyName a, TagKeyName b)
Parameters
NameDescription
aTagKeyName
bTagKeyName
Returns
TypeDescription
bool

operator !=(TagKeyName, TagKeyName)

public static bool operator !=(TagKeyName a, TagKeyName b)
Parameters
NameDescription
aTagKeyName
bTagKeyName
Returns
TypeDescription
bool