Skip to main content

labels

Creates, updates, deletes, gets or lists a labels resource.

Overview

Namelabels
TypeResource
Idgoogleworkspace.drivelabelsv2beta.labels

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringOutput only. Globally unique identifier of this label. ID makes up part of the label name, but unlike name, ID is consistent between revisions. Matches the regex: ([a-zA-Z0-9])+.
namestringOutput only. Resource name of the label. Will be in the form of either: labels/{id} or labels/{id}@{revision_id} depending on the request. See id and revision_id below.
appliedCapabilitiesobjectOutput only. The capabilities related to this label on applied metadata. (id: GoogleAppsDriveLabelsV2betaLabelAppliedCapabilities)
appliedLabelPolicyobjectOutput only. Behavior of this label when it's applied to Drive items. (id: GoogleAppsDriveLabelsV2betaLabelAppliedLabelPolicy)
createTimestring (google-datetime)Output only. The time this label was created.
creatorobjectOutput only. The user who created this label. (id: GoogleAppsDriveLabelsV2betaUserInfo)
customerstringOutput only. The customer this label belongs to. For example: customers/123abc789.
disableTimestring (google-datetime)Output only. The time this label was disabled. This value has no meaning when the label isn't disabled.
disablerobjectOutput only. The user who disabled this label. This value has no meaning when the label isn't disabled. (id: GoogleAppsDriveLabelsV2betaUserInfo)
displayHintsobjectOutput only. UI display hints for rendering the label. (id: GoogleAppsDriveLabelsV2betaLabelDisplayHints)
enabledAppSettingsobjectOptional. The EnabledAppSettings for this Label. (id: GoogleAppsDriveLabelsV2betaLabelEnabledAppSettings)
fieldsarrayList of fields in descending priority order.
labelTypestringRequired. The type of label.
learnMoreUristringCustom URL to present to users to allow them to learn more about this label and how it should be used.
lifecycleobjectOutput only. The lifecycle state of the label including whether it's published, deprecated, and has draft changes. (id: GoogleAppsDriveLabelsV2betaLifecycle)
lockStatusobjectOutput only. The LockStatus of this label. (id: GoogleAppsDriveLabelsV2betaLockStatus)
propertiesobjectRequired. The basic properties of the label. (id: GoogleAppsDriveLabelsV2betaLabelProperties)
publishTimestring (google-datetime)Output only. The time this label was published. This value has no meaning when the label isn't published.
publisherobjectOutput only. The user who published this label. This value has no meaning when the label isn't published.>> (id: GoogleAppsDriveLabelsV2betaUserInfo)
revisionCreateTimestring (google-datetime)Output only. The time this label revision was created.
revisionCreatorobjectOutput only. The user who created this label revision. (id: GoogleAppsDriveLabelsV2betaUserInfo)
revisionIdstringOutput only. Revision ID of the label. Revision ID might be part of the label name depending on the request issued. A new revision is created whenever revisioned properties of a label are changed. Matches the regex: ([a-zA-Z0-9])+.
schemaCapabilitiesobjectOutput only. The capabilities the user has on this label. (id: GoogleAppsDriveLabelsV2betaLabelSchemaCapabilities)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectlabelsIduseAdminAccess, languageCode, viewGet a label by its resource name. For more information, see Search for labels. Resource name may be any of: * labels/{id} - See labels/{id}@latest * labels/{id}@latest - Gets the latest revision of the label. * labels/{id}@published - Gets the current published revision of the label. * labels/{id}@{revision_id} - Gets the label at the specified revision ID.
listselectuseAdminAccess, minimumRole, publishedOnly, customer, languageCode, pageSize, pageToken, viewList labels. For more information, see Search for labels.
createinsertuseAdminAccess, languageCodeCreates a label. For more information, see Create and publish a label.
deletedeletelabelsIduseAdminAccess, writeControl.requiredRevisionIdPermanently deletes a label and related metadata on Drive items. For more information, see Disable, enable, and delete a label. Once deleted, the label and related Drive item metadata will be deleted. Only draft labels and disabled labels may be deleted.
deltaexeclabelsIdUpdates a single label by applying a set of update requests resulting in a new draft revision. For more information, see Update a label. The batch update is all-or-nothing: If any of the update requests are invalid, no changes are applied. The resulting draft revision must be published before the changes may be used with Drive items.
publishexeclabelsIdPublish all draft changes to the label. Once published, the label may not return to its draft state. For more information, see Create and publish a label. Publishing a label will result in a new published revision. All previous draft revisions will be deleted. Previous published revisions will be kept but are subject to automated deletion as needed. For more information, see Label lifecycle. Once published, some changes are no longer permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the label will be rejected. For example, the following changes to a label will be rejected after the label is published: * The label cannot be directly deleted. It must be disabled first, then deleted. * Field.FieldType cannot be changed. * Changes to field validation options cannot reject something that was previously accepted. * Reducing the maximum entries.
disableexeclabelsIdDisable a published label. For more information, see Disable, enable, and delete a label. Disabling a label will result in a new disabled published revision based on the current published revision. If there's a draft revision, a new disabled draft revision will be created based on the latest draft revision. Older draft revisions will be deleted. Once disabled, a label may be deleted with DeleteLabel.
enableexeclabelsIdEnable a disabled label and restore it to its published state. For more information, see Disable, enable, and delete a label. This will result in a new published revision based on the current disabled published revision. If there's an existing disabled draft revision, a new revision will be created based on that draft and will be enabled.

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
labelsIdstring
customerstring
languageCodestring
minimumRolestring
pageSizeinteger (int32)
pageTokenstring
publishedOnlyboolean
useAdminAccessboolean
viewstring
writeControl.requiredRevisionIdstring

