Class TemplatedResourceName

public sealed class TemplatedResourceName : IResourceName, IEquatable<TemplatedResourceName>

Class for representing and working with resource names.

Inheritance

Object > TemplatedResourceName

Namespace

Google.Api.Gax

Assembly

Google.Api.Gax.dll

Remarks

A resource name is represented by a PathTemplate, an assignment of resource IDs to parameters in the template, and an optional service name. This class allows the service name and resource IDs to be modified, but only within the same template.

Constructors

TemplatedResourceName(PathTemplate, String[])

public TemplatedResourceName(PathTemplate template, params string[] resourceIds)

Creates a resource name with the given template and resource IDs. The resource IDs are cloned, so later changes to resourceIds are ignored. This constructor does not populate the ServiceName property, but that can be set after construction.

Parameters
TypeNameDescription
PathTemplatetemplate

The template for the new resource name. Must not be null.

String[]resourceIds

The resource IDs to populate template parameters with. Must not be null.

Properties

IsKnownPattern

public bool IsKnownPattern { get; }

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

Property Value
TypeDescription
Boolean

Item[Int32]

public string this[int index] { get; set; }

Gets or sets the identifier for the specified parameter index.

Parameter
TypeNameDescription
Int32index

The index of the parameter value to retrieve.

Property Value
TypeDescription
String

The identifier within the resource name at the given parameter index.

Item[String]

public string this[string parameterName] { get; set; }

Gets or sets the identifier for the specified parameter name.

Parameter
TypeNameDescription
StringparameterName

The name of the parameter value to retrieve.

Property Value
TypeDescription
String

The identifier within the resource name with the given parameter name.

ServiceName

public string ServiceName { get; set; }

The service name part of this resource name, or null if no service name is specified.

Property Value
TypeDescription
String

Template

public PathTemplate Template { get; }

The template this resource name is associated with. Never null.

Property Value
TypeDescription
PathTemplate

Methods

Clone()

public TemplatedResourceName Clone()

Creates a clone of this resource name, which is then independent of the original.

Returns
TypeDescription
TemplatedResourceName

A clone of this resource name.

Equals(TemplatedResourceName)

public bool Equals(TemplatedResourceName other)
Parameter
TypeNameDescription
TemplatedResourceNameother
Returns
TypeDescription
Boolean

Equals(Object)

public override bool Equals(object obj)
Parameter
TypeNameDescription
Objectobj
Returns
TypeDescription
Boolean
Overrides

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32
Overrides

ToString()

public override string ToString()

Returns a string representation of this resource name, expanding the template parameters with the resource IDs and prepending the service name (if present).

Returns
TypeDescription
String

A string representation of this resource name.

Overrides

Operators

Equality(TemplatedResourceName, TemplatedResourceName)

public static bool operator ==(TemplatedResourceName a, TemplatedResourceName b)
Parameters
TypeNameDescription
TemplatedResourceNamea
TemplatedResourceNameb
Returns
TypeDescription
Boolean

Inequality(TemplatedResourceName, TemplatedResourceName)

public static bool operator !=(TemplatedResourceName a, TemplatedResourceName b)
Parameters
TypeNameDescription
TemplatedResourceNamea
TemplatedResourceNameb
Returns
TypeDescription
Boolean

Implements