Skip to main content

attributes

Creates, updates, deletes, gets or lists an attributes resource.

Overview

Nameattributes
TypeResource
Idgoogle.apihub.attributes

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. The name of the attribute in the API Hub. Format: projects/{project}/locations/{location}/attributes/{attribute}
allowedValuesarrayOptional. 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.
cardinalityinteger (int32)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.
createTimestring (google-datetime)Output only. The time at which the attribute was created.
dataTypestringRequired. The type of the data of the attribute.
definitionTypestringOutput only. The definition type of the attribute.
descriptionstringOptional. The description of the attribute.
displayNamestringRequired. The display name of the attribute.
mandatorybooleanOutput only. When mandatory is true, the attribute is mandatory for the resource specified in the scope. Only System defined attributes can be mandatory.
scopestringRequired. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked.
updateTimestring (google-datetime)Output only. The time at which the attribute was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, attributesIdGet details about the attribute.
listselectprojectsId, locationsIdfilter, pageSize, pageTokenList all attributes.
createinsertprojectsId, locationsIdattributeIdCreate a user defined attribute. Certain pre defined attributes are already created by the API hub. These attributes will have type as SYSTEM_DEFINED and can be listed via ListAttributes method. Allowed values for the same can be updated via UpdateAttribute method.
patchupdateprojectsId, locationsId, attributesIdupdateMaskUpdate the attribute. The following fields in the Attribute resource can be updated: * display_name The display name can be updated for user defined attributes only. * description The description can be updated for user defined attributes only. * allowed_values To update the list of allowed values, clients need to use the fetched list of allowed values and add or remove values to or from the same list. The mutable allowed values can be updated for both user defined and System defined attributes. The immutable allowed values cannot be updated or deleted. The updated list of allowed values cannot be empty. If an allowed value that is already used by some resource's attribute is deleted, then the association between the resource and the attribute value will also be deleted. * cardinality The cardinality can be updated for user defined attributes only. Cardinality can only be increased during an update. The update_mask should be used to specify the fields being updated.
deletedeleteprojectsId, locationsId, attributesIdDelete an attribute. Note: System defined attributes cannot be deleted. All associations of the attribute being deleted with any API hub resource will also get deleted.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
attributesIdstring
locationsIdstring
projectsIdstring
attributeIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Get details about the attribute.

SELECT
name,
allowedValues,
cardinality,
createTime,
dataType,
definitionType,
description,
displayName,
mandatory,
scope,
updateTime
FROM google.apihub.attributes
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND attributesId = '{{ attributesId }}' -- required;

INSERT examples

Create a user defined attribute. Certain pre defined attributes are already created by the API hub. These attributes will have type as SYSTEM_DEFINED and can be listed via ListAttributes method. Allowed values for the same can be updated via UpdateAttribute method.

INSERT INTO google.apihub.attributes (
data__name,
data__displayName,
data__description,
data__scope,
data__dataType,
data__allowedValues,
data__cardinality,
projectsId,
locationsId,
attributeId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ description }}',
'{{ scope }}',
'{{ dataType }}',
'{{ allowedValues }}',
{{ cardinality }},
'{{ projectsId }}',
'{{ locationsId }}',
'{{ attributeId }}'
RETURNING
name,
allowedValues,
cardinality,
createTime,
dataType,
definitionType,
description,
displayName,
mandatory,
scope,
updateTime
;

UPDATE examples

Update the attribute. The following fields in the Attribute resource can be updated: * display_name The display name can be updated for user defined attributes only. * description The description can be updated for user defined attributes only. * allowed_values To update the list of allowed values, clients need to use the fetched list of allowed values and add or remove values to or from the same list. The mutable allowed values can be updated for both user defined and System defined attributes. The immutable allowed values cannot be updated or deleted. The updated list of allowed values cannot be empty. If an allowed value that is already used by some resource's attribute is deleted, then the association between the resource and the attribute value will also be deleted. * cardinality The cardinality can be updated for user defined attributes only. Cardinality can only be increased during an update. The update_mask should be used to specify the fields being updated.

UPDATE google.apihub.attributes
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__description = '{{ description }}',
data__scope = '{{ scope }}',
data__dataType = '{{ dataType }}',
data__allowedValues = '{{ allowedValues }}',
data__cardinality = {{ cardinality }}
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND attributesId = '{{ attributesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
allowedValues,
cardinality,
createTime,
dataType,
definitionType,
description,
displayName,
mandatory,
scope,
updateTime;

DELETE examples

Delete an attribute. Note: System defined attributes cannot be deleted. All associations of the attribute being deleted with any API hub resource will also get deleted.

DELETE FROM google.apihub.attributes
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND attributesId = '{{ attributesId }}' --required;