Skip to content

Commit d123935

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit af0cd40 of spec repo
1 parent f15169a commit d123935

File tree

11 files changed

+688
-0
lines changed

11 files changed

+688
-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+
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Create email notification channel for user returns "Created" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::OnCallAPI.new
5+
6+
body = DatadogAPIClient::V2::Email.new({
7+
data: DatadogAPIClient::V2::EmailData.new({
8+
attributes: DatadogAPIClient::V2::EmailAttributes.new({
9+
active: true,
10+
address: "[email protected]",
11+
_alias: "",
12+
blocked: false,
13+
created_at: "2024-04-16T23:38:50.388642Z",
14+
formats: [
15+
"html",
16+
],
17+
modified_at: "2024-04-16T23:38:50.388642Z",
18+
}),
19+
id: "45cd9fe5-dd96-42ad-83de-2242ea9f6efd",
20+
type: DatadogAPIClient::V2::EmailType::EMAILS,
21+
}),
22+
})
23+
p api_instance.create_user_email_notification_channel("00000000-0000-0000-0000-000000000000", body)

features/scenarios_model_mapping.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,10 @@
25342534
"include" => "String",
25352535
"body" => "TeamRoutingRulesRequest",
25362536
},
2537+
"v2.CreateUserEmailNotificationChannel" => {
2538+
"user_id" => "String",
2539+
"body" => "Email",
2540+
},
25372541
"v2.CreateOnCallPage" => {
25382542
"body" => "CreatePageRequest",
25392543
},

features/v2/on-call.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,30 @@ Feature: On-Call
4343
When the request is sent
4444
Then the response status is 201 Created
4545

46+
@generated @skip @team:DataDog/on-call
47+
Scenario: Create email notification channel for user returns "Bad Request" response
48+
Given new "CreateUserEmailNotificationChannel" request
49+
And request contains "user_id" parameter from "REPLACE.ME"
50+
And body with value {"data": {"attributes": {"active": true, "address": "[email protected]", "alias": "", "blocked": false, "created_at": "2024-04-16T23:38:50.388642Z", "formats": ["html"], "modified_at": "2024-04-16T23:38:50.388642Z"}, "id": "45cd9fe5-dd96-42ad-83de-2242ea9f6efd", "type": "emails"}}
51+
When the request is sent
52+
Then the response status is 400 Bad Request
53+
54+
@generated @skip @team:DataDog/on-call
55+
Scenario: Create email notification channel for user returns "Created" response
56+
Given new "CreateUserEmailNotificationChannel" request
57+
And request contains "user_id" parameter from "REPLACE.ME"
58+
And body with value {"data": {"attributes": {"active": true, "address": "[email protected]", "alias": "", "blocked": false, "created_at": "2024-04-16T23:38:50.388642Z", "formats": ["html"], "modified_at": "2024-04-16T23:38:50.388642Z"}, "id": "45cd9fe5-dd96-42ad-83de-2242ea9f6efd", "type": "emails"}}
59+
When the request is sent
60+
Then the response status is 201 Created
61+
62+
@generated @skip @team:DataDog/on-call
63+
Scenario: Create email notification channel for user returns "Not Found" response
64+
Given new "CreateUserEmailNotificationChannel" request
65+
And request contains "user_id" parameter from "REPLACE.ME"
66+
And body with value {"data": {"attributes": {"active": true, "address": "[email protected]", "alias": "", "blocked": false, "created_at": "2024-04-16T23:38:50.388642Z", "formats": ["html"], "modified_at": "2024-04-16T23:38:50.388642Z"}, "id": "45cd9fe5-dd96-42ad-83de-2242ea9f6efd", "type": "emails"}}
67+
When the request is sent
68+
Then the response status is 404 Not Found
69+
4670
@team:DataDog/on-call
4771
Scenario: Delete On-Call escalation policy returns "No Content" response
4872
Given new "DeleteOnCallEscalationPolicy" request

