Skip to content

Commit 5baca49

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit bb92271 of spec repo
1 parent add72e5 commit 5baca49

43 files changed

Lines changed: 4500 additions & 75 deletions

Some content is hidden

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

.generator/schemas/v2/openapi.yaml

Lines changed: 738 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Create a personal access token returns "Created" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.KeyManagementApi(configuration);
9+
10+
const params: v2.KeyManagementApiCreatePersonalAccessTokenRequest = {
11+
body: {
12+
data: {
13+
type: "personal_access_tokens",
14+
attributes: {
15+
name: "Example-Personal-Access-Token",
16+
scopes: ["dashboards_read"],
17+
expiresAt: new Date(new Date().getTime() + 365 * 86400 * 1000),
18+
},
19+
},
20+
},
21+
};
22+
23+
apiInstance
24+
.createPersonalAccessToken(params)
25+
.then((data: v2.PersonalAccessTokenCreateResponse) => {
26+
console.log(
27+
"API called successfully. Returned data: " + JSON.stringify(data)
28+
);
29+
})
30+
.catch((error: any) => console.error(error));
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Get a personal access token returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.KeyManagementApi(configuration);
9+
10+
// there is a valid "personal_access_token" in the system
11+
const PERSONAL_ACCESS_TOKEN_DATA_ID = process.env
12+
.PERSONAL_ACCESS_TOKEN_DATA_ID as string;
13+
14+
const params: v2.KeyManagementApiGetPersonalAccessTokenRequest = {
15+
patUuid: PERSONAL_ACCESS_TOKEN_DATA_ID,
16+
};
17+
18+
apiInstance
19+
.getPersonalAccessToken(params)
20+
.then((data: v2.PersonalAccessTokenResponse) => {
21+
console.log(
22+
"API called successfully. Returned data: " + JSON.stringify(data)
23+
);
24+
})
25+
.catch((error: any) => console.error(error));
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Get all personal access tokens returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.KeyManagementApi(configuration);
9+
10+
apiInstance
11+
.listPersonalAccessTokens()
12+
.then((data: v2.ListPersonalAccessTokensResponse) => {
13+
console.log(
14+
"API called successfully. Returned data: " + JSON.stringify(data)
15+
);
16+
})
17+
.catch((error: any) => console.error(error));
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Revoke a personal access token returns "No Content" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.KeyManagementApi(configuration);
9+
10+
// there is a valid "personal_access_token" in the system
11+
const PERSONAL_ACCESS_TOKEN_DATA_ID = process.env
12+
.PERSONAL_ACCESS_TOKEN_DATA_ID as string;
13+
14+
const params: v2.KeyManagementApiRevokePersonalAccessTokenRequest = {
15+
patUuid: PERSONAL_ACCESS_TOKEN_DATA_ID,
16+
};
17+
18+
apiInstance
19+
.revokePersonalAccessToken(params)
20+
.then((data: any) => {
21+
console.log(
22+
"API called successfully. Returned data: " + JSON.stringify(data)
23+
);
24+
})
25+
.catch((error: any) => console.error(error));
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Update a personal access token returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.KeyManagementApi(configuration);
9+
10+
// there is a valid "personal_access_token" in the system
11+
const PERSONAL_ACCESS_TOKEN_DATA_ID = process.env
12+
.PERSONAL_ACCESS_TOKEN_DATA_ID as string;
13+
14+
const params: v2.KeyManagementApiUpdatePersonalAccessTokenRequest = {
15+
body: {
16+
data: {
17+
type: "personal_access_tokens",
18+
id: PERSONAL_ACCESS_TOKEN_DATA_ID,
19+
attributes: {
20+
name: "Example-Personal-Access-Token-updated",
21+
},
22+
},
23+
},
24+
patUuid: PERSONAL_ACCESS_TOKEN_DATA_ID,
25+
};
26+
27+
apiInstance
28+
.updatePersonalAccessToken(params)
29+
.then((data: v2.PersonalAccessTokenResponse) => {
30+
console.log(
31+
"API called successfully. Returned data: " + JSON.stringify(data)
32+
);
33+
})
34+
.catch((error: any) => console.error(error));
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Create an access token for a service account returns "Created" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.ServiceAccountsApi(configuration);
9+
10+
const params: v2.ServiceAccountsApiCreateServiceAccountAccessTokenRequest = {
11+
body: {
12+
data: {
13+
attributes: {
14+
expiresAt: new Date(2025, 12, 31, 23, 59, 59, 0),
15+
name: "Service Account Access Token",
16+
scopes: ["dashboards_read", "dashboards_write"],
17+
},
18+
type: "personal_access_tokens",
19+
},
20+
},
21+
serviceAccountId: "00000000-0000-1234-0000-000000000000",
22+
};
23+
24+
apiInstance
25+
.createServiceAccountAccessToken(params)
26+
.then((data: v2.PersonalAccessTokenCreateResponse) => {
27+
console.log(
28+
"API called successfully. Returned data: " + JSON.stringify(data)
29+
);
30+
})
31+
.catch((error: any) => console.error(error));
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Create a service account access token returns "Created" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.KeyManagementApi(configuration);
9+
10+
// there is a valid "service_account_user" in the system
11+
const SERVICE_ACCOUNT_USER_DATA_ID = process.env
12+
.SERVICE_ACCOUNT_USER_DATA_ID as string;
13+
14+
const params: v2.KeyManagementApiCreateServiceAccountAccessTokenRequest = {
15+
body: {
16+
data: {
17+
type: "personal_access_tokens",
18+
attributes: {
19+
name: "Example-Personal-Access-Token",
20+
scopes: ["dashboards_read"],
21+
},
22+
},
23+
},
24+
serviceAccountId: SERVICE_ACCOUNT_USER_DATA_ID,
25+
};
26+
27+
apiInstance
28+
.createServiceAccountAccessToken(params)
29+
.then((data: v2.PersonalAccessTokenCreateResponse) => {
30+
console.log(
31+
"API called successfully. Returned data: " + JSON.stringify(data)
32+
);
33+
})
34+
.catch((error: any) => console.error(error));
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Get an access token for a service account returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.ServiceAccountsApi(configuration);
9+
10+
const params: v2.ServiceAccountsApiGetServiceAccountAccessTokenRequest = {
11+
serviceAccountId: "00000000-0000-1234-0000-000000000000",
12+
patUuid: "00000000-0000-1234-0000-000000000000",
13+
};
14+
15+
apiInstance
16+
.getServiceAccountAccessToken(params)
17+
.then((data: v2.PersonalAccessTokenResponse) => {
18+
console.log(
19+
"API called successfully. Returned data: " + JSON.stringify(data)
20+
);
21+
})
22+
.catch((error: any) => console.error(error));
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* List access tokens for a service account returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.ServiceAccountsApi(configuration);
9+
10+
const params: v2.ServiceAccountsApiListServiceAccountAccessTokensRequest = {
11+
serviceAccountId: "00000000-0000-1234-0000-000000000000",
12+
};
13+
14+
apiInstance
15+
.listServiceAccountAccessTokens(params)
16+
.then((data: v2.ListPersonalAccessTokensResponse) => {
17+
console.log(
18+
"API called successfully. Returned data: " + JSON.stringify(data)
19+
);
20+
})
21+
.catch((error: any) => console.error(error));

0 commit comments

Comments
 (0)