Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update swagger and API to latest alpha version #77

Merged
merged 9 commits into from
Jan 3, 2020
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 1.4.0 [unreleased]

### API
1. [#77](https://github.com/influxdata/influxdb-client-java/pull/77): Updated swagger to latest version

## 1.3.0 [2019-12-06]

### API
Expand Down
3 changes: 2 additions & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ String query = "from(bucket: \"my-bucket\") "
+ "|> filter(fn: (r) => r._measurement == \"stock\") "
+ "|> filter(fn: (r) => r.company == \"zyz\") "
+ "|> aggregateWindow(every: 5s, fn: mean) "
+ "|> filter(fn: (r) => r._field == \"current\") "
+ "|> yield(name: \"mean\")";

LesserThreshold threshold = new LesserThreshold();
Expand All @@ -781,7 +782,7 @@ String message = "The Stock price for XYZ is on: ${ r._level } level!";

influxDBClient
.getChecksApi()
.createThresholdCheck("XYZ Stock value", query, "current", "5s", message, threshold, org.getId());
.createThresholdCheck("XYZ Stock value", query, "5s", message, threshold, org.getId());
```

##### Create Slack Notification endpoint
Expand Down
6 changes: 6 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
</dependency>

<dependency>
<groupId>com.moandjiezana.toml</groupId>
<artifactId>toml4j</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import java.time.OffsetDateTime;

/**
* the delete predicate request
* The delete predicate request.
*/
@ApiModel(description = "the delete predicate request")
@ApiModel(description = "The delete predicate request.")

public class DeletePredicateRequest {
public static final String SERIALIZED_NAME_START = "start";
Expand All @@ -49,10 +49,10 @@ public DeletePredicateRequest start(OffsetDateTime start) {
}

/**
* RFC3339Nano.
* RFC3339Nano
* @return start
**/
@ApiModelProperty(required = true, value = "RFC3339Nano.")
@ApiModelProperty(required = true, value = "RFC3339Nano")
public OffsetDateTime getStart() {
return start;
}
Expand All @@ -67,10 +67,10 @@ public DeletePredicateRequest stop(OffsetDateTime stop) {
}

/**
* RFC3339Nano.
* RFC3339Nano
* @return stop
**/
@ApiModelProperty(required = true, value = "RFC3339Nano.")
@ApiModelProperty(required = true, value = "RFC3339Nano")
public OffsetDateTime getStop() {
return stop;
}
Expand All @@ -85,10 +85,10 @@ public DeletePredicateRequest predicate(String predicate) {
}

/**
* sql where like delete statement
* InfluxQL-like delete statement
* @return predicate
**/
@ApiModelProperty(example = "tag1=\"value1\" and (tag2=\"value2\" and tag3!=\"value3\")", value = "sql where like delete statement")
@ApiModelProperty(example = "tag1=\"value1\" and (tag2=\"value2\" and tag3!=\"value3\")", value = "InfluxQL-like delete statement")
public String getPredicate() {
return predicate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public SlackNotificationEndpoint url(String url) {
* Specifies the URL of the Slack endpoint. Specify either &#x60;URL&#x60; or &#x60;Token&#x60;.
* @return url
**/
@ApiModelProperty(value = "Specifies the URL of the Slack endpoint. Specify either `URL` or `Token`.")
@ApiModelProperty(required = true, value = "Specifies the URL of the Slack endpoint. Specify either `URL` or `Token`.")
public String getUrl() {
return url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
import com.influxdb.client.domain.Label;
import com.influxdb.client.domain.TelegrafLinks;
import com.influxdb.client.domain.TelegrafRequest;
import com.influxdb.client.domain.TelegrafRequestAgent;
import com.influxdb.client.domain.TelegrafRequestPlugin;
import com.influxdb.client.domain.TelegrafRequestMetadata;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,30 @@
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.influxdb.client.domain.TelegrafPluginInputCpu;
import com.influxdb.client.domain.TelegrafPluginInputDisk;
import com.influxdb.client.domain.TelegrafPluginInputDiskio;
import com.influxdb.client.domain.TelegrafPluginInputDocker;
import com.influxdb.client.domain.TelegrafPluginInputFile;
import com.influxdb.client.domain.TelegrafPluginInputKubernetes;
import com.influxdb.client.domain.TelegrafPluginInputLogParser;
import com.influxdb.client.domain.TelegrafPluginInputProcstat;
import com.influxdb.client.domain.TelegrafPluginInputPrometheus;
import com.influxdb.client.domain.TelegrafPluginInputRedis;
import com.influxdb.client.domain.TelegrafPluginInputSyslog;
import com.influxdb.client.domain.TelegrafPluginOutputFile;
import com.influxdb.client.domain.TelegrafPluginOutputInfluxDBV2;
import com.influxdb.client.domain.TelegrafPluginOutputInfluxDBV2Config;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* TelegrafRequestPlugin
* TelegrafPlugin
*/

public class TelegrafRequestPlugin<T, C> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private T name;

public class TelegrafPlugin {
/**
* Gets or Sets type
*/
@JsonAdapter(TypeEnum.Adapter.class)
public enum TypeEnum {
INPUT("input"),
INPUTS("inputs"),

OUTPUTS("outputs"),

AGGREGATORS("aggregators"),

OUTPUT("output");
PROCESSORS("processors");

private String value;

Expand Down Expand Up @@ -98,11 +87,37 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException {
@SerializedName(SERIALIZED_NAME_TYPE)
private TypeEnum type;

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;

public static final String SERIALIZED_NAME_CONFIG = "config";
@SerializedName(SERIALIZED_NAME_CONFIG)
private C config;
private Map<String, Object> config = new HashMap<>();

public TelegrafPlugin type(TypeEnum type) {
this.type = type;
return this;
}

public TelegrafRequestPlugin name(T name) {
/**
* Get type
* @return type
**/
@ApiModelProperty(value = "")
public TypeEnum getType() {
return type;
}

public void setType(TypeEnum type) {
this.type = type;
}

public TelegrafPlugin name(String name) {
this.name = name;
return this;
}
Expand All @@ -112,47 +127,55 @@ public TelegrafRequestPlugin name(T name) {
* @return name
**/
@ApiModelProperty(value = "")
public T getName() {
public String getName() {
return name;
}

public void setName(T name) {
public void setName(String name) {
this.name = name;
}

public TelegrafRequestPlugin type(TypeEnum type) {
this.type = type;
public TelegrafPlugin description(String description) {
this.description = description;
return this;
}

/**
* Get type
* @return type
* Get description
* @return description
**/
@ApiModelProperty(value = "")
public TypeEnum getType() {
return type;
public String getDescription() {
return description;
}

public void setType(TypeEnum type) {
this.type = type;
public void setDescription(String description) {
this.description = description;
}

public TelegrafRequestPlugin config(C config) {
public TelegrafPlugin config(Map<String, Object> config) {
this.config = config;
return this;
}

public TelegrafPlugin putConfigItem(String key, Object configItem) {
if (this.config == null) {
this.config = new HashMap<>();
}
this.config.put(key, configItem);
return this;
}

/**
* Get config
* @return config
**/
@ApiModelProperty(value = "")
public C getConfig() {
public Map<String, Object> getConfig() {
return config;
}

public void setConfig(C config) {
public void setConfig(Map<String, Object> config) {
this.config = config;
}

Expand All @@ -165,21 +188,26 @@ public boolean equals(java.lang.Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
TelegrafPlugin telegrafPlugin = (TelegrafPlugin) o;
return Objects.equals(this.type, telegrafPlugin.type) &&
Objects.equals(this.name, telegrafPlugin.name) &&
Objects.equals(this.description, telegrafPlugin.description) &&
Objects.equals(this.config, telegrafPlugin.config);
}

@Override
public int hashCode() {
return Objects.hash(name, type, config);
return Objects.hash(type, name, description, config);
}


@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TelegrafRequestPlugin {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("class TelegrafPlugin {\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" config: ").append(toIndentedString(config)).append("\n");
sb.append("}");
return sb.toString();
Expand Down
Loading