public sealed class Attribute : IMessage<Attribute>, IEquatable<Attribute>, IDeepCloneable<Attribute>, IBufferMessage, IMessage
Reference documentation and code samples for the API hub v1 API class Attribute.
An attribute in the API Hub.
An attribute is a name value pair which can be attached to different
resources in the API hub based on the scope of the attribute. Attributes can
either be pre-defined by the API Hub or created by users.
public RepeatedField<Attribute.Types.AllowedValue> AllowedValues { get; }
Optional. The list of allowed values when the attribute value is of type
enum. This is required when the data_type of the attribute is ENUM. The
maximum number of allowed values of an attribute will be 1000.
Optional. The maximum number of values that the attribute can have when
associated with an API Hub resource. Cardinality 1 would represent a
single-valued attribute. It must not be less than 1 or greater than 20. If
not specified, the cardinality would be set to 1 by default and represent a
single-valued attribute.
Output only. When mandatory is true, the attribute is mandatory for the
resource specified in the scope. Only System defined attributes can be
mandatory.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eAttribute\u003c/code\u003e class in the Google Cloud API Hub v1 API represents a name-value pair that can be attached to various resources within the API Hub, with the capability of being predefined or user-created.\u003c/p\u003e\n"],["\u003cp\u003eAttributes have properties like \u003ccode\u003eDataType\u003c/code\u003e, \u003ccode\u003eCardinality\u003c/code\u003e, \u003ccode\u003eScope\u003c/code\u003e, and \u003ccode\u003eDefinitionType\u003c/code\u003e to define the nature of the value, the number of possible values, the resources they can be linked to, and whether it was created by the user or system.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAttribute\u003c/code\u003e class has constructors for creating new instances and provides read/write properties to change attributes, such as descriptions, display names, and whether or not an attribute is mandatory for a given resource.\u003c/p\u003e\n"],["\u003cp\u003eAttributes support enumerated types via \u003ccode\u003eAllowedValues\u003c/code\u003e, which can be used to limit the values for a given attribute, and attributes have a maximum cardinality of 20 for the number of allowed values.\u003c/p\u003e\n"],["\u003cp\u003eEach \u003ccode\u003eAttribute\u003c/code\u003e has associated timestamps (\u003ccode\u003eCreateTime\u003c/code\u003e, \u003ccode\u003eUpdateTime\u003c/code\u003e) that show when it was created or last modified, and system-defined attributes can be set as mandatory for a resource.\u003c/p\u003e\n"]]],[],null,["# API hub v1 API - Class Attribute (1.0.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.0 (latest)](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/latest/Google.Cloud.ApiHub.V1.Attribute)\n- [1.0.0-beta02](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/1.0.0-beta02/Google.Cloud.ApiHub.V1.Attribute) \n\n public sealed class Attribute : IMessage\u003cAttribute\u003e, IEquatable\u003cAttribute\u003e, IDeepCloneable\u003cAttribute\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the API hub v1 API class Attribute.\n\nAn attribute in the API Hub.\nAn attribute is a name value pair which can be attached to different\nresources in the API hub based on the scope of the attribute. Attributes can\neither be pre-defined by the API Hub or created by users. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Attribute \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Attribute](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/latest/Google.Cloud.ApiHub.V1.Attribute), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Attribute](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/latest/Google.Cloud.ApiHub.V1.Attribute), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Attribute](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/latest/Google.Cloud.ApiHub.V1.Attribute), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.ApiHub.V1](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/latest/Google.Cloud.ApiHub.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.ApiHub.V1.dll\n\nConstructors\n------------\n\n### Attribute()\n\n public Attribute()\n\n### Attribute(Attribute)\n\n public Attribute(Attribute other)\n\nProperties\n----------\n\n### AllowedValues\n\n public RepeatedField\u003cAttribute.Types.AllowedValue\u003e AllowedValues { get; }\n\nOptional. The list of allowed values when the attribute value is of type\nenum. This is required when the data_type of the attribute is ENUM. The\nmaximum number of allowed values of an attribute will be 1000.\n\n### AttributeName\n\n public AttributeName AttributeName { get; set; }\n\n[AttributeName](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/latest/Google.Cloud.ApiHub.V1.AttributeName)-typed view over the [Name](/dotnet/docs/reference/Google.Cloud.ApiHub.V1/latest/Google.Cloud.ApiHub.V1.Attribute#Google_Cloud_ApiHub_V1_Attribute_Name) resource name property.\n\n### Cardinality\n\n public int Cardinality { get; set; }\n\nOptional. The maximum number of values that the attribute can have when\nassociated with an API Hub resource. Cardinality 1 would represent a\nsingle-valued attribute. It must not be less than 1 or greater than 20. If\nnot specified, the cardinality would be set to 1 by default and represent a\nsingle-valued attribute.\n\n### CreateTime\n\n public Timestamp CreateTime { get; set; }\n\nOutput only. The time at which the attribute was created.\n\n### DataType\n\n public Attribute.Types.DataType DataType { get; set; }\n\nRequired. The type of the data of the attribute.\n\n### DefinitionType\n\n public Attribute.Types.DefinitionType DefinitionType { get; set; }\n\nOutput only. The definition type of the attribute.\n\n### Description\n\n public string Description { get; set; }\n\nOptional. The description of the attribute.\n\n### DisplayName\n\n public string DisplayName { get; set; }\n\nRequired. The display name of the attribute.\n\n### Mandatory\n\n public bool Mandatory { get; set; }\n\nOutput only. When mandatory is true, the attribute is mandatory for the\nresource specified in the scope. Only System defined attributes can be\nmandatory.\n\n### Name\n\n public string Name { get; set; }\n\nIdentifier. The name of the attribute in the API Hub.\n\nFormat:\n`projects/{project}/locations/{location}/attributes/{attribute}`\n\n### Scope\n\n public Attribute.Types.Scope Scope { get; set; }\n\nRequired. The scope of the attribute. It represents the resource in the API\nHub to which the attribute can be linked.\n\n### UpdateTime\n\n public Timestamp UpdateTime { get; set; }\n\nOutput only. The time at which the attribute was last updated."]]