Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.5",
"regenerated": "2023-08-29 18:35:10.969074",
"spec_repo_commit": "0fac706f"
"regenerated": "2023-08-30 07:29:22.452330",
"spec_repo_commit": "febdee32"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-08-29 18:35:10.986720",
"spec_repo_commit": "0fac706f"
"regenerated": "2023-08-30 07:29:22.469851",
"spec_repo_commit": "febdee32"
}
}
}
5 changes: 5 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27004,6 +27004,7 @@ paths:
name: limit
required: false
schema:
default: 1000
format: int64
type: integer
- description: The specific offset to use as the beginning of the returned response.
Expand Down Expand Up @@ -27048,6 +27049,10 @@ paths:
summary: Get all SLOs
tags:
- Service Level Objectives
x-pagination:
limitParam: limit
pageOffsetParam: offset
resultsPath: data
post:
description: Create a service level objective object.
operationId: CreateSLO
Expand Down
27 changes: 27 additions & 0 deletions examples/v1/service-level-objectives/ListSLOs_3036942817.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Get all SLOs returns "OK" response with pagination

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.v1.api.ServiceLevelObjectivesApi;
import com.datadog.api.client.v1.api.ServiceLevelObjectivesApi.ListSLOsOptionalParameters;
import com.datadog.api.client.v1.model.ServiceLevelObjective;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
ServiceLevelObjectivesApi apiInstance = new ServiceLevelObjectivesApi(defaultClient);

try {
PaginationIterable<ServiceLevelObjective> iterable =
apiInstance.listSLOsWithPagination(new ListSLOsOptionalParameters().limit(2L));

for (ServiceLevelObjective item : iterable) {
System.out.println(item);
}
} catch (RuntimeException e) {
System.err.println("Exception when calling ServiceLevelObjectivesApi#listSLOsWithPagination");
System.err.println("Reason: " + e.getMessage());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.ApiResponse;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.Pair;
import com.datadog.api.client.v1.model.CheckCanDeleteSLOResponse;
import com.datadog.api.client.v1.model.SLOBulkDeleteResponse;
Expand All @@ -19,6 +20,7 @@
import jakarta.ws.rs.core.GenericType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -1320,7 +1322,7 @@ public ListSLOsOptionalParameters metricsQuery(String metricsQuery) {
/**
* Set limit.
*
* @param limit The number of SLOs to return in the response. (optional)
* @param limit The number of SLOs to return in the response. (optional, default to 1000)
* @return ListSLOsOptionalParameters
*/
public ListSLOsOptionalParameters limit(Long limit) {
Expand Down Expand Up @@ -1397,6 +1399,57 @@ public CompletableFuture<SLOListResponse> listSLOsAsync(ListSLOsOptionalParamete
});
}

/**
* Get all SLOs.
*
* <p>See {@link #listSLOsWithHttpInfo}.
*
* @return PaginationIterable&lt;ServiceLevelObjective&gt;
*/
public PaginationIterable<ServiceLevelObjective> listSLOsWithPagination() {
ListSLOsOptionalParameters parameters = new ListSLOsOptionalParameters();
return listSLOsWithPagination(parameters);
}

/**
* Get all SLOs.
*
* <p>See {@link #listSLOsWithHttpInfo}.
*
* @return SLOListResponse
*/
public PaginationIterable<ServiceLevelObjective> listSLOsWithPagination(
ListSLOsOptionalParameters parameters) {
String resultsPath = "getData";
String valueGetterPath = "";
String valueSetterPath = "offset";
Boolean valueSetterParamOptional = true;
Long limit;

if (parameters.limit == null) {
limit = 1000l;
parameters.limit(limit);
} else {
limit = parameters.limit;
}

LinkedHashMap<String, Object> args = new LinkedHashMap<String, Object>();
args.put("optionalParams", parameters);

PaginationIterable iterator =
new PaginationIterable(
this,
"listSLOs",
resultsPath,
valueGetterPath,
valueSetterPath,
valueSetterParamOptional,
limit,
args);

return iterator;
}

/**
* Get a list of service level objective objects for your organization.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-08-25T12:33:42.432Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[
{
"httpRequest": {
"headers": {},
"method": "GET",
"path": "/api/v1/slo",
"queryStringParameters": {
"limit": [
"2"
]
},
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"data\":[{\"id\":\"70e82706f4ae56ff8bdd7f02e767f97c\",\"name\":\"test SLO 1668426861\",\"tags\":[\"type:test\"],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":90.0,\"target_display\":\"90.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"\",\"timeframe\":\"7d\",\"target_threshold\":90.0,\"query\":{\"denominator\":\"sum:my.custom.metric{!type:ignored}.as_count()\",\"numerator\":\"sum:my.custom.metric{type:good,!type:ignored}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1668426862,\"modified_at\":1668426862},{\"id\":\"955ab6301fa656e7b061de4a05ad4774\",\"name\":\"tf-TestAccDatadogServiceLevelObjective_Basic-local-1673543942-updated\",\"tags\":[\"foo:bar\",\"baz\"],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":99.5,\"target_display\":\"99.5\",\"warning\":99.8,\"warning_display\":\"99.8\"},{\"timeframe\":\"30d\",\"target\":98.0,\"target_display\":\"98.\",\"warning\":99.0,\"warning_display\":\"99.\"},{\"timeframe\":\"90d\",\"target\":99.9,\"target_display\":\"99.9\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"some updated description about foo SLO\",\"timeframe\":\"7d\",\"warning_threshold\":99.8,\"target_threshold\":99.5,\"query\":{\"denominator\":\"sum:my.metric{type:good}.as_count() + sum:my.metric{type:bad}.as_count()\",\"numerator\":\"sum:my.metric{type:good}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1673543944,\"modified_at\":1673543945}],\"error\":null,\"metadata\":{\"page\":{\"total_count\":3,\"total_filtered_count\":2}}}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "a179f385-5616-5828-2db7-9e086f7baadf"
},
{
"httpRequest": {
"headers": {},
"method": "GET",
"path": "/api/v1/slo",
"queryStringParameters": {
"limit": [
"2"
],
"offset": [
"2"
]
},
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"data\":[{\"id\":\"a17acfd48b7c55d19192e3a697cc1d01\",\"name\":\"test SLO 1677686870\",\"tags\":[],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":90.0,\"target_display\":\"90.\"}],\"type\":\"monitor\",\"type_id\":0,\"description\":\"\",\"timeframe\":\"7d\",\"target_threshold\":90.0,\"monitor_ids\":[112445445],\"creator\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\"},\"created_at\":1677686871,\"modified_at\":1677686871}],\"error\":null,\"metadata\":{\"page\":{\"total_count\":3,\"total_filtered_count\":2}}}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "20536200-5460-72f9-877a-58046da401ba"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ Feature: Service Level Objectives
And the response "data" has length 1
And the response "data[0].id" has the same value as "slo.data[0].id"

@replay-only @skip-validation @team:DataDog/slo-app @with-pagination
Scenario: Get all SLOs returns "OK" response with pagination
Given new "ListSLOs" request
And request contains "limit" parameter with value 2
When the request with pagination is sent
Then the response status is 200 OK
And the response has 3 items

@generated @skip @team:DataDog/slo-app
Scenario: Get an SLO's details returns "Not found" response
Given new "GetSLO" request
Expand Down