Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-04 10:38:24.095988",
"spec_repo_commit": "7a63d530"
"regenerated": "2024-10-04 15:31:57.989019",
"spec_repo_commit": "f28ad048"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-04 10:38:24.110677",
"spec_repo_commit": "7a63d530"
"regenerated": "2024-10-04 15:31:58.012298",
"spec_repo_commit": "f28ad048"
}
}
}
38 changes: 38 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10640,6 +10640,7 @@ components:
oneOf:
- $ref: '#/components/schemas/SlackIntegrationMetadata'
- $ref: '#/components/schemas/JiraIntegrationMetadata'
- $ref: '#/components/schemas/MSTeamsIntegrationMetadata'
IncidentIntegrationMetadataPatchData:
description: Incident integration metadata data for a patch request.
properties:
Expand Down Expand Up @@ -13634,6 +13635,43 @@ components:
from the other indexes
type: string
type: object
MSTeamsIntegrationMetadata:
description: Incident integration metadata for the Microsoft Teams integration.
properties:
teams:
description: Array of Microsoft Teams in this integration metadata.
example: []
items:
$ref: '#/components/schemas/MSTeamsIntegrationMetadataTeamsItem'
type: array
required:
- teams
type: object
MSTeamsIntegrationMetadataTeamsItem:
description: Item in the Microsoft Teams integration metadata teams array.
properties:
ms_channel_id:
description: Microsoft Teams channel ID.
example: 19:abc00abcdef00a0abcdef0abcdef0a@thread.tacv2
type: string
ms_channel_name:
description: Microsoft Teams channel name.
example: incident-0001-example
type: string
ms_tenant_id:
description: Microsoft Teams tenant ID.
example: 00000000-abcd-0005-0000-000000000000
type: string
redirect_url:
description: URL redirecting to the Microsoft Teams channel.
example: https://teams.microsoft.com/l/channel/19%3Aabc00abcdef00a0abcdef0abcdef0a%40thread.tacv2/conversations?groupId=12345678-abcd-dcba-abcd-1234567890ab&tenantId=00000000-abcd-0005-0000-000000000000
type: string
required:
- ms_tenant_id
- ms_channel_id
- ms_channel_name
- redirect_url
type: object
Metric:
description: Object for a single metric tag configuration.
example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,51 @@ public IncidentIntegrationMetadataMetadata deserialize(
log.log(Level.FINER, "Input data does not match schema 'JiraIntegrationMetadata'", e);
}

