diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 51ea971a3e8..49c921bf48d 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -4179,7 +4179,7 @@ components: example: false type: boolean type: object - HostTags: + HostTagsInput: description: Set of tags to associate with your host. properties: host: @@ -4194,6 +4194,21 @@ components: type: string type: array type: object + HostTagsOutput: + description: Set of tags to associate with your host. + properties: + host: + description: Your host name. + example: test.host + type: string + tags: + description: A list of tags attached to a given host. + items: + description: A given tag in a list. + example: environment:production + type: string + type: array + type: object HostTotals: description: Total number of host currently monitored by Datadog. properties: @@ -18689,18 +18704,18 @@ components: - match type: object TagToHosts: - description: In this object, the key is the tag, the value is a list of host - names that are reporting that tag. + description: In this object, the key is the tag, and the value is a list of + host names that are reporting that tag. properties: tags: additionalProperties: - description: A list of additional properties for tags. + description: A list of host names which contain this tag items: description: A given tag in a list. example: test.metric.host type: string type: array - description: A list of tags to apply to the host. + description: A mapping of tags to host names type: object type: object TargetFormatType: @@ -35712,11 +35727,13 @@ paths: - synthetics_global_variable_write /api/v1/tags/hosts: get: - description: Return a mapping of tags to hosts for your whole infrastructure. + description: 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 host names from the org that can be attached to tags and returned. operationId: ListHostTags parameters: - - description: When specified, filters host list to those tags with the specified - source. + - description: 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. in: query name: source required: false @@ -35747,7 +35764,7 @@ paths: - apiKeyAuth: [] appKeyAuth: [] - AuthZ: [] - summary: Get Tags + summary: Get All Host Tags tags: - Tags x-permission: @@ -35760,16 +35777,14 @@ paths: for a single host.' operationId: DeleteHostTags parameters: - - description: This endpoint allows you to remove all user-assigned tags for - a single host. + - description: Specified host name to delete tags in: path name: host_name required: true schema: type: string - - description: 'The source of the tags (for example chef, puppet). - - [Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).' + - description: 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. in: query name: source required: false @@ -35799,14 +35814,14 @@ paths: description: Return the list of tags that apply to a given host. operationId: GetHostTags parameters: - - description: When specified, filters list of tags to those tags with the specified - source. + - description: Specified host name to view tags in: path name: host_name required: true schema: type: string - - description: Source to filter. + - description: 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. in: query name: source required: false @@ -35817,7 +35832,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/HostTags' + $ref: '#/components/schemas/HostTagsOutput' description: OK '403': content: @@ -35833,25 +35848,23 @@ paths: description: Not Found '429': $ref: '#/components/responses/TooManyRequestsResponse' - summary: Get host tags + summary: Get Host Tags tags: - Tags post: description: 'This endpoint allows you to add new tags to a host, - optionally specifying where these tags come from.' + optionally specifying what source these tags come from.' operationId: CreateHostTags parameters: - - description: This endpoint allows you to add new tags to a host, optionally - specifying where the tags came from. + - description: Specified host name to add new tags in: path name: host_name required: true schema: type: string - - description: 'The source of the tags. - - [Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value).' + - description: 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. example: chef in: query name: source @@ -35862,7 +35875,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/HostTags' + $ref: '#/components/schemas/HostTagsInput' description: Update host tags request body. required: true responses: @@ -35870,7 +35883,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/HostTags' + $ref: '#/components/schemas/HostTagsOutput' description: Created '403': content: @@ -35896,16 +35909,14 @@ paths: an integration source with those supplied in the request.' operationId: UpdateHostTags parameters: - - description: This endpoint allows you to update/replace all in an integration - source with those supplied in the request. + - description: Specified host name to change tags in: path name: host_name required: true schema: type: string - - description: 'The source of the tags (for example chef, puppet). - - [Complete list of source attribute values](https://docs.datadoghq.com/integrations/faq/list-of-api-source-attribute-value)' + - description: 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. in: query name: source required: false @@ -35915,7 +35926,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/HostTags' + $ref: '#/components/schemas/HostTagsInput' description: Add tags to host required: true responses: @@ -35923,7 +35934,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/HostTags' + $ref: '#/components/schemas/HostTagsOutput' description: OK '403': content: @@ -38918,7 +38929,8 @@ tags: by a source. For example, some valid sources include nagios, hudson, jenkins, - users, feed, chef, puppet, git, bitbucket, fabric, capistrano, etc. + 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). Read more about tags on [Getting Started with Tags](https://docs.datadoghq.com/getting_started/tagging/).' diff --git a/examples/v1/tags/CreateHostTags.java b/examples/v1/tags/CreateHostTags.java index 2f09445a66c..a63fb8e71ef 100644 --- a/examples/v1/tags/CreateHostTags.java +++ b/examples/v1/tags/CreateHostTags.java @@ -3,7 +3,8 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v1.api.TagsApi; -import com.datadog.api.client.v1.model.HostTags; +import com.datadog.api.client.v1.model.HostTagsInput; +import com.datadog.api.client.v1.model.HostTagsOutput; import java.util.Collections; public class Example { @@ -11,11 +12,13 @@ public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); TagsApi apiInstance = new TagsApi(defaultClient); - HostTags body = - new HostTags().host("test.host").tags(Collections.singletonList("environment:production")); + HostTagsInput body = + new HostTagsInput() + .host("test.host") + .tags(Collections.singletonList("environment:production")); try { - HostTags result = apiInstance.createHostTags("host_name", body); + HostTagsOutput result = apiInstance.createHostTags("host_name", body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling TagsApi#createHostTags"); diff --git a/examples/v1/tags/GetHostTags.java b/examples/v1/tags/GetHostTags.java index 41cbdae0358..acfe67724b7 100644 --- a/examples/v1/tags/GetHostTags.java +++ b/examples/v1/tags/GetHostTags.java @@ -1,9 +1,9 @@ -// Get host tags returns "OK" response +// Get Host Tags returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v1.api.TagsApi; -import com.datadog.api.client.v1.model.HostTags; +import com.datadog.api.client.v1.model.HostTagsOutput; public class Example { public static void main(String[] args) { @@ -11,7 +11,7 @@ public static void main(String[] args) { TagsApi apiInstance = new TagsApi(defaultClient); try { - HostTags result = apiInstance.getHostTags("host_name"); + HostTagsOutput result = apiInstance.getHostTags("host_name"); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling TagsApi#getHostTags"); diff --git a/examples/v1/tags/ListHostTags.java b/examples/v1/tags/ListHostTags.java index a63fe39f365..5a7cb72c8ff 100644 --- a/examples/v1/tags/ListHostTags.java +++ b/examples/v1/tags/ListHostTags.java @@ -1,4 +1,4 @@ -// Get Tags returns "OK" response +// Get All Host Tags returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; diff --git a/examples/v1/tags/UpdateHostTags.java b/examples/v1/tags/UpdateHostTags.java index cf9f8c70d77..9600dd11b51 100644 --- a/examples/v1/tags/UpdateHostTags.java +++ b/examples/v1/tags/UpdateHostTags.java @@ -3,7 +3,8 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v1.api.TagsApi; -import com.datadog.api.client.v1.model.HostTags; +import com.datadog.api.client.v1.model.HostTagsInput; +import com.datadog.api.client.v1.model.HostTagsOutput; import java.util.Collections; public class Example { @@ -11,11 +12,13 @@ public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); TagsApi apiInstance = new TagsApi(defaultClient); - HostTags body = - new HostTags().host("test.host").tags(Collections.singletonList("environment:production")); + HostTagsInput body = + new HostTagsInput() + .host("test.host") + .tags(Collections.singletonList("environment:production")); try { - HostTags result = apiInstance.updateHostTags("host_name", body); + HostTagsOutput result = apiInstance.updateHostTags("host_name", body); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling TagsApi#updateHostTags"); diff --git a/src/main/java/com/datadog/api/client/v1/api/TagsApi.java b/src/main/java/com/datadog/api/client/v1/api/TagsApi.java index bb99d2b0979..9810eb53fd8 100644 --- a/src/main/java/com/datadog/api/client/v1/api/TagsApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/TagsApi.java @@ -4,7 +4,8 @@ import com.datadog.api.client.ApiException; import com.datadog.api.client.ApiResponse; import com.datadog.api.client.Pair; -import com.datadog.api.client.v1.model.HostTags; +import com.datadog.api.client.v1.model.HostTagsInput; +import com.datadog.api.client.v1.model.HostTagsOutput; import com.datadog.api.client.v1.model.TagToHosts; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; @@ -52,9 +53,10 @@ public static class CreateHostTagsOptionalParameters { /** * Set source. * - * @param source The source of the tags. Complete - * list of source attribute values. (optional) + * list of source attribute values. Use "user" source for custom-defined tags. + * (optional) * @return CreateHostTagsOptionalParameters */ public CreateHostTagsOptionalParameters source(String source) { @@ -68,13 +70,12 @@ public CreateHostTagsOptionalParameters source(String source) { * *