features/v2/undo.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,6 +2697,14 @@
26972697
"type": "idempotent"
26982698
}
26992699
},
2700+
"CreateUserEmailNotificationChannel": {
2701+
"tag": "On-Call",
2702+
"undo": {
2703+
"operationId": "TODO",
2704+
"parameters": [],
2705+
"type": "unsafe"
2706+
}
2707+
},
27002708
"ListOrgConfigs": {
27012709
"tag": "Organizations",
27022710
"undo": {

lib/datadog_api_client/inflector.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,10 @@ def overrides
19541954
"v2.downtime_update_request" => "DowntimeUpdateRequest",
19551955
"v2.downtime_update_request_attributes" => "DowntimeUpdateRequestAttributes",
19561956
"v2.downtime_update_request_data" => "DowntimeUpdateRequestData",
1957+
"v2.email" => "Email",
1958+
"v2.email_attributes" => "EmailAttributes",
1959+
"v2.email_data" => "EmailData",
1960+
"v2.email_type" => "EmailType",
19571961
"v2.entity_attributes" => "EntityAttributes",
19581962
"v2.entity_data" => "EntityData",
19591963
"v2.entity_meta" => "EntityMeta",

lib/datadog_api_client/v2/api/on_call_api.rb

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,78 @@ def create_on_call_schedule_with_http_info(body, opts = {})
161161
return data, status_code, headers
162162
end
163163

164+
# Create email notification channel for user.
165+
#
166+
# @see #create_user_email_notification_channel_with_http_info
167+
def create_user_email_notification_channel(user_id, body, opts = {})
168+
create_user_email_notification_channel_with_http_info(user_id, body, opts)
169+
nil
170+
end
171+
172+
# Create email notification channel for user.
173+
#
174+
# Create a new email notification channel for an on-call user
175+
#
176+
# @param user_id [String] The user ID
177+
# @param body [Email]
178+
# @param opts [Hash] the optional parameters
179+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
180+
def create_user_email_notification_channel_with_http_info(user_id, body, opts = {})
181+
182+
if @api_client.config.debugging
183+
@api_client.config.logger.debug 'Calling API: OnCallAPI.create_user_email_notification_channel ...'
184+
end
185+
# verify the required parameter 'user_id' is set
186+
if @api_client.config.client_side_validation && user_id.nil?
187+
fail ArgumentError, "Missing the required parameter 'user_id' when calling OnCallAPI.create_user_email_notification_channel"
188+
end
189+
# verify the required parameter 'body' is set
190+
if @api_client.config.client_side_validation && body.nil?
191+
fail ArgumentError, "Missing the required parameter 'body' when calling OnCallAPI.create_user_email_notification_channel"
192+
end
193+
# resource path
194+
local_var_path = '/api/v2/on-call/users/{user_id}/notification-channels/emails'.sub('{user_id}', CGI.escape(user_id.to_s).gsub('%2F', '/'))
195+
196+
# query parameters
197+
query_params = opts[:query_params] || {}
198+
199+
# header parameters
200+
header_params = opts[:header_params] || {}
201+
# HTTP header 'Accept' (if needed)
202+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
203+
# HTTP header 'Content-Type'
204+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
205+
206+
# form parameters
207+
form_params = opts[:form_params] || {}
208+
209+
# http body (model)
210+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
211+
212+
# return_type
213+
return_type = opts[:debug_return_type]
214+
215+
# auth_names
216+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
217+
218+
new_options = opts.merge(
219+
:operation => :create_user_email_notification_channel,
220+
:header_params => header_params,
221+
:query_params => query_params,
222+
:form_params => form_params,
223+
:body => post_body,
224+
:auth_names => auth_names,
225+
:return_type => return_type,
226+
:api_version => "V2"
227+
)
228+
229+
data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
230+
if @api_client.config.debugging
231+
@api_client.config.logger.debug "API called: OnCallAPI#create_user_email_notification_channel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
232+
end
233+
return data, status_code, headers
234+
end
235+
164236
# Delete On-Call escalation policy.
165237
#
166238
# @see #delete_on_call_escalation_policy_with_http_info

0 commit comments

Comments
 (0)