Skip to content

Commit

Permalink
MGMT-11404: add rest-api doc for cluster tags (#4252)
Browse files Browse the repository at this point in the history
Added documentation for creating/updating cluster tags
using the rest-api (in docs/user-guide).
  • Loading branch information
danielerez committed Aug 15, 2022
1 parent 99e02e2 commit 2343139
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions docs/user-guide/rest-api-cluster-tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# REST-API - Cluster Tags

The `tags` property in cluster object is a comma-separated list of tags that are associated to the cluster. Each tag is a free-text string that can consist of the following characters:
Alphanumeric (aA-zZ, 0-9), underscore (_) and white-spaces.

Tags are not read or manipulated by the system, so they can be used for marking clusters with some filtering criteria, installation tracking indication, etc.

## Usage

* The property can be specified when creating (v2RegisterCluster) or updating (V2UpdateCluster) a cluster.
* The tags are stored in the cluster object, so the property can be fetched when getting (v2GetCluster) the cluster.
* The property can be cleared by specifying an empty string.


## Examples

### Create tags (using v2RegisterCluster)

```bash
cat register_cluster.json
{
"name":"test",
"pull_secret":"<pull_secret>",
"openshift_version":"4.10",
"tags":"tag1,tag_2,tag 3"
}
```

```bash
curl -X POST -H "Content-Type: application/json" -d @register_cluster.json \
<HOST>:<PORT>/api/assisted-install/v2/clusters
```

### Update tags (using V2UpdateCluster)

```bash
cat update_cluster.json
{
"tags":"tag1,tag_2,tag 3,tag4"
}
```

```bash
curl -X PATCH -H "Content-Type: application/json" -d @update_cluster.json \
<HOST>:<PORT>/api/assisted-install/v2/clusters/<cluster_id>
```

### Get tags (using v2GetCluster)

```bash
curl <HOST>:<PORT>/api/assisted-install/v2/clusters/<cluster_id> | jq '.tags'

output: "tag1,tag_2,tag 3,tag4"
```

0 comments on commit 2343139

Please sign in to comment.