Skip to content

Commit 5bc6f72

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 9777e49 of spec repo (#205)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent e875e55 commit 5bc6f72

File tree

9 files changed

+311
-6
lines changed

9 files changed

+311
-6
lines changed

.apigentools-info

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"info_version": "2",
44
"spec_versions": {
55
"v1": {
6-
"apigentools_version": "1.4.1.dev8",
7-
"regenerated": "2021-07-01 19:07:51.346514",
8-
"spec_repo_commit": "1847a67"
6+
"apigentools_version": "1.4.1.dev11",
7+
"regenerated": "2021-07-05 14:12:17.319690",
8+
"spec_repo_commit": "9777e49"
99
},
1010
"v2": {
11-
"apigentools_version": "1.4.1.dev8",
12-
"regenerated": "2021-07-01 19:09:10.959829",
13-
"spec_repo_commit": "1847a67"
11+
"apigentools_version": "1.4.1.dev11",
12+
"regenerated": "2021-07-05 14:13:47.942174",
13+
"spec_repo_commit": "9777e49"
1414
}
1515
}
1616
}

docs/v2/KeyManagementApi.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Method | HTTP request | Description
1010
[**deleteApplicationKey**](KeyManagementApi.md#deleteApplicationKey) | **DELETE** /api/v2/application_keys/{app_key_id} | Delete an application key
1111
[**deleteCurrentUserApplicationKey**](KeyManagementApi.md#deleteCurrentUserApplicationKey) | **DELETE** /api/v2/current_user/application_keys/{app_key_id} | Delete an application key owned by current user
1212
[**getAPIKey**](KeyManagementApi.md#getAPIKey) | **GET** /api/v2/api_keys/{api_key_id} | Get API key
13+
[**getApplicationKey**](KeyManagementApi.md#getApplicationKey) | **GET** /api/v2/application_keys/{app_key_id} | Get an application key
1314
[**getCurrentUserApplicationKey**](KeyManagementApi.md#getCurrentUserApplicationKey) | **GET** /api/v2/current_user/application_keys/{app_key_id} | Get one application key owned by current user
1415
[**listAPIKeys**](KeyManagementApi.md#listAPIKeys) | **GET** /api/v2/api_keys | Get all API keys
1516
[**listApplicationKeys**](KeyManagementApi.md#listApplicationKeys) | **GET** /api/v2/application_keys | Get all application keys
@@ -372,6 +373,66 @@ Name | Type | Description | Notes
372373

373374
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
374375

376+
## **getApplicationKey**
377+
> ApplicationKeyResponse getApplicationKey()
378+
379+
Get an application key for your org.
380+
381+
### Example
382+
383+
384+
```typescript
385+
import { v2 } from '@datadog/datadog-api-client';
386+
import * as fs from 'fs';
387+
388+
const configuration = v2.createConfiguration();
389+
const apiInstance = new v2.KeyManagementApi(configuration);
390+
391+
let params:v2.KeyManagementApiGetApplicationKeyRequest = {
392+
// string | The ID of the application key.
393+
appKeyId: "app_key_id_example",
394+
// string | Resource path for related resources to include in the response. Only `owned_by` is supported. (optional)
395+
include: "owned_by",
396+
};
397+
398+
apiInstance.getApplicationKey(params).then((data:any) => {
399+
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
400+
}).catch((error:any) => console.error(error));
401+
```
402+
403+
404+
### Parameters
405+
406+
Name | Type | Description | Notes
407+
------------- | ------------- | ------------- | -------------
408+
**appKeyId** | [**string**] | The ID of the application key. | defaults to undefined
409+
**include** | [**string**] | Resource path for related resources to include in the response. Only &#x60;owned_by&#x60; is supported. | (optional) defaults to undefined
410+
411+
412+
### Return type
413+
414+
**ApplicationKeyResponse**
415+
416+
### Authorization
417+
418+
[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth)
419+
420+
### HTTP request headers
421+
422+
- **Content-Type**: Not defined
423+
- **Accept**: application/json
424+
425+
426+
### HTTP response details
427+
| Status code | Description | Response headers |
428+
|-------------|-------------|------------------|
429+
**200** | OK | - |
430+
**400** | Bad Request | - |
431+
**403** | Forbidden | - |
432+
**404** | Not Found | - |
433+
434+
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
435+
375436
## **getCurrentUserApplicationKey**
376437
> ApplicationKeyResponse getCurrentUserApplicationKey()
377438

features/v2/key_management.feature

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,28 @@ Feature: Key Management
260260
When the request is sent
261261
Then the response status is 200 OK
262262

263+
@generated @skip
264+
Scenario: Get an application key returns "Bad Request" response
265+
Given new "GetApplicationKey" request
266+
And request contains "app_key_id" parameter from "<PATH>"
267+
When the request is sent
268+
Then the response status is 400 Bad Request
269+
270+
@generated @skip
271+
Scenario: Get an application key returns "Not Found" response
272+
Given new "GetApplicationKey" request
273+
And request contains "app_key_id" parameter from "<PATH>"
274+
When the request is sent
275+
Then the response status is 404 Not Found
276+
277+
@integration-only
278+
Scenario: Get an application key returns "OK" response
279+
Given there is a valid "application_key" in the system
280+
And new "GetApplicationKey" request
281+
And request contains "app_key_id" parameter from "application_key.data.id"
282+
When the request is sent
283+
Then the response status is 200 OK
284+
263285
@integration-only
264286
Scenario: Get one Application key owned by current user returns "OK" response
265287
Given there is a valid "application_key" in the system

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
"type": "idempotent"
4949
}
5050
},
51+
"GetApplicationKey": {
52+
"tag": "Key Management",
53+
"undo": {
54+
"type": "safe"
55+
}
56+
},
5157
"UpdateApplicationKey": {
5258
"tag": "Key Management",
5359
"undo": {

packages/datadog-api-client-v2/apis/KeyManagementApi.ts

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,68 @@ export class KeyManagementApiRequestFactory extends BaseAPIRequestFactory {
366366
return requestContext;
367367
}
368368

369+
/**
370+
* Get an application key for your org.
371+
* Get an application key
372+
* @param appKeyId The ID of the application key.
373+
* @param include Resource path for related resources to include in the response. Only &#x60;owned_by&#x60; is supported.
374+
*/
375+
public async getApplicationKey(
376+
appKeyId: string,
377+
include?: string,
378+
options?: Configuration
379+
): Promise<RequestContext> {
380+
const config = options || this.configuration;
381+
382+
// verify required parameter 'appKeyId' is not null or undefined
383+
if (appKeyId === null || appKeyId === undefined) {
384+
throw new RequiredError(
385+
"Required parameter appKeyId was null or undefined when calling getApplicationKey."
386+
);
387+
}
388+
389+
// Path Params
390+
const localVarPath = "/api/v2/application_keys/{app_key_id}".replace(
391+
"{" + "app_key_id" + "}",
392+
encodeURIComponent(String(appKeyId))
393+
);
394+
395+
// Make Request Context
396+
const requestContext = getServer(
397+
config,
398+
"KeyManagementApi.getApplicationKey"
399+
).makeRequestContext(localVarPath, HttpMethod.GET);
400+
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
401+
requestContext.setHttpConfig(config.httpConfig);
402+
403+
// Query Params
404+
if (include !== undefined) {
405+
requestContext.setQueryParam(
406+
"include",
407+
ObjectSerializer.serialize(include, "string", "")
408+
);
409+
}
410+
411+
// Header Params
412+
413+
// Form Params
414+
415+
// Body Params
416+
417+
let authMethod = null;
418+
// Apply auth methods
419+
authMethod = config.authMethods["apiKeyAuth"];
420+
if (authMethod) {
421+
await authMethod.applySecurityAuthentication(requestContext);
422+
}
423+
authMethod = config.authMethods["appKeyAuth"];
424+
if (authMethod) {
425+
await authMethod.applySecurityAuthentication(requestContext);
426+
}
427+
428+
return requestContext;
429+
}
430+
369431
/**
370432
* Get an application key owned by current user
371433
* Get one application key owned by current user
@@ -1241,6 +1303,69 @@ export class KeyManagementApiResponseProcessor {
12411303
);
12421304
}
12431305

1306+
/**
1307+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
1308+
* to the expected objects
1309+
*
1310+
* @params response Response returned by the server for a request to getApplicationKey
1311+
* @throws ApiException if the response code was not in [200, 299]
1312+
*/
1313+
public async getApplicationKey(
1314+
response: ResponseContext
1315+
): Promise<ApplicationKeyResponse> {
1316+
const contentType = ObjectSerializer.normalizeMediaType(
1317+
response.headers["content-type"]
1318+
);
1319+
if (isCodeInRange("200", response.httpStatusCode)) {
1320+
const body: ApplicationKeyResponse = ObjectSerializer.deserialize(
1321+
ObjectSerializer.parse(await response.body.text(), contentType),
1322+
"ApplicationKeyResponse",
1323+
""
1324+
) as ApplicationKeyResponse;
1325+
return body;
1326+
}
1327+
if (isCodeInRange("400", response.httpStatusCode)) {
1328+
const body: APIErrorResponse = ObjectSerializer.deserialize(
1329+
ObjectSerializer.parse(await response.body.text(), contentType),
1330+
"APIErrorResponse",
1331+
""
1332+
) as APIErrorResponse;
1333+
throw new ApiException<APIErrorResponse>(400, body);
1334+
}
1335+
if (isCodeInRange("403", response.httpStatusCode)) {
1336+
const body: APIErrorResponse = ObjectSerializer.deserialize(
1337+
ObjectSerializer.parse(await response.body.text(), contentType),
1338+
"APIErrorResponse",
1339+
""
1340+
) as APIErrorResponse;
1341+
throw new ApiException<APIErrorResponse>(403, body);
1342+
}
1343+
if (isCodeInRange("404", response.httpStatusCode)) {
1344+
const body: APIErrorResponse = ObjectSerializer.deserialize(
1345+
ObjectSerializer.parse(await response.body.text(), contentType),
1346+
"APIErrorResponse",
1347+
""
1348+
) as APIErrorResponse;
1349+
throw new ApiException<APIErrorResponse>(404, body);
1350+
}
1351+
1352+
// Work around for missing responses in specification, e.g. for petstore.yaml
1353+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1354+
const body: ApplicationKeyResponse = ObjectSerializer.deserialize(
1355+
ObjectSerializer.parse(await response.body.text(), contentType),
1356+
"ApplicationKeyResponse",
1357+
""
1358+
) as ApplicationKeyResponse;
1359+
return body;
1360+
}
1361+
1362+
const body = response.body || "";
1363+
throw new ApiException<string>(
1364+
response.httpStatusCode,
1365+
'Unknown API Status Code!\nBody: "' + body + '"'
1366+
);
1367+
}
1368+
12441369
/**
12451370
* Unwraps the actual response sent by the server from the response context and deserializes the response content
12461371
* to the expected objects

packages/datadog-api-client-v2/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export {
3636
KeyManagementApiDeleteApplicationKeyRequest,
3737
KeyManagementApiDeleteCurrentUserApplicationKeyRequest,
3838
KeyManagementApiGetAPIKeyRequest,
39+
KeyManagementApiGetApplicationKeyRequest,
3940
KeyManagementApiGetCurrentUserApplicationKeyRequest,
4041
KeyManagementApiListAPIKeysRequest,
4142
KeyManagementApiListApplicationKeysRequest,

packages/datadog-api-client-v2/types/ObjectParamAPI.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,21 @@ export interface KeyManagementApiGetAPIKeyRequest {
775775
include?: string;
776776
}
777777

778+
export interface KeyManagementApiGetApplicationKeyRequest {
779+
/**
780+
* The ID of the application key.
781+
* @type string
782+
* @memberof KeyManagementApigetApplicationKey
783+
*/
784+
appKeyId: string;
785+
/**
786+
* Resource path for related resources to include in the response. Only &#x60;owned_by&#x60; is supported.
787+
* @type string
788+
* @memberof KeyManagementApigetApplicationKey
789+
*/
790+
include?: string;
791+
}
792+
778793
export interface KeyManagementApiGetCurrentUserApplicationKeyRequest {
779794
/**
780795
* The ID of the application key.
@@ -1057,6 +1072,20 @@ export class ObjectKeyManagementApi {
10571072
.toPromise();
10581073
}
10591074

1075+
/**
1076+
* Get an application key for your org.
1077+
* Get an application key
1078+
* @param param the request object
1079+
*/
1080+
public getApplicationKey(
1081+
param: KeyManagementApiGetApplicationKeyRequest,
1082+
options?: Configuration
1083+
): Promise<ApplicationKeyResponse> {
1084+
return this.api
1085+
.getApplicationKey(param.appKeyId, param.include, options)
1086+
.toPromise();
1087+
}
1088+
10601089
/**
10611090
* Get an application key owned by current user
10621091
* Get one application key owned by current user

packages/datadog-api-client-v2/types/ObservableAPI.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,52 @@ export class ObservableKeyManagementApi {
13201320
);
13211321
}
13221322

1323+
/**
1324+
* Get an application key for your org.
1325+
* Get an application key
1326+
* @param appKeyId The ID of the application key.
1327+
* @param include Resource path for related resources to include in the response. Only &#x60;owned_by&#x60; is supported.
1328+
*/
1329+
public getApplicationKey(
1330+
appKeyId: string,
1331+
include?: string,
1332+
options?: Configuration
1333+
): Observable<ApplicationKeyResponse> {
1334+
const requestContextPromise = this.requestFactory.getApplicationKey(
1335+
appKeyId,
1336+
include,
1337+
options
1338+
);
1339+
1340+
// build promise chain
1341+
let middlewarePreObservable = from_<RequestContext>(requestContextPromise);
1342+
for (const middleware of this.configuration.middleware) {
1343+
middlewarePreObservable = middlewarePreObservable.pipe(
1344+
mergeMap((ctx: RequestContext) => middleware.pre(ctx))
1345+
);
1346+
}
1347+
1348+
return middlewarePreObservable
1349+
.pipe(
1350+
mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))
1351+
)
1352+
.pipe(
1353+
mergeMap((response: ResponseContext) => {
1354+
let middlewarePostObservable = of(response);
1355+
for (const middleware of this.configuration.middleware) {
1356+
middlewarePostObservable = middlewarePostObservable.pipe(
1357+
mergeMap((rsp: ResponseContext) => middleware.post(rsp))
1358+
);
1359+
}
1360+
return middlewarePostObservable.pipe(
1361+
map((rsp: ResponseContext) =>
1362+
this.responseProcessor.getApplicationKey(rsp)
1363+
)
1364+
);
1365+
})
1366+
);
1367+
}
1368+
13231369
/**
13241370
* Get an application key owned by current user
13251371
* Get one application key owned by current user

0 commit comments

Comments
 (0)