Class OccurrenceName (2.4.0)

public sealed class OccurrenceName : IResourceName, IEquatable<OccurrenceName>

Resource name for the Occurrence resource.

Inheritance

Object > OccurrenceName

Namespace

Grafeas.V1

Assembly

Grafeas.V1.dll

Constructors

OccurrenceName(String, String)

public OccurrenceName(string projectId, string occurrenceId)

Constructs a new instance of a OccurrenceName class from the component parts of pattern projects/{project}/occurrences/{occurrence}

Parameters
NameDescription
projectIdString

The Project ID. Must not be null or empty.

occurrenceIdString

The Occurrence 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

OccurrenceId

public string OccurrenceId { get; }

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

Property Value
TypeDescription
String

ProjectId

public string ProjectId { get; }

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

Property Value
TypeDescription
String

Type

public OccurrenceName.ResourceNameType Type { get; }

The OccurrenceName.ResourceNameType of the contained resource name.

Property Value
TypeDescription
OccurrenceName.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 occurrenceId)

Formats the IDs into the string representation of this OccurrenceName with pattern projects/{project}/occurrences/{occurrence}.

Parameters
NameDescription
projectIdString

The Project ID. Must not be null or empty.

occurrenceIdString

The Occurrence ID. Must not be null or empty.

Returns
TypeDescription
String

The string representation of this OccurrenceName with pattern projects/{project}/occurrences/{occurrence}.

FormatProjectOccurrence(String, String)

public static string FormatProjectOccurrence(string projectId, string occurrenceId)

Formats the IDs into the string representation of this OccurrenceName with pattern projects/{project}/occurrences/{occurrence}.

Parameters
NameDescription
projectIdString

The Project ID. Must not be null or empty.

occurrenceIdString

The Occurrence ID. Must not be null or empty.

Returns
TypeDescription
String

The string representation of this OccurrenceName with pattern projects/{project}/occurrences/{occurrence}.

FromProjectOccurrence(String, String)

public static OccurrenceName FromProjectOccurrence(string projectId, string occurrenceId)

Creates a OccurrenceName with the pattern projects/{project}/occurrences/{occurrence}.

Parameters
NameDescription
projectIdString

The Project ID. Must not be null or empty.

occurrenceIdString

The Occurrence ID. Must not be null or empty.

Returns
TypeDescription
OccurrenceName

A new instance of OccurrenceName constructed from the provided ids.

FromUnparsed(UnparsedResourceName)

public static OccurrenceName FromUnparsed(UnparsedResourceName unparsedResourceName)

Creates a OccurrenceName containing an unparsed resource name.

Parameter
NameDescription
unparsedResourceNameUnparsedResourceName

The unparsed resource name. Must not be null.

Returns
TypeDescription
OccurrenceName

A new instance of OccurrenceName 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 OccurrenceName Parse(string occurrenceName)

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

Parameter
NameDescription
occurrenceNameString

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

Returns
TypeDescription
OccurrenceName

The parsed OccurrenceName if successful.

Remarks

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

  • projects/{project}/occurrences/{occurrence}

Parse(String, Boolean)

public static OccurrenceName Parse(string occurrenceName, bool allowUnparsed)

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

Parameters
NameDescription
occurrenceNameString

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

allowUnparsedBoolean

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
OccurrenceName

The parsed OccurrenceName if successful.

Remarks

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

  • projects/{project}/occurrences/{occurrence}
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 OccurrenceName)

public static bool TryParse(string occurrenceName, out OccurrenceName result)

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

Parameters
NameDescription
occurrenceNameString

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

resultOccurrenceName

When this method returns, the parsed OccurrenceName, 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}/occurrences/{occurrence}

TryParse(String, Boolean, out OccurrenceName)

public static bool TryParse(string occurrenceName, bool allowUnparsed, out OccurrenceName result)

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

Parameters
NameDescription
occurrenceNameString

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

allowUnparsedBoolean

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.

resultOccurrenceName

When this method returns, the parsed OccurrenceName, 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}/occurrences/{occurrence}
Or may be in any format if allowUnparsed is true.

Operators

Equality(OccurrenceName, OccurrenceName)

public static bool operator ==(OccurrenceName a, OccurrenceName b)
Parameters
NameDescription
aOccurrenceName
bOccurrenceName
Returns
TypeDescription
Boolean

Inequality(OccurrenceName, OccurrenceName)

public static bool operator !=(OccurrenceName a, OccurrenceName b)
Parameters
NameDescription
aOccurrenceName
bOccurrenceName
Returns
TypeDescription
Boolean