// deserialize MSTeamsIntegrationMetadata
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (MSTeamsIntegrationMetadata.class.equals(Integer.class)
|| MSTeamsIntegrationMetadata.class.equals(Long.class)
|| MSTeamsIntegrationMetadata.class.equals(Float.class)
|| MSTeamsIntegrationMetadata.class.equals(Double.class)
|| MSTeamsIntegrationMetadata.class.equals(Boolean.class)
|| MSTeamsIntegrationMetadata.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((MSTeamsIntegrationMetadata.class.equals(Integer.class)
|| MSTeamsIntegrationMetadata.class.equals(Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((MSTeamsIntegrationMetadata.class.equals(Float.class)
|| MSTeamsIntegrationMetadata.class.equals(Double.class))
&& (token == JsonToken.VALUE_NUMBER_FLOAT
|| token == JsonToken.VALUE_NUMBER_INT));
attemptParsing |=
(MSTeamsIntegrationMetadata.class.equals(Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |=
(MSTeamsIntegrationMetadata.class.equals(String.class)
&& token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
tmp = tree.traverse(jp.getCodec()).readValueAs(MSTeamsIntegrationMetadata.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
if (!((MSTeamsIntegrationMetadata) tmp).unparsed) {
deserialized = tmp;
match++;
}
log.log(Level.FINER, "Input data matches schema 'MSTeamsIntegrationMetadata'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'MSTeamsIntegrationMetadata'", e);
}

IncidentIntegrationMetadataMetadata ret = new IncidentIntegrationMetadataMetadata();
if (match == 1) {
ret.setActualInstance(deserialized);
Expand Down Expand Up @@ -215,9 +260,15 @@ public IncidentIntegrationMetadataMetadata(JiraIntegrationMetadata o) {
setActualInstance(o);
}

public IncidentIntegrationMetadataMetadata(MSTeamsIntegrationMetadata o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

static {
schemas.put("SlackIntegrationMetadata", new GenericType<SlackIntegrationMetadata>() {});
schemas.put("JiraIntegrationMetadata", new GenericType<JiraIntegrationMetadata>() {});
schemas.put("MSTeamsIntegrationMetadata", new GenericType<MSTeamsIntegrationMetadata>() {});
JSON.registerDescendants(
IncidentIntegrationMetadataMetadata.class, Collections.unmodifiableMap(schemas));
}
Expand All @@ -229,7 +280,8 @@ public Map<String, GenericType> getSchemas() {

/**
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
* against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata
* against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata,
* MSTeamsIntegrationMetadata
*
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
* composed schema (allOf, anyOf, oneOf).
Expand All @@ -244,20 +296,26 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(MSTeamsIntegrationMetadata.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}

if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException(
"Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata");
"Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata,"
+ " MSTeamsIntegrationMetadata");
}

/**
* Get the actual instance, which can be the following: SlackIntegrationMetadata,
* JiraIntegrationMetadata
* JiraIntegrationMetadata, MSTeamsIntegrationMetadata
*
* @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata)
* @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata,
* MSTeamsIntegrationMetadata)
*/
@Override
public Object getActualInstance() {
Expand Down Expand Up @@ -285,4 +343,15 @@ public SlackIntegrationMetadata getSlackIntegrationMetadata() throws ClassCastEx
public JiraIntegrationMetadata getJiraIntegrationMetadata() throws ClassCastException {
return (JiraIntegrationMetadata) super.getActualInstance();
}

/**
* Get the actual instance of `MSTeamsIntegrationMetadata`. If the actual instance is not
* `MSTeamsIntegrationMetadata`, the ClassCastException will be thrown.
*
* @return The actual instance of `MSTeamsIntegrationMetadata`
* @throws ClassCastException if the instance is not `MSTeamsIntegrationMetadata`
*/
public MSTeamsIntegrationMetadata getMSTeamsIntegrationMetadata() throws ClassCastException {
return (MSTeamsIntegrationMetadata) super.getActualInstance();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/

package com.datadog.api.client.v2.model;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/** Incident integration metadata for the Microsoft Teams integration. */
@JsonPropertyOrder({MSTeamsIntegrationMetadata.JSON_PROPERTY_TEAMS})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class MSTeamsIntegrationMetadata {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_TEAMS = "teams";
private List<MSTeamsIntegrationMetadataTeamsItem> teams = new ArrayList<>();

public MSTeamsIntegrationMetadata() {}

@JsonCreator
public MSTeamsIntegrationMetadata(
@JsonProperty(required = true, value = JSON_PROPERTY_TEAMS)
List<MSTeamsIntegrationMetadataTeamsItem> teams) {
this.teams = teams;
}

public MSTeamsIntegrationMetadata teams(List<MSTeamsIntegrationMetadataTeamsItem> teams) {
this.teams = teams;
for (MSTeamsIntegrationMetadataTeamsItem item : teams) {
this.unparsed |= item.unparsed;
}
return this;
}

public MSTeamsIntegrationMetadata addTeamsItem(MSTeamsIntegrationMetadataTeamsItem teamsItem) {
this.teams.add(teamsItem);
this.unparsed |= teamsItem.unparsed;
return this;
}

/**
* Array of Microsoft Teams in this integration metadata.
*
* @return teams
*/
@JsonProperty(JSON_PROPERTY_TEAMS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<MSTeamsIntegrationMetadataTeamsItem> getTeams() {
return teams;
}

public void setTeams(List<MSTeamsIntegrationMetadataTeamsItem> teams) {
this.teams = teams;
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;

/**
* Set the additional (undeclared) property with the specified name and value. If the property
* does not already exist, create it otherwise replace it.
*
* @param key The arbitrary key to set
* @param value The associated value
* @return MSTeamsIntegrationMetadata
*/
@JsonAnySetter
public MSTeamsIntegrationMetadata putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}

/**
* Return the additional (undeclared) property with the specified name.
*
* @param key The arbitrary key to get
* @return The specific additional property for the given key
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}

/** Return true if this MSTeamsIntegrationMetadata object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MSTeamsIntegrationMetadata msTeamsIntegrationMetadata = (MSTeamsIntegrationMetadata) o;
return Objects.equals(this.teams, msTeamsIntegrationMetadata.teams)
&& Objects.equals(
this.additionalProperties, msTeamsIntegrationMetadata.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(teams, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class MSTeamsIntegrationMetadata {\n");
sb.append(" teams: ").append(toIndentedString(teams)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append('}');
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Loading