attributes
Creates, updates, deletes, gets or lists an attributes
resource.
Overview
Name | attributes |
Type | Resource |
Id | google.apihub.attributes |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The name of the attribute in the API Hub. Format: projects/{project}/locations/{location}/attributes/{attribute} |
allowedValues | array | 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. |
cardinality | integer (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. |
createTime | string (google-datetime) | Output only. The time at which the attribute was created. |
dataType | string | Required. The type of the data of the attribute. |
definitionType | string | Output only. The definition type of the attribute. |
description | string | Optional. The description of the attribute. |
displayName | string | Required. The display name of the attribute. |
mandatory | boolean | Output only. When mandatory is true, the attribute is mandatory for the resource specified in the scope. Only System defined attributes can be mandatory. |
scope | string | Required. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked. |
updateTime | string (google-datetime) | Output only. The time at which the attribute was last updated. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The name of the attribute in the API Hub. Format: projects/{project}/locations/{location}/attributes/{attribute} |
allowedValues | array | 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. |
cardinality | integer (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. |
createTime | string (google-datetime) | Output only. The time at which the attribute was created. |
dataType | string | Required. The type of the data of the attribute. |
definitionType | string | Output only. The definition type of the attribute. |
description | string | Optional. The description of the attribute. |
displayName | string | Required. The display name of the attribute. |
mandatory | boolean | Output only. When mandatory is true, the attribute is mandatory for the resource specified in the scope. Only System defined attributes can be mandatory. |
scope | string | Required. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked. |
updateTime | string (google-datetime) | Output only. The time at which the attribute was last updated. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , attributesId | Get details about the attribute. | |
list | select | projectsId , locationsId | filter , pageSize , pageToken | List all attributes. |
create | insert | projectsId , locationsId | attributeId | 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. |
patch | update | projectsId , locationsId , attributesId | updateMask | 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. |
delete | delete | projectsId , locationsId , attributesId | 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. |
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.
Name | Datatype | Description |
---|---|---|
attributesId | string | |
locationsId | string | |
projectsId | string | |
attributeId | string | |
filter | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
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;
List all attributes.
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 filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: attributes
props:
- name: projectsId
value: string
description: Required parameter for the attributes resource.
- name: locationsId
value: string
description: Required parameter for the attributes resource.
- name: name
value: string
description: >
Identifier. The name of the attribute in the API Hub. Format: `projects/{project}/locations/{location}/attributes/{attribute}`
- name: displayName
value: string
description: >
Required. The display name of the attribute.
- name: description
value: string
description: >
Optional. The description of the attribute.
- name: scope
value: string
description: >
Required. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked.
valid_values: ['SCOPE_UNSPECIFIED', 'API', 'VERSION', 'SPEC', 'API_OPERATION', 'DEPLOYMENT', 'DEPENDENCY', 'DEFINITION', 'EXTERNAL_API', 'PLUGIN']
- name: dataType
value: string
description: >
Required. The type of the data of the attribute.
valid_values: ['DATA_TYPE_UNSPECIFIED', 'ENUM', 'JSON', 'STRING', 'URI']
- name: allowedValues
value: array
description: >
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.
- name: cardinality
value: integer
description: >
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.
- name: attributeId
value: string
UPDATE
examples
- patch
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
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;