Skip to content

Commit b577818

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
[REDHOSTS-612] Update Tags API Documentation (#2998)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 52fefa4 commit b577818

7 files changed

Lines changed: 66 additions & 64 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4219,14 +4219,14 @@ components:
42194219
type: boolean
42204220
type: object
42214221
HostTags:
4222-
description: Set of tags to associate with your host.
4222+
description: Host name and an array of its tags
42234223
properties:
42244224
host:
42254225
description: Your host name.
42264226
example: test.host
42274227
type: string
42284228
tags:
4229-
description: A list of tags to apply to the host.
4229+
description: A list of tags associated with a host.
42304230
items:
42314231
description: A given tag in a list.
42324232
example: environment:production
@@ -18972,18 +18972,18 @@ components:
1897218972
- match
1897318973
type: object
1897418974
TagToHosts:
18975-
description: In this object, the key is the tag, the value is a list of host
18976-
names that are reporting that tag.
18975+
description: In this object, the key is the tag, and the value is a list of
18976+
host names that are reporting that tag.
1897718977
properties:
1897818978
tags:
1897918979
additionalProperties:
18980-
description: A list of additional properties for tags.
18980+
description: A list of host names which contain this tag
1898118981
items:
1898218982
description: A given tag in a list.
1898318983
example: test.metric.host
1898418984
type: string
1898518985
type: array
18986-
description: A list of tags to apply to the host.
18986+
description: A mapping of tags to host names
1898718987
type: object
1898818988
type: object
1898918989
TargetFormatType:
@@ -36008,11 +36008,13 @@ paths:
3600836008
- synthetics_global_variable_write
3600936009
/api/v1/tags/hosts:
3601036010
get:
36011-
description: Return a mapping of tags to hosts for your whole infrastructure.
36011+
description: Returns a mapping of tags to hosts. For each tag, the response
36012+
returns a list of host names that contain this tag. There is a restriction
36013+
of 10k total host names from the org that can be attached to tags and returned.
3601236014
operationId: ListHostTags
3601336015
parameters:
36014-
- description: When specified, filters host list to those tags with the specified
36015-
source.
36016+
- description: Source to filter. [Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).
36017+
Use "user" source for custom-defined tags.
3601636018
in: query
3601736019
name: source
3601836020
required: false
@@ -36043,29 +36045,29 @@ paths:
3604336045
- apiKeyAuth: []
3604436046
appKeyAuth: []
3604536047
- AuthZ: []
36046-
summary: Get Tags
36048+
summary: Get All Host Tags
3604736049
tags:
3604836050
- Tags
3604936051
x-permission:
3605036052
operator: OPEN
3605136053
permissions: []
3605236054
/api/v1/tags/hosts/{host_name}:
3605336055
delete:
36054-
description: 'This endpoint allows you to remove all user-assigned tags
36056+
description: 'This endpoint allows you to remove all tags
3605536057

36056-
for a single host.'
36058+
for a single host. If no source is specified, only deletes from the source
36059+
"User".'
3605736060
operationId: DeleteHostTags
3605836061
parameters:
36059-
- description: This endpoint allows you to remove all user-assigned tags for
36060-
a single host.
36062+
- description: Specified host name to delete tags
3606136063
in: path
3606236064
name: host_name
3606336065
required: true
3606436066
schema:
3606536067
type: string
36066-
- description: 'The source of the tags (for example chef, puppet).
36067-
36068-
[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).'
36068+
- description: Source of the tags to be deleted. [Complete list of source attribute
36069+
values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).
36070+
Use "user" source for custom-defined tags.
3606936071
in: query
3607036072
name: source
3607136073
required: false
@@ -36095,14 +36097,14 @@ paths:
3609536097
description: Return the list of tags that apply to a given host.
3609636098
operationId: GetHostTags
3609736099
parameters:
36098-
- description: When specified, filters list of tags to those tags with the specified
36099-
source.
36100+
- description: Name of the host to retrieve tags for
3610036101
in: path
3610136102
name: host_name
3610236103
required: true
3610336104
schema:
3610436105
type: string
36105-
- description: Source to filter.
36106+
- description: Source to filter. [Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).
36107+
Use "user" source for custom-defined tags.
3610636108
in: query
3610736109
name: source
3610836110
required: false
@@ -36129,25 +36131,25 @@ paths:
3612936131
description: Not Found
3613036132
'429':
3613136133
$ref: '#/components/responses/TooManyRequestsResponse'
36132-
summary: Get host tags
36134+
summary: Get Host Tags
3613336135
tags:
3613436136
- Tags
3613536137
post:
3613636138
description: 'This endpoint allows you to add new tags to a host,
3613736139

36138-
optionally specifying where these tags come from.'
36140+
optionally specifying what source these tags come from. If tags already exist,
36141+
appends new tags to the tag list. If no source is specified, defaults to "user".'
3613936142
operationId: CreateHostTags
3614036143
parameters:
36141-
- description: This endpoint allows you to add new tags to a host, optionally
36142-
specifying where the tags came from.
36144+
- description: Specified host name to add new tags
3614336145
in: path
3614436146
name: host_name
3614536147
required: true
3614636148
schema:
3614736149
type: string
36148-
- description: 'The source of the tags.
36149-
36150-
[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).'
36150+
- description: Source to add tags. [Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).
36151+
Use "user" source for custom-defined tags. If no source is specified, defaults
36152+
to "user".
3615136153
example: chef
3615236154
in: query
3615336155
name: source
@@ -36192,16 +36194,15 @@ paths:
3619236194
an integration source with those supplied in the request.'
3619336195
operationId: UpdateHostTags
3619436196
parameters:
36195-
- description: This endpoint allows you to update/replace all in an integration
36196-
source with those supplied in the request.
36197+
- description: Specified host name to change tags
3619736198
in: path
3619836199
name: host_name
3619936200
required: true
3620036201
schema:
3620136202
type: string
36202-
- description: 'The source of the tags (for example chef, puppet).
36203-
36204-
[Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value)'
36203+
- description: Source to update tags. [Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).
36204+
Use "user" source for custom-defined tags. If no source specified, defaults
36205+
to "user".
3620536206
in: query
3620636207
name: source
3620736208
required: false
@@ -39217,7 +39218,8 @@ tags:
3921739218

3921839219
by a source. For example, some valid sources include nagios, hudson, jenkins,
3921939220

39220-
users, feed, chef, puppet, git, bitbucket, fabric, capistrano, etc.
39221+
users, feed, chef, puppet, git, bitbucket, fabric, capistrano, etc. Find a complete
39222+
list of source type names under [API Source Attributes](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).
3922139223

3922239224

3922339225
Read more about tags on [Getting Started with Tags](https://docs.datadoghq.com/getting_started/tagging/).'

examples/v1/tags/GetHostTags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Get host tags returns "OK" response
2+
Get Host Tags returns "OK" response
33
"""
44

55
from datadog_api_client import ApiClient, Configuration

examples/v1/tags/ListHostTags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Get Tags returns "OK" response
2+
Get All Host Tags returns "OK" response
33
"""
44

55
from datadog_api_client import ApiClient, Configuration

src/datadog_api_client/v1/api/tags_api.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TagsApi:
2525
2626
The component of your infrastructure responsible for a tag is identified
2727
by a source. For example, some valid sources include nagios, hudson, jenkins,
28-
users, feed, chef, puppet, git, bitbucket, fabric, capistrano, etc.
28+
users, feed, chef, puppet, git, bitbucket, fabric, capistrano, etc. Find a complete list of source type names under `API Source Attributes <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_.
2929
3030
Read more about tags on `Getting Started with Tags <https://docs.datadoghq.com/getting_started/tagging/>`_.
3131
"""
@@ -185,14 +185,13 @@ def create_host_tags(
185185
"""Add tags to a host.
186186
187187
This endpoint allows you to add new tags to a host,
188-
optionally specifying where these tags come from.
188+
optionally specifying what source these tags come from. If tags already exist, appends new tags to the tag list. If no source is specified, defaults to "user".
189189
190-
:param host_name: This endpoint allows you to add new tags to a host, optionally specifying where the tags came from.
190+
:param host_name: Specified host name to add new tags
191191
:type host_name: str
192192
:param body: Update host tags request body.
193193
:type body: HostTags
194-
:param source: The source of the tags.
195-
`Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_.
194+
:param source: Source to add tags. `Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_. Use "user" source for custom-defined tags. If no source is specified, defaults to "user".
196195
:type source: str, optional
197196
:rtype: HostTags
198197
"""
@@ -214,13 +213,12 @@ def delete_host_tags(
214213
) -> None:
215214
"""Remove host tags.
216215
217-
This endpoint allows you to remove all user-assigned tags
218-
for a single host.
216+
This endpoint allows you to remove all tags
217+
for a single host. If no source is specified, only deletes from the source "User".
219218
220-
:param host_name: This endpoint allows you to remove all user-assigned tags for a single host.
219+
:param host_name: Specified host name to delete tags
221220
:type host_name: str
222-
:param source: The source of the tags (for example chef, puppet).
223-
`Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_.
221+
:param source: Source of the tags to be deleted. `Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_. Use "user" source for custom-defined tags.
224222
:type source: str, optional
225223
:rtype: None
226224
"""
@@ -238,13 +236,13 @@ def get_host_tags(
238236
*,
239237
source: Union[str, UnsetType] = unset,
240238
) -> HostTags:
241-
"""Get host tags.
239+
"""Get Host Tags.
242240
243241
Return the list of tags that apply to a given host.
244242
245-
:param host_name: When specified, filters list of tags to those tags with the specified source.
243+
:param host_name: Name of the host to retrieve tags for
246244
:type host_name: str
247-
:param source: Source to filter.
245+
:param source: Source to filter. `Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_. Use "user" source for custom-defined tags.
248246
:type source: str, optional
249247
:rtype: HostTags
250248
"""
@@ -261,11 +259,11 @@ def list_host_tags(
261259
*,
262260
source: Union[str, UnsetType] = unset,
263261
) -> TagToHosts:
264-
"""Get Tags.
262+
"""Get All Host Tags.
265263
266-
Return a mapping of tags to hosts for your whole infrastructure.
264+
Returns a mapping of tags to hosts. For each tag, the response returns a list of host names that contain this tag. There is a restriction of 10k total host names from the org that can be attached to tags and returned.
267265
268-
:param source: When specified, filters host list to those tags with the specified source.
266+
:param source: Source to filter. `Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_. Use "user" source for custom-defined tags.
269267
:type source: str, optional
270268
:rtype: TagToHosts
271269
"""
@@ -287,12 +285,11 @@ def update_host_tags(
287285
This endpoint allows you to update/replace all tags in
288286
an integration source with those supplied in the request.
289287
290-
:param host_name: This endpoint allows you to update/replace all in an integration source with those supplied in the request.
288+
:param host_name: Specified host name to change tags
291289
:type host_name: str
292290
:param body: Add tags to host
293291
:type body: HostTags
294-
:param source: The source of the tags (for example chef, puppet).
295-
`Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_
292+
:param source: Source to update tags. `Complete list of source attribute values <https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value>`_. Use "user" source for custom-defined tags. If no source specified, defaults to "user".
296293
:type source: str, optional
297294
:rtype: HostTags
298295
"""

src/datadog_api_client/v1/model/host_tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ def openapi_types(_):
2828

2929
def __init__(self_, host: Union[str, UnsetType] = unset, tags: Union[List[str], UnsetType] = unset, **kwargs):
3030
"""
31-
Set of tags to associate with your host.
31+
Host name and an array of its tags
3232
3333
:param host: Your host name.
3434
:type host: str, optional
3535
36-
:param tags: A list of tags to apply to the host.
36+
:param tags: A list of tags associated with a host.
3737
:type tags: [str], optional
3838
"""
3939
if host is not unset:

src/datadog_api_client/v1/model/tag_to_hosts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def openapi_types(_):
2626

2727
def __init__(self_, tags: Union[Dict[str, List[str]], UnsetType] = unset, **kwargs):
2828
"""
29-
In this object, the key is the tag, the value is a list of host names that are reporting that tag.
29+
In this object, the key is the tag, and the value is a list of host names that are reporting that tag.
3030
31-
:param tags: A list of tags to apply to the host.
31+
:param tags: A mapping of tags to host names
3232
:type tags: {str: ([str],)}, optional
3333
"""
3434
if tags is not unset:

tests/v1/features/tags.feature

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ Feature: Tags
66
tags to a particular host. The component of your infrastructure
77
responsible for a tag is identified by a source. For example, some valid
88
sources include nagios, hudson, jenkins, users, feed, chef, puppet, git,
9-
bitbucket, fabric, capistrano, etc. Read more about tags on [Getting
10-
Started with Tags](https://docs.datadoghq.com/getting_started/tagging/).
9+
bitbucket, fabric, capistrano, etc. Find a complete list of source type
10+
names under [API Source
11+
Attributes](https://docs.datadoghq.com/integrations/faq/list-of-api-
12+
source-attribute-value). Read more about tags on [Getting Started with
13+
Tags](https://docs.datadoghq.com/getting_started/tagging/).
1114

1215
Background:
1316
Given a valid "apiKeyAuth" key in the system
@@ -31,26 +34,26 @@ Feature: Tags
3134
Then the response status is 404 Not Found
3235

3336
@generated @skip @team:DataDog/core-index
34-
Scenario: Get Tags returns "Not Found" response
37+
Scenario: Get All Host Tags returns "Not Found" response
3538
Given new "ListHostTags" request
3639
When the request is sent
3740
Then the response status is 404 Not Found
3841

3942
@generated @skip @team:DataDog/core-index
40-
Scenario: Get Tags returns "OK" response
43+
Scenario: Get All Host Tags returns "OK" response
4144
Given new "ListHostTags" request
4245
When the request is sent
4346
Then the response status is 200 OK
4447

4548
@generated @skip @team:DataDog/core-index
46-
Scenario: Get host tags returns "Not Found" response
49+
Scenario: Get Host Tags returns "Not Found" response
4750
Given new "GetHostTags" request
4851
And request contains "host_name" parameter from "REPLACE.ME"
4952
When the request is sent
5053
Then the response status is 404 Not Found
5154

5255
@generated @skip @team:DataDog/core-index
53-
Scenario: Get host tags returns "OK" response
56+
Scenario: Get Host Tags returns "OK" response
5457
Given new "GetHostTags" request
5558
And request contains "host_name" parameter from "REPLACE.ME"
5659
When the request is sent

0 commit comments

Comments
 (0)