SELECT examples

Get a label by its resource name. For more information, see Search for labels. Resource name may be any of: * labels/{id} - See labels/{id}@latest * labels/{id}@latest - Gets the latest revision of the label. * labels/{id}@published - Gets the current published revision of the label. * labels/{id}@{revision_id} - Gets the label at the specified revision ID.

SELECT
id,
name,
appliedCapabilities,
appliedLabelPolicy,
createTime,
creator,
customer,
disableTime,
disabler,
displayHints,
enabledAppSettings,
fields,
labelType,
learnMoreUri,
lifecycle,
lockStatus,
properties,
publishTime,
publisher,
revisionCreateTime,
revisionCreator,
revisionId,
schemaCapabilities
FROM googleworkspace.drivelabelsv2beta.labels
WHERE labelsId = '{{ labelsId }}' -- required
AND useAdminAccess = '{{ useAdminAccess }}'
AND languageCode = '{{ languageCode }}'
AND view = '{{ view }}'
;

INSERT examples

Creates a label. For more information, see Create and publish a label.

INSERT INTO googleworkspace.drivelabelsv2beta.labels (
data__labelType,
data__properties,
data__fields,
data__learnMoreUri,
data__enabledAppSettings,
useAdminAccess,
languageCode
)
SELECT
'{{ labelType }}',
'{{ properties }}',
'{{ fields }}',
'{{ learnMoreUri }}',
'{{ enabledAppSettings }}',
'{{ useAdminAccess }}',
'{{ languageCode }}'
RETURNING
id,
name,
appliedCapabilities,
appliedLabelPolicy,
createTime,
creator,
customer,
disableTime,
disabler,
displayHints,
enabledAppSettings,
fields,
labelType,
learnMoreUri,
lifecycle,
lockStatus,
properties,
publishTime,
publisher,
revisionCreateTime,
revisionCreator,
revisionId,
schemaCapabilities
;

DELETE examples

Permanently deletes a label and related metadata on Drive items. For more information, see Disable, enable, and delete a label. Once deleted, the label and related Drive item metadata will be deleted. Only draft labels and disabled labels may be deleted.

DELETE FROM googleworkspace.drivelabelsv2beta.labels
WHERE labelsId = '{{ labelsId }}' --required
AND useAdminAccess = '{{ useAdminAccess }}'
AND writeControl.requiredRevisionId = '{{ writeControl.requiredRevisionId }}'
;

Lifecycle Methods

Updates a single label by applying a set of update requests resulting in a new draft revision. For more information, see Update a label. The batch update is all-or-nothing: If any of the update requests are invalid, no changes are applied. The resulting draft revision must be published before the changes may be used with Drive items.

EXEC googleworkspace.drivelabelsv2beta.labels.delta 
@labelsId='{{ labelsId }}' --required
@@json=
'{
"writeControl": "{{ writeControl }}",
"requests": "{{ requests }}",
"useAdminAccess": {{ useAdminAccess }},
"view": "{{ view }}",
"languageCode": "{{ languageCode }}"
}'
;