Managing Tags

A tag is an arbitrary key or a key-value pair that you can create and assign to your Oracle Data Hub Cloud Service clusters. You can use tags to organize and categorize your clusters, and to search for them.

Creating, Assigning, and Unassigning Tags

You can create and assign tags to Oracle Data Hub Cloud Service clusters while creating the clusters or later. When you no longer need certain tags for a cluster, you can unassign them.

To assign tags to a cluster or to unassign tags:

  1. Navigate to the Overview page for the cluster for which you want to assign or unassign tags.
  2. This step depends on whether any tags are already assigned to the cluster:
    If at least one tag is assigned to the cluster, the Overview page shows a Tags field.
    1. Hover over any of the tags in the Tags field, until a More link is displayed.

    2. Click the More link.

    If you don’t see the Tags field, then no tags are currently assigned to the cluster.
    1. Click Manage this service Action menu in the cluster name bar at the top.

    2. Select Add Tags.

    The Manage Tags dialog box is displayed.
  3. Assign or unassign tags, as required:
    • In the Assign section, from the Tags field, select the tags that you want to assign to the cluster.
    • If the tags that you want to assign don't exist, then create them by selecting Create and Assign in the Tags field and enter the new tags in the Enter New Tags field.
    • To unassign a tag, in the Unassign section, look for the tag that you want to unassign, and click the X button next to the tag.
    • To exit without changing any tag assignments for the cluster, click Cancel.
  4. After assigning and unassigning tags, click OK for the tag assignments to take effect.

Finding Tags and Clusters Using Search Expressions

A tag is an arbitrary key or a key-value pair that you can create and assign to your Oracle Data Hub Cloud Service clusters. You can use tags to organize and categorize your clusters, and to search for them. Over time, you might create dozens of tags, and you might assign one or more tags to several of your clusters. To search for specific tags and to find clusters that are assigned specific tags, you can use filtering expressions.

For example, on the home page of the service console, you can search for the clusters that are assigned a tag with the key env and any value starting with dev (example: env:dev1, env:dev2), by entering the search expression 'env':'dev%' in the Search field.
Screenshot highlighting the Search field on the home page of the Oracle Data Hub Cloud Service console

Similarly, when you use the REST API to find tags or to find clusters that are assigned specific tags, you can filter the results by appending the optional tagFilter=expression query parameter to the REST endpoint URL.
  • To find specific tags: GET paas/api/v1.1/tags/{identity_domain}/tags?tagFilter={expression}
  • To get a list of clusters that are assigned specific tags: GET paas/api/v1.1/clustermgmt/{identity_domain}/clusters?tagFilter={expression}

Syntax and Rules for Building Tag-Search Expressions

  • When using cURL to send tag-search API requests, enclose the URL in double quotation marks.

    Example:
    curl -s -u username:password -H "X-ID-TENANT-NAME:acme" "https://dhcs.emea.oraclecloud.com/paas/api/v1.1/clustermgmt/acme/clusters?tagFilter='env'"

    This request returns all the tags that have the key env.

  • Enclose each key and each value in single quotation marks. And use a colon (:) to indicate a key:value pair.

    Examples:
    'env'
    'env':'dev'
  • You can include keys or key:value pairs in a tag-filtering expression.

    Sample Expression Description Sample Search Result

    'env'

    Finds the tags with the key env, or the clusters that are assigned the tags with that key.

    The following tags, or the clusters that are assigned any of these tags:
    env:dev
    env:qa

    'env':'dev'

    Finds the tag with the key env and the value dev, or the clusters that are assigned that tag.

    The following tag, or the clusters that are assigned this tag
    env:dev
  • You can build a tag-search expression by using actual keys and key values, or by using the following wildcard characters.

    % (percent sign): Matches any number of characters.

    _ (underscore): Matches one character.

    Sample Expression Description Sample Search Result

    'env':'dev%'

    Finds the tags with the key env and a value starting with dev, or the clusters that are assigned such tags.

    The following tags, or the clusters that are assigned any of these tags:
    env:dev
    env:dev1

    'env':'dev_'

    Finds the tags with the key env and the value devX where X can be any one character, or finds the clusters that are assigned such tags.

    The following tags, or the clusters that are assigned any of these tags:

    env:dev1
    env:dev2
  • To use a single quotation mark ('), the percent sign (%), or the underscore (_) as a literal character in a search expression, escape the character by prefixing a backslash (\).
    Sample Expression Description Sample Search Result

    'env':'dev\_%'

    Finds the tags with the key env and a value starting with dev_, or the clusters that are assigned such tags.

    The following tags, or the clusters that are assigned any of these tags:
    env:dev_1
    env:dev_admin
  • You can use the Boolean operators AND, OR, and NOT in your search expressions:
    Sample Expression Description Sample Search Result

    'env' OR 'owner'

    Finds the tags with the key env or the key owner, or the clusters that are assigned either of those keys.

    The following tags, or the clusters that are assigned any of these tags:
    env:dev
    owner:admin

    'env' AND 'owner'

    Finds the clusters that are assigned the tags env and owner.

    Note: This expression won’t return any results when used to search for tags, because a tag can have only one key.

    The clusters that are assigned all of the following tags:
    env:dev
    owner:admin

    NOT 'env’

    Finds the tags that have a key other than env, or the clusters that are assigned such tags.

    Note: Untagged clusters as well will satisfy this search expression.

    The following tags, or the clusters that are assigned any of these tags or no tags:
    owner:admin
    department

    ('env' OR 'owner') AND NOT 'department'

    Finds the tags that have the key env or the key owner but not the key department, or the clusters that are assigned such tags.

    The following tags, or the clusters that are assigned any of these tags:
    env:dev
    owner:admin