See {@link #createHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to add new tags to a host, optionally specifying where - * the tags came from. (required) + * @param hostName Specified host name to add new tags (required) * @param body Update host tags request body. (required) - * @return HostTags + * @return HostTagsOutput * @throws ApiException if fails to make API call */ - public HostTags createHostTags(String hostName, HostTags body) throws ApiException { + public HostTagsOutput createHostTags(String hostName, HostTagsInput body) throws ApiException { return createHostTagsWithHttpInfo(hostName, body, new CreateHostTagsOptionalParameters()) .getData(); } @@ -84,12 +85,12 @@ public HostTags createHostTags(String hostName, HostTags body) throws ApiExcepti * *

See {@link #createHostTagsWithHttpInfoAsync}. * - * @param hostName This endpoint allows you to add new tags to a host, optionally specifying where - * the tags came from. (required) + * @param hostName Specified host name to add new tags (required) * @param body Update host tags request body. (required) - * @return CompletableFuture<HostTags> + * @return CompletableFuture<HostTagsOutput> */ - public CompletableFuture createHostTagsAsync(String hostName, HostTags body) { + public CompletableFuture createHostTagsAsync( + String hostName, HostTagsInput body) { return createHostTagsWithHttpInfoAsync(hostName, body, new CreateHostTagsOptionalParameters()) .thenApply( response -> { @@ -102,15 +103,14 @@ public CompletableFuture createHostTagsAsync(String hostName, HostTags * *

See {@link #createHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to add new tags to a host, optionally specifying where - * the tags came from. (required) + * @param hostName Specified host name to add new tags (required) * @param body Update host tags request body. (required) * @param parameters Optional parameters for the request. - * @return HostTags + * @return HostTagsOutput * @throws ApiException if fails to make API call */ - public HostTags createHostTags( - String hostName, HostTags body, CreateHostTagsOptionalParameters parameters) + public HostTagsOutput createHostTags( + String hostName, HostTagsInput body, CreateHostTagsOptionalParameters parameters) throws ApiException { return createHostTagsWithHttpInfo(hostName, body, parameters).getData(); } @@ -120,14 +120,13 @@ public HostTags createHostTags( * *

See {@link #createHostTagsWithHttpInfoAsync}. * - * @param hostName This endpoint allows you to add new tags to a host, optionally specifying where - * the tags came from. (required) + * @param hostName Specified host name to add new tags (required) * @param body Update host tags request body. (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<HostTags> + * @return CompletableFuture<HostTagsOutput> */ - public CompletableFuture createHostTagsAsync( - String hostName, HostTags body, CreateHostTagsOptionalParameters parameters) { + public CompletableFuture createHostTagsAsync( + String hostName, HostTagsInput body, CreateHostTagsOptionalParameters parameters) { return createHostTagsWithHttpInfoAsync(hostName, body, parameters) .thenApply( response -> { @@ -136,14 +135,13 @@ public CompletableFuture createHostTagsAsync( } /** - * This endpoint allows you to add new tags to a host, optionally specifying where these tags come - * from. + * This endpoint allows you to add new tags to a host, optionally specifying what source these + * tags come from. * - * @param hostName This endpoint allows you to add new tags to a host, optionally specifying where - * the tags came from. (required) + * @param hostName Specified host name to add new tags (required) * @param body Update host tags request body. (required) * @param parameters Optional parameters for the request. - * @return ApiResponse<HostTags> + * @return ApiResponse<HostTagsOutput> * @throws ApiException if fails to make API call * @http.response.details * @@ -155,8 +153,8 @@ public CompletableFuture createHostTagsAsync( * *
429 Too many requests -
*/ - public ApiResponse createHostTagsWithHttpInfo( - String hostName, HostTags body, CreateHostTagsOptionalParameters parameters) + public ApiResponse createHostTagsWithHttpInfo( + String hostName, HostTagsInput body, CreateHostTagsOptionalParameters parameters) throws ApiException { Object localVarPostBody = body; @@ -199,7 +197,7 @@ public ApiResponse createHostTagsWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -207,19 +205,18 @@ public ApiResponse createHostTagsWithHttpInfo( * *

See {@link #createHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to add new tags to a host, optionally specifying where - * the tags came from. (required) + * @param hostName Specified host name to add new tags (required) * @param body Update host tags request body. (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<HostTags>> + * @return CompletableFuture<ApiResponse<HostTagsOutput>> */ - public CompletableFuture> createHostTagsWithHttpInfoAsync( - String hostName, HostTags body, CreateHostTagsOptionalParameters parameters) { + public CompletableFuture> createHostTagsWithHttpInfoAsync( + String hostName, HostTagsInput body, CreateHostTagsOptionalParameters parameters) { Object localVarPostBody = body; // verify the required parameter 'hostName' is set if (hostName == null) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'hostName' when calling createHostTags")); @@ -228,7 +225,7 @@ public CompletableFuture> createHostTagsWithHttpInfoAsync( // verify the required parameter 'body' is set if (body == null) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'body' when calling createHostTags")); @@ -257,7 +254,7 @@ public CompletableFuture> createHostTagsWithHttpInfoAsync( new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -269,7 +266,7 @@ public CompletableFuture> createHostTagsWithHttpInfoAsync( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to deleteHostTags. */ @@ -279,9 +276,10 @@ public static class DeleteHostTagsOptionalParameters { /** * Set source. * - * @param source The source of the tags (for example chef, puppet). Complete - * list of source attribute values. (optional) + * list of source attribute values. Use "user" source for custom-defined tags. + * (optional) * @return DeleteHostTagsOptionalParameters */ public DeleteHostTagsOptionalParameters source(String source) { @@ -295,8 +293,7 @@ public DeleteHostTagsOptionalParameters source(String source) { * *

See {@link #deleteHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to remove all user-assigned tags for a single host. - * (required) + * @param hostName Specified host name to delete tags (required) * @throws ApiException if fails to make API call */ public void deleteHostTags(String hostName) throws ApiException { @@ -308,8 +305,7 @@ public void deleteHostTags(String hostName) throws ApiException { * *

See {@link #deleteHostTagsWithHttpInfoAsync}. * - * @param hostName This endpoint allows you to remove all user-assigned tags for a single host. - * (required) + * @param hostName Specified host name to delete tags (required) * @return CompletableFuture */ public CompletableFuture deleteHostTagsAsync(String hostName) { @@ -325,8 +321,7 @@ public CompletableFuture deleteHostTagsAsync(String hostName) { * *

See {@link #deleteHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to remove all user-assigned tags for a single host. - * (required) + * @param hostName Specified host name to delete tags (required) * @param parameters Optional parameters for the request. * @throws ApiException if fails to make API call */ @@ -340,8 +335,7 @@ public void deleteHostTags(String hostName, DeleteHostTagsOptionalParameters par * *

See {@link #deleteHostTagsWithHttpInfoAsync}. * - * @param hostName This endpoint allows you to remove all user-assigned tags for a single host. - * (required) + * @param hostName Specified host name to delete tags (required) * @param parameters Optional parameters for the request. * @return CompletableFuture */ @@ -357,8 +351,7 @@ public CompletableFuture deleteHostTagsAsync( /** * This endpoint allows you to remove all user-assigned tags for a single host. * - * @param hostName This endpoint allows you to remove all user-assigned tags for a single host. - * (required) + * @param hostName Specified host name to delete tags (required) * @param parameters Optional parameters for the request. * @return ApiResponse<Void> * @throws ApiException if fails to make API call @@ -417,8 +410,7 @@ public ApiResponse deleteHostTagsWithHttpInfo( * *

See {@link #deleteHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to remove all user-assigned tags for a single host. - * (required) + * @param hostName Specified host name to delete tags (required) * @param parameters Optional parameters for the request. * @return CompletableFuture<ApiResponse<Void>> */ @@ -479,7 +471,10 @@ public static class GetHostTagsOptionalParameters { /** * Set source. * - * @param source Source to filter. (optional) + * @param source Source to filter. Complete + * list of source attribute values. Use "user" source for custom-defined tags. + * (optional) * @return GetHostTagsOptionalParameters */ public GetHostTagsOptionalParameters source(String source) { @@ -489,29 +484,27 @@ public GetHostTagsOptionalParameters source(String source) { } /** - * Get host tags. + * Get Host Tags. * *

See {@link #getHostTagsWithHttpInfo}. * - * @param hostName When specified, filters list of tags to those tags with the specified source. - * (required) - * @return HostTags + * @param hostName Specified host name to view tags (required) + * @return HostTagsOutput * @throws ApiException if fails to make API call */ - public HostTags getHostTags(String hostName) throws ApiException { + public HostTagsOutput getHostTags(String hostName) throws ApiException { return getHostTagsWithHttpInfo(hostName, new GetHostTagsOptionalParameters()).getData(); } /** - * Get host tags. + * Get Host Tags. * *

See {@link #getHostTagsWithHttpInfoAsync}. * - * @param hostName When specified, filters list of tags to those tags with the specified source. - * (required) - * @return CompletableFuture<HostTags> + * @param hostName Specified host name to view tags (required) + * @return CompletableFuture<HostTagsOutput> */ - public CompletableFuture getHostTagsAsync(String hostName) { + public CompletableFuture getHostTagsAsync(String hostName) { return getHostTagsWithHttpInfoAsync(hostName, new GetHostTagsOptionalParameters()) .thenApply( response -> { @@ -520,32 +513,30 @@ public CompletableFuture getHostTagsAsync(String hostName) { } /** - * Get host tags. + * Get Host Tags. * *

See {@link #getHostTagsWithHttpInfo}. * - * @param hostName When specified, filters list of tags to those tags with the specified source. - * (required) + * @param hostName Specified host name to view tags (required) * @param parameters Optional parameters for the request. - * @return HostTags + * @return HostTagsOutput * @throws ApiException if fails to make API call */ - public HostTags getHostTags(String hostName, GetHostTagsOptionalParameters parameters) + public HostTagsOutput getHostTags(String hostName, GetHostTagsOptionalParameters parameters) throws ApiException { return getHostTagsWithHttpInfo(hostName, parameters).getData(); } /** - * Get host tags. + * Get Host Tags. * *

See {@link #getHostTagsWithHttpInfoAsync}. * - * @param hostName When specified, filters list of tags to those tags with the specified source. - * (required) + * @param hostName Specified host name to view tags (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<HostTags> + * @return CompletableFuture<HostTagsOutput> */ - public CompletableFuture getHostTagsAsync( + public CompletableFuture getHostTagsAsync( String hostName, GetHostTagsOptionalParameters parameters) { return getHostTagsWithHttpInfoAsync(hostName, parameters) .thenApply( @@ -557,10 +548,9 @@ public CompletableFuture getHostTagsAsync( /** * Return the list of tags that apply to a given host. * - * @param hostName When specified, filters list of tags to those tags with the specified source. - * (required) + * @param hostName Specified host name to view tags (required) * @param parameters Optional parameters for the request. - * @return ApiResponse<HostTags> + * @return ApiResponse<HostTagsOutput> * @throws ApiException if fails to make API call * @http.response.details * @@ -572,7 +562,7 @@ public CompletableFuture getHostTagsAsync( * *
429 Too many requests -
*/ - public ApiResponse getHostTagsWithHttpInfo( + public ApiResponse getHostTagsWithHttpInfo( String hostName, GetHostTagsOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; @@ -609,26 +599,25 @@ public ApiResponse getHostTagsWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get host tags. + * Get Host Tags. * *

See {@link #getHostTagsWithHttpInfo}. * - * @param hostName When specified, filters list of tags to those tags with the specified source. - * (required) + * @param hostName Specified host name to view tags (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<HostTags>> + * @return CompletableFuture<ApiResponse<HostTagsOutput>> */ - public CompletableFuture> getHostTagsWithHttpInfoAsync( + public CompletableFuture> getHostTagsWithHttpInfoAsync( String hostName, GetHostTagsOptionalParameters parameters) { Object localVarPostBody = null; // verify the required parameter 'hostName' is set if (hostName == null) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'hostName' when calling getHostTags")); @@ -657,7 +646,7 @@ public CompletableFuture> getHostTagsWithHttpInfoAsync( new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -669,7 +658,7 @@ public CompletableFuture> getHostTagsWithHttpInfoAsync( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to listHostTags. */ @@ -679,7 +668,9 @@ public static class ListHostTagsOptionalParameters { /** * Set source. * - * @param source When specified, filters host list to those tags with the specified source. + * @param source Source to filter. Complete + * list of source attribute values. Use "user" source for custom-defined tags. * (optional) * @return ListHostTagsOptionalParameters */ @@ -690,7 +681,7 @@ public ListHostTagsOptionalParameters source(String source) { } /** - * Get Tags. + * Get All Host Tags. * *

See {@link #listHostTagsWithHttpInfo}. * @@ -702,7 +693,7 @@ public TagToHosts listHostTags() throws ApiException { } /** - * Get Tags. + * Get All Host Tags. * *

See {@link #listHostTagsWithHttpInfoAsync}. * @@ -717,7 +708,7 @@ public CompletableFuture listHostTagsAsync() { } /** - * Get Tags. + * Get All Host Tags. * *

See {@link #listHostTagsWithHttpInfo}. * @@ -730,7 +721,7 @@ public TagToHosts listHostTags(ListHostTagsOptionalParameters parameters) throws } /** - * Get Tags. + * Get All Host Tags. * *

See {@link #listHostTagsWithHttpInfoAsync}. * @@ -747,7 +738,9 @@ public CompletableFuture listHostTagsAsync( } /** - * Return a mapping of tags to hosts for your whole infrastructure. + * 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 host names from the org that can be + * attached to tags and returned. * * @param parameters Optional parameters for the request. * @return ApiResponse<TagToHosts> @@ -795,7 +788,7 @@ public ApiResponse listHostTagsWithHttpInfo(ListHostTagsOptionalPara } /** - * Get Tags. + * Get All Host Tags. * *

See {@link #listHostTagsWithHttpInfo}. * @@ -848,9 +841,10 @@ public static class UpdateHostTagsOptionalParameters { /** * Set source. * - * @param source The source of the tags (for example chef, puppet). Complete - * list of source attribute values (optional) + * list of source attribute values. Use "user" source for custom-defined tags. + * (optional) * @return UpdateHostTagsOptionalParameters */ public UpdateHostTagsOptionalParameters source(String source) { @@ -864,13 +858,12 @@ public UpdateHostTagsOptionalParameters source(String source) { * *

See {@link #updateHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to update/replace all in an integration source with - * those supplied in the request. (required) + * @param hostName Specified host name to change tags (required) * @param body Add tags to host (required) - * @return HostTags + * @return HostTagsOutput * @throws ApiException if fails to make API call */ - public HostTags updateHostTags(String hostName, HostTags body) throws ApiException { + public HostTagsOutput updateHostTags(String hostName, HostTagsInput body) throws ApiException { return updateHostTagsWithHttpInfo(hostName, body, new UpdateHostTagsOptionalParameters()) .getData(); } @@ -880,12 +873,12 @@ public HostTags updateHostTags(String hostName, HostTags body) throws ApiExcepti * *

See {@link #updateHostTagsWithHttpInfoAsync}. * - * @param hostName This endpoint allows you to update/replace all in an integration source with - * those supplied in the request. (required) + * @param hostName Specified host name to change tags (required) * @param body Add tags to host (required) - * @return CompletableFuture<HostTags> + * @return CompletableFuture<HostTagsOutput> */ - public CompletableFuture updateHostTagsAsync(String hostName, HostTags body) { + public CompletableFuture updateHostTagsAsync( + String hostName, HostTagsInput body) { return updateHostTagsWithHttpInfoAsync(hostName, body, new UpdateHostTagsOptionalParameters()) .thenApply( response -> { @@ -898,15 +891,14 @@ public CompletableFuture updateHostTagsAsync(String hostName, HostTags * *

See {@link #updateHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to update/replace all in an integration source with - * those supplied in the request. (required) + * @param hostName Specified host name to change tags (required) * @param body Add tags to host (required) * @param parameters Optional parameters for the request. - * @return HostTags + * @return HostTagsOutput * @throws ApiException if fails to make API call */ - public HostTags updateHostTags( - String hostName, HostTags body, UpdateHostTagsOptionalParameters parameters) + public HostTagsOutput updateHostTags( + String hostName, HostTagsInput body, UpdateHostTagsOptionalParameters parameters) throws ApiException { return updateHostTagsWithHttpInfo(hostName, body, parameters).getData(); } @@ -916,14 +908,13 @@ public HostTags updateHostTags( * *

See {@link #updateHostTagsWithHttpInfoAsync}. * - * @param hostName This endpoint allows you to update/replace all in an integration source with - * those supplied in the request. (required) + * @param hostName Specified host name to change tags (required) * @param body Add tags to host (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<HostTags> + * @return CompletableFuture<HostTagsOutput> */ - public CompletableFuture updateHostTagsAsync( - String hostName, HostTags body, UpdateHostTagsOptionalParameters parameters) { + public CompletableFuture updateHostTagsAsync( + String hostName, HostTagsInput body, UpdateHostTagsOptionalParameters parameters) { return updateHostTagsWithHttpInfoAsync(hostName, body, parameters) .thenApply( response -> { @@ -935,11 +926,10 @@ public CompletableFuture updateHostTagsAsync( * This endpoint allows you to update/replace all tags in an integration source with those * supplied in the request. * - * @param hostName This endpoint allows you to update/replace all in an integration source with - * those supplied in the request. (required) + * @param hostName Specified host name to change tags (required) * @param body Add tags to host (required) * @param parameters Optional parameters for the request. - * @return ApiResponse<HostTags> + * @return ApiResponse<HostTagsOutput> * @throws ApiException if fails to make API call * @http.response.details * @@ -951,8 +941,8 @@ public CompletableFuture updateHostTagsAsync( * *
429 Too many requests -
*/ - public ApiResponse updateHostTagsWithHttpInfo( - String hostName, HostTags body, UpdateHostTagsOptionalParameters parameters) + public ApiResponse updateHostTagsWithHttpInfo( + String hostName, HostTagsInput body, UpdateHostTagsOptionalParameters parameters) throws ApiException { Object localVarPostBody = body; @@ -995,7 +985,7 @@ public ApiResponse updateHostTagsWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -1003,19 +993,18 @@ public ApiResponse updateHostTagsWithHttpInfo( * *

See {@link #updateHostTagsWithHttpInfo}. * - * @param hostName This endpoint allows you to update/replace all in an integration source with - * those supplied in the request. (required) + * @param hostName Specified host name to change tags (required) * @param body Add tags to host (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<HostTags>> + * @return CompletableFuture<ApiResponse<HostTagsOutput>> */ - public CompletableFuture> updateHostTagsWithHttpInfoAsync( - String hostName, HostTags body, UpdateHostTagsOptionalParameters parameters) { + public CompletableFuture> updateHostTagsWithHttpInfoAsync( + String hostName, HostTagsInput body, UpdateHostTagsOptionalParameters parameters) { Object localVarPostBody = body; // verify the required parameter 'hostName' is set if (hostName == null) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'hostName' when calling updateHostTags")); @@ -1024,7 +1013,7 @@ public CompletableFuture> updateHostTagsWithHttpInfoAsync( // verify the required parameter 'body' is set if (body == null) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, "Missing the required parameter 'body' when calling updateHostTags")); @@ -1053,7 +1042,7 @@ public CompletableFuture> updateHostTagsWithHttpInfoAsync( new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -1065,6 +1054,6 @@ public CompletableFuture> updateHostTagsWithHttpInfoAsync( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } } diff --git a/src/main/java/com/datadog/api/client/v1/model/HostTags.java b/src/main/java/com/datadog/api/client/v1/model/HostTagsInput.java similarity index 85% rename from src/main/java/com/datadog/api/client/v1/model/HostTags.java rename to src/main/java/com/datadog/api/client/v1/model/HostTagsInput.java index fda1c74e074..ff2fdd246c4 100644 --- a/src/main/java/com/datadog/api/client/v1/model/HostTags.java +++ b/src/main/java/com/datadog/api/client/v1/model/HostTagsInput.java @@ -19,10 +19,10 @@ import java.util.Objects; /** Set of tags to associate with your host. */ -@JsonPropertyOrder({HostTags.JSON_PROPERTY_HOST, HostTags.JSON_PROPERTY_TAGS}) +@JsonPropertyOrder({HostTagsInput.JSON_PROPERTY_HOST, HostTagsInput.JSON_PROPERTY_TAGS}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class HostTags { +public class HostTagsInput { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_HOST = "host"; private String host; @@ -30,7 +30,7 @@ public class HostTags { public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; - public HostTags host(String host) { + public HostTagsInput host(String host) { this.host = host; return this; } @@ -51,12 +51,12 @@ public void setHost(String host) { this.host = host; } - public HostTags tags(List tags) { + public HostTagsInput tags(List tags) { this.tags = tags; return this; } - public HostTags addTagsItem(String tagsItem) { + public HostTagsInput addTagsItem(String tagsItem) { if (this.tags == null) { this.tags = new ArrayList<>(); } @@ -92,10 +92,10 @@ public void setTags(List tags) { * * @param key The arbitrary key to set * @param value The associated value - * @return HostTags + * @return HostTagsInput */ @JsonAnySetter - public HostTags putAdditionalProperty(String key, Object value) { + public HostTagsInput putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -126,7 +126,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this HostTags object is equal to o. */ + /** Return true if this HostTagsInput object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -135,10 +135,10 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - HostTags hostTags = (HostTags) o; - return Objects.equals(this.host, hostTags.host) - && Objects.equals(this.tags, hostTags.tags) - && Objects.equals(this.additionalProperties, hostTags.additionalProperties); + HostTagsInput hostTagsInput = (HostTagsInput) o; + return Objects.equals(this.host, hostTagsInput.host) + && Objects.equals(this.tags, hostTagsInput.tags) + && Objects.equals(this.additionalProperties, hostTagsInput.additionalProperties); } @Override @@ -149,7 +149,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class HostTags {\n"); + sb.append("class HostTagsInput {\n"); sb.append(" host: ").append(toIndentedString(host)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/main/java/com/datadog/api/client/v1/model/HostTagsOutput.java b/src/main/java/com/datadog/api/client/v1/model/HostTagsOutput.java new file mode 100644 index 00000000000..c224c19f2cf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/HostTagsOutput.java @@ -0,0 +1,171 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Set of tags to associate with your host. */ +@JsonPropertyOrder({HostTagsOutput.JSON_PROPERTY_HOST, HostTagsOutput.JSON_PROPERTY_TAGS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class HostTagsOutput { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HOST = "host"; + private String host; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public HostTagsOutput host(String host) { + this.host = host; + return this; + } + + /** + * Your host name. + * + * @return host + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HOST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public HostTagsOutput tags(List tags) { + this.tags = tags; + return this; + } + + public HostTagsOutput addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * A list of tags attached to a given host. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return HostTagsOutput + */ + @JsonAnySetter + public HostTagsOutput putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this HostTagsOutput object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HostTagsOutput hostTagsOutput = (HostTagsOutput) o; + return Objects.equals(this.host, hostTagsOutput.host) + && Objects.equals(this.tags, hostTagsOutput.tags) + && Objects.equals(this.additionalProperties, hostTagsOutput.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(host, tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HostTagsOutput {\n"); + sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/TagToHosts.java b/src/main/java/com/datadog/api/client/v1/model/TagToHosts.java index 2cc5d52c271..4048f2f6cb0 100644 --- a/src/main/java/com/datadog/api/client/v1/model/TagToHosts.java +++ b/src/main/java/com/datadog/api/client/v1/model/TagToHosts.java @@ -18,7 +18,7 @@ import java.util.Objects; /** - * In this object, the key is the tag, the value is a list of host names that are reporting that + * In this object, the key is the tag, and the value is a list of host names that are reporting that * tag. */ @JsonPropertyOrder({TagToHosts.JSON_PROPERTY_TAGS}) @@ -43,7 +43,7 @@ public TagToHosts putTagsItem(String key, List tagsItem) { } /** - * A list of tags to apply to the host. + * A mapping of tags to host names * * @return tags */ diff --git a/src/test/resources/com/datadog/api/client/v1/api/tags.feature b/src/test/resources/com/datadog/api/client/v1/api/tags.feature index 36e1eabfdc2..d6557ca1882 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/tags.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/tags.feature @@ -6,8 +6,11 @@ Feature: Tags tags to a particular host. The component of your infrastructure responsible for a tag is identified by a source. For example, some valid sources include nagios, hudson, jenkins, users, feed, chef, puppet, git, - bitbucket, fabric, capistrano, etc. Read more about tags on [Getting - Started with Tags](https://docs.datadoghq.com/getting_started/tagging/). + 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). Read more about tags on [Getting Started with + Tags](https://docs.datadoghq.com/getting_started/tagging/). Background: Given a valid "apiKeyAuth" key in the system @@ -31,26 +34,26 @@ Feature: Tags Then the response status is 404 Not Found @generated @skip @team:DataDog/core-index - Scenario: Get Tags returns "Not Found" response + Scenario: Get All Host Tags returns "Not Found" response Given new "ListHostTags" request When the request is sent Then the response status is 404 Not Found @generated @skip @team:DataDog/core-index - Scenario: Get Tags returns "OK" response + Scenario: Get All Host Tags returns "OK" response Given new "ListHostTags" request When the request is sent Then the response status is 200 OK @generated @skip @team:DataDog/core-index - Scenario: Get host tags returns "Not Found" response + Scenario: Get Host Tags returns "Not Found" response Given new "GetHostTags" request And request contains "host_name" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found @generated @skip @team:DataDog/core-index - Scenario: Get host tags returns "OK" response + Scenario: Get Host Tags returns "OK" response Given new "GetHostTags" request And request contains "host_name" parameter from "REPLACE.ME" When the request is sent