Skip to content

Commit 8ae069f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI spec for authn-validation /api/v2/validate endpoint (#3793)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 7d56afc commit 8ae069f

13 files changed

Lines changed: 1386 additions & 47 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82733,6 +82733,77 @@ components:
8273382733
description: The title of the event.
8273482734
example: "The event title"
8273582735
type: string
82736+
ValidateAPIKeyResponse:
82737+
description: Response object for the API and application key validation status check.
82738+
properties:
82739+
status:
82740+
$ref: "#/components/schemas/ValidateAPIKeyStatus"
82741+
required:
82742+
- status
82743+
type: object
82744+
ValidateAPIKeyStatus:
82745+
description: Status of the validation. Always `ok` when both the API key and the application key are valid.
82746+
enum:
82747+
- ok
82748+
example: ok
82749+
type: string
82750+
x-enum-varnames:
82751+
- OK
82752+
ValidateV2Attributes:
82753+
description: Attributes of the API key validation response.
82754+
properties:
82755+
api_key_id:
82756+
description: The UUID of the API key.
82757+
example: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
82758+
type: string
82759+
api_key_scopes:
82760+
description: List of scope names associated with the API key.
82761+
example:
82762+
- "remote_config_read"
82763+
items:
82764+
type: string
82765+
type: array
82766+
valid:
82767+
description: Whether the API key is valid.
82768+
example: true
82769+
type: boolean
82770+
required:
82771+
- valid
82772+
- api_key_scopes
82773+
- api_key_id
82774+
type: object
82775+
ValidateV2Data:
82776+
description: Data object containing the API key validation result.
82777+
properties:
82778+
attributes:
82779+
$ref: "#/components/schemas/ValidateV2Attributes"
82780+
id:
82781+
description: The UUID of the organization associated with the API key.
82782+
example: "550e8400-e29b-41d4-a716-446655440000"
82783+
type: string
82784+
type:
82785+
$ref: "#/components/schemas/ValidateV2Type"
82786+
required:
82787+
- id
82788+
- type
82789+
- attributes
82790+
type: object
82791+
ValidateV2Response:
82792+
description: Response for the API key validation endpoint.
82793+
properties:
82794+
data:
82795+
$ref: "#/components/schemas/ValidateV2Data"
82796+
required:
82797+
- data
82798+
type: object
82799+
ValidateV2Type:
82800+
description: Resource type for the API key validation response.
82801+
enum:
82802+
- validate_v2
82803+
example: validate_v2
82804+
type: string
82805+
x-enum-varnames:
82806+
- ValidateV2
8273682807
ValidationError:
8273782808
description: Represents a single validation error, including a human-readable title and metadata.
8273882809
properties:
@@ -145630,6 +145701,89 @@ paths:
145630145701
operator: OR
145631145702
permissions:
145632145703
- teams_read
145704+
/api/v2/validate:
145705+
get:
145706+
description: Check if the API key is valid. Returns the organization UUID, API key ID, and associated scopes.
145707+
operationId: Validate
145708+
responses:
145709+
"200":
145710+
content:
145711+
application/json:
145712+
examples:
145713+
default:
145714+
value:
145715+
data:
145716+
attributes:
145717+
api_key_id: "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6"
145718+
api_key_scopes:
145719+
- "remote_config_read"
145720+
valid: true
145721+
id: "550e8400-e29b-41d4-a716-446655440000"
145722+
type: "validate_v2"
145723+
schema:
145724+
$ref: "#/components/schemas/ValidateV2Response"
145725+
description: OK
145726+
"403":
145727+
content:
145728+
application/json:
145729+
schema:
145730+
$ref: "#/components/schemas/JSONAPIErrorResponse"
145731+
description: Forbidden
145732+
"429":
145733+
$ref: "#/components/responses/TooManyRequestsResponse"
145734+
security:
145735+
- apiKeyAuth: []
145736+
summary: Validate API key
145737+
tags:
145738+
- Key Management
145739+
"x-permission":
145740+
operator: OPEN
145741+
permissions: []
145742+
x-unstable: |-
145743+
**Note**: This endpoint is in preview and is subject to change.
145744+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
145745+
/api/v2/validate_keys:
145746+
get:
145747+
description: |-
145748+
Check that the API key and application key used for the request are both valid.
145749+
Returns `{"status": "ok"}` on success, `401` or `403` otherwise. Useful as a
145750+
lightweight authentication probe before issuing other API calls that require
145751+
full credentials.
145752+
operationId: ValidateAPIKey
145753+
responses:
145754+
"200":
145755+
content:
145756+
application/json:
145757+
examples:
145758+
default:
145759+
value:
145760+
status: ok
145761+
schema:
145762+
$ref: "#/components/schemas/ValidateAPIKeyResponse"
145763+
description: OK
145764+
"401":
145765+
content:
145766+
application/json:
145767+
schema:
145768+
$ref: "#/components/schemas/APIErrorResponse"
145769+
description: Unauthorized
145770+
"403":
145771+
content:
145772+
application/json:
145773+
schema:
145774+
$ref: "#/components/schemas/APIErrorResponse"
145775+
description: Forbidden
145776+
"429":
145777+
$ref: "#/components/responses/TooManyRequestsResponse"
145778+
security:
145779+
- apiKeyAuth: []
145780+
appKeyAuth: []
145781+
summary: Validate API and application keys
145782+
tags:
145783+
- Key Management
145784+
"x-permission":
145785+
operator: OPEN
145786+
permissions: []
145633145787
/api/v2/web-integrations/{integration_name}/accounts:
145634145788
get:
145635145789
description: List accounts for a given web integration.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Validate API key returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.KeyManagementApi;
6+
import com.datadog.api.client.v2.model.ValidateV2Response;
7+
8+
public class Example {
9+
public static void main(String[] args) {
10+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
11+
defaultClient.setUnstableOperationEnabled("v2.validate", true);
12+
KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
13+
14+
try {
15+
ValidateV2Response result = apiInstance.validate();
16+
System.out.println(result);
17+
} catch (ApiException e) {
18+
System.err.println("Exception when calling KeyManagementApi#validate");
19+
System.err.println("Status code: " + e.getCode());
20+
System.err.println("Reason: " + e.getResponseBody());
21+
System.err.println("Response headers: " + e.getResponseHeaders());
22+
e.printStackTrace();
23+
}
24+
}
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Validate API and application keys returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.KeyManagementApi;
6+
import com.datadog.api.client.v2.model.ValidateAPIKeyResponse;
7+
8+
public class Example {
9+
public static void main(String[] args) {
10+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
11+
KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
12+
13+
try {
14+
ValidateAPIKeyResponse result = apiInstance.validateAPIKey();
15+
System.out.println(result);
16+
} catch (ApiException e) {
17+
System.err.println("Exception when calling KeyManagementApi#validateAPIKey");
18+
System.err.println("Status code: " + e.getCode());
19+
System.err.println("Reason: " + e.getResponseBody());
20+
System.err.println("Response headers: " + e.getResponseHeaders());
21+
e.printStackTrace();
22+
}
23+
}
24+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ public class ApiClient {
803803
put("v2.updateLLMObsExperiment", false);
804804
put("v2.updateLLMObsProject", false);
805805
put("v2.anonymizeUsers", false);
806+
put("v2.validate", false);
806807
put("v2.createOpenAPI", false);
807808
put("v2.deleteOpenAPI", false);
808809
put("v2.getOpenAPI", false);

0 commit comments

Comments
 (0)