Skip to content

Commit e171891

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add MSTeams integration metadata info (#2514)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 28d292d commit e171891

File tree

5 files changed

+502
-8
lines changed

5 files changed

+502
-8
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-10-04 10:38:24.095988",
8-
"spec_repo_commit": "7a63d530"
7+
"regenerated": "2024-10-04 15:31:57.989019",
8+
"spec_repo_commit": "f28ad048"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-04 10:38:24.110677",
13-
"spec_repo_commit": "7a63d530"
12+
"regenerated": "2024-10-04 15:31:58.012298",
13+
"spec_repo_commit": "f28ad048"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10640,6 +10640,7 @@ components:
1064010640
oneOf:
1064110641
- $ref: '#/components/schemas/SlackIntegrationMetadata'
1064210642
- $ref: '#/components/schemas/JiraIntegrationMetadata'
10643+
- $ref: '#/components/schemas/MSTeamsIntegrationMetadata'
1064310644
IncidentIntegrationMetadataPatchData:
1064410645
description: Incident integration metadata data for a patch request.
1064510646
properties:
@@ -13634,6 +13635,43 @@ components:
1363413635
from the other indexes
1363513636
type: string
1363613637
type: object
13638+
MSTeamsIntegrationMetadata:
13639+
description: Incident integration metadata for the Microsoft Teams integration.
13640+
properties:
13641+
teams:
13642+
description: Array of Microsoft Teams in this integration metadata.
13643+
example: []
13644+
items:
13645+
$ref: '#/components/schemas/MSTeamsIntegrationMetadataTeamsItem'
13646+
type: array
13647+
required:
13648+
- teams
13649+
type: object
13650+
MSTeamsIntegrationMetadataTeamsItem:
13651+
description: Item in the Microsoft Teams integration metadata teams array.
13652+
properties:
13653+
ms_channel_id:
13654+
description: Microsoft Teams channel ID.
13655+
example: 19:abc00abcdef00a0abcdef0abcdef0a@thread.tacv2
13656+
type: string
13657+
ms_channel_name:
13658+
description: Microsoft Teams channel name.
13659+
example: incident-0001-example
13660+
type: string
13661+
ms_tenant_id:
13662+
description: Microsoft Teams tenant ID.
13663+
example: 00000000-abcd-0005-0000-000000000000
13664+
type: string
13665+
redirect_url:
13666+
description: URL redirecting to the Microsoft Teams channel.
13667+
example: https://teams.microsoft.com/l/channel/19%3Aabc00abcdef00a0abcdef0abcdef0a%40thread.tacv2/conversations?groupId=12345678-abcd-dcba-abcd-1234567890ab&tenantId=00000000-abcd-0005-0000-000000000000
13668+
type: string
13669+
required:
13670+
- ms_tenant_id
13671+
- ms_channel_id
13672+
- ms_channel_name
13673+
- redirect_url
13674+
type: object
1363713675
Metric:
1363813676
description: Object for a single metric tag configuration.
1363913677
example:

src/main/java/com/datadog/api/client/v2/model/IncidentIntegrationMetadataMetadata.java

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,51 @@ public IncidentIntegrationMetadataMetadata deserialize(
175175
log.log(Level.FINER, "Input data does not match schema 'JiraIntegrationMetadata'", e);
176176
}
177177

178+
// deserialize MSTeamsIntegrationMetadata
179+
try {
180+
boolean attemptParsing = true;
181+
// ensure that we respect type coercion as set on the client ObjectMapper
182+
if (MSTeamsIntegrationMetadata.class.equals(Integer.class)
183+
|| MSTeamsIntegrationMetadata.class.equals(Long.class)
184+
|| MSTeamsIntegrationMetadata.class.equals(Float.class)
185+
|| MSTeamsIntegrationMetadata.class.equals(Double.class)
186+
|| MSTeamsIntegrationMetadata.class.equals(Boolean.class)
187+
|| MSTeamsIntegrationMetadata.class.equals(String.class)) {
188+
attemptParsing = typeCoercion;
189+
if (!attemptParsing) {
190+
attemptParsing |=
191+
((MSTeamsIntegrationMetadata.class.equals(Integer.class)
192+
|| MSTeamsIntegrationMetadata.class.equals(Long.class))
193+
&& token == JsonToken.VALUE_NUMBER_INT);
194+
attemptParsing |=
195+
((MSTeamsIntegrationMetadata.class.equals(Float.class)
196+
|| MSTeamsIntegrationMetadata.class.equals(Double.class))
197+
&& (token == JsonToken.VALUE_NUMBER_FLOAT
198+
|| token == JsonToken.VALUE_NUMBER_INT));
199+
attemptParsing |=
200+
(MSTeamsIntegrationMetadata.class.equals(Boolean.class)
201+
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
202+
attemptParsing |=
203+
(MSTeamsIntegrationMetadata.class.equals(String.class)
204+
&& token == JsonToken.VALUE_STRING);
205+
}
206+
}
207+
if (attemptParsing) {
208+
tmp = tree.traverse(jp.getCodec()).readValueAs(MSTeamsIntegrationMetadata.class);
209+
// TODO: there is no validation against JSON schema constraints
210+
// (min, max, enum, pattern...), this does not perform a strict JSON
211+
// validation, which means the 'match' count may be higher than it should be.
212+
if (!((MSTeamsIntegrationMetadata) tmp).unparsed) {
213+
deserialized = tmp;
214+
match++;
215+
}
216+
log.log(Level.FINER, "Input data matches schema 'MSTeamsIntegrationMetadata'");
217+
}
218+
} catch (Exception e) {
219+
// deserialization failed, continue
220+
log.log(Level.FINER, "Input data does not match schema 'MSTeamsIntegrationMetadata'", e);
221+
}
222+
178223
IncidentIntegrationMetadataMetadata ret = new IncidentIntegrationMetadataMetadata();
179224
if (match == 1) {
180225
ret.setActualInstance(deserialized);
@@ -215,9 +260,15 @@ public IncidentIntegrationMetadataMetadata(JiraIntegrationMetadata o) {
215260
setActualInstance(o);
216261
}
217262

263+
public IncidentIntegrationMetadataMetadata(MSTeamsIntegrationMetadata o) {
264+
super("oneOf", Boolean.FALSE);
265+
setActualInstance(o);
266+
}
267+
218268
static {
219269
schemas.put("SlackIntegrationMetadata", new GenericType<SlackIntegrationMetadata>() {});
220270
schemas.put("JiraIntegrationMetadata", new GenericType<JiraIntegrationMetadata>() {});
271+
schemas.put("MSTeamsIntegrationMetadata", new GenericType<MSTeamsIntegrationMetadata>() {});
221272
JSON.registerDescendants(
222273
IncidentIntegrationMetadataMetadata.class, Collections.unmodifiableMap(schemas));
223274
}
@@ -229,7 +280,8 @@ public Map<String, GenericType> getSchemas() {
229280

230281
/**
231282
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
232-
* against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata
283+
* against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata,
284+
* MSTeamsIntegrationMetadata
233285
*
234286
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
235287
* composed schema (allOf, anyOf, oneOf).
@@ -244,20 +296,26 @@ public void setActualInstance(Object instance) {
244296
super.setActualInstance(instance);
245297
return;
246298
}
299+
if (JSON.isInstanceOf(MSTeamsIntegrationMetadata.class, instance, new HashSet<Class<?>>())) {
300+
super.setActualInstance(instance);
301+
return;
302+
}
247303

248304
if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
249305
super.setActualInstance(instance);
250306
return;
251307
}
252308
throw new RuntimeException(
253-
"Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata");
309+
"Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata,"
310+
+ " MSTeamsIntegrationMetadata");
254311
}
255312

256313
/**
257314
* Get the actual instance, which can be the following: SlackIntegrationMetadata,
258-
* JiraIntegrationMetadata
315+
* JiraIntegrationMetadata, MSTeamsIntegrationMetadata
259316
*
260-
* @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata)
317+
* @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata,
318+
* MSTeamsIntegrationMetadata)
261319
*/
262320
@Override
263321
public Object getActualInstance() {
@@ -285,4 +343,15 @@ public SlackIntegrationMetadata getSlackIntegrationMetadata() throws ClassCastEx
285343
public JiraIntegrationMetadata getJiraIntegrationMetadata() throws ClassCastException {
286344
return (JiraIntegrationMetadata) super.getActualInstance();
287345
}
346+
347+
/**
348+
* Get the actual instance of `MSTeamsIntegrationMetadata`. If the actual instance is not
349+
* `MSTeamsIntegrationMetadata`, the ClassCastException will be thrown.
350+
*
351+
* @return The actual instance of `MSTeamsIntegrationMetadata`
352+
* @throws ClassCastException if the instance is not `MSTeamsIntegrationMetadata`
353+
*/
354+
public MSTeamsIntegrationMetadata getMSTeamsIntegrationMetadata() throws ClassCastException {
355+
return (MSTeamsIntegrationMetadata) super.getActualInstance();
356+
}
288357
}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
package com.datadog.api.client.v2.model;
8+
9+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
10+
import com.fasterxml.jackson.annotation.JsonAnySetter;
11+
import com.fasterxml.jackson.annotation.JsonCreator;
12+
import com.fasterxml.jackson.annotation.JsonIgnore;
13+
import com.fasterxml.jackson.annotation.JsonInclude;
14+
import com.fasterxml.jackson.annotation.JsonProperty;
15+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
16+
import java.util.ArrayList;
17+
import java.util.HashMap;
18+
import java.util.List;
19+
import java.util.Map;
20+
import java.util.Objects;
21+
22+
/** Incident integration metadata for the Microsoft Teams integration. */
23+
@JsonPropertyOrder({MSTeamsIntegrationMetadata.JSON_PROPERTY_TEAMS})
24+
@jakarta.annotation.Generated(
25+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
26+
public class MSTeamsIntegrationMetadata {
27+
@JsonIgnore public boolean unparsed = false;
28+
public static final String JSON_PROPERTY_TEAMS = "teams";
29+
private List<MSTeamsIntegrationMetadataTeamsItem> teams = new ArrayList<>();
30+
31+
public MSTeamsIntegrationMetadata() {}
32+
33+
@JsonCreator
34+
public MSTeamsIntegrationMetadata(
35+
@JsonProperty(required = true, value = JSON_PROPERTY_TEAMS)
36+
List<MSTeamsIntegrationMetadataTeamsItem> teams) {
37+
this.teams = teams;
38+
}
39+
40+
public MSTeamsIntegrationMetadata teams(List<MSTeamsIntegrationMetadataTeamsItem> teams) {
41+
this.teams = teams;
42+
for (MSTeamsIntegrationMetadataTeamsItem item : teams) {
43+
this.unparsed |= item.unparsed;
44+
}
45+
return this;
46+
}
47+
48+
public MSTeamsIntegrationMetadata addTeamsItem(MSTeamsIntegrationMetadataTeamsItem teamsItem) {
49+
this.teams.add(teamsItem);
50+
this.unparsed |= teamsItem.unparsed;
51+
return this;
52+
}
53+
54+
/**
55+
* Array of Microsoft Teams in this integration metadata.
56+
*
57+
* @return teams
58+
*/
59+
@JsonProperty(JSON_PROPERTY_TEAMS)
60+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
61+
public List<MSTeamsIntegrationMetadataTeamsItem> getTeams() {
62+
return teams;
63+
}
64+
65+
public void setTeams(List<MSTeamsIntegrationMetadataTeamsItem> teams) {
66+
this.teams = teams;
67+
}
68+
69+
/**
70+
* A container for additional, undeclared properties. This is a holder for any undeclared
71+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
72+
*/
73+
private Map<String, Object> additionalProperties;
74+
75+
/**
76+
* Set the additional (undeclared) property with the specified name and value. If the property
77+
* does not already exist, create it otherwise replace it.
78+
*
79+
* @param key The arbitrary key to set
80+
* @param value The associated value
81+
* @return MSTeamsIntegrationMetadata
82+
*/
83+
@JsonAnySetter
84+
public MSTeamsIntegrationMetadata putAdditionalProperty(String key, Object value) {
85+
if (this.additionalProperties == null) {
86+
this.additionalProperties = new HashMap<String, Object>();
87+
}
88+
this.additionalProperties.put(key, value);
89+
return this;
90+
}
91+
92+
/**
93+
* Return the additional (undeclared) property.
94+
*
95+
* @return The additional properties
96+
*/
97+
@JsonAnyGetter
98+
public Map<String, Object> getAdditionalProperties() {
99+
return additionalProperties;
100+
}
101+
102+
/**
103+
* Return the additional (undeclared) property with the specified name.
104+
*
105+
* @param key The arbitrary key to get
106+
* @return The specific additional property for the given key
107+
*/
108+
public Object getAdditionalProperty(String key) {
109+
if (this.additionalProperties == null) {
110+
return null;
111+
}
112+
return this.additionalProperties.get(key);
113+
}
114+
115+
/** Return true if this MSTeamsIntegrationMetadata object is equal to o. */
116+
@Override
117+
public boolean equals(Object o) {
118+
if (this == o) {
119+
return true;
120+
}
121+
if (o == null || getClass() != o.getClass()) {
122+
return false;
123+
}
124+
MSTeamsIntegrationMetadata msTeamsIntegrationMetadata = (MSTeamsIntegrationMetadata) o;
125+
return Objects.equals(this.teams, msTeamsIntegrationMetadata.teams)
126+
&& Objects.equals(
127+
this.additionalProperties, msTeamsIntegrationMetadata.additionalProperties);
128+
}
129+
130+
@Override
131+
public int hashCode() {
132+
return Objects.hash(teams, additionalProperties);
133+
}
134+
135+
@Override
136+
public String toString() {
137+
StringBuilder sb = new StringBuilder();
138+
sb.append("class MSTeamsIntegrationMetadata {\n");
139+
sb.append(" teams: ").append(toIndentedString(teams)).append("\n");
140+
sb.append(" additionalProperties: ")
141+
.append(toIndentedString(additionalProperties))
142+
.append("\n");
143+
sb.append('}');
144+
return sb.toString();
145+
}
146+
147+
/**
148+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
149+
*/
150+
private String toIndentedString(Object o) {
151+
if (o == null) {
152+
return "null";
153+
}
154+
return o.toString().replace("\n", "\n ");
155+
}
156+
}

0 commit comments

Comments
 (0)