diff --git a/CHANGELOG.md b/CHANGELOG.md index 06b5de8039f..20700f51b02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.1.0 [unreleased] +### API +1. [#58](https://github.com/influxdata/influxdb-client-java/pull/58): Updated swagger to latest version + ### Bugs 1. [#57](https://github.com/influxdata/influxdb-client-java/pull/57): LabelsApi: orgID parameter has to be pass as second argument diff --git a/README.md b/README.md index 49361430bbe..3638fc14f4c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![CircleCI](https://circleci.com/gh/influxdata/influxdb-client-java.svg?style=svg)](https://circleci.com/gh/influxdata/influxdb-client-java) [![codecov](https://codecov.io/gh/influxdata/influxdb-client-java/branch/master/graph/badge.svg)](https://codecov.io/gh/influxdata/influxdb-client-java) [![License](https://img.shields.io/github/license/influxdata/influxdb-client-java.svg)](https://github.com/influxdata/influxdb-client-java/blob/master/LICENSE) -[![Maven Version](https://img.shields.io/nexus/s/https/repo1.maven.org/maven2/com.influxdb/influxdb-client-java.svg)](https://repo1.maven.org/maven2/com/influxdb/) +[![Maven Central](https://img.shields.io/maven-central/v/com.influxdb/influxdb-client)](https://repo1.maven.org/maven2/com/influxdb/) [![GitHub issues](https://img.shields.io/github/issues-raw/influxdata/influxdb-client-java.svg)](https://github.com/influxdata/influxdb-client-java/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/influxdata/influxdb-client-java.svg)](https://github.com/influxdata/influxdb-client-java/pulls) diff --git a/client/src/generated/java/com/influxdb/client/domain/DeadmanCheck.java b/client/src/generated/java/com/influxdb/client/domain/DeadmanCheck.java index 90bc39c44a1..556ecc4814d 100644 --- a/client/src/generated/java/com/influxdb/client/domain/DeadmanCheck.java +++ b/client/src/generated/java/com/influxdb/client/domain/DeadmanCheck.java @@ -88,7 +88,11 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException { public static final String SERIALIZED_NAME_TIME_SINCE = "timeSince"; @SerializedName(SERIALIZED_NAME_TIME_SINCE) - private Integer timeSince; + private String timeSince; + + public static final String SERIALIZED_NAME_STALE_TIME = "staleTime"; + @SerializedName(SERIALIZED_NAME_STALE_TIME) + private String staleTime; public static final String SERIALIZED_NAME_REPORT_ZERO = "reportZero"; @SerializedName(SERIALIZED_NAME_REPORT_ZERO) @@ -107,24 +111,42 @@ public TypeEnum getType() { return type; } - public DeadmanCheck timeSince(Integer timeSince) { + public DeadmanCheck timeSince(String timeSince) { this.timeSince = timeSince; return this; } /** - * seconds before deadman triggers + * string duration before deadman triggers * @return timeSince **/ - @ApiModelProperty(value = "seconds before deadman triggers") - public Integer getTimeSince() { + @ApiModelProperty(value = "string duration before deadman triggers") + public String getTimeSince() { return timeSince; } - public void setTimeSince(Integer timeSince) { + public void setTimeSince(String timeSince) { this.timeSince = timeSince; } + public DeadmanCheck staleTime(String staleTime) { + this.staleTime = staleTime; + return this; + } + + /** + * string duration for time that a series is considered stale and should not trigger deadman + * @return staleTime + **/ + @ApiModelProperty(value = "string duration for time that a series is considered stale and should not trigger deadman") + public String getStaleTime() { + return staleTime; + } + + public void setStaleTime(String staleTime) { + this.staleTime = staleTime; + } + public DeadmanCheck reportZero(Boolean reportZero) { this.reportZero = reportZero; return this; @@ -173,6 +195,7 @@ public boolean equals(java.lang.Object o) { DeadmanCheck deadmanCheck = (DeadmanCheck) o; return Objects.equals(this.type, deadmanCheck.type) && Objects.equals(this.timeSince, deadmanCheck.timeSince) && + Objects.equals(this.staleTime, deadmanCheck.staleTime) && Objects.equals(this.reportZero, deadmanCheck.reportZero) && Objects.equals(this.level, deadmanCheck.level) && super.equals(o); @@ -180,7 +203,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(type, timeSince, reportZero, level, super.hashCode()); + return Objects.hash(type, timeSince, staleTime, reportZero, level, super.hashCode()); } @@ -191,6 +214,7 @@ public String toString() { sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" timeSince: ").append(toIndentedString(timeSince)).append("\n"); + sb.append(" staleTime: ").append(toIndentedString(staleTime)).append("\n"); sb.append(" reportZero: ").append(toIndentedString(reportZero)).append("\n"); sb.append(" level: ").append(toIndentedString(level)).append("\n"); sb.append("}"); diff --git a/client/src/generated/java/com/influxdb/client/domain/FluxResponse.java b/client/src/generated/java/com/influxdb/client/domain/FluxResponse.java new file mode 100644 index 00000000000..ec7faae603f --- /dev/null +++ b/client/src/generated/java/com/influxdb/client/domain/FluxResponse.java @@ -0,0 +1,95 @@ +/* + * Influx API Service + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.influxdb.client.domain; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * Rendered flux that backs the check or notification. + */ +@ApiModel(description = "Rendered flux that backs the check or notification.") + +public class FluxResponse { + public static final String SERIALIZED_NAME_FLUX = "flux"; + @SerializedName(SERIALIZED_NAME_FLUX) + private String flux; + + public FluxResponse flux(String flux) { + this.flux = flux; + return this; + } + + /** + * Get flux + * @return flux + **/ + @ApiModelProperty(value = "") + public String getFlux() { + return flux; + } + + public void setFlux(String flux) { + this.flux = flux; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FluxResponse fluxResponse = (FluxResponse) o; + return Objects.equals(this.flux, fluxResponse.flux); + } + + @Override + public int hashCode() { + return Objects.hash(flux); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FluxResponse {\n"); + sb.append(" flux: ").append(toIndentedString(flux)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/client/src/generated/java/com/influxdb/client/domain/WebhookNotificationEndpoint.java b/client/src/generated/java/com/influxdb/client/domain/HTTPNotificationEndpoint.java similarity index 74% rename from client/src/generated/java/com/influxdb/client/domain/WebhookNotificationEndpoint.java rename to client/src/generated/java/com/influxdb/client/domain/HTTPNotificationEndpoint.java index 2907696e4b9..279decbee76 100644 --- a/client/src/generated/java/com/influxdb/client/domain/WebhookNotificationEndpoint.java +++ b/client/src/generated/java/com/influxdb/client/domain/HTTPNotificationEndpoint.java @@ -30,10 +30,10 @@ import java.util.List; /** - * WebhookNotificationEndpoint + * HTTPNotificationEndpoint */ -public class WebhookNotificationEndpoint extends NotificationEndpoint { +public class HTTPNotificationEndpoint extends NotificationEndpoint { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) private String url; @@ -104,10 +104,10 @@ public MethodEnum read(final JsonReader jsonReader) throws IOException { private MethodEnum method; /** - * Gets or Sets authmethod + * Gets or Sets authMethod */ - @JsonAdapter(AuthmethodEnum.Adapter.class) - public enum AuthmethodEnum { + @JsonAdapter(AuthMethodEnum.Adapter.class) + public enum AuthMethodEnum { NONE("none"), BASIC("basic"), @@ -116,7 +116,7 @@ public enum AuthmethodEnum { private String value; - AuthmethodEnum(String value) { + AuthMethodEnum(String value) { this.value = value; } @@ -129,8 +129,8 @@ public String toString() { return String.valueOf(value); } - public static AuthmethodEnum fromValue(String text) { - for (AuthmethodEnum b : AuthmethodEnum.values()) { + public static AuthMethodEnum fromValue(String text) { + for (AuthMethodEnum b : AuthMethodEnum.values()) { if (String.valueOf(b.value).equals(text)) { return b; } @@ -138,29 +138,29 @@ public static AuthmethodEnum fromValue(String text) { return null; } - public static class Adapter extends TypeAdapter { + public static class Adapter extends TypeAdapter { @Override - public void write(final JsonWriter jsonWriter, final AuthmethodEnum enumeration) throws IOException { + public void write(final JsonWriter jsonWriter, final AuthMethodEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public AuthmethodEnum read(final JsonReader jsonReader) throws IOException { + public AuthMethodEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); - return AuthmethodEnum.fromValue(String.valueOf(value)); + return AuthMethodEnum.fromValue(String.valueOf(value)); } } } - public static final String SERIALIZED_NAME_AUTHMETHOD = "authmethod"; - @SerializedName(SERIALIZED_NAME_AUTHMETHOD) - private AuthmethodEnum authmethod; + public static final String SERIALIZED_NAME_AUTH_METHOD = "authMethod"; + @SerializedName(SERIALIZED_NAME_AUTH_METHOD) + private AuthMethodEnum authMethod; public static final String SERIALIZED_NAME_CONTENT_TEMPLATE = "contentTemplate"; @SerializedName(SERIALIZED_NAME_CONTENT_TEMPLATE) private String contentTemplate; - public WebhookNotificationEndpoint url(String url) { + public HTTPNotificationEndpoint url(String url) { this.url = url; return this; } @@ -178,7 +178,7 @@ public void setUrl(String url) { this.url = url; } - public WebhookNotificationEndpoint username(String username) { + public HTTPNotificationEndpoint username(String username) { this.username = username; return this; } @@ -196,7 +196,7 @@ public void setUsername(String username) { this.username = username; } - public WebhookNotificationEndpoint password(String password) { + public HTTPNotificationEndpoint password(String password) { this.password = password; return this; } @@ -214,7 +214,7 @@ public void setPassword(String password) { this.password = password; } - public WebhookNotificationEndpoint token(String token) { + public HTTPNotificationEndpoint token(String token) { this.token = token; return this; } @@ -232,7 +232,7 @@ public void setToken(String token) { this.token = token; } - public WebhookNotificationEndpoint method(MethodEnum method) { + public HTTPNotificationEndpoint method(MethodEnum method) { this.method = method; return this; } @@ -250,25 +250,25 @@ public void setMethod(MethodEnum method) { this.method = method; } - public WebhookNotificationEndpoint authmethod(AuthmethodEnum authmethod) { - this.authmethod = authmethod; + public HTTPNotificationEndpoint authMethod(AuthMethodEnum authMethod) { + this.authMethod = authMethod; return this; } /** - * Get authmethod - * @return authmethod + * Get authMethod + * @return authMethod **/ @ApiModelProperty(required = true, value = "") - public AuthmethodEnum getAuthmethod() { - return authmethod; + public AuthMethodEnum getAuthMethod() { + return authMethod; } - public void setAuthmethod(AuthmethodEnum authmethod) { - this.authmethod = authmethod; + public void setAuthMethod(AuthMethodEnum authMethod) { + this.authMethod = authMethod; } - public WebhookNotificationEndpoint contentTemplate(String contentTemplate) { + public HTTPNotificationEndpoint contentTemplate(String contentTemplate) { this.contentTemplate = contentTemplate; return this; } @@ -295,34 +295,34 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - WebhookNotificationEndpoint webhookNotificationEndpoint = (WebhookNotificationEndpoint) o; - return Objects.equals(this.url, webhookNotificationEndpoint.url) && - Objects.equals(this.username, webhookNotificationEndpoint.username) && - Objects.equals(this.password, webhookNotificationEndpoint.password) && - Objects.equals(this.token, webhookNotificationEndpoint.token) && - Objects.equals(this.method, webhookNotificationEndpoint.method) && - Objects.equals(this.authmethod, webhookNotificationEndpoint.authmethod) && - Objects.equals(this.contentTemplate, webhookNotificationEndpoint.contentTemplate) && + HTTPNotificationEndpoint htTPNotificationEndpoint = (HTTPNotificationEndpoint) o; + return Objects.equals(this.url, htTPNotificationEndpoint.url) && + Objects.equals(this.username, htTPNotificationEndpoint.username) && + Objects.equals(this.password, htTPNotificationEndpoint.password) && + Objects.equals(this.token, htTPNotificationEndpoint.token) && + Objects.equals(this.method, htTPNotificationEndpoint.method) && + Objects.equals(this.authMethod, htTPNotificationEndpoint.authMethod) && + Objects.equals(this.contentTemplate, htTPNotificationEndpoint.contentTemplate) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(url, username, password, token, method, authmethod, contentTemplate, super.hashCode()); + return Objects.hash(url, username, password, token, method, authMethod, contentTemplate, super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class WebhookNotificationEndpoint {\n"); + sb.append("class HTTPNotificationEndpoint {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" username: ").append(toIndentedString(username)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append(" token: ").append(toIndentedString(token)).append("\n"); sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append(" authmethod: ").append(toIndentedString(authmethod)).append("\n"); + sb.append(" authMethod: ").append(toIndentedString(authMethod)).append("\n"); sb.append(" contentTemplate: ").append(toIndentedString(contentTemplate)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/client/src/generated/java/com/influxdb/client/domain/LevelRule.java b/client/src/generated/java/com/influxdb/client/domain/LevelRule.java deleted file mode 100644 index 3667f12e4ba..00000000000 --- a/client/src/generated/java/com/influxdb/client/domain/LevelRule.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Influx API Service - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * OpenAPI spec version: 0.1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.influxdb.client.domain; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.influxdb.client.domain.CheckStatusLevel; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; - -/** - * LevelRule - */ - -public class LevelRule { - public static final String SERIALIZED_NAME_LEVEL = "level"; - @SerializedName(SERIALIZED_NAME_LEVEL) - private CheckStatusLevel level = null; - - /** - * Gets or Sets operation - */ - @JsonAdapter(OperationEnum.Adapter.class) - public enum OperationEnum { - EQUAL("equal"), - - NOTEQUAL("notequal"); - - private String value; - - OperationEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static OperationEnum fromValue(String text) { - for (OperationEnum b : OperationEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final OperationEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public OperationEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return OperationEnum.fromValue(String.valueOf(value)); - } - } - } - - public static final String SERIALIZED_NAME_OPERATION = "operation"; - @SerializedName(SERIALIZED_NAME_OPERATION) - private OperationEnum operation; - - public LevelRule level(CheckStatusLevel level) { - this.level = level; - return this; - } - - /** - * Get level - * @return level - **/ - @ApiModelProperty(value = "") - public CheckStatusLevel getLevel() { - return level; - } - - public void setLevel(CheckStatusLevel level) { - this.level = level; - } - - public LevelRule operation(OperationEnum operation) { - this.operation = operation; - return this; - } - - /** - * Get operation - * @return operation - **/ - @ApiModelProperty(value = "") - public OperationEnum getOperation() { - return operation; - } - - public void setOperation(OperationEnum operation) { - this.operation = operation; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LevelRule levelRule = (LevelRule) o; - return Objects.equals(this.level, levelRule.level) && - Objects.equals(this.operation, levelRule.operation); - } - - @Override - public int hashCode() { - return Objects.hash(level, operation); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class LevelRule {\n"); - sb.append(" level: ").append(toIndentedString(level)).append("\n"); - sb.append(" operation: ").append(toIndentedString(operation)).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(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoint.java b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoint.java index d6fede3f8cf..55b07bd0259 100644 --- a/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoint.java +++ b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoint.java @@ -15,11 +15,11 @@ import java.util.Objects; import java.util.Arrays; +import com.influxdb.client.domain.HTTPNotificationEndpoint; import com.influxdb.client.domain.Label; import com.influxdb.client.domain.NotificationEndpointType; import com.influxdb.client.domain.PagerDutyNotificationEndpoint; import com.influxdb.client.domain.SlackNotificationEndpoint; -import com.influxdb.client.domain.WebhookNotificationEndpoint; import java.time.OffsetDateTime; import java.util.List; diff --git a/client/src/generated/java/com/influxdb/client/domain/NotificationEndpointType.java b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpointType.java index 9c625647057..95404a0d318 100644 --- a/client/src/generated/java/com/influxdb/client/domain/NotificationEndpointType.java +++ b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpointType.java @@ -33,7 +33,7 @@ public enum NotificationEndpointType { PAGERDUTY("pagerduty"), - WEBHOOK("webhook"); + HTTP("http"); private String value; diff --git a/client/src/generated/java/com/influxdb/client/domain/NotificationEndpointUpdate.java b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpointUpdate.java new file mode 100644 index 00000000000..c8c238f2d50 --- /dev/null +++ b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpointUpdate.java @@ -0,0 +1,189 @@ +/* + * Influx API Service + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.influxdb.client.domain; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * NotificationEndpointUpdate + */ + +public class NotificationEndpointUpdate { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("active"), + + INACTIVE("inactive"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(String.valueOf(value)); + } + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private StatusEnum status; + + public NotificationEndpointUpdate name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public NotificationEndpointUpdate description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @ApiModelProperty(value = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public NotificationEndpointUpdate status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(value = "") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NotificationEndpointUpdate notificationEndpointUpdate = (NotificationEndpointUpdate) o; + return Objects.equals(this.name, notificationEndpointUpdate.name) && + Objects.equals(this.description, notificationEndpointUpdate.description) && + Objects.equals(this.status, notificationEndpointUpdate.status); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NotificationEndpointUpdate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoints.java b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoints.java index 76b411309d8..ca8c2857beb 100644 --- a/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoints.java +++ b/client/src/generated/java/com/influxdb/client/domain/NotificationEndpoints.java @@ -173,8 +173,8 @@ private Object deserialize(final String[] types, final JsonElement json, final J if (Arrays.equals(new String[]{ "PagerDutyNotificationEndpoint" }, types)) { return context.deserialize(json, PagerDutyNotificationEndpoint.class); } - if (Arrays.equals(new String[]{ "WebhookNotificationEndpoint" }, types)) { - return context.deserialize(json, WebhookNotificationEndpoint.class); + if (Arrays.equals(new String[]{ "HTTPNotificationEndpoint" }, types)) { + return context.deserialize(json, HTTPNotificationEndpoint.class); } return context.deserialize(json, Object.class); diff --git a/client/src/generated/java/com/influxdb/client/domain/NotificationRuleBase.java b/client/src/generated/java/com/influxdb/client/domain/NotificationRuleBase.java index b32fe7f9364..6e3116e46b5 100644 --- a/client/src/generated/java/com/influxdb/client/domain/NotificationRuleBase.java +++ b/client/src/generated/java/com/influxdb/client/domain/NotificationRuleBase.java @@ -40,9 +40,9 @@ public class NotificationRuleBase extends SlackNotificationRule { @SerializedName(SERIALIZED_NAME_ID) private String id; - public static final String SERIALIZED_NAME_NOTIFY_ENDPOINT_I_D = "notifyEndpointID"; - @SerializedName(SERIALIZED_NAME_NOTIFY_ENDPOINT_I_D) - private String notifyEndpointID; + public static final String SERIALIZED_NAME_ENDPOINT_I_D = "endpointID"; + @SerializedName(SERIALIZED_NAME_ENDPOINT_I_D) + private String endpointID; public static final String SERIALIZED_NAME_ORG_I_D = "orgID"; @SerializedName(SERIALIZED_NAME_ORG_I_D) @@ -122,12 +122,12 @@ public String getId() { } /** - * Get notifyEndpointID - * @return notifyEndpointID + * Get endpointID + * @return endpointID **/ @ApiModelProperty(value = "") - public String getNotifyEndpointID() { - return notifyEndpointID; + public String getEndpointID() { + return endpointID; } public NotificationRuleBase orgID(String orgID) { @@ -438,7 +438,7 @@ public boolean equals(java.lang.Object o) { } NotificationRuleBase notificationRuleBase = (NotificationRuleBase) o; return Objects.equals(this.id, notificationRuleBase.id) && - Objects.equals(this.notifyEndpointID, notificationRuleBase.notifyEndpointID) && + Objects.equals(this.endpointID, notificationRuleBase.endpointID) && Objects.equals(this.orgID, notificationRuleBase.orgID) && Objects.equals(this.ownerID, notificationRuleBase.ownerID) && Objects.equals(this.createdAt, notificationRuleBase.createdAt) && @@ -461,7 +461,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash(id, notifyEndpointID, orgID, ownerID, createdAt, updatedAt, status, name, sleepUntil, every, offset, cron, runbookLink, limitEvery, limit, tagRules, description, statusRules, labels, super.hashCode()); + return Objects.hash(id, endpointID, orgID, ownerID, createdAt, updatedAt, status, name, sleepUntil, every, offset, cron, runbookLink, limitEvery, limit, tagRules, description, statusRules, labels, super.hashCode()); } @@ -471,7 +471,7 @@ public String toString() { sb.append("class NotificationRuleBase {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" notifyEndpointID: ").append(toIndentedString(notifyEndpointID)).append("\n"); + sb.append(" endpointID: ").append(toIndentedString(endpointID)).append("\n"); sb.append(" orgID: ").append(toIndentedString(orgID)).append("\n"); sb.append(" ownerID: ").append(toIndentedString(ownerID)).append("\n"); sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); diff --git a/client/src/generated/java/com/influxdb/client/domain/RuleStatusLevel.java b/client/src/generated/java/com/influxdb/client/domain/RuleStatusLevel.java new file mode 100644 index 00000000000..8ade24f4db6 --- /dev/null +++ b/client/src/generated/java/com/influxdb/client/domain/RuleStatusLevel.java @@ -0,0 +1,82 @@ +/* + * Influx API Service + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * OpenAPI spec version: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.influxdb.client.domain; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * the state to record if check matches a criteria + */ +@JsonAdapter(RuleStatusLevel.Adapter.class) +public enum RuleStatusLevel { + + UNKNOWN("UNKNOWN"), + + OK("OK"), + + INFO("INFO"), + + CRIT("CRIT"), + + WARN("WARN"), + + ANY("ANY"); + + private String value; + + RuleStatusLevel(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RuleStatusLevel fromValue(String text) { + for (RuleStatusLevel b : RuleStatusLevel.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RuleStatusLevel enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RuleStatusLevel read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RuleStatusLevel.fromValue(String.valueOf(value)); + } + } +} + diff --git a/client/src/generated/java/com/influxdb/client/domain/StatusRule.java b/client/src/generated/java/com/influxdb/client/domain/StatusRule.java index 45a428eef4e..5be94edc049 100644 --- a/client/src/generated/java/com/influxdb/client/domain/StatusRule.java +++ b/client/src/generated/java/com/influxdb/client/domain/StatusRule.java @@ -20,7 +20,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.influxdb.client.domain.LevelRule; +import com.influxdb.client.domain.RuleStatusLevel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; @@ -32,11 +32,11 @@ public class StatusRule { public static final String SERIALIZED_NAME_CURRENT_LEVEL = "currentLevel"; @SerializedName(SERIALIZED_NAME_CURRENT_LEVEL) - private LevelRule currentLevel = null; + private RuleStatusLevel currentLevel = null; public static final String SERIALIZED_NAME_PREVIOUS_LEVEL = "previousLevel"; @SerializedName(SERIALIZED_NAME_PREVIOUS_LEVEL) - private LevelRule previousLevel = null; + private RuleStatusLevel previousLevel = null; public static final String SERIALIZED_NAME_COUNT = "count"; @SerializedName(SERIALIZED_NAME_COUNT) @@ -46,7 +46,7 @@ public class StatusRule { @SerializedName(SERIALIZED_NAME_PERIOD) private String period; - public StatusRule currentLevel(LevelRule currentLevel) { + public StatusRule currentLevel(RuleStatusLevel currentLevel) { this.currentLevel = currentLevel; return this; } @@ -56,15 +56,15 @@ public StatusRule currentLevel(LevelRule currentLevel) { * @return currentLevel **/ @ApiModelProperty(value = "") - public LevelRule getCurrentLevel() { + public RuleStatusLevel getCurrentLevel() { return currentLevel; } - public void setCurrentLevel(LevelRule currentLevel) { + public void setCurrentLevel(RuleStatusLevel currentLevel) { this.currentLevel = currentLevel; } - public StatusRule previousLevel(LevelRule previousLevel) { + public StatusRule previousLevel(RuleStatusLevel previousLevel) { this.previousLevel = previousLevel; return this; } @@ -74,11 +74,11 @@ public StatusRule previousLevel(LevelRule previousLevel) { * @return previousLevel **/ @ApiModelProperty(value = "") - public LevelRule getPreviousLevel() { + public RuleStatusLevel getPreviousLevel() { return previousLevel; } - public void setPreviousLevel(LevelRule previousLevel) { + public void setPreviousLevel(RuleStatusLevel previousLevel) { this.previousLevel = previousLevel; } diff --git a/client/src/generated/java/com/influxdb/client/service/ChecksService.java b/client/src/generated/java/com/influxdb/client/service/ChecksService.java index c0bc3bb51d5..8076e792d9b 100644 --- a/client/src/generated/java/com/influxdb/client/service/ChecksService.java +++ b/client/src/generated/java/com/influxdb/client/service/ChecksService.java @@ -10,6 +10,10 @@ import com.influxdb.client.domain.Check; import com.influxdb.client.domain.Checks; import com.influxdb.client.domain.Error; +import com.influxdb.client.domain.FluxResponse; +import com.influxdb.client.domain.LabelMapping; +import com.influxdb.client.domain.LabelResponse; +import com.influxdb.client.domain.LabelsResponse; import java.util.ArrayList; import java.util.HashMap; @@ -43,6 +47,19 @@ Call deleteChecksID( @retrofit2.http.Path("checkID") String checkID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * delete label from a check + * + * @param checkID ID of the check (required) + * @param labelID the label id to delete (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<Void> + */ + @DELETE("api/v2/checks/{checkID}/labels/{labelID}") + Call deleteChecksIDLabelsID( + @retrofit2.http.Path("checkID") String checkID, @retrofit2.http.Path("labelID") String labelID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + /** * Get all checks * @@ -57,7 +74,7 @@ Call getChecks( ); /** - * Get an check + * Get a check * * @param checkID ID of check (required) * @param zapTraceSpan OpenTracing span context (optional) @@ -68,6 +85,30 @@ Call getChecksID( @retrofit2.http.Path("checkID") String checkID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * list all labels for a check + * + * @param checkID ID of the check (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<LabelsResponse> + */ + @GET("api/v2/checks/{checkID}/labels") + Call getChecksIDLabels( + @retrofit2.http.Path("checkID") String checkID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + + /** + * Get an check query + * + * @param checkID ID of check (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<FluxResponse> + */ + @GET("api/v2/checks/{checkID}/query") + Call getChecksIDQuery( + @retrofit2.http.Path("checkID") String checkID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + /** * Update a check * @@ -84,4 +125,20 @@ Call patchChecksID( @retrofit2.http.Path("checkID") String checkID, @retrofit2.http.Body Check check, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * add a label to a check + * + * @param checkID ID of the check (required) + * @param labelMapping label to add (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<LabelResponse> + */ + @Headers({ + "Content-Type:application/json" + }) + @POST("api/v2/checks/{checkID}/labels") + Call postChecksIDLabels( + @retrofit2.http.Path("checkID") String checkID, @retrofit2.http.Body LabelMapping labelMapping, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + } diff --git a/client/src/generated/java/com/influxdb/client/service/NotificationEndpointsService.java b/client/src/generated/java/com/influxdb/client/service/NotificationEndpointsService.java index 01f11e15470..451ad897831 100644 --- a/client/src/generated/java/com/influxdb/client/service/NotificationEndpointsService.java +++ b/client/src/generated/java/com/influxdb/client/service/NotificationEndpointsService.java @@ -8,9 +8,12 @@ import okhttp3.MultipartBody; import com.influxdb.client.domain.Error; +import com.influxdb.client.domain.LabelMapping; +import com.influxdb.client.domain.LabelResponse; +import com.influxdb.client.domain.LabelsResponse; import com.influxdb.client.domain.NotificationEndpoint; +import com.influxdb.client.domain.NotificationEndpointUpdate; import com.influxdb.client.domain.NotificationEndpoints; -import com.influxdb.client.domain.NotificationRule; import java.util.ArrayList; import java.util.HashMap; @@ -22,13 +25,13 @@ public interface NotificationEndpointsService { * Add new notification endpoint * * @param notificationEndpoint notificationEndpoint to create (required) - * @return Call<NotificationRule> + * @return Call<NotificationEndpoint> */ @Headers({ "Content-Type:application/json" }) @POST("api/v2/notificationEndpoints") - Call createNotificationEndpoint( + Call createNotificationEndpoint( @retrofit2.http.Body NotificationEndpoint notificationEndpoint ); @@ -44,6 +47,19 @@ Call deleteNotificationEndpointsID( @retrofit2.http.Path("endpointID") String endpointID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * delete label from a notification endpoint + * + * @param endpointID ID of the notification endpoint (required) + * @param labelID the label id to delete (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<Void> + */ + @DELETE("api/v2/notificationEndpoints/{endpointID}/labels/{labelID}") + Call deleteNotificationEndpointsIDLabelsID( + @retrofit2.http.Path("endpointID") String endpointID, @retrofit2.http.Path("labelID") String labelID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + /** * Get all notification endpoints * @@ -69,11 +85,23 @@ Call getNotificationEndpointsID( @retrofit2.http.Path("endpointID") String endpointID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * list all labels for a notification endpoint + * + * @param endpointID ID of the notification endpoint (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<LabelsResponse> + */ + @GET("api/v2/notificationEndpoints/{endpointID}/labels") + Call getNotificationEndpointsIDLabels( + @retrofit2.http.Path("endpointID") String endpointID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + /** * Update a notification endpoint * * @param endpointID ID of notification endpoint (required) - * @param notificationEndpoint check update to apply (required) + * @param notificationEndpointUpdate check update to apply (required) * @param zapTraceSpan OpenTracing span context (optional) * @return Call<NotificationEndpoint> */ @@ -82,6 +110,38 @@ Call getNotificationEndpointsID( }) @PATCH("api/v2/notificationEndpoints/{endpointID}") Call patchNotificationEndpointsID( + @retrofit2.http.Path("endpointID") String endpointID, @retrofit2.http.Body NotificationEndpointUpdate notificationEndpointUpdate, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + + /** + * add a label to a notification endpoint + * + * @param endpointID ID of the notification endpoint (required) + * @param labelMapping label to add (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<LabelResponse> + */ + @Headers({ + "Content-Type:application/json" + }) + @POST("api/v2/notificationEndpoints/{endpointID}/labels") + Call postNotificationEndpointIDLabels( + @retrofit2.http.Path("endpointID") String endpointID, @retrofit2.http.Body LabelMapping labelMapping, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + + /** + * Update a notification endpoint + * + * @param endpointID ID of notification endpoint (required) + * @param notificationEndpoint a new notification endpoint to replace the existing endpoint with (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<NotificationEndpoint> + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("api/v2/notificationEndpoints/{endpointID}") + Call putNotificationEndpointsID( @retrofit2.http.Path("endpointID") String endpointID, @retrofit2.http.Body NotificationEndpoint notificationEndpoint, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); diff --git a/client/src/generated/java/com/influxdb/client/service/NotificationRulesService.java b/client/src/generated/java/com/influxdb/client/service/NotificationRulesService.java index 7525fad4573..03cd31d9eb8 100644 --- a/client/src/generated/java/com/influxdb/client/service/NotificationRulesService.java +++ b/client/src/generated/java/com/influxdb/client/service/NotificationRulesService.java @@ -8,6 +8,9 @@ import okhttp3.MultipartBody; import com.influxdb.client.domain.Error; +import com.influxdb.client.domain.LabelMapping; +import com.influxdb.client.domain.LabelResponse; +import com.influxdb.client.domain.LabelsResponse; import com.influxdb.client.domain.NotificationRule; import com.influxdb.client.domain.NotificationRuleUpdate; import com.influxdb.client.domain.NotificationRules; @@ -44,6 +47,19 @@ Call deleteNotificationRulesID( @retrofit2.http.Path("ruleID") String ruleID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * delete label from a notification rule + * + * @param ruleID ID of the notification rule (required) + * @param labelID the label id to delete (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<Void> + */ + @DELETE("api/v2/notificationRules/{ruleID}/labels/{labelID}") + Call deleteNotificationRulesIDLabelsID( + @retrofit2.http.Path("ruleID") String ruleID, @retrofit2.http.Path("labelID") String labelID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + /** * Get all notification rules * @@ -51,11 +67,12 @@ Call deleteNotificationRulesID( * @param offset (optional) * @param limit (optional, default to 20) * @param checkID only show notifications that belong to the specified check (optional) + * @param tag only show notification rules that match a tag pair. Uses AND logic if multiple tags are specified. (optional) * @return Call<NotificationRules> */ @GET("api/v2/notificationRules") Call getNotificationRules( - @retrofit2.http.Query("orgID") String orgID, @retrofit2.http.Query("offset") Integer offset, @retrofit2.http.Query("limit") Integer limit, @retrofit2.http.Query("checkID") String checkID + @retrofit2.http.Query("orgID") String orgID, @retrofit2.http.Query("offset") Integer offset, @retrofit2.http.Query("limit") Integer limit, @retrofit2.http.Query("checkID") String checkID, @retrofit2.http.Query("tag") String tag ); /** @@ -70,6 +87,18 @@ Call getNotificationRulesID( @retrofit2.http.Path("ruleID") String ruleID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * list all labels for a notification rule + * + * @param ruleID ID of the notification rule (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<LabelsResponse> + */ + @GET("api/v2/notificationRules/{ruleID}/labels") + Call getNotificationRulesIDLabels( + @retrofit2.http.Path("ruleID") String ruleID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + /** * Update a notification rule * @@ -86,6 +115,22 @@ Call patchNotificationRulesID( @retrofit2.http.Path("ruleID") String ruleID, @retrofit2.http.Body NotificationRuleUpdate notificationRuleUpdate, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan ); + /** + * add a label to a notification rule + * + * @param ruleID ID of the notification rule (required) + * @param labelMapping label to add (required) + * @param zapTraceSpan OpenTracing span context (optional) + * @return Call<LabelResponse> + */ + @Headers({ + "Content-Type:application/json" + }) + @POST("api/v2/notificationRules/{ruleID}/labels") + Call postNotificationRuleIDLabels( + @retrofit2.http.Path("ruleID") String ruleID, @retrofit2.http.Body LabelMapping labelMapping, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan + ); + /** * Update a notification rule * diff --git a/client/src/main/resources/swagger.yml b/client/src/main/resources/swagger.yml index 6a2821f1742..b157394199c 100644 --- a/client/src/main/resources/swagger.yml +++ b/client/src/main/resources/swagger.yml @@ -5175,7 +5175,7 @@ paths: operationId: GetChecksID tags: - Checks - summary: Get an check + summary: Get a check parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -5264,6 +5264,101 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + '/checks/{checkID}/labels': + get: + operationId: GetChecksIDLabels + tags: + - Checks + summary: list all labels for a check + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: checkID + schema: + type: string + required: true + description: ID of the check + responses: + '200': + description: a list of all labels for a check + content: + application/json: + schema: + $ref: "#/components/schemas/LabelsResponse" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + operationId: PostChecksIDLabels + tags: + - Checks + summary: add a label to a check + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: checkID + schema: + type: string + required: true + description: ID of the check + requestBody: + description: label to add + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/LabelMapping" + responses: + '201': + description: the label was added to the check + content: + application/json: + schema: + $ref: "#/components/schemas/LabelResponse" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + '/checks/{checkID}/labels/{labelID}': + delete: + operationId: DeleteChecksIDLabelsID + tags: + - Checks + summary: delete label from a check + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: checkID + schema: + type: string + required: true + description: ID of the check + - in: path + name: labelID + schema: + type: string + required: true + description: the label id to delete + responses: + '204': + description: delete has been accepted + '404': + description: check or label not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" /notificationRules: get: operationId: GetNotificationRules @@ -5284,6 +5379,13 @@ paths: description: only show notifications that belong to the specified check schema: type: string + - in: query + name: tag + description: only show notification rules that match a tag pair. Uses AND logic if multiple tags are specified. + schema: + type: string + pattern: ^[a-zA-Z0-9_]+:[a-zA-Z0-9_]+$ + example: env:prod responses: '200': description: A list of notification rules @@ -5322,6 +5424,45 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + '/checks/{checkID}/query': + get: + operationId: GetChecksIDQuery + tags: + - Checks + summary: Get an check query + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: checkID + schema: + type: string + required: true + description: ID of check + responses: + '200': + description: the check query requested + content: + application/json: + schema: + $ref: "#/components/schemas/FluxResponse" + '400': + description: invalid request + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + '404': + description: check not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" '/notificationRules/{ruleID}': get: operationId: GetNotificationRulesID @@ -5455,6 +5596,101 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + '/notificationRules/{ruleID}/labels': + get: + operationId: GetNotificationRulesIDLabels + tags: + - NotificationRules + summary: list all labels for a notification rule + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: ruleID + schema: + type: string + required: true + description: ID of the notification rule + responses: + '200': + description: a list of all labels for a notification rule + content: + application/json: + schema: + $ref: "#/components/schemas/LabelsResponse" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + operationId: PostNotificationRuleIDLabels + tags: + - NotificationRules + summary: add a label to a notification rule + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: ruleID + schema: + type: string + required: true + description: ID of the notification rule + requestBody: + description: label to add + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/LabelMapping" + responses: + '201': + description: the label was added to the notification rule + content: + application/json: + schema: + $ref: "#/components/schemas/LabelResponse" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + '/notificationRules/{ruleID}/labels/{labelID}': + delete: + operationId: DeleteNotificationRulesIDLabelsID + tags: + - NotificationRules + summary: delete label from a notification rule + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: ruleID + schema: + type: string + required: true + description: ID of the notification rule + - in: path + name: labelID + schema: + type: string + required: true + description: the label id to delete + responses: + '204': + description: delete has been accepted + '404': + description: rule or label not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" /notificationEndpoints: get: operationId: GetNotificationEndpoints @@ -5472,7 +5708,7 @@ paths: type: string responses: '200': - description: A list of notification rules + description: A list of notification endpoints content: application/json: schema: @@ -5501,7 +5737,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/NotificationRule" + $ref: "#/components/schemas/NotificationEndpoint" default: description: unexpected error content: @@ -5535,6 +5771,45 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + put: + operationId: PutNotificationEndpointsID + tags: + - NotificationEndpoints + summary: Update a notification endpoint + requestBody: + description: a new notification endpoint to replace the existing endpoint with + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/NotificationEndpoint" + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: endpointID + schema: + type: string + required: true + description: ID of notification endpoint + responses: + '200': + description: An updated notification endpoint + content: + application/json: + schema: + $ref: "#/components/schemas/NotificationEndpoint" + '404': + description: The notification endpoint was not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" patch: operationId: PatchNotificationEndpointsID tags: @@ -5546,7 +5821,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/NotificationEndpoint" + $ref: "#/components/schemas/NotificationEndpointUpdate" parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -5602,6 +5877,101 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + '/notificationEndpoints/{endpointID}/labels': + get: + operationId: GetNotificationEndpointsIDLabels + tags: + - NotificationEndpoints + summary: list all labels for a notification endpoint + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: endpointID + schema: + type: string + required: true + description: ID of the notification endpoint + responses: + '200': + description: a list of all labels for a notification endpoint + content: + application/json: + schema: + $ref: "#/components/schemas/LabelsResponse" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + operationId: PostNotificationEndpointIDLabels + tags: + - NotificationEndpoints + summary: add a label to a notification endpoint + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: endpointID + schema: + type: string + required: true + description: ID of the notification endpoint + requestBody: + description: label to add + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/LabelMapping" + responses: + '201': + description: the label was added to the notification endpoint + content: + application/json: + schema: + $ref: "#/components/schemas/LabelResponse" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + '/notificationEndpoints/{endpointID}/labels/{labelID}': + delete: + operationId: DeleteNotificationEndpointsIDLabelsID + tags: + - NotificationEndpoints + summary: delete label from a notification endpoint + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: endpointID + schema: + type: string + required: true + description: ID of the notification endpoint + - in: path + name: labelID + schema: + type: string + required: true + description: the label id to delete + responses: + '204': + description: delete has been accepted + '404': + description: endpoint or label not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" components: parameters: Offset: @@ -8875,6 +9245,11 @@ components: description: description: An optional description of the task. type: string + FluxResponse: + description: Rendered flux that backs the check or notification. + properties: + flux: + type: string Check: oneOf: - $ref: "#/components/schemas/DeadmanCheck" @@ -8940,7 +9315,7 @@ components: type: string labels: $ref: "#/components/schemas/Labels" - required: [name, orgID, query] + required: [name, type, orgID, query] ThresholdCheck: allOf: - $ref: "#/components/schemas/CheckBase" @@ -8967,8 +9342,11 @@ components: type: string enum: [deadman] timeSince: - description: seconds before deadman triggers - type: integer + description: string duration before deadman triggers + type: string + staleTime: + description: string duration for time that a series is considered stale and should not trigger deadman + type: string reportZero: description: if only zero values reported since time, trigger alert type: boolean @@ -9026,6 +9404,10 @@ components: description: the state to record if check matches a criteria type: string enum: ["UNKNOWN", "OK", "INFO", "CRIT", "WARN"] + RuleStatusLevel: + description: the state to record if check matches a criteria + type: string + enum: ["UNKNOWN", "OK", "INFO", "CRIT", "WARN", "ANY"] NotificationRuleUpdate: type: object properties: @@ -9065,7 +9447,7 @@ components: id: readOnly: true type: string - notifyEndpointID: + endpointID: type: string readOnly: true orgID: @@ -9137,21 +9519,13 @@ components: type: object properties: currentLevel: - $ref: "#/components/schemas/LevelRule" + $ref: "#/components/schemas/RuleStatusLevel" previousLevel: - $ref: "#/components/schemas/LevelRule" + $ref: "#/components/schemas/RuleStatusLevel" count: type: integer period: type: string - LevelRule: - type: object - properties: - level: - $ref: "#/components/schemas/CheckStatusLevel" - operation: - type: string - enum: ["equal", "notequal"] HTTPNotificationRuleBase: type: object required: [type, url] @@ -9210,17 +9584,29 @@ components: enum: [pagerduty] messageTemplate: type: string + NotificationEndpointUpdate: + type: object + properties: + name: + type: string + description: + type: string + status: + type: string + enum: + - active + - inactive NotificationEndpoint: oneOf: - $ref: "#/components/schemas/SlackNotificationEndpoint" - $ref: "#/components/schemas/PagerDutyNotificationEndpoint" - - $ref: "#/components/schemas/WebhookNotificationEndpoint" + - $ref: "#/components/schemas/HTTPNotificationEndpoint" discriminator: propertyName: type mapping: slack: "#/components/schemas/SlackNotificationEndpoint" pagerduty: "#/components/schemas/PagerDutyNotificationEndpoint" - webhook: "#/components/schemas/WebhookNotificationEndpoint" + http: "#/components/schemas/HTTPNotificationEndpoint" NotificationEndpoints: properties: notificationEndpoints: @@ -9283,12 +9669,12 @@ components: type: string routingKey: type: string - WebhookNotificationEndpoint: + HTTPNotificationEndpoint: type: object allOf: - $ref: "#/components/schemas/NotificationEndpointBase" - type: object - required: [url, authmethod, method] + required: [url, authMethod, method] properties: url: type: string @@ -9301,14 +9687,14 @@ components: method: type: string enum: ['POST', 'GET', 'PUT'] - authmethod: + authMethod: type: string enum: ['none', 'basic', 'bearer'] contentTemplate: type: string NotificationEndpointType: type: string - enum: ['slack', 'pagerduty', 'webhook'] + enum: ['slack', 'pagerduty', 'http'] securitySchemes: BasicAuth: type: http