Skip to content

Commit cf5d794

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit af0cd40 of spec repo
1 parent 81af379 commit cf5d794

File tree

9 files changed

+1056
-0
lines changed

9 files changed

+1056
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17289,6 +17289,76 @@ components:
1728917289
- score
1729017290
- severity
1729117291
type: object
17292+
Email:
17293+
description: On-Call User Email.
17294+
example:
17295+
data:
17296+
attributes:
17297+
active: true
17298+
address: john.doe@datadoghq.com
17299+
alias: ''
17300+
blocked: false
17301+
created_at: '2024-04-16T23:38:50.388642Z'
17302+
formats:
17303+
- html
17304+
modified_at: '2024-04-16T23:38:50.388642Z'
17305+
id: 45cd9fe5-dd96-42ad-83de-2242ea9f6efd
17306+
type: emails
17307+
properties:
17308+
data:
17309+
$ref: '#/components/schemas/EmailData'
17310+
type: object
17311+
EmailAttributes:
17312+
description: Attributes for an on-call email.
17313+
properties:
17314+
active:
17315+
description: Whether the email is currently active.
17316+
type: boolean
17317+
address:
17318+
description: Email address.
17319+
type: string
17320+
alias:
17321+
description: Optional display alias for the email.
17322+
type: string
17323+
blocked:
17324+
description: Whether the email is blocked.
17325+
type: boolean
17326+
created_at:
17327+
description: Creation time of the email resource.
17328+
format: date-time
17329+
type: string
17330+
formats:
17331+
description: Preferred content formats for notifications.
17332+
items:
17333+
type: string
17334+
type: array
17335+
modified_at:
17336+
description: Last modification time of the email resource.
17337+
format: date-time
17338+
type: string
17339+
type: object
17340+
EmailData:
17341+
description: Data for an on-call email resource.
17342+
properties:
17343+
attributes:
17344+
$ref: '#/components/schemas/EmailAttributes'
17345+
id:
17346+
description: The email's unique identifier.
17347+
type: string
17348+
type:
17349+
$ref: '#/components/schemas/EmailType'
17350+
required:
17351+
- type
17352+
type: object
17353+
EmailType:
17354+
default: emails
17355+
description: Indicates that the resource is of type 'emails'.
17356+
enum:
17357+
- emails
17358+
example: emails
17359+
type: string
17360+
x-enum-varnames:
17361+
- EMAILS
1729217362
Enabled:
1729317363
description: Field used to enable or disable the rule.
1729417364
example: true
@@ -70837,6 +70907,48 @@ paths:
7083770907
operator: AND
7083870908
permissions:
7083970909
- on_call_write
70910+
/api/v2/on-call/users/{user_id}/notification-channels/emails:
70911+
post:
70912+
description: Create a new email notification channel for an on-call user
70913+
operationId: CreateUserEmailNotificationChannel
70914+
parameters:
70915+
- description: The user ID
70916+
in: path
70917+
name: user_id
70918+
required: true
70919+
schema:
70920+
example: 00000000-0000-0000-0000-000000000000
70921+
type: string
70922+
requestBody:
70923+
content:
70924+
application/json:
70925+
schema:
70926+
$ref: '#/components/schemas/Email'
70927+
required: true
70928+
responses:
70929+
'201':
70930+
description: Created
70931+
'400':
70932+
$ref: '#/components/responses/BadRequestResponse'
70933+
'401':
70934+
$ref: '#/components/responses/UnauthorizedResponse'
70935+
'403':
70936+
$ref: '#/components/responses/ForbiddenResponse'
70937+
'404':
70938+
$ref: '#/components/responses/NotFoundResponse'
70939+
'429':
70940+
$ref: '#/components/responses/TooManyRequestsResponse'
70941+
security:
70942+
- apiKeyAuth: []
70943+
appKeyAuth: []
70944+
- AuthZ: []
70945+
summary: Create email notification channel for user
70946+
tags:
70947+
- On-Call
70948+
x-permission:
70949+
operator: AND
70950+
permissions:
70951+
- on_call_admin
7084070952
/api/v2/org_configs:
7084170953
get:
7084270954
description: Returns all Org Configs (name, description, and value).
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Create email notification channel for user returns "Created" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.OnCallApi;
6+
import com.datadog.api.client.v2.model.Email;
7+
import com.datadog.api.client.v2.model.EmailAttributes;
8+
import com.datadog.api.client.v2.model.EmailData;
9+
import com.datadog.api.client.v2.model.EmailType;
10+
import java.time.OffsetDateTime;
11+
import java.util.Collections;
12+
13+
public class Example {
14+
public static void main(String[] args) {
15+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
16+
OnCallApi apiInstance = new OnCallApi(defaultClient);
17+
18+
Email body =
19+
new Email()
20+
.data(
21+
new EmailData()
22+
.attributes(
23+
new EmailAttributes()
24+
.active(true)
25+
.address("john.doe@datadoghq.com")
26+
.alias("")
27+
.blocked(false)
28+
.createdAt(OffsetDateTime.parse("2024-04-16T23:38:50.388642Z"))
29+
.formats(Collections.singletonList("html"))
30+
.modifiedAt(OffsetDateTime.parse("2024-04-16T23:38:50.388642Z")))
31+
.id("45cd9fe5-dd96-42ad-83de-2242ea9f6efd")
32+
.type(EmailType.EMAILS));
33+
34+
try {
35+
apiInstance.createUserEmailNotificationChannel("00000000-0000-0000-0000-000000000000", body);
36+
} catch (ApiException e) {
37+
System.err.println("Exception when calling OnCallApi#createUserEmailNotificationChannel");
38+
System.err.println("Status code: " + e.getCode());
39+
System.err.println("Reason: " + e.getResponseBody());
40+
System.err.println("Response headers: " + e.getResponseHeaders());
41+
e.printStackTrace();
42+
}
43+
}
44+
}

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

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
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.Email;
78
import com.datadog.api.client.v2.model.EscalationPolicy;
89
import com.datadog.api.client.v2.model.EscalationPolicyCreateRequest;
910
import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequest;
@@ -452,6 +453,169 @@ public CompletableFuture<ApiResponse<Schedule>> createOnCallScheduleWithHttpInfo
452453
new GenericType<Schedule>() {});
453454
}
454455

456+
/**
457+
* Create email notification channel for user.
458+
*
459+
* <p>See {@link #createUserEmailNotificationChannelWithHttpInfo}.
460+
*
461+
* @param userId The user ID (required)
462+
* @param body (required)
463+
* @throws ApiException if fails to make API call
464+
*/
465+
public void createUserEmailNotificationChannel(String userId, Email body) throws ApiException {
466+
createUserEmailNotificationChannelWithHttpInfo(userId, body);
467+
}
468+
469+
/**
470+
* Create email notification channel for user.
471+
*
472+
* <p>See {@link #createUserEmailNotificationChannelWithHttpInfoAsync}.
473+
*
474+
* @param userId The user ID (required)
475+
* @param body (required)
476+
* @return CompletableFuture
477+
*/
478+
public CompletableFuture<Void> createUserEmailNotificationChannelAsync(
479+
String userId, Email body) {
480+
return createUserEmailNotificationChannelWithHttpInfoAsync(userId, body)
481+
.thenApply(
482+
response -> {
483+
return response.getData();
484+
});
485+
}
486+
487+
/**
488+
* Create a new email notification channel for an on-call user
489+
*
490+
* @param userId The user ID (required)
491+
* @param body (required)
492+
* @return ApiResponse&lt;Void&gt;
493+
* @throws ApiException if fails to make API call
494+
* @http.response.details
495+
* <table border="1">
496+
* <caption>Response details</caption>
497+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
498+
* <tr><td> 201 </td><td> Created </td><td> - </td></tr>
499+
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
500+
* <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
501+
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
502+
* <tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
503+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
504+
* </table>
505+
*/
506+
public ApiResponse<Void> createUserEmailNotificationChannelWithHttpInfo(String userId, Email body)
507+
throws ApiException {
508+
Object localVarPostBody = body;
509+
510+
// verify the required parameter 'userId' is set
511+
if (userId == null) {
512+
throw new ApiException(
513+
400,
514+
"Missing the required parameter 'userId' when calling"
515+
+ " createUserEmailNotificationChannel");
516+
}
517+
518+
// verify the required parameter 'body' is set
519+
if (body == null) {
520+
throw new ApiException(
521+
400,
522+
"Missing the required parameter 'body' when calling createUserEmailNotificationChannel");
523+
}
524+
// create path and map variables
525+
String localVarPath =
526+
"/api/v2/on-call/users/{user_id}/notification-channels/emails"
527+
.replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString()));
528+
529+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
530+
531+
Invocation.Builder builder =
532+
apiClient.createBuilder(
533+
"v2.OnCallApi.createUserEmailNotificationChannel",
534+
localVarPath,
535+
new ArrayList<Pair>(),
536+
localVarHeaderParams,
537+
new HashMap<String, String>(),
538+
new String[] {"*/*"},
539+
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
540+
return apiClient.invokeAPI(
541+
"POST",
542+
builder,
543+
localVarHeaderParams,
544+
new String[] {"application/json"},
545+
localVarPostBody,
546+
new HashMap<String, Object>(),
547+
false,
548+
null);
549+
}
550+
551+
/**
552+
* Create email notification channel for user.
553+
*
554+
* <p>See {@link #createUserEmailNotificationChannelWithHttpInfo}.
555+
*
556+
* @param userId The user ID (required)
557+
* @param body (required)
558+
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
559+
*/
560+
public CompletableFuture<ApiResponse<Void>> createUserEmailNotificationChannelWithHttpInfoAsync(
561+
String userId, Email body) {
562+
Object localVarPostBody = body;
563+
564+
// verify the required parameter 'userId' is set
565+
if (userId == null) {
566+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
567+
result.completeExceptionally(
568+
new ApiException(
569+
400,
570+
"Missing the required parameter 'userId' when calling"
571+
+ " createUserEmailNotificationChannel"));
572+
return result;
573+
}
574+
575+
// verify the required parameter 'body' is set
576+
if (body == null) {
577+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
578+
result.completeExceptionally(
579+
new ApiException(
580+
400,
581+
"Missing the required parameter 'body' when calling"
582+
+ " createUserEmailNotificationChannel"));
583+
return result;
584+
}
585+
// create path and map variables
586+
String localVarPath =
587+
"/api/v2/on-call/users/{user_id}/notification-channels/emails"
588+
.replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString()));
589+
590+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
591+
592+
Invocation.Builder builder;
593+
try {
594+
builder =
595+
apiClient.createBuilder(
596+
"v2.OnCallApi.createUserEmailNotificationChannel",
597+
localVarPath,
598+
new ArrayList<Pair>(),
599+
localVarHeaderParams,
600+
new HashMap<String, String>(),
601+
new String[] {"*/*"},
602+
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
603+
} catch (ApiException ex) {
604+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
605+
result.completeExceptionally(ex);
606+
return result;
607+
}
608+
return apiClient.invokeAPIAsync(
609+
"POST",
610+
builder,
611+
localVarHeaderParams,
612+
new String[] {"application/json"},
613+
localVarPostBody,
614+
new HashMap<String, Object>(),
615+
false,
616+
null);
617+
}
618+
455619
/**
456620
* Delete On-Call escalation policy.
457621
*

0 commit comments

Comments
 (0)