diff --git a/.apigentools-info b/.apigentools-info index bd623a4ad0f..814d0d09f3b 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-06 14:53:22.185897", - "spec_repo_commit": "e591d5d4" + "regenerated": "2025-06-06 17:43:33.552338", + "spec_repo_commit": "01341d5b" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-06 14:53:22.203481", - "spec_repo_commit": "e591d5d4" + "regenerated": "2025-06-06 17:43:33.567997", + "spec_repo_commit": "01341d5b" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5baec1eb2af..d093ae5abd7 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -563,6 +563,14 @@ components: required: true schema: type: string + KindID: + description: Entity kind. + in: path + name: kind_id + required: true + schema: + example: my-job + type: string MetricID: description: The name of the log-based metric. in: path @@ -19303,6 +19311,90 @@ components: - index - caseIndex type: object + KindAttributes: + description: Kind attributes. + properties: + description: + description: Short description of the kind. + type: string + displayName: + description: User friendly name of the kind. + type: string + name: + description: The kind name. + example: my-job + minLength: 1 + type: string + type: object + KindData: + description: Schema that defines the structure of a Kind object in the Software + Catalog. + properties: + attributes: + $ref: '#/components/schemas/KindAttributes' + id: + description: A read-only globally unique identifier for the entity generated + by Datadog. User supplied values are ignored. + example: 4b163705-23c0-4573-b2fb-f6cea2163fcb + minLength: 1 + type: string + meta: + $ref: '#/components/schemas/KindMetadata' + type: + description: Kind. + type: string + type: object + KindMetadata: + description: Kind metadata. + properties: + createdAt: + description: The creation time. + type: string + modifiedAt: + description: The modification time. + type: string + type: object + KindObj: + description: Schema for kind. + properties: + description: + description: Short description of the kind. + type: string + displayName: + description: The display name of the kind. Automatically generated if not + provided. + type: string + kind: + description: The name of the kind to create or update. This must be in kebab-case + format. + example: my-job + type: string + required: + - kind + type: object + KindRaw: + description: Kind definition in raw JSON or YAML representation. + example: 'kind: service + + displayName: Service + + description: A service entity in the catalog. + + ' + type: string + KindResponseData: + description: List of kind responses. + items: + $ref: '#/components/schemas/KindData' + type: array + KindResponseMeta: + description: Kind response metadata. + properties: + count: + description: Total kinds count. + format: int64 + type: integer + type: object Layer: description: Encapsulates a layer resource, holding attributes like rotation details, plus relationships to the members covering that layer. @@ -19789,6 +19881,14 @@ components: meta: $ref: '#/components/schemas/HistoricalJobListMeta' type: object + ListKindCatalogResponse: + description: List kind response. + properties: + data: + $ref: '#/components/schemas/KindResponseData' + meta: + $ref: '#/components/schemas/KindResponseMeta' + type: object ListPipelinesResponse: description: Represents the response payload containing a list of pipelines and associated metadata. @@ -39531,6 +39631,19 @@ components: description: Upsert entity response included item. oneOf: - $ref: '#/components/schemas/EntityResponseIncludedSchema' + UpsertCatalogKindRequest: + description: Create or update kind request. + oneOf: + - $ref: '#/components/schemas/KindObj' + - $ref: '#/components/schemas/KindRaw' + UpsertCatalogKindResponse: + description: Upsert kind response. + properties: + data: + $ref: '#/components/schemas/KindResponseData' + meta: + $ref: '#/components/schemas/KindResponseMeta' + type: object Urgency: description: Specifies the level of urgency for a routing rule (low, high, or dynamic). @@ -43768,6 +43881,105 @@ paths: summary: Delete a single entity tags: - Software Catalog + /api/v2/catalog/kind: + get: + description: Get a list of entity kinds from Software Catalog. + operationId: ListCatalogKind + parameters: + - $ref: '#/components/parameters/PageOffset' + - description: Maximum number of kinds in the response. + example: 100 + in: query + name: page[limit] + required: false + schema: + default: 100 + format: int64 + type: integer + - $ref: '#/components/parameters/FilterByID' + - $ref: '#/components/parameters/FilterByName' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListKindCatalogResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_read + summary: Get a list of entity kinds + tags: + - Software Catalog + x-pagination: + limitParam: page[limit] + pageOffsetParam: page[offset] + resultsPath: data + post: + description: Create or update kinds in Software Catalog. + operationId: UpsertCatalogKind + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpsertCatalogKindRequest' + description: Kind YAML or JSON. + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/UpsertCatalogKindResponse' + description: ACCEPTED + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_write + summary: Create or update kinds + tags: + - Software Catalog + x-codegen-request-body-name: body + /api/v2/catalog/kind/{kind_id}: + delete: + description: Delete a single kind in Software Catalog. + operationId: DeleteCatalogKind + parameters: + - $ref: '#/components/parameters/KindID' + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_write + summary: Delete a single kind + tags: + - Software Catalog /api/v2/catalog/relation: get: description: Get a list of entity relations from Software Catalog. diff --git a/examples/v2/software-catalog/DeleteCatalogKind.java b/examples/v2/software-catalog/DeleteCatalogKind.java new file mode 100644 index 00000000000..21413a212a5 --- /dev/null +++ b/examples/v2/software-catalog/DeleteCatalogKind.java @@ -0,0 +1,22 @@ +// Delete a single kind returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SoftwareCatalogApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + SoftwareCatalogApi apiInstance = new SoftwareCatalogApi(defaultClient); + + try { + apiInstance.deleteCatalogKind("my-job"); + } catch (ApiException e) { + System.err.println("Exception when calling SoftwareCatalogApi#deleteCatalogKind"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/software-catalog/ListCatalogKind.java b/examples/v2/software-catalog/ListCatalogKind.java new file mode 100644 index 00000000000..29614eabad0 --- /dev/null +++ b/examples/v2/software-catalog/ListCatalogKind.java @@ -0,0 +1,24 @@ +// Get a list of entity kinds returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SoftwareCatalogApi; +import com.datadog.api.client.v2.model.ListKindCatalogResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + SoftwareCatalogApi apiInstance = new SoftwareCatalogApi(defaultClient); + + try { + ListKindCatalogResponse result = apiInstance.listCatalogKind(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SoftwareCatalogApi#listCatalogKind"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/software-catalog/ListCatalogKind_3806205775.java b/examples/v2/software-catalog/ListCatalogKind_3806205775.java new file mode 100644 index 00000000000..f91b0fbe5f9 --- /dev/null +++ b/examples/v2/software-catalog/ListCatalogKind_3806205775.java @@ -0,0 +1,25 @@ +// Get a list of entity kinds returns "OK" response with pagination + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.PaginationIterable; +import com.datadog.api.client.v2.api.SoftwareCatalogApi; +import com.datadog.api.client.v2.model.KindData; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + SoftwareCatalogApi apiInstance = new SoftwareCatalogApi(defaultClient); + + try { + PaginationIterable iterable = apiInstance.listCatalogKindWithPagination(); + + for (KindData item : iterable) { + System.out.println(item); + } + } catch (RuntimeException e) { + System.err.println("Exception when calling SoftwareCatalogApi#listCatalogKindWithPagination"); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/software-catalog/UpsertCatalogKind.java b/examples/v2/software-catalog/UpsertCatalogKind.java new file mode 100644 index 00000000000..bbe1d13988f --- /dev/null +++ b/examples/v2/software-catalog/UpsertCatalogKind.java @@ -0,0 +1,28 @@ +// Create or update kinds returns "ACCEPTED" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.SoftwareCatalogApi; +import com.datadog.api.client.v2.model.KindObj; +import com.datadog.api.client.v2.model.UpsertCatalogKindRequest; +import com.datadog.api.client.v2.model.UpsertCatalogKindResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + SoftwareCatalogApi apiInstance = new SoftwareCatalogApi(defaultClient); + + UpsertCatalogKindRequest body = new UpsertCatalogKindRequest(new KindObj().kind("my-job")); + + try { + UpsertCatalogKindResponse result = apiInstance.upsertCatalogKind(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SoftwareCatalogApi#upsertCatalogKind"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/SoftwareCatalogApi.java b/src/main/java/com/datadog/api/client/v2/api/SoftwareCatalogApi.java index 44a495538cd..bb2874a8a1b 100644 --- a/src/main/java/com/datadog/api/client/v2/api/SoftwareCatalogApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/SoftwareCatalogApi.java @@ -7,13 +7,17 @@ import com.datadog.api.client.Pair; import com.datadog.api.client.v2.model.EntityData; import com.datadog.api.client.v2.model.IncludeType; +import com.datadog.api.client.v2.model.KindData; import com.datadog.api.client.v2.model.ListEntityCatalogResponse; +import com.datadog.api.client.v2.model.ListKindCatalogResponse; import com.datadog.api.client.v2.model.ListRelationCatalogResponse; import com.datadog.api.client.v2.model.RelationIncludeType; import com.datadog.api.client.v2.model.RelationResponse; import com.datadog.api.client.v2.model.RelationType; import com.datadog.api.client.v2.model.UpsertCatalogEntityRequest; import com.datadog.api.client.v2.model.UpsertCatalogEntityResponse; +import com.datadog.api.client.v2.model.UpsertCatalogKindRequest; +import com.datadog.api.client.v2.model.UpsertCatalogKindResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -188,6 +192,139 @@ public CompletableFuture> deleteCatalogEntityWithHttpInfoAsync null); } + /** + * Delete a single kind. + * + *

See {@link #deleteCatalogKindWithHttpInfo}. + * + * @param kindId Entity kind. (required) + * @throws ApiException if fails to make API call + */ + public void deleteCatalogKind(String kindId) throws ApiException { + deleteCatalogKindWithHttpInfo(kindId); + } + + /** + * Delete a single kind. + * + *

See {@link #deleteCatalogKindWithHttpInfoAsync}. + * + * @param kindId Entity kind. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteCatalogKindAsync(String kindId) { + return deleteCatalogKindWithHttpInfoAsync(kindId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete a single kind in Software Catalog. + * + * @param kindId Entity kind. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteCatalogKindWithHttpInfo(String kindId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'kindId' is set + if (kindId == null) { + throw new ApiException( + 400, "Missing the required parameter 'kindId' when calling deleteCatalogKind"); + } + // create path and map variables + String localVarPath = + "/api/v2/catalog/kind/{kind_id}" + .replaceAll("\\{" + "kind_id" + "\\}", apiClient.escapeString(kindId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SoftwareCatalogApi.deleteCatalogKind", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a single kind. + * + *

See {@link #deleteCatalogKindWithHttpInfo}. + * + * @param kindId Entity kind. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteCatalogKindWithHttpInfoAsync(String kindId) { + Object localVarPostBody = null; + + // verify the required parameter 'kindId' is set + if (kindId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'kindId' when calling deleteCatalogKind")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/catalog/kind/{kind_id}" + .replaceAll("\\{" + "kind_id" + "\\}", apiClient.escapeString(kindId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SoftwareCatalogApi.deleteCatalogKind", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** Manage optional parameters to listCatalogEntity. */ public static class ListCatalogEntityOptionalParameters { private Long pageOffset; @@ -557,6 +694,276 @@ public ApiResponse listCatalogEntityWithHttpInfo( new GenericType() {}); } + /** Manage optional parameters to listCatalogKind. */ + public static class ListCatalogKindOptionalParameters { + private Long pageOffset; + private Long pageLimit; + private String filterId; + private String filterName; + + /** + * Set pageOffset. + * + * @param pageOffset Specific offset to use as the beginning of the returned page. (optional, + * default to 0) + * @return ListCatalogKindOptionalParameters + */ + public ListCatalogKindOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Maximum number of kinds in the response. (optional, default to 100) + * @return ListCatalogKindOptionalParameters + */ + public ListCatalogKindOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + + /** + * Set filterId. + * + * @param filterId Filter entities by UUID. (optional) + * @return ListCatalogKindOptionalParameters + */ + public ListCatalogKindOptionalParameters filterId(String filterId) { + this.filterId = filterId; + return this; + } + + /** + * Set filterName. + * + * @param filterName Filter entities by name. (optional) + * @return ListCatalogKindOptionalParameters + */ + public ListCatalogKindOptionalParameters filterName(String filterName) { + this.filterName = filterName; + return this; + } + } + + /** + * Get a list of entity kinds. + * + *

See {@link #listCatalogKindWithHttpInfo}. + * + * @return ListKindCatalogResponse + * @throws ApiException if fails to make API call + */ + public ListKindCatalogResponse listCatalogKind() throws ApiException { + return listCatalogKindWithHttpInfo(new ListCatalogKindOptionalParameters()).getData(); + } + + /** + * Get a list of entity kinds. + * + *

See {@link #listCatalogKindWithHttpInfoAsync}. + * + * @return CompletableFuture<ListKindCatalogResponse> + */ + public CompletableFuture listCatalogKindAsync() { + return listCatalogKindWithHttpInfoAsync(new ListCatalogKindOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a list of entity kinds. + * + *

See {@link #listCatalogKindWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return ListKindCatalogResponse + * @throws ApiException if fails to make API call + */ + public ListKindCatalogResponse listCatalogKind(ListCatalogKindOptionalParameters parameters) + throws ApiException { + return listCatalogKindWithHttpInfo(parameters).getData(); + } + + /** + * Get a list of entity kinds. + * + *

See {@link #listCatalogKindWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListKindCatalogResponse> + */ + public CompletableFuture listCatalogKindAsync( + ListCatalogKindOptionalParameters parameters) { + return listCatalogKindWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a list of entity kinds. + * + *

See {@link #listCatalogKindWithHttpInfo}. + * + * @return PaginationIterable<KindData> + */ + public PaginationIterable listCatalogKindWithPagination() { + ListCatalogKindOptionalParameters parameters = new ListCatalogKindOptionalParameters(); + return listCatalogKindWithPagination(parameters); + } + + /** + * Get a list of entity kinds. + * + *

See {@link #listCatalogKindWithHttpInfo}. + * + * @return ListKindCatalogResponse + */ + public PaginationIterable listCatalogKindWithPagination( + ListCatalogKindOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = ""; + String valueSetterPath = "pageOffset"; + Boolean valueSetterParamOptional = true; + Long limit; + + if (parameters.pageLimit == null) { + limit = 100l; + parameters.pageLimit(limit); + } else { + limit = parameters.pageLimit; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listCatalogKind", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + limit, + args); + + return iterator; + } + + /** + * Get a list of entity kinds from Software Catalog. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListKindCatalogResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listCatalogKindWithHttpInfo( + ListCatalogKindOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; + String filterId = parameters.filterId; + String filterName = parameters.filterName; + // create path and map variables + String localVarPath = "/api/v2/catalog/kind"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[id]", filterId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[name]", filterName)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SoftwareCatalogApi.listCatalogKind", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a list of entity kinds. + * + *

See {@link #listCatalogKindWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListKindCatalogResponse>> + */ + public CompletableFuture> listCatalogKindWithHttpInfoAsync( + ListCatalogKindOptionalParameters parameters) { + Object localVarPostBody = null; + Long pageOffset = parameters.pageOffset; + Long pageLimit = parameters.pageLimit; + String filterId = parameters.filterId; + String filterName = parameters.filterName; + // create path and map variables + String localVarPath = "/api/v2/catalog/kind"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[id]", filterId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[name]", filterName)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SoftwareCatalogApi.listCatalogKind", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to listCatalogRelation. */ public static class ListCatalogRelationOptionalParameters { private Long pageOffset; @@ -995,4 +1402,137 @@ public ApiResponse upsertCatalogEntityWithHttpInfo( false, new GenericType() {}); } + + /** + * Create or update kinds. + * + *

See {@link #upsertCatalogKindWithHttpInfo}. + * + * @param body Kind YAML or JSON. (required) + * @return UpsertCatalogKindResponse + * @throws ApiException if fails to make API call + */ + public UpsertCatalogKindResponse upsertCatalogKind(UpsertCatalogKindRequest body) + throws ApiException { + return upsertCatalogKindWithHttpInfo(body).getData(); + } + + /** + * Create or update kinds. + * + *

See {@link #upsertCatalogKindWithHttpInfoAsync}. + * + * @param body Kind YAML or JSON. (required) + * @return CompletableFuture<UpsertCatalogKindResponse> + */ + public CompletableFuture upsertCatalogKindAsync( + UpsertCatalogKindRequest body) { + return upsertCatalogKindWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create or update kinds in Software Catalog. + * + * @param body Kind YAML or JSON. (required) + * @return ApiResponse<UpsertCatalogKindResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 ACCEPTED -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse upsertCatalogKindWithHttpInfo( + UpsertCatalogKindRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling upsertCatalogKind"); + } + // create path and map variables + String localVarPath = "/api/v2/catalog/kind"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.SoftwareCatalogApi.upsertCatalogKind", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create or update kinds. + * + *

See {@link #upsertCatalogKindWithHttpInfo}. + * + * @param body Kind YAML or JSON. (required) + * @return CompletableFuture<ApiResponse<UpsertCatalogKindResponse>> + */ + public CompletableFuture> + upsertCatalogKindWithHttpInfoAsync(UpsertCatalogKindRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling upsertCatalogKind")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/catalog/kind"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.SoftwareCatalogApi.upsertCatalogKind", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/KindAttributes.java b/src/main/java/com/datadog/api/client/v2/model/KindAttributes.java new file mode 100644 index 00000000000..e70eb4934ed --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/KindAttributes.java @@ -0,0 +1,191 @@ +/* + * 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.v2.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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Kind attributes. */ +@JsonPropertyOrder({ + KindAttributes.JSON_PROPERTY_DESCRIPTION, + KindAttributes.JSON_PROPERTY_DISPLAY_NAME, + KindAttributes.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class KindAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public KindAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Short description of the kind. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public KindAttributes displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * User friendly name of the kind. + * + * @return displayName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public KindAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The kind name. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 KindAttributes + */ + @JsonAnySetter + public KindAttributes 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 KindAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KindAttributes kindAttributes = (KindAttributes) o; + return Objects.equals(this.description, kindAttributes.description) + && Objects.equals(this.displayName, kindAttributes.displayName) + && Objects.equals(this.name, kindAttributes.name) + && Objects.equals(this.additionalProperties, kindAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, displayName, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KindAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/v2/model/KindData.java b/src/main/java/com/datadog/api/client/v2/model/KindData.java new file mode 100644 index 00000000000..333b943e358 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/KindData.java @@ -0,0 +1,221 @@ +/* + * 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.v2.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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Schema that defines the structure of a Kind object in the Software Catalog. */ +@JsonPropertyOrder({ + KindData.JSON_PROPERTY_ATTRIBUTES, + KindData.JSON_PROPERTY_ID, + KindData.JSON_PROPERTY_META, + KindData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class KindData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private KindAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_META = "meta"; + private KindMetadata meta; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public KindData attributes(KindAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Kind attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public KindAttributes getAttributes() { + return attributes; + } + + public void setAttributes(KindAttributes attributes) { + this.attributes = attributes; + } + + public KindData id(String id) { + this.id = id; + return this; + } + + /** + * A read-only globally unique identifier for the entity generated by Datadog. User supplied + * values are ignored. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public KindData meta(KindMetadata meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Kind metadata. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public KindMetadata getMeta() { + return meta; + } + + public void setMeta(KindMetadata meta) { + this.meta = meta; + } + + public KindData type(String type) { + this.type = type; + return this; + } + + /** + * Kind. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * 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 KindData + */ + @JsonAnySetter + public KindData 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 KindData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KindData kindData = (KindData) o; + return Objects.equals(this.attributes, kindData.attributes) + && Objects.equals(this.id, kindData.id) + && Objects.equals(this.meta, kindData.meta) + && Objects.equals(this.type, kindData.type) + && Objects.equals(this.additionalProperties, kindData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, meta, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KindData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/v2/model/KindMetadata.java b/src/main/java/com/datadog/api/client/v2/model/KindMetadata.java new file mode 100644 index 00000000000..96b4e0dae24 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/KindMetadata.java @@ -0,0 +1,161 @@ +/* + * 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.v2.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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Kind metadata. */ +@JsonPropertyOrder({KindMetadata.JSON_PROPERTY_CREATED_AT, KindMetadata.JSON_PROPERTY_MODIFIED_AT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class KindMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modifiedAt"; + private String modifiedAt; + + public KindMetadata createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The creation time. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public KindMetadata modifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * The modification time. + * + * @return modifiedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + } + + /** + * 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 KindMetadata + */ + @JsonAnySetter + public KindMetadata 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 KindMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KindMetadata kindMetadata = (KindMetadata) o; + return Objects.equals(this.createdAt, kindMetadata.createdAt) + && Objects.equals(this.modifiedAt, kindMetadata.modifiedAt) + && Objects.equals(this.additionalProperties, kindMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, modifiedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KindMetadata {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).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/v2/model/KindObj.java b/src/main/java/com/datadog/api/client/v2/model/KindObj.java new file mode 100644 index 00000000000..6ef2fdda7d6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/KindObj.java @@ -0,0 +1,198 @@ +/* + * 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.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Schema for kind. */ +@JsonPropertyOrder({ + KindObj.JSON_PROPERTY_DESCRIPTION, + KindObj.JSON_PROPERTY_DISPLAY_NAME, + KindObj.JSON_PROPERTY_KIND +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class KindObj { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName; + + public static final String JSON_PROPERTY_KIND = "kind"; + private String kind; + + public KindObj() {} + + @JsonCreator + public KindObj(@JsonProperty(required = true, value = JSON_PROPERTY_KIND) String kind) { + this.kind = kind; + } + + public KindObj description(String description) { + this.description = description; + return this; + } + + /** + * Short description of the kind. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public KindObj displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The display name of the kind. Automatically generated if not provided. + * + * @return displayName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public KindObj kind(String kind) { + this.kind = kind; + return this; + } + + /** + * The name of the kind to create or update. This must be in kebab-case format. + * + * @return kind + */ + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKind() { + return kind; + } + + public void setKind(String kind) { + this.kind = kind; + } + + /** + * 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 KindObj + */ + @JsonAnySetter + public KindObj 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 KindObj object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KindObj kindObj = (KindObj) o; + return Objects.equals(this.description, kindObj.description) + && Objects.equals(this.displayName, kindObj.displayName) + && Objects.equals(this.kind, kindObj.kind) + && Objects.equals(this.additionalProperties, kindObj.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, displayName, kind, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KindObj {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).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/v2/model/KindResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/KindResponseMeta.java new file mode 100644 index 00000000000..9a25bf198e4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/KindResponseMeta.java @@ -0,0 +1,135 @@ +/* + * 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.v2.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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Kind response metadata. */ +@JsonPropertyOrder({KindResponseMeta.JSON_PROPERTY_COUNT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class KindResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COUNT = "count"; + private Long count; + + public KindResponseMeta count(Long count) { + this.count = count; + return this; + } + + /** + * Total kinds count. + * + * @return count + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getCount() { + return count; + } + + public void setCount(Long count) { + this.count = count; + } + + /** + * 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 KindResponseMeta + */ + @JsonAnySetter + public KindResponseMeta 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 KindResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + KindResponseMeta kindResponseMeta = (KindResponseMeta) o; + return Objects.equals(this.count, kindResponseMeta.count) + && Objects.equals(this.additionalProperties, kindResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(count, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KindResponseMeta {\n"); + sb.append(" count: ").append(toIndentedString(count)).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/v2/model/ListKindCatalogResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListKindCatalogResponse.java new file mode 100644 index 00000000000..fa002636d0b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListKindCatalogResponse.java @@ -0,0 +1,179 @@ +/* + * 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.v2.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; + +/** List kind response. */ +@JsonPropertyOrder({ + ListKindCatalogResponse.JSON_PROPERTY_DATA, + ListKindCatalogResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListKindCatalogResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private KindResponseMeta meta; + + public ListKindCatalogResponse data(List data) { + this.data = data; + for (KindData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListKindCatalogResponse addDataItem(KindData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of kind responses. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public ListKindCatalogResponse meta(KindResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Kind response metadata. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public KindResponseMeta getMeta() { + return meta; + } + + public void setMeta(KindResponseMeta meta) { + this.meta = meta; + } + + /** + * 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 ListKindCatalogResponse + */ + @JsonAnySetter + public ListKindCatalogResponse 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 ListKindCatalogResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListKindCatalogResponse listKindCatalogResponse = (ListKindCatalogResponse) o; + return Objects.equals(this.data, listKindCatalogResponse.data) + && Objects.equals(this.meta, listKindCatalogResponse.meta) + && Objects.equals(this.additionalProperties, listKindCatalogResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListKindCatalogResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/v2/model/UpsertCatalogKindRequest.java b/src/main/java/com/datadog/api/client/v2/model/UpsertCatalogKindRequest.java new file mode 100644 index 00000000000..250115e90af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpsertCatalogKindRequest.java @@ -0,0 +1,272 @@ +/* + * 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.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = UpsertCatalogKindRequest.UpsertCatalogKindRequestDeserializer.class) +@JsonSerialize(using = UpsertCatalogKindRequest.UpsertCatalogKindRequestSerializer.class) +public class UpsertCatalogKindRequest extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpsertCatalogKindRequest.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class UpsertCatalogKindRequestSerializer + extends StdSerializer { + public UpsertCatalogKindRequestSerializer(Class t) { + super(t); + } + + public UpsertCatalogKindRequestSerializer() { + this(null); + } + + @Override + public void serialize( + UpsertCatalogKindRequest value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class UpsertCatalogKindRequestDeserializer + extends StdDeserializer { + public UpsertCatalogKindRequestDeserializer() { + this(UpsertCatalogKindRequest.class); + } + + public UpsertCatalogKindRequestDeserializer(Class vc) { + super(vc); + } + + @Override + public UpsertCatalogKindRequest deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize KindObj + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (KindObj.class.equals(Integer.class) + || KindObj.class.equals(Long.class) + || KindObj.class.equals(Float.class) + || KindObj.class.equals(Double.class) + || KindObj.class.equals(Boolean.class) + || KindObj.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((KindObj.class.equals(Integer.class) || KindObj.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((KindObj.class.equals(Float.class) || KindObj.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (KindObj.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (KindObj.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(KindObj.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((KindObj) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'KindObj'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'KindObj'", e); + } + + // deserialize String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) + || String.class.equals(Long.class) + || String.class.equals(Float.class) + || String.class.equals(Double.class) + || String.class.equals(Boolean.class) + || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((String.class.equals(Integer.class) || String.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((String.class.equals(Float.class) || String.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (String.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(String.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + UpsertCatalogKindRequest ret = new UpsertCatalogKindRequest(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public UpsertCatalogKindRequest getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "UpsertCatalogKindRequest cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public UpsertCatalogKindRequest() { + super("oneOf", Boolean.FALSE); + } + + public UpsertCatalogKindRequest(KindObj o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public UpsertCatalogKindRequest(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("KindObj", new GenericType() {}); + schemas.put("String", new GenericType() {}); + JSON.registerDescendants(UpsertCatalogKindRequest.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return UpsertCatalogKindRequest.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: KindObj, String + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(KindObj.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be KindObj, String"); + } + + /** + * Get the actual instance, which can be the following: KindObj, String + * + * @return The actual instance (KindObj, String) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `KindObj`. If the actual instance is not `KindObj`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `KindObj` + * @throws ClassCastException if the instance is not `KindObj` + */ + public KindObj getKindObj() throws ClassCastException { + return (KindObj) super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpsertCatalogKindResponse.java b/src/main/java/com/datadog/api/client/v2/model/UpsertCatalogKindResponse.java new file mode 100644 index 00000000000..f3050dc526d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpsertCatalogKindResponse.java @@ -0,0 +1,180 @@ +/* + * 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.v2.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; + +/** Upsert kind response. */ +@JsonPropertyOrder({ + UpsertCatalogKindResponse.JSON_PROPERTY_DATA, + UpsertCatalogKindResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpsertCatalogKindResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public static final String JSON_PROPERTY_META = "meta"; + private KindResponseMeta meta; + + public UpsertCatalogKindResponse data(List data) { + this.data = data; + for (KindData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UpsertCatalogKindResponse addDataItem(KindData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of kind responses. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public UpsertCatalogKindResponse meta(KindResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Kind response metadata. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public KindResponseMeta getMeta() { + return meta; + } + + public void setMeta(KindResponseMeta meta) { + this.meta = meta; + } + + /** + * 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 UpsertCatalogKindResponse + */ + @JsonAnySetter + public UpsertCatalogKindResponse 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 UpsertCatalogKindResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertCatalogKindResponse upsertCatalogKindResponse = (UpsertCatalogKindResponse) o; + return Objects.equals(this.data, upsertCatalogKindResponse.data) + && Objects.equals(this.meta, upsertCatalogKindResponse.meta) + && Objects.equals( + this.additionalProperties, upsertCatalogKindResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertCatalogKindResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 794ed14f84f..dd414a687e9 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -108,6 +108,18 @@ "tag": "Software Catalog", "operationId": "UpsertCatalogEntity" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"kind\": \"my-job\",\n \"displayName\": \"My Job\",\n \"description\": \"A job entity in the catalog.\"\n}" + } + ], + "step": "there is a valid kind", + "key": "kind", + "tag": "Software Catalog", + "operationId": "UpsertCatalogKind" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/software_catalog.feature b/src/test/resources/com/datadog/api/client/v2/api/software_catalog.feature index afb04f1b186..070e066a944 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/software_catalog.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/software_catalog.feature @@ -28,6 +28,20 @@ Feature: Software Catalog When the request is sent Then the response status is 500 Internal Server Error + @generated @skip @team:DataDog/service-catalog + Scenario: Create or update kinds returns "ACCEPTED" response + Given new "UpsertCatalogKind" request + And body with value {"kind": "my-job"} + When the request is sent + Then the response status is 202 ACCEPTED + + @generated @skip @team:DataDog/service-catalog + Scenario: Create or update kinds returns "Bad Request" response + Given new "UpsertCatalogKind" request + And body with value {"kind": "my-job"} + When the request is sent + Then the response status is 400 Bad Request + @team:DataDog/service-catalog Scenario: Create or update software catalog entity using schema v3 returns "ACCEPTED" response Given new "UpsertCatalogEntity" request @@ -59,6 +73,27 @@ Feature: Software Catalog When the request is sent Then the response status is 204 OK + @generated @skip @team:DataDog/service-catalog + Scenario: Delete a single kind returns "Bad Request" response + Given new "DeleteCatalogKind" request + And request contains "kind_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: Delete a single kind returns "Not Found" response + Given new "DeleteCatalogKind" request + And request contains "kind_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/service-catalog + Scenario: Delete a single kind returns "OK" response + Given new "DeleteCatalogKind" request + And request contains "kind_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + @skip @team:DataDog/service-catalog Scenario: Delete an entity returns "Not Found" response Given new "DeleteCatalogEntity" request @@ -79,6 +114,24 @@ Feature: Software Catalog When the request with pagination is sent Then the response status is 200 OK + @generated @skip @team:DataDog/service-catalog + Scenario: Get a list of entity kinds returns "Bad Request" response + Given new "ListCatalogKind" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: Get a list of entity kinds returns "OK" response + Given new "ListCatalogKind" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/service-catalog @with-pagination + Scenario: Get a list of entity kinds returns "OK" response with pagination + Given new "ListCatalogKind" request + When the request with pagination is sent + Then the response status is 200 OK + @replay-only @team:DataDog/service-catalog Scenario: Get a list of entity relations returns "OK" response Given new "ListCatalogRelation" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index a7a5bb3ac1e..2d33b5cd716 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -471,6 +471,31 @@ "type": "idempotent" } }, + "ListCatalogKind": { + "tag": "Software Catalog", + "undo": { + "type": "safe" + } + }, + "UpsertCatalogKind": { + "tag": "Software Catalog", + "undo": { + "operationId": "DeleteCatalogKind", + "parameters": [ + { + "name": "kind_id", + "source": "data[0].id" + } + ], + "type": "unsafe" + } + }, + "DeleteCatalogKind": { + "tag": "Software Catalog", + "undo": { + "type": "idempotent" + } + }, "ListCatalogRelation": { "tag": "Software Catalog", "undo": {