Skip to content

Commit 2384c34

Browse files
committed
fix deserializing
1 parent 2cf8a5a commit 2384c34

File tree

164 files changed

+28111
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+28111
-22
lines changed

.generator/src/generator/templates/modelOneOf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public class {{ name }} extends AbstractOpenApiSchema {
9292
// TODO: there is no validation against JSON schema constraints
9393
// (min, max, enum, pattern...), this does not perform a strict JSON
9494
// validation, which means the 'match' count may be higher than it should be.
95-
{%- if not oneOf|is_primitive and not unParameterizedDataType|lower|is_java_base_type %}
95+
{%- if not oneOf|is_primitive and not unParameterizedDataType|lower|is_java_base_type and "enum" not in oneOf %}
9696
if (!(({{ unParameterizedDataType }})tmp).unparsed) {
9797
deserialized = tmp;
9898
match++;

src/main/java/com/datadog/api/client/ApiClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,9 @@ public class ApiClient {
430430
put("v2.createPipeline", false);
431431
put("v2.deletePipeline", false);
432432
put("v2.getPipeline", false);
433+
put("v2.listPipelines", false);
433434
put("v2.updatePipeline", false);
435+
put("v2.validatePipeline", false);
434436
put("v2.createScorecardOutcomesBatch", false);
435437
put("v2.createScorecardRule", false);
436438
put("v2.deleteScorecardRule", false);

src/main/java/com/datadog/api/client/v2/api/ObservabilityPipelinesApi.java

Lines changed: 356 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.ApiResponse;
66
import com.datadog.api.client.Pair;
7+
import com.datadog.api.client.v2.model.ListPipelinesResponse;
78
import com.datadog.api.client.v2.model.ObservabilityPipeline;
89
import com.datadog.api.client.v2.model.ObservabilityPipelineCreateRequest;
10+
import com.datadog.api.client.v2.model.ValidationErrorResponse;
911
import jakarta.ws.rs.client.Invocation;
1012
import jakarta.ws.rs.core.GenericType;
1113
import java.util.ArrayList;
1214
import java.util.HashMap;
15+
import java.util.List;
1316
import java.util.Map;
1417
import java.util.concurrent.CompletableFuture;
1518

@@ -500,6 +503,209 @@ public CompletableFuture<ApiResponse<ObservabilityPipeline>> getPipelineWithHttp
500503
new GenericType<ObservabilityPipeline>() {});
501504
}
502505

506+
/** Manage optional parameters to listPipelines. */
507+
public static class ListPipelinesOptionalParameters {
508+
private Long pageSize;
509+
private Long pageNumber;
510+
511+
/**
512+
* Set pageSize.
513+
*
514+
* @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default
515+
* to 10)
516+
* @return ListPipelinesOptionalParameters
517+
*/
518+
public ListPipelinesOptionalParameters pageSize(Long pageSize) {
519+
this.pageSize = pageSize;
520+
return this;
521+
}
522+
523+
/**
524+
* Set pageNumber.
525+
*
526+
* @param pageNumber Specific page number to return. (optional, default to 0)
527+
* @return ListPipelinesOptionalParameters
528+
*/
529+
public ListPipelinesOptionalParameters pageNumber(Long pageNumber) {
530+
this.pageNumber = pageNumber;
531+
return this;
532+
}
533+
}
534+
535+
/**
536+
* List pipelines.
537+
*
538+
* <p>See {@link #listPipelinesWithHttpInfo}.
539+
*
540+
* @return ListPipelinesResponse
541+
* @throws ApiException if fails to make API call
542+
*/
543+
public ListPipelinesResponse listPipelines() throws ApiException {
544+
return listPipelinesWithHttpInfo(new ListPipelinesOptionalParameters()).getData();
545+
}
546+
547+
/**
548+
* List pipelines.
549+
*
550+
* <p>See {@link #listPipelinesWithHttpInfoAsync}.
551+
*
552+
* @return CompletableFuture&lt;ListPipelinesResponse&gt;
553+
*/
554+
public CompletableFuture<ListPipelinesResponse> listPipelinesAsync() {
555+
return listPipelinesWithHttpInfoAsync(new ListPipelinesOptionalParameters())
556+
.thenApply(
557+
response -> {
558+
return response.getData();
559+
});
560+
}
561+
562+
/**
563+
* List pipelines.
564+
*
565+
* <p>See {@link #listPipelinesWithHttpInfo}.
566+
*
567+
* @param parameters Optional parameters for the request.
568+
* @return ListPipelinesResponse
569+
* @throws ApiException if fails to make API call
570+
*/
571+
public ListPipelinesResponse listPipelines(ListPipelinesOptionalParameters parameters)
572+
throws ApiException {
573+
return listPipelinesWithHttpInfo(parameters).getData();
574+
}
575+
576+
/**
577+
* List pipelines.
578+
*
579+
* <p>See {@link #listPipelinesWithHttpInfoAsync}.
580+
*
581+
* @param parameters Optional parameters for the request.
582+
* @return CompletableFuture&lt;ListPipelinesResponse&gt;
583+
*/
584+
public CompletableFuture<ListPipelinesResponse> listPipelinesAsync(
585+
ListPipelinesOptionalParameters parameters) {
586+
return listPipelinesWithHttpInfoAsync(parameters)
587+
.thenApply(
588+
response -> {
589+
return response.getData();
590+
});
591+
}
592+
593+
/**
594+
* Retrieve a list of pipelines.
595+
*
596+
* @param parameters Optional parameters for the request.
597+
* @return ApiResponse&lt;ListPipelinesResponse&gt;
598+
* @throws ApiException if fails to make API call
599+
* @http.response.details
600+
* <table border="1">
601+
* <caption>Response details</caption>
602+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
603+
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
604+
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
605+
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
606+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
607+
* </table>
608+
*/
609+
public ApiResponse<ListPipelinesResponse> listPipelinesWithHttpInfo(
610+
ListPipelinesOptionalParameters parameters) throws ApiException {
611+
// Check if unstable operation is enabled
612+
String operationId = "listPipelines";
613+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
614+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
615+
} else {
616+
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
617+
}
618+
Object localVarPostBody = null;
619+
Long pageSize = parameters.pageSize;
620+
Long pageNumber = parameters.pageNumber;
621+
// create path and map variables
622+
String localVarPath = "/api/v2/remote_config/products/obs_pipelines/pipelines";
623+
624+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
625+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
626+
627+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize));
628+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber));
629+
630+
Invocation.Builder builder =
631+
apiClient.createBuilder(
632+
"v2.ObservabilityPipelinesApi.listPipelines",
633+
localVarPath,
634+
localVarQueryParams,
635+
localVarHeaderParams,
636+
new HashMap<String, String>(),
637+
new String[] {"application/json"},
638+
new String[] {"apiKeyAuth", "appKeyAuth"});
639+
return apiClient.invokeAPI(
640+
"GET",
641+
builder,
642+
localVarHeaderParams,
643+
new String[] {},
644+
localVarPostBody,
645+
new HashMap<String, Object>(),
646+
false,
647+
new GenericType<ListPipelinesResponse>() {});
648+
}
649+
650+
/**
651+
* List pipelines.
652+
*
653+
* <p>See {@link #listPipelinesWithHttpInfo}.
654+
*
655+
* @param parameters Optional parameters for the request.
656+
* @return CompletableFuture&lt;ApiResponse&lt;ListPipelinesResponse&gt;&gt;
657+
*/
658+
public CompletableFuture<ApiResponse<ListPipelinesResponse>> listPipelinesWithHttpInfoAsync(
659+
ListPipelinesOptionalParameters parameters) {
660+
// Check if unstable operation is enabled
661+
String operationId = "listPipelines";
662+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
663+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
664+
} else {
665+
CompletableFuture<ApiResponse<ListPipelinesResponse>> result = new CompletableFuture<>();
666+
result.completeExceptionally(
667+
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
668+
return result;
669+
}
670+
Object localVarPostBody = null;
671+
Long pageSize = parameters.pageSize;
672+
Long pageNumber = parameters.pageNumber;
673+
// create path and map variables
674+
String localVarPath = "/api/v2/remote_config/products/obs_pipelines/pipelines";
675+
676+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
677+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
678+
679+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize));
680+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber));
681+
682+
Invocation.Builder builder;
683+
try {
684+
builder =
685+
apiClient.createBuilder(
686+
"v2.ObservabilityPipelinesApi.listPipelines",
687+
localVarPath,
688+
localVarQueryParams,
689+
localVarHeaderParams,
690+
new HashMap<String, String>(),
691+
new String[] {"application/json"},
692+
new String[] {"apiKeyAuth", "appKeyAuth"});
693+
} catch (ApiException ex) {
694+
CompletableFuture<ApiResponse<ListPipelinesResponse>> result = new CompletableFuture<>();
695+
result.completeExceptionally(ex);
696+
return result;
697+
}
698+
return apiClient.invokeAPIAsync(
699+
"GET",
700+
builder,
701+
localVarHeaderParams,
702+
new String[] {},
703+
localVarPostBody,
704+
new HashMap<String, Object>(),
705+
false,
706+
new GenericType<ListPipelinesResponse>() {});
707+
}
708+
503709
/**
504710
* Update a pipeline.
505711
*
@@ -676,4 +882,154 @@ public CompletableFuture<ApiResponse<ObservabilityPipeline>> updatePipelineWithH
676882
false,
677883
new GenericType<ObservabilityPipeline>() {});
678884
}
885+
886+
/**
887+
* Validate an observability pipeline.
888+
*
889+
* <p>See {@link #validatePipelineWithHttpInfo}.
890+
*
891+
* @param body (required)
892+
* @return ValidationErrorResponse
893+
* @throws ApiException if fails to make API call
894+
*/
895+
public ValidationErrorResponse validatePipeline(ObservabilityPipelineCreateRequest body)
896+
throws ApiException {
897+
return validatePipelineWithHttpInfo(body).getData();
898+
}
899+
900+
/**
901+
* Validate an observability pipeline.
902+
*
903+
* <p>See {@link #validatePipelineWithHttpInfoAsync}.
904+
*
905+
* @param body (required)
906+
* @return CompletableFuture&lt;ValidationErrorResponse&gt;
907+
*/
908+
public CompletableFuture<ValidationErrorResponse> validatePipelineAsync(
909+
ObservabilityPipelineCreateRequest body) {
910+
return validatePipelineWithHttpInfoAsync(body)
911+
.thenApply(
912+
response -> {
913+
return response.getData();
914+
});
915+
}
916+
917+
/**
918+
* Validates a pipeline configuration without creating or updating any resources. Returns a list
919+
* of validation errors, if any.
920+
*
921+
* @param body (required)
922+
* @return ApiResponse&lt;ValidationErrorResponse&gt;
923+
* @throws ApiException if fails to make API call
924+
* @http.response.details
925+
* <table border="1">
926+
* <caption>Response details</caption>
927+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
928+
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
929+
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
930+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
931+
* </table>
932+
*/
933+
public ApiResponse<ValidationErrorResponse> validatePipelineWithHttpInfo(
934+
ObservabilityPipelineCreateRequest body) throws ApiException {
935+
// Check if unstable operation is enabled
936+
String operationId = "validatePipeline";
937+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
938+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
939+
} else {
940+
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
941+
}
942+
Object localVarPostBody = body;
943+
944+
// verify the required parameter 'body' is set
945+
if (body == null) {
946+
throw new ApiException(
947+
400, "Missing the required parameter 'body' when calling validatePipeline");
948+
}
949+
// create path and map variables
950+
String localVarPath = "/api/v2/remote_config/products/obs_pipelines/pipelines/validate";
951+
952+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
953+
954+
Invocation.Builder builder =
955+
apiClient.createBuilder(
956+
"v2.ObservabilityPipelinesApi.validatePipeline",
957+
localVarPath,
958+
new ArrayList<Pair>(),
959+
localVarHeaderParams,
960+
new HashMap<String, String>(),
961+
new String[] {"application/json"},
962+
new String[] {"apiKeyAuth", "appKeyAuth"});
963+
return apiClient.invokeAPI(
964+
"POST",
965+
builder,
966+
localVarHeaderParams,
967+
new String[] {"application/json"},
968+
localVarPostBody,
969+
new HashMap<String, Object>(),
970+
false,
971+
new GenericType<ValidationErrorResponse>() {});
972+
}
973+
974+
/**
975+
* Validate an observability pipeline.
976+
*
977+
* <p>See {@link #validatePipelineWithHttpInfo}.
978+
*
979+
* @param body (required)
980+
* @return CompletableFuture&lt;ApiResponse&lt;ValidationErrorResponse&gt;&gt;
981+
*/
982+
public CompletableFuture<ApiResponse<ValidationErrorResponse>> validatePipelineWithHttpInfoAsync(
983+
ObservabilityPipelineCreateRequest body) {
984+
// Check if unstable operation is enabled
985+
String operationId = "validatePipeline";
986+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
987+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
988+
} else {
989+
CompletableFuture<ApiResponse<ValidationErrorResponse>> result = new CompletableFuture<>();
990+
result.completeExceptionally(
991+
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
992+
return result;
993+
}
994+
Object localVarPostBody = body;
995+
996+
// verify the required parameter 'body' is set
997+
if (body == null) {
998+
CompletableFuture<ApiResponse<ValidationErrorResponse>> result = new CompletableFuture<>();
999+
result.completeExceptionally(
1000+
new ApiException(
1001+
400, "Missing the required parameter 'body' when calling validatePipeline"));
1002+
return result;
1003+
}
1004+
// create path and map variables
1005+
String localVarPath = "/api/v2/remote_config/products/obs_pipelines/pipelines/validate";
1006+
1007+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
1008+
1009+
Invocation.Builder builder;
1010+
try {
1011+
builder =
1012+
apiClient.createBuilder(
1013+
"v2.ObservabilityPipelinesApi.validatePipeline",
1014+
localVarPath,
1015+
new ArrayList<Pair>(),
1016+
localVarHeaderParams,
1017+
new HashMap<String, String>(),
1018+
new String[] {"application/json"},
1019+
new String[] {"apiKeyAuth", "appKeyAuth"});
1020+
} catch (ApiException ex) {
1021+
CompletableFuture<ApiResponse<ValidationErrorResponse>> result = new CompletableFuture<>();
1022+
result.completeExceptionally(ex);
1023+
return result;
1024+
}
1025+
return apiClient.invokeAPIAsync(
1026+
"POST",
1027+
builder,
1028+
localVarHeaderParams,
1029+
new String[] {"application/json"},
1030+
localVarPostBody,
1031+
new HashMap<String, Object>(),
1032+
false,
1033+
new GenericType<ValidationErrorResponse>() {});
1034+
}
6791035
}

0 commit comments

Comments
 (0)