diff --git a/.gitignore b/.gitignore index 673c4bfc870..6546e60610b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,7 @@ tree.txt .java-version **nightly** -**/influxd.bolt \ No newline at end of file +**/influxd.bolt + +**/.openapi-generator* +**/swagger2.yml \ No newline at end of file diff --git a/README.md b/README.md index 9aad1b79224..24950b4c913 100644 --- a/README.md +++ b/README.md @@ -252,8 +252,7 @@ import org.influxdata.client.domain.Authorization; import org.influxdata.client.domain.Bucket; import org.influxdata.client.domain.Permission; import org.influxdata.client.domain.PermissionResource; -import org.influxdata.client.domain.ResourceType; -import org.influxdata.client.domain.RetentionRule; +import org.influxdata.client.domain.BucketRetentionRules; public class InfluxDB2ManagementExample { @@ -277,17 +276,17 @@ public class InfluxDB2ManagementExample { PermissionResource resource = new PermissionResource(); resource.setId(bucket.getId()); resource.setOrgID("org_id"); - resource.setType(ResourceType.BUCKETS); + resource.setType(PermissionResource.TypeEnum.BUCKETS); // Read permission Permission read = new Permission(); read.setResource(resource); - read.setAction(Permission.READ_ACTION); + read.setAction(Permission.ActionEnum.READ); // Write permission Permission write = new Permission(); write.setResource(resource); - write.setAction(Permission.WRITE_ACTION); + write.setAction(Permission.ActionEnum.WRITE); Authorization authorization = influxDBClient.getAuthorizationsApi() .createAuthorization("org_id", Arrays.asList(read, write)); diff --git a/client-core/src/main/java/org/influxdata/internal/AbstractRestClient.java b/client-core/src/main/java/org/influxdata/internal/AbstractRestClient.java index 6473235a6cc..c1a517f136b 100644 --- a/client-core/src/main/java/org/influxdata/internal/AbstractRestClient.java +++ b/client-core/src/main/java/org/influxdata/internal/AbstractRestClient.java @@ -74,6 +74,9 @@ protected T execute(@Nonnull final Call call) throws InfluxException { return execute(call, (String) null); } + // + // TODO null catch can be only used for "search" not for getByID + // protected T execute(@Nonnull final Call call, @Nullable final String nullError) throws InfluxException { return execute(call, nullError, null, null); } diff --git a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/InfluxDBClientKotlin.kt b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/InfluxDBClientKotlin.kt index f8e9e8bfa18..92cc19cf011 100644 --- a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/InfluxDBClientKotlin.kt +++ b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/InfluxDBClientKotlin.kt @@ -22,7 +22,7 @@ package org.influxdata.client.kotlin import org.influxdata.LogLevel -import org.influxdata.client.domain.Health +import org.influxdata.client.domain.Check /** * The reference Kotlin client that allows query and write for the InfluxDB 2.0 by Kotlin Channel coroutines. @@ -43,7 +43,7 @@ interface InfluxDBClientKotlin { * * @return health of an instance */ - fun health(): Health + fun health(): Check /** * Gets the [LogLevel] that is used for logging requests and responses. diff --git a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/QueryKotlinApi.kt b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/QueryKotlinApi.kt index bd7dfb13e57..86a44560f47 100644 --- a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/QueryKotlinApi.kt +++ b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/QueryKotlinApi.kt @@ -23,6 +23,8 @@ package org.influxdata.client.kotlin import kotlinx.coroutines.channels.Channel +import org.influxdata.client.domain.Dialect +import org.influxdata.client.domain.Query import org.influxdata.query.FluxRecord /** @@ -41,6 +43,15 @@ interface QueryKotlinApi { */ fun query(query: String, orgID: String): Channel + /** + * Executes the Flux query against the InfluxDB and asynchronously stream [FluxRecord]s to [Channel]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @return the stream of [FluxRecord]s + */ + fun query(query: Query, orgID: String): Channel + /** * Executes the Flux query against the InfluxDB and asynchronously stream measurements to [Channel]. * @@ -51,6 +62,16 @@ interface QueryKotlinApi { */ fun query(query: String, orgID: String, measurementType: Class): Channel + /** + * Executes the Flux query against the InfluxDB and asynchronously stream measurements to [Channel]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @param the type of the measurement (POJO) + * @return the stream of measurements + */ + fun query(query: Query, orgID: String, measurementType: Class): Channel + /** * Executes the Flux query against the InfluxDB and asynchronously stream response to [Channel]. * @@ -69,6 +90,15 @@ interface QueryKotlinApi { * [See dialect SPEC](http://bit.ly/flux-dialect). * @return the response stream */ - fun queryRaw(query: String, dialect: String, orgID: String): Channel + fun queryRaw(query: String, dialect: Dialect, orgID: String): Channel + + /** + * Executes the Flux query against the InfluxDB and asynchronously stream response to [Channel]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @return the response stream + */ + fun queryRaw(query: Query, orgID: String): Channel } \ No newline at end of file diff --git a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/InfluxDBClientKotlinImpl.kt b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/InfluxDBClientKotlinImpl.kt index 50dd0e82e33..ec8bd43e832 100644 --- a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/InfluxDBClientKotlinImpl.kt +++ b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/InfluxDBClientKotlinImpl.kt @@ -23,23 +23,23 @@ package org.influxdata.client.kotlin.internal import org.influxdata.LogLevel import org.influxdata.client.InfluxDBClientOptions -import org.influxdata.client.domain.Health +import org.influxdata.client.domain.Check import org.influxdata.client.internal.AbstractInfluxDBClient -import org.influxdata.client.internal.InfluxDBService import org.influxdata.client.kotlin.InfluxDBClientKotlin import org.influxdata.client.kotlin.QueryKotlinApi +import org.influxdata.client.service.QueryService /** * @author Jakub Bednar (bednar@github) (07/02/2019 13:21) */ -internal class InfluxDBClientKotlinImpl(options: InfluxDBClientOptions) : AbstractInfluxDBClient(options, InfluxDBService::class.java), InfluxDBClientKotlin { +internal class InfluxDBClientKotlinImpl(options: InfluxDBClientOptions) : AbstractInfluxDBClient(options), InfluxDBClientKotlin { override fun getQueryKotlinApi(): QueryKotlinApi { - return QueryKotlinApiImpl(influxDBService) + return QueryKotlinApiImpl(retrofit.create(QueryService::class.java)) } - override fun health(): Health { - return health(influxDBService.health()) + override fun health(): Check { + return health(healthService.healthGet(null)) } override fun getLogLevel(): LogLevel { diff --git a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/QueryKotlinApiImpl.kt b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/QueryKotlinApiImpl.kt index 91c37b3c84f..0098fd18d4c 100644 --- a/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/QueryKotlinApiImpl.kt +++ b/client-kotlin/src/main/kotlin/org/influxdata/client/kotlin/internal/QueryKotlinApiImpl.kt @@ -25,8 +25,11 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.runBlocking import org.influxdata.Arguments import org.influxdata.Cancellable -import org.influxdata.client.internal.InfluxDBService +import org.influxdata.client.domain.Dialect +import org.influxdata.client.domain.Query +import org.influxdata.client.internal.AbstractInfluxDBClient import org.influxdata.client.kotlin.QueryKotlinApi +import org.influxdata.client.service.QueryService import org.influxdata.internal.AbstractQueryApi import org.influxdata.query.FluxRecord import org.influxdata.query.FluxTable @@ -37,20 +40,28 @@ import java.util.function.Consumer /** * @author Jakub Bednar (bednar@github) (30/10/2018 08:51) */ -internal class QueryKotlinApiImpl(private val influxDBService: InfluxDBService) : AbstractQueryApi(), QueryKotlinApi { +internal class QueryKotlinApiImpl(private val service: QueryService) : AbstractQueryApi(), QueryKotlinApi { override fun query(query: String, orgID: String): Channel { Arguments.checkNonEmpty(query, "query") Arguments.checkNonEmpty(orgID, "orgID") + return query(Query().dialect(AbstractInfluxDBClient.DEFAULT_DIALECT).query(query), orgID) + } + + override fun query(query: Query, orgID: String): Channel { + + Arguments.checkNotNull(query, "query") + Arguments.checkNonEmpty(orgID, "orgID") + val consumer = BiConsumer { channel: Channel, record: FluxRecord -> runBlocking { channel.send(record) } } - return query(query, AbstractQueryApi.DEFAULT_DIALECT.toString(), orgID, consumer) + return query(query, orgID, consumer) } override fun query(query: String, orgID: String, measurementType: Class): Channel { @@ -65,7 +76,22 @@ internal class QueryKotlinApiImpl(private val influxDBService: InfluxDBService) } } - return query(query, AbstractQueryApi.DEFAULT_DIALECT.toString(), orgID, consumer) + return query(Query().dialect(AbstractInfluxDBClient.DEFAULT_DIALECT).query(query), orgID, consumer) + } + + override fun query(query: Query, orgID: String, measurementType: Class): Channel { + + Arguments.checkNotNull(query, "query") + Arguments.checkNonEmpty(orgID, "orgID") + Arguments.checkNotNull(measurementType, "measurementType") + + val consumer = BiConsumer { channel: Channel, record: FluxRecord -> + runBlocking { + channel.send(resultMapper.toPOJO(record, measurementType)) + } + } + + return query(query, orgID, consumer) } override fun queryRaw(query: String, orgID: String): Channel { @@ -73,17 +99,26 @@ internal class QueryKotlinApiImpl(private val influxDBService: InfluxDBService) Arguments.checkNonEmpty(query, "query") Arguments.checkNonEmpty(orgID, "orgID") - return queryRaw(query, AbstractQueryApi.DEFAULT_DIALECT.toString(), orgID) + return queryRaw(query, AbstractInfluxDBClient.DEFAULT_DIALECT, orgID) } - override fun queryRaw(query: String, dialect: String, orgID: String): Channel { + override fun queryRaw(query: String, dialect: Dialect, orgID: String): Channel { Arguments.checkNonEmpty(query, "query") Arguments.checkNonEmpty(orgID, "orgID") - val channel = Channel() + return queryRaw(Query().dialect(dialect).query(query), orgID) + } + + override fun queryRaw(query: Query, orgID: String): Channel { + + Arguments.checkNotNull(query, "query") + Arguments.checkNonEmpty(orgID, "orgID") + + val channel = Channel() - val queryCall = influxDBService.query(orgID, createBody(dialect, query)) + val queryCall = service.queryPostResponseBody(null, "text/csv", "application/json", + null, orgID, query) val consumer = BiConsumer { cancellable: Cancellable, line: String -> @@ -99,17 +134,18 @@ internal class QueryKotlinApiImpl(private val influxDBService: InfluxDBService) queryRaw(queryCall, consumer, Consumer { channel.close(it) }, Runnable { channel.close() }, true) return channel + } - private fun query(query: String, dialect: String, orgID: String, consumer: BiConsumer, FluxRecord>): Channel { + private fun query(query: Query, orgID: String, consumer: BiConsumer, FluxRecord>): Channel { - Arguments.checkNonEmpty(query, "query") + Arguments.checkNotNull(query, "query") Arguments.checkNonEmpty(orgID, "orgID") - Arguments.checkNonEmpty(dialect, "dialect") val channel = Channel() - val queryCall = influxDBService.query(orgID, createBody(dialect, query)) + val queryCall = service.queryPostResponseBody(null, "text/csv", "application/json", + null, orgID, query) val responseConsumer = object : FluxResponseConsumer { diff --git a/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITInfluxDBClientKotlin.kt b/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITInfluxDBClientKotlin.kt index e767f4128de..433e1fd9915 100644 --- a/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITInfluxDBClientKotlin.kt +++ b/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITInfluxDBClientKotlin.kt @@ -23,6 +23,7 @@ package org.influxdata.client.kotlin import org.assertj.core.api.Assertions import org.influxdata.LogLevel +import org.influxdata.client.domain.Check import org.junit.jupiter.api.Test import org.junit.platform.runner.JUnitPlatform import org.junit.runner.RunWith @@ -46,7 +47,7 @@ internal class ITInfluxDBClientKotlin : AbstractITInfluxDBClientKotlin() { val health = influxDBClient.health() Assertions.assertThat(health).isNotNull - Assertions.assertThat(health.isHealthy).isTrue() + Assertions.assertThat(health.status).isEqualTo(Check.StatusEnum.PASS) Assertions.assertThat(health.message).isEqualTo("ready for queries and writes") } @@ -59,7 +60,7 @@ internal class ITInfluxDBClientKotlin : AbstractITInfluxDBClientKotlin() { val health = clientNotRunning.health() Assertions.assertThat(health).isNotNull - Assertions.assertThat(health.isHealthy).isFalse() + Assertions.assertThat(health.status).isEqualTo(Check.StatusEnum.FAIL) Assertions.assertThat(health.message).startsWith("Failed to connect to") clientNotRunning.close() diff --git a/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITQueryKotlinApi.kt b/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITQueryKotlinApi.kt index 64465a9fd09..b1d942d6b00 100644 --- a/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITQueryKotlinApi.kt +++ b/client-kotlin/src/test/kotlin/org/influxdata/client/kotlin/ITQueryKotlinApi.kt @@ -35,19 +35,18 @@ import kotlinx.coroutines.runBlocking import org.influxdata.annotations.Column import org.influxdata.client.InfluxDBClientFactory import org.influxdata.client.domain.Bucket +import org.influxdata.client.domain.BucketRetentionRules +import org.influxdata.client.domain.Dialect import org.influxdata.client.domain.Organization import org.influxdata.client.domain.Permission import org.influxdata.client.domain.PermissionResource -import org.influxdata.client.domain.ResourceType -import org.influxdata.client.domain.RetentionRule -import org.json.JSONObject +import org.influxdata.client.domain.WritePrecision import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.platform.runner.JUnitPlatform import org.junit.runner.RunWith import java.net.ConnectException import java.time.Instant -import java.time.temporal.ChronoUnit import java.util.* /** @@ -72,9 +71,9 @@ internal class ITQueryKotlinApi : AbstractITInfluxDBClientKotlin() { .findFirst() .orElseThrow { IllegalStateException() } - val retentionRule = RetentionRule() - retentionRule.type = "expire" - retentionRule.everySeconds = 3600L + val retentionRule = BucketRetentionRules() + retentionRule.type = BucketRetentionRules.TypeEnum.EXPIRE + retentionRule.everySeconds = 3600 bucket = client.bucketsApi .createBucket(generateName("h2o"), retentionRule, organization) @@ -85,16 +84,16 @@ internal class ITQueryKotlinApi : AbstractITInfluxDBClientKotlin() { val resource = PermissionResource() resource.orgID = organization.id - resource.type = ResourceType.BUCKETS + resource.type = PermissionResource.TypeEnum.BUCKETS resource.id = bucket.id val readBucket = Permission() readBucket.resource = resource - readBucket.action = Permission.READ_ACTION + readBucket.action = Permission.ActionEnum.READ val writeBucket = Permission() writeBucket.resource = resource - writeBucket.action = Permission.WRITE_ACTION + writeBucket.action = Permission.ActionEnum.WRITE val authorization = client.authorizationsApi .createAuthorization(organization, Arrays.asList(readBucket, writeBucket)) @@ -111,7 +110,7 @@ internal class ITQueryKotlinApi : AbstractITInfluxDBClientKotlin() { .joinToString("\n") val writeApi = client.writeApi - writeApi.writeRecord(bucket.name, organization.id, ChronoUnit.NANOS, records) + writeApi.writeRecord(bucket.name, organization.id, WritePrecision.NS, records) writeApi.close() client.close() @@ -146,7 +145,7 @@ internal class ITQueryKotlinApi : AbstractITInfluxDBClientKotlin() { val values = records.map { it.value }.toList() assert(values).hasSize(10) - assert(values).containsExactly(10L, 11L, 20L, 22L, 35L, 38L, 55L, 45L, 49L, 65L) + assert(values).containsExactly(55L, 65L, 35L, 38L, 45L, 49L, 10L, 11L, 20L, 22L) } @Test @@ -228,9 +227,7 @@ internal class ITQueryKotlinApi : AbstractITInfluxDBClientKotlin() { "|> filter(fn: (r) => (r[\"_measurement\"] == \"mem\" and r[\"_field\"] == \"free\"))\t" + "|> sum()" - val dialect = JSONObject() - .put("header", false) - .toString() + val dialect = Dialect().header(false) val lines = queryKotlinApi.queryRaw(flux, dialect, organization.id).toList() diff --git a/client-reactive/src/main/java/org/influxdata/client/reactive/InfluxDBClientReactive.java b/client-reactive/src/main/java/org/influxdata/client/reactive/InfluxDBClientReactive.java index c00500f7cef..22230e4a24c 100644 --- a/client-reactive/src/main/java/org/influxdata/client/reactive/InfluxDBClientReactive.java +++ b/client-reactive/src/main/java/org/influxdata/client/reactive/InfluxDBClientReactive.java @@ -26,7 +26,7 @@ import org.influxdata.LogLevel; import org.influxdata.client.InfluxDBClient; import org.influxdata.client.WriteOptions; -import org.influxdata.client.domain.Health; +import org.influxdata.client.domain.Check; import io.reactivex.Single; @@ -68,7 +68,7 @@ public interface InfluxDBClientReactive extends AutoCloseable { * @return health of an instance */ @Nonnull - Single health(); + Single health(); /** * @return the {@link LogLevel} that is used for logging requests and responses diff --git a/client-reactive/src/main/java/org/influxdata/client/reactive/QueryReactiveApi.java b/client-reactive/src/main/java/org/influxdata/client/reactive/QueryReactiveApi.java index 65c9d87683f..e1f7bc1f75a 100644 --- a/client-reactive/src/main/java/org/influxdata/client/reactive/QueryReactiveApi.java +++ b/client-reactive/src/main/java/org/influxdata/client/reactive/QueryReactiveApi.java @@ -24,6 +24,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.influxdata.client.domain.Dialect; import org.influxdata.query.FluxRecord; import io.reactivex.Flowable; @@ -119,7 +120,7 @@ Flowable query(@Nonnull final Publisher queryStream, */ @Nonnull Flowable queryRaw(@Nonnull final String query, - @Nullable final String dialect, + @Nullable final Dialect dialect, @Nonnull final String orgID); /** @@ -133,6 +134,6 @@ Flowable queryRaw(@Nonnull final String query, */ @Nonnull Flowable queryRaw(@Nonnull final Publisher queryStream, - @Nullable final String dialect, + @Nullable final Dialect dialect, @Nonnull final String orgID); } \ No newline at end of file diff --git a/client-reactive/src/main/java/org/influxdata/client/reactive/WriteReactiveApi.java b/client-reactive/src/main/java/org/influxdata/client/reactive/WriteReactiveApi.java index f7bec7551fd..e41c456d51d 100644 --- a/client-reactive/src/main/java/org/influxdata/client/reactive/WriteReactiveApi.java +++ b/client-reactive/src/main/java/org/influxdata/client/reactive/WriteReactiveApi.java @@ -21,11 +21,10 @@ */ package org.influxdata.client.reactive; -import java.time.temporal.ChronoUnit; -import java.util.concurrent.TimeUnit; import javax.annotation.Nonnull; import org.influxdata.client.WriteApi; +import org.influxdata.client.domain.WritePrecision; import org.influxdata.client.write.Point; import org.influxdata.client.write.events.AbstractWriteEvent; import org.influxdata.client.write.events.BackpressureEvent; @@ -52,16 +51,13 @@ public interface WriteReactiveApi extends AutoCloseable { * * @param bucket specifies the destination bucket for writes * @param orgID specifies the destination organization for writes - * @param precision specifies the precision for the unix timestamps within the body line-protocol. - * Available values : {@link ChronoUnit#NANOS}, {@link ChronoUnit#MICROS}, - * {@link ChronoUnit#MILLIS}, {@link ChronoUnit#SECONDS}. - * Default value : {@link TimeUnit#NANOSECONDS}. + * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param record specifies the record in InfluxDB Line Protocol. * The {@code record} is considered as one batch unit. */ void writeRecord(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Maybe record); @@ -70,15 +66,12 @@ void writeRecord(@Nonnull final String bucket, * * @param bucket specifies the destination bucket for writes * @param orgID specifies the destination organization for writes - * @param precision specifies the precision for the unix timestamps within the body line-protocol. - * Available values : {@link ChronoUnit#NANOS}, {@link ChronoUnit#MICROS}, - * {@link ChronoUnit#MILLIS}, {@link ChronoUnit#SECONDS}. - * Default value : {@link TimeUnit#NANOSECONDS}. + * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param records specifies the records in InfluxDB Line Protocol */ void writeRecords(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Flowable records); /** @@ -86,15 +79,12 @@ void writeRecords(@Nonnull final String bucket, * * @param bucket specifies the destination bucket for writes * @param orgID specifies the destination organization for writes - * @param precision specifies the precision for the unix timestamps within the body line-protocol. - * Available values : {@link ChronoUnit#NANOS}, {@link ChronoUnit#MICROS}, - * {@link ChronoUnit#MILLIS}, {@link ChronoUnit#SECONDS}. - * Default value : {@link TimeUnit#NANOSECONDS}. + * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param records specifies the records in InfluxDB Line Protocol */ void writeRecords(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Publisher records); /** @@ -137,16 +127,13 @@ void writePoints(@Nonnull final String bucket, * * @param bucket specifies the destination bucket for writes * @param orgID specifies the destination organization for writes - * @param precision specifies the precision for the unix timestamps within the body line-protocol. - * Available values : {@link ChronoUnit#NANOS}, {@link ChronoUnit#MICROS}, - * {@link ChronoUnit#MILLIS}, {@link ChronoUnit#SECONDS}. - * Default value : {@link TimeUnit#NANOSECONDS}. + * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param measurement specifies the Measurement to write into bucket * @param type of measurement */ void writeMeasurement(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Maybe measurement); @@ -155,16 +142,13 @@ void writeMeasurement(@Nonnull final String bucket, * * @param bucket specifies the destination bucket for writes * @param orgID specifies the destination organization for writes - * @param precision specifies the precision for the unix timestamps within the body line-protocol. - * Available values : {@link ChronoUnit#NANOS}, {@link ChronoUnit#MICROS}, - * {@link ChronoUnit#MILLIS}, {@link ChronoUnit#SECONDS}. - * Default value : {@link TimeUnit#NANOSECONDS}. + * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param measurements specifies the Measurements to write into bucket * @param type of measurement */ void writeMeasurements(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Flowable measurements); /** @@ -172,16 +156,13 @@ void writeMeasurements(@Nonnull final String bucket, * * @param bucket specifies the destination bucket for writes * @param orgID specifies the destination organization for writes - * @param precision specifies the precision for the unix timestamps within the body line-protocol. - * Available values : {@link ChronoUnit#NANOS}, {@link ChronoUnit#MICROS}, - * {@link ChronoUnit#MILLIS}, {@link ChronoUnit#SECONDS}. - * Default value : {@link TimeUnit#NANOSECONDS}. + * @param precision specifies the precision for the unix timestamps within the body line-protocol (optional) * @param measurements specifies the Measurements to write into bucket * @param type of measurement */ void writeMeasurements(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Publisher measurements); /** diff --git a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/InfluxDBClientReactiveImpl.java b/client-reactive/src/main/java/org/influxdata/client/reactive/internal/InfluxDBClientReactiveImpl.java index 73328bae2fe..d89e27734bf 100644 --- a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/InfluxDBClientReactiveImpl.java +++ b/client-reactive/src/main/java/org/influxdata/client/reactive/internal/InfluxDBClientReactiveImpl.java @@ -27,31 +27,32 @@ import org.influxdata.LogLevel; import org.influxdata.client.InfluxDBClientOptions; import org.influxdata.client.WriteOptions; -import org.influxdata.client.domain.Health; +import org.influxdata.client.domain.Check; import org.influxdata.client.internal.AbstractInfluxDBClient; import org.influxdata.client.reactive.InfluxDBClientReactive; import org.influxdata.client.reactive.QueryReactiveApi; import org.influxdata.client.reactive.WriteReactiveApi; +import org.influxdata.client.service.QueryService; +import org.influxdata.client.service.WriteService; import io.reactivex.Single; /** * @author Jakub Bednar (bednar@github) (20/11/2018 07:12) */ -public class InfluxDBClientReactiveImpl extends AbstractInfluxDBClient +public class InfluxDBClientReactiveImpl extends AbstractInfluxDBClient implements InfluxDBClientReactive { public InfluxDBClientReactiveImpl(@Nonnull final InfluxDBClientOptions options) { - super(options, InfluxDBReactiveService.class); + super(options); } @Nonnull @Override public QueryReactiveApi getQueryReactiveApi() { - return new QueryReactiveApiImpl(influxDBService); + return new QueryReactiveApiImpl(retrofit.create(QueryService.class)); } - @Nonnull @Override public WriteReactiveApi getWriteReactiveApi() { @@ -64,14 +65,14 @@ public WriteReactiveApi getWriteReactiveApi(@Nonnull final WriteOptions writeOpt Arguments.checkNotNull(writeOptions, "WriteOptions"); - return new WriteReactiveApiImpl(writeOptions, influxDBService); + return new WriteReactiveApiImpl(writeOptions, retrofit.create(WriteService.class)); } @Nonnull @Override - public Single health() { + public Single health() { - return Single.fromCallable(() -> health(influxDBService.health())); + return Single.fromCallable(() -> health(healthService.healthGet(null))); } @Nonnull diff --git a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/InfluxDBReactiveService.java b/client-reactive/src/main/java/org/influxdata/client/reactive/internal/InfluxDBReactiveService.java deleted file mode 100644 index 2767e865653..00000000000 --- a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/InfluxDBReactiveService.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.influxdata.client.reactive.internal; - -import javax.annotation.Nonnull; - -import org.influxdata.client.domain.Health; - -import io.reactivex.Maybe; -import okhttp3.RequestBody; -import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.POST; -import retrofit2.http.Query; -import retrofit2.http.Streaming; - -/** - * @author Jakub Bednar (bednar@github) (20/11/2018 07:19) - */ -interface InfluxDBReactiveService { - - // - // Health - // - @GET("/health") - @Nonnull - @Headers("Content-Type: application/json") - Call health(); - - // - // Query - // - @Streaming - @POST("/api/v2/query") - @Nonnull - @Headers("Content-Type: application/json") - Call query(@Query("orgID") final String orgID, @Nonnull @Body final RequestBody query); - - - // Write - // - @POST("/api/v2/write") - @Nonnull - Maybe> writePoints(@Query("org") final String orgID, - @Query("bucket") final String bucket, - @Query("precision") final String precision, - @Body final RequestBody points); -} \ No newline at end of file diff --git a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/QueryReactiveApiImpl.java b/client-reactive/src/main/java/org/influxdata/client/reactive/internal/QueryReactiveApiImpl.java index 0819f7961cb..17004982845 100644 --- a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/QueryReactiveApiImpl.java +++ b/client-reactive/src/main/java/org/influxdata/client/reactive/internal/QueryReactiveApiImpl.java @@ -27,7 +27,11 @@ import org.influxdata.Arguments; import org.influxdata.Cancellable; +import org.influxdata.client.domain.Dialect; +import org.influxdata.client.domain.Query; +import org.influxdata.client.internal.AbstractInfluxDBClient; import org.influxdata.client.reactive.QueryReactiveApi; +import org.influxdata.client.service.QueryService; import org.influxdata.internal.AbstractQueryApi; import org.influxdata.query.FluxRecord; import org.influxdata.query.FluxTable; @@ -43,13 +47,13 @@ */ final class QueryReactiveApiImpl extends AbstractQueryApi implements QueryReactiveApi { - private final InfluxDBReactiveService influxDBService; + private final QueryService service; - QueryReactiveApiImpl(@Nonnull final InfluxDBReactiveService influxDBService) { + QueryReactiveApiImpl(@Nonnull final QueryService service) { - Arguments.checkNotNull(influxDBService, "InfluxDBReactiveService"); + Arguments.checkNotNull(service, "InfluxDBReactiveService"); - this.influxDBService = influxDBService; + this.service = service; } @Nonnull @@ -84,7 +88,8 @@ public Flowable query(@Nonnull final Publisher queryStream, return Flowable .fromPublisher(queryStream) - .map(it -> influxDBService.query(orgID, createBody(DEFAULT_DIALECT.toString(), it))) + .map(it -> service.queryPostResponseBody(null, "text/csv", "application/json", + null, orgID, new Query().query(it).dialect(AbstractInfluxDBClient.DEFAULT_DIALECT))) .flatMap(queryCall -> { Observable observable = Observable.create(subscriber -> { @@ -149,13 +154,13 @@ public Flowable queryRaw(@Nonnull final Publisher queryStream, Arguments.checkNotNull(queryStream, "queryStream"); Arguments.checkNonEmpty(orgID, "orgID"); - return queryRaw(queryStream, DEFAULT_DIALECT.toString(), orgID); + return queryRaw(queryStream, AbstractInfluxDBClient.DEFAULT_DIALECT, orgID); } @Nonnull @Override public Flowable queryRaw(@Nonnull final String query, - @Nullable final String dialect, + @Nullable final Dialect dialect, @Nonnull final String orgID) { Arguments.checkNonEmpty(query, "Flux query"); @@ -167,7 +172,7 @@ public Flowable queryRaw(@Nonnull final String query, @Nonnull @Override public Flowable queryRaw(@Nonnull final Publisher queryStream, - @Nullable final String dialect, + @Nullable final Dialect dialect, @Nonnull final String orgID) { Arguments.checkNotNull(queryStream, "queryStream"); @@ -175,7 +180,8 @@ public Flowable queryRaw(@Nonnull final Publisher queryStream, return Flowable .fromPublisher(queryStream) - .map(it -> influxDBService.query(orgID, createBody(dialect, it))) + .map(it -> service.queryPostResponseBody(null, "text/csv", "application/json", + null, orgID, new Query().query(it).dialect(dialect))) .flatMap(queryCall -> { Observable observable = Observable.create(subscriber -> { diff --git a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/WriteReactiveApiImpl.java b/client-reactive/src/main/java/org/influxdata/client/reactive/internal/WriteReactiveApiImpl.java index d5472376ef0..9f40f0ec084 100644 --- a/client-reactive/src/main/java/org/influxdata/client/reactive/internal/WriteReactiveApiImpl.java +++ b/client-reactive/src/main/java/org/influxdata/client/reactive/internal/WriteReactiveApiImpl.java @@ -21,43 +21,38 @@ */ package org.influxdata.client.reactive.internal; -import java.time.temporal.ChronoUnit; import java.util.Objects; import javax.annotation.Nonnull; import org.influxdata.Arguments; import org.influxdata.client.WriteOptions; +import org.influxdata.client.domain.WritePrecision; import org.influxdata.client.internal.AbstractWriteClient; import org.influxdata.client.reactive.WriteReactiveApi; +import org.influxdata.client.service.WriteService; import org.influxdata.client.write.Point; import org.influxdata.client.write.events.AbstractWriteEvent; import io.reactivex.Flowable; import io.reactivex.Maybe; import io.reactivex.Observable; -import okhttp3.RequestBody; import org.reactivestreams.Publisher; -import retrofit2.Response; /** * @author Jakub Bednar (bednar@github) (22/11/2018 06:50) */ public class WriteReactiveApiImpl extends AbstractWriteClient implements WriteReactiveApi { - private final InfluxDBReactiveService influxDBService; - WriteReactiveApiImpl(@Nonnull final WriteOptions writeOptions, - @Nonnull final InfluxDBReactiveService influxDBService) { - - super(writeOptions, writeOptions.getWriteScheduler()); + @Nonnull final WriteService service) { - this.influxDBService = influxDBService; + super(writeOptions, writeOptions.getWriteScheduler(), service); } @Override public void writeRecord(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Maybe record) { Arguments.checkNonEmpty(bucket, "bucket"); @@ -71,7 +66,7 @@ public void writeRecord(@Nonnull final String bucket, @Override public void writeRecords(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Flowable records) { Arguments.checkNonEmpty(bucket, "bucket"); @@ -87,7 +82,7 @@ public void writeRecords(@Nonnull final String bucket, @Override public void writeRecords(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Publisher records) { Arguments.checkNonEmpty(bucket, "bucket"); @@ -139,7 +134,7 @@ public void writePoints(@Nonnull final String bucket, @Override public void writeMeasurement(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Maybe measurement) { Arguments.checkNonEmpty(bucket, "bucket"); @@ -153,7 +148,7 @@ public void writeMeasurement(@Nonnull final String bucket, @Override public void writeMeasurements(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Flowable measurements) { Arguments.checkNonEmpty(bucket, "bucket"); @@ -169,7 +164,7 @@ public void writeMeasurements(@Nonnull final String bucket, @Override public void writeMeasurements(@Nonnull final String bucket, @Nonnull final String orgID, - @Nonnull final ChronoUnit precision, + @Nonnull final WritePrecision precision, @Nonnull final Publisher measurements) { Arguments.checkNonEmpty(bucket, "bucket"); @@ -190,13 +185,4 @@ public Observable listenEvents(@Nonnull final public void close() { super.close(); } - - @Override - public Maybe> writeCall(final RequestBody requestBody, - final String organization, - final String bucket, - final String precision) { - - return influxDBService.writePoints(organization, bucket, precision, requestBody); - } } \ No newline at end of file diff --git a/client-reactive/src/test/java/org/influxdata/client/reactive/ITInfluxDBReactiveClient.java b/client-reactive/src/test/java/org/influxdata/client/reactive/ITInfluxDBReactiveClient.java index ad1191bd1ae..7a9d41bf7db 100644 --- a/client-reactive/src/test/java/org/influxdata/client/reactive/ITInfluxDBReactiveClient.java +++ b/client-reactive/src/test/java/org/influxdata/client/reactive/ITInfluxDBReactiveClient.java @@ -22,7 +22,7 @@ package org.influxdata.client.reactive; import org.influxdata.LogLevel; -import org.influxdata.client.domain.Health; +import org.influxdata.client.domain.Check; import io.reactivex.Single; import org.assertj.core.api.Assertions; @@ -51,15 +51,15 @@ void writeClient() { @Test void health() { - Single health = influxDBClient.health(); + Single check = influxDBClient.health(); - health + check .test() .assertNoErrors() .assertValue(it -> { Assertions.assertThat(it).isNotNull(); - Assertions.assertThat(it.isHealthy()).isTrue(); + Assertions.assertThat(it.getStatus()).isEqualTo(Check.StatusEnum.PASS); Assertions.assertThat(it.getMessage()).isEqualTo("ready for queries and writes"); return true; @@ -70,7 +70,7 @@ void health() { void healthNotRunningInstance() throws Exception { InfluxDBClientReactive clientNotRunning = InfluxDBClientReactiveFactory.create("http://localhost:8099"); - Single health = clientNotRunning.health(); + Single health = clientNotRunning.health(); health .test() @@ -78,7 +78,7 @@ void healthNotRunningInstance() throws Exception { .assertValue(it -> { Assertions.assertThat(it).isNotNull(); - Assertions.assertThat(it.isHealthy()).isFalse(); + Assertions.assertThat(it.getStatus()).isEqualTo(Check.StatusEnum.FAIL); Assertions.assertThat(it.getMessage()).startsWith("Failed to connect to"); return true; diff --git a/client-reactive/src/test/java/org/influxdata/client/reactive/ITWriteQueryReactiveApiTest.java b/client-reactive/src/test/java/org/influxdata/client/reactive/ITWriteQueryReactiveApiTest.java index a8478150618..80161d1455f 100644 --- a/client-reactive/src/test/java/org/influxdata/client/reactive/ITWriteQueryReactiveApiTest.java +++ b/client-reactive/src/test/java/org/influxdata/client/reactive/ITWriteQueryReactiveApiTest.java @@ -22,7 +22,6 @@ package org.influxdata.client.reactive; import java.time.Instant; -import java.time.temporal.ChronoUnit; import java.util.Arrays; import java.util.concurrent.CountDownLatch; @@ -33,11 +32,11 @@ import org.influxdata.client.WriteOptions; import org.influxdata.client.domain.Authorization; import org.influxdata.client.domain.Bucket; +import org.influxdata.client.domain.BucketRetentionRules; import org.influxdata.client.domain.Permission; import org.influxdata.client.domain.PermissionResource; -import org.influxdata.client.domain.ResourceType; -import org.influxdata.client.domain.RetentionRule; import org.influxdata.client.domain.User; +import org.influxdata.client.domain.WritePrecision; import org.influxdata.client.write.Point; import org.influxdata.client.write.events.WriteSuccessEvent; import org.influxdata.query.FluxRecord; @@ -71,12 +70,12 @@ void setUp() throws Exception { InfluxDBClient client = InfluxDBClientFactory.create(influxDB_URL, "my-user", "my-password".toCharArray()); - RetentionRule retentionRule = new RetentionRule(); - retentionRule.setType("expire"); - retentionRule.setEverySeconds(3600L); + BucketRetentionRules bucketRetentionRules = new BucketRetentionRules(); + bucketRetentionRules.setType(BucketRetentionRules.TypeEnum.EXPIRE); + bucketRetentionRules.setEverySeconds(3600); bucket = client.getBucketsApi() - .createBucket(generateName("h2o"), retentionRule, organization); + .createBucket(generateName("h2o"), bucketRetentionRules, organization); // // Add Permissions to read and write to the Bucket @@ -84,16 +83,16 @@ void setUp() throws Exception { PermissionResource resource = new PermissionResource(); resource.setOrgID(organization.getId()); - resource.setType(ResourceType.BUCKETS); + resource.setType(PermissionResource.TypeEnum.BUCKETS); resource.setId(bucket.getId()); Permission readBucket = new Permission(); readBucket.setResource(resource); - readBucket.setAction(Permission.READ_ACTION); + readBucket.setAction(Permission.ActionEnum.READ); Permission writeBucket = new Permission(); writeBucket.setResource(resource); - writeBucket.setAction(Permission.WRITE_ACTION); + writeBucket.setAction(Permission.ActionEnum.WRITE); User loggedUser = client.getUsersApi().me(); Assertions.assertThat(loggedUser).isNotNull(); @@ -142,7 +141,7 @@ void writeRecord() { countDownLatch.countDown(); }); - writeClient.writeRecord(bucketName, organization.getId(), ChronoUnit.NANOS, record); + writeClient.writeRecord(bucketName, organization.getId(), WritePrecision.NS, record); waitToCallback(); @@ -166,7 +165,7 @@ void writeRecordEmpty() { writeClient = influxDBClient.getWriteReactiveApi(); - writeClient.writeRecord(bucket.getName(), organization.getId(), ChronoUnit.SECONDS, Maybe.empty()); + writeClient.writeRecord(bucket.getName(), organization.getId(), WritePrecision.S, Maybe.empty()); } @Test @@ -184,7 +183,7 @@ void writeRecords() { .listenEvents(WriteSuccessEvent.class) .subscribe(event -> countDownLatch.countDown()); - writeClient.writeRecords(bucket.getName(), organization.getId(), ChronoUnit.SECONDS, records); + writeClient.writeRecords(bucket.getName(), organization.getId(), WritePrecision.S, records); waitToCallback(); @@ -218,7 +217,7 @@ void writePoint() { writeClient = influxDBClient.getWriteReactiveApi(); Instant time = Instant.ofEpochSecond(1000); - Point point = Point.measurement("h2o_feet").addTag("location", "south").addField("water_level", 1).time(time, ChronoUnit.MILLIS); + Point point = Point.measurement("h2o_feet").addTag("location", "south").addField("water_level", 1).time(time, WritePrecision.MS); writeClient .listenEvents(WriteSuccessEvent.class) @@ -251,8 +250,8 @@ void writePoints() { Instant time = Instant.ofEpochSecond(2000); - Point point1 = Point.measurement("h2o_feet").addTag("location", "west").addField("water_level", 1).time(time, ChronoUnit.MILLIS); - Point point2 = Point.measurement("h2o_feet").addTag("location", "west").addField("water_level", 2).time(time.plusSeconds(10), ChronoUnit.SECONDS); + Point point1 = Point.measurement("h2o_feet").addTag("location", "west").addField("water_level", 1).time(time, WritePrecision.MS); + Point point2 = Point.measurement("h2o_feet").addTag("location", "west").addField("water_level", 2).time(time.plusSeconds(10), WritePrecision.S); writeClient .listenEvents(WriteSuccessEvent.class) @@ -282,7 +281,7 @@ void writeMeasurement() { .listenEvents(WriteSuccessEvent.class) .subscribe(event -> countDownLatch.countDown()); - writeClient.writeMeasurement(bucket.getName(), organization.getId(), ChronoUnit.NANOS, Maybe.just(measurement)); + writeClient.writeMeasurement(bucket.getName(), organization.getId(), WritePrecision.NS, Maybe.just(measurement)); waitToCallback(); @@ -319,7 +318,7 @@ void writeMeasurements() { .listenEvents(WriteSuccessEvent.class) .subscribe(event -> countDownLatch.countDown()); - writeClient.writeMeasurements(bucket.getName(), organization.getId(), ChronoUnit.NANOS, (Publisher) Flowable.just(measurement1, measurement2)); + writeClient.writeMeasurements(bucket.getName(), organization.getId(), WritePrecision.NS, (Publisher) Flowable.just(measurement1, measurement2)); waitToCallback(); @@ -356,7 +355,7 @@ void queryRaw() { .listenEvents(WriteSuccessEvent.class) .subscribe(event -> countDownLatch.countDown()); - writeClient.writeRecord(bucket.getName(), organization.getId(), ChronoUnit.NANOS, Maybe.just("h2o_feet,location=coyote_creek level\\ water_level=1.0 1")); + writeClient.writeRecord(bucket.getName(), organization.getId(), WritePrecision.NS, Maybe.just("h2o_feet,location=coyote_creek level\\ water_level=1.0 1")); waitToCallback(); @@ -385,7 +384,7 @@ void queryRawDialect() { .listenEvents(WriteSuccessEvent.class) .subscribe(event -> countDownLatch.countDown()); - writeClient.writeRecord(bucket.getName(), organization.getId(), ChronoUnit.NANOS, Maybe.just("h2o_feet,location=coyote_creek level\\ water_level=1.0 1")); + writeClient.writeRecord(bucket.getName(), organization.getId(), WritePrecision.NS, Maybe.just("h2o_feet,location=coyote_creek level\\ water_level=1.0 1")); waitToCallback(); diff --git a/client-scala/src/main/scala/org/influxdata/client/scala/InfluxDBClientScala.scala b/client-scala/src/main/scala/org/influxdata/client/scala/InfluxDBClientScala.scala index 454b17c7800..28505438cae 100644 --- a/client-scala/src/main/scala/org/influxdata/client/scala/InfluxDBClientScala.scala +++ b/client-scala/src/main/scala/org/influxdata/client/scala/InfluxDBClientScala.scala @@ -23,7 +23,7 @@ package org.influxdata.client.scala import javax.annotation.Nonnull import org.influxdata.LogLevel -import org.influxdata.client.domain.Health +import org.influxdata.client.domain.Check /** * The reference Scala client that allows query and write for the InfluxDB 2.0 by Akka Streams. @@ -44,7 +44,7 @@ trait InfluxDBClientScala { * * @return health of an instance */ - @Nonnull def health: Health + @Nonnull def health: Check /** * Gets the [[LogLevel]] that is used for logging requests and responses. diff --git a/client-scala/src/main/scala/org/influxdata/client/scala/QueryScalaApi.scala b/client-scala/src/main/scala/org/influxdata/client/scala/QueryScalaApi.scala index be9eff56876..34db01b8d8f 100644 --- a/client-scala/src/main/scala/org/influxdata/client/scala/QueryScalaApi.scala +++ b/client-scala/src/main/scala/org/influxdata/client/scala/QueryScalaApi.scala @@ -24,6 +24,7 @@ package org.influxdata.client.scala import akka.NotUsed import akka.stream.scaladsl.Source import javax.annotation.Nonnull +import org.influxdata.client.domain.{Dialect, Query} import org.influxdata.query.FluxRecord /** @@ -42,6 +43,15 @@ trait QueryScalaApi { */ @Nonnull def query(@Nonnull query: String, @Nonnull orgID: String): Source[FluxRecord, NotUsed] + /** + * Executes the Flux query against the InfluxDB and asynchronously stream [[FluxRecord]]s to [[Stream]]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @return the stream of [[FluxRecord]]s + */ + @Nonnull def query(@Nonnull query: Query, @Nonnull orgID: String): Source[FluxRecord, NotUsed] + /** * Executes the Flux query against the InfluxDB and asynchronously stream measurements to [[Stream]]. * @@ -53,6 +63,17 @@ trait QueryScalaApi { */ @Nonnull def query[M](@Nonnull query: String, @Nonnull orgID: String, @Nonnull measurementType: Class[M]): Source[M, NotUsed] + /** + * Executes the Flux query against the InfluxDB and asynchronously stream measurements to [[Stream]]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @param measurementType the measurement (POJO) + * @tparam M the type of the measurement (POJO) + * @return the stream of measurements + */ + @Nonnull def query[M](@Nonnull query: Query, @Nonnull orgID: String, @Nonnull measurementType: Class[M]): Source[M, NotUsed] + /** * Executes the Flux query against the InfluxDB and asynchronously stream response to [[Stream]]. * @@ -71,5 +92,14 @@ trait QueryScalaApi { * @param orgID specifies the source organization * @return the response stream */ - @Nonnull def queryRaw(@Nonnull query: String, @Nonnull dialect: String, @Nonnull orgID: String): Source[String, NotUsed] + @Nonnull def queryRaw(@Nonnull query: String, @Nonnull dialect: Dialect, @Nonnull orgID: String): Source[String, NotUsed] + + /** + * Executes the Flux query against the InfluxDB and asynchronously stream response to [[Stream]]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @return the response stream + */ + @Nonnull def queryRaw(@Nonnull query: Query, @Nonnull orgID: String): Source[String, NotUsed] } diff --git a/client-scala/src/main/scala/org/influxdata/client/scala/internal/InfluxDBClientScalaImpl.scala b/client-scala/src/main/scala/org/influxdata/client/scala/internal/InfluxDBClientScalaImpl.scala index 7bc7bb27162..a0c94253da8 100644 --- a/client-scala/src/main/scala/org/influxdata/client/scala/internal/InfluxDBClientScalaImpl.scala +++ b/client-scala/src/main/scala/org/influxdata/client/scala/internal/InfluxDBClientScalaImpl.scala @@ -25,29 +25,30 @@ import akka.stream.OverflowStrategy import javax.annotation.Nonnull import org.influxdata.LogLevel import org.influxdata.client.InfluxDBClientOptions -import org.influxdata.client.domain.Health -import org.influxdata.client.internal.{AbstractInfluxDBClient, InfluxDBService} +import org.influxdata.client.domain.Check +import org.influxdata.client.internal.AbstractInfluxDBClient import org.influxdata.client.scala.{InfluxDBClientScala, QueryScalaApi} +import org.influxdata.client.service.QueryService /** * @author Jakub Bednar (bednar@github) (08/02/2019 09:26) */ class InfluxDBClientScalaImpl(@Nonnull options: InfluxDBClientOptions, @Nonnull val bufferSize: Int, - @Nonnull val overflowStrategy: OverflowStrategy) extends AbstractInfluxDBClient(options, classOf[InfluxDBService]) with InfluxDBClientScala { + @Nonnull val overflowStrategy: OverflowStrategy) extends AbstractInfluxDBClient(options) with InfluxDBClientScala { /** * Get the Query client. * * @return the new client instance for the Query API */ - override def getQueryScalaApi(): QueryScalaApi = new QueryScalaApiImpl(influxDBService, bufferSize, overflowStrategy) + override def getQueryScalaApi(): QueryScalaApi = new QueryScalaApiImpl(retrofit.create(classOf[QueryService]), bufferSize, overflowStrategy) /** * Get the health of an instance. * * @return health of an instance */ - override def health: Health = health(influxDBService.health()) + override def health: Check = health(healthService.healthGet(null)) /** * Gets the [[LogLevel]] that is used for logging requests and responses. diff --git a/client-scala/src/main/scala/org/influxdata/client/scala/internal/QueryScalaApiImpl.scala b/client-scala/src/main/scala/org/influxdata/client/scala/internal/QueryScalaApiImpl.scala index e7757be2c76..5fa50f7a4bc 100644 --- a/client-scala/src/main/scala/org/influxdata/client/scala/internal/QueryScalaApiImpl.scala +++ b/client-scala/src/main/scala/org/influxdata/client/scala/internal/QueryScalaApiImpl.scala @@ -27,8 +27,10 @@ import akka.NotUsed import akka.stream.OverflowStrategy import akka.stream.scaladsl.Source import javax.annotation.Nonnull -import org.influxdata.client.internal.InfluxDBService +import org.influxdata.client.domain.{Dialect, Query} +import org.influxdata.client.internal.AbstractInfluxDBClient import org.influxdata.client.scala.QueryScalaApi +import org.influxdata.client.service.QueryService import org.influxdata.internal.AbstractQueryApi import org.influxdata.query.internal.FluxCsvParser import org.influxdata.query.{FluxRecord, FluxTable} @@ -39,7 +41,7 @@ import scala.compat.java8.FunctionConverters.asJavaConsumer /** * @author Jakub Bednar (bednar@github) (06/11/2018 08:19) */ -class QueryScalaApiImpl(@Nonnull influxDBService: InfluxDBService, +class QueryScalaApiImpl(@Nonnull service: QueryService, @Nonnull val bufferSize: Int, @Nonnull val overflowStrategy: OverflowStrategy) @@ -60,9 +62,26 @@ class QueryScalaApiImpl(@Nonnull influxDBService: InfluxDBService, Arguments.checkNonEmpty(query, "query") Arguments.checkNonEmpty(orgID, "orgID") + this.query(new Query().query(query).dialect(AbstractInfluxDBClient.DEFAULT_DIALECT), orgID) + } + + /** + * Executes the Flux query against the InfluxDB and asynchronously stream [[FluxRecord]]s to [[Stream]]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @return the stream of [[FluxRecord]]s + */ + override def query(query: Query, orgID: String): Source[FluxRecord, NotUsed] = { + + Arguments.checkNotNull(query, "query") + Arguments.checkNonEmpty(orgID, "orgID") + Source .single(query) - .map(it => influxDBService.query(orgID, createBody(AbstractQueryApi.DEFAULT_DIALECT.toString, it))) + .map(_ => service + .queryPostResponseBody(null, "text/csv", "application/json", + null, orgID, query)) .flatMapConcat(queryCall => { Source.queue[FluxRecord](bufferSize, overflowStrategy) .mapMaterializedValue(queue => { @@ -88,7 +107,7 @@ class QueryScalaApiImpl(@Nonnull influxDBService: InfluxDBService, this.query(queryCall, consumer, onError, () => queue.complete, true) }) - }) + }) } /** @@ -108,6 +127,24 @@ class QueryScalaApiImpl(@Nonnull influxDBService: InfluxDBService, this.query(query, orgID).map(t => resultMapper.toPOJO(t, measurementType)) } + /** + * Executes the Flux query against the InfluxDB and asynchronously stream measurements to [[Stream]]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @param measurementType the measurement (POJO) + * @tparam M the type of the measurement (POJO) + * @return the stream of measurements + */ + override def query[M](query: Query, orgID: String, measurementType: Class[M]): Source[M, NotUsed] = { + + Arguments.checkNotNull(query, "query") + Arguments.checkNonEmpty(orgID, "orgID") + Arguments.checkNotNull(measurementType, "measurementType") + + this.query(query, orgID).map(t => resultMapper.toPOJO(t, measurementType)) + } + /** * Executes the Flux query against the InfluxDB and asynchronously stream response to [[Stream]]. * @@ -119,7 +156,7 @@ class QueryScalaApiImpl(@Nonnull influxDBService: InfluxDBService, Arguments.checkNonEmpty(query, "query") Arguments.checkNonEmpty(orgID, "orgID") - queryRaw(query, AbstractQueryApi.DEFAULT_DIALECT.toString, orgID) + queryRaw(query, AbstractInfluxDBClient.DEFAULT_DIALECT, orgID) } /** @@ -130,14 +167,31 @@ class QueryScalaApiImpl(@Nonnull influxDBService: InfluxDBService, * [[http://bit.ly/flux-dialect See dialect SPEC]]. * @return the response stream */ - override def queryRaw(query: String, dialect: String, orgID: String): Source[String, NotUsed] = { + override def queryRaw(query: String, dialect: Dialect, orgID: String): Source[String, NotUsed] = { Arguments.checkNonEmpty(query, "query") Arguments.checkNonEmpty(orgID, "orgID") + this.queryRaw(new Query().query(query).dialect(dialect), orgID) + } + + /** + * Executes the Flux query against the InfluxDB and asynchronously stream response to [[Stream]]. + * + * @param query the flux query to execute + * @param orgID specifies the source organization + * @return the response stream + */ + override def queryRaw(query: Query, orgID: String): Source[String, NotUsed] = { + + Arguments.checkNotNull(query, "query") + Arguments.checkNonEmpty(orgID, "orgID") + Source .single(query) - .map(it => influxDBService.query(orgID, createBody(dialect, it))) + .map(it => service + .queryPostResponseBody(null, "text/csv", "application/json", + null, orgID, query)) .flatMapConcat(queryCall => { Source.queue[String](bufferSize, overflowStrategy) .mapMaterializedValue(queue => { diff --git a/client-scala/src/test/scala/org/influxdata/client/scala/ITInfluxDBClientScala.scala b/client-scala/src/test/scala/org/influxdata/client/scala/ITInfluxDBClientScala.scala index f884bbeb263..23fbda3939f 100644 --- a/client-scala/src/test/scala/org/influxdata/client/scala/ITInfluxDBClientScala.scala +++ b/client-scala/src/test/scala/org/influxdata/client/scala/ITInfluxDBClientScala.scala @@ -22,6 +22,7 @@ package org.influxdata.client.scala import org.influxdata.LogLevel +import org.influxdata.client.domain.Check import org.scalatest.Matchers /** @@ -43,7 +44,7 @@ class ITInfluxDBClientScala extends AbstractITQueryScalaApi with Matchers { val health = influxDBClient.health health should not be null - health.isHealthy should be(true) + health.getStatus should be(Check.StatusEnum.PASS) health.getMessage should be("ready for queries and writes") } @@ -54,7 +55,7 @@ class ITInfluxDBClientScala extends AbstractITQueryScalaApi with Matchers { val health = client.health health should not be null - health.isHealthy should be(false) + health.getStatus should be(Check.StatusEnum.FAIL) health.getMessage should startWith("Failed to connect to") client.close() diff --git a/client-scala/src/test/scala/org/influxdata/client/scala/ITQueryScalaApiQuery.scala b/client-scala/src/test/scala/org/influxdata/client/scala/ITQueryScalaApiQuery.scala index c838c5201cf..ca693698194 100644 --- a/client-scala/src/test/scala/org/influxdata/client/scala/ITQueryScalaApiQuery.scala +++ b/client-scala/src/test/scala/org/influxdata/client/scala/ITQueryScalaApiQuery.scala @@ -23,7 +23,6 @@ package org.influxdata.client.scala import java.net.ConnectException import java.time.Instant -import java.time.temporal.ChronoUnit import akka.actor.ActorSystem import akka.stream.ActorMaterializer @@ -33,7 +32,6 @@ import org.influxdata.client.InfluxDBClientFactory import org.influxdata.client.domain._ import org.influxdata.exceptions.InfluxException import org.influxdata.query.FluxRecord -import org.json.JSONObject import org.scalatest.Matchers import scala.collection.JavaConverters._ @@ -62,9 +60,9 @@ class ITQueryScalaApiQuery extends AbstractITQueryScalaApi with Matchers { .filter(o => o.getName == "my-org").findFirst() .orElseThrow(() => new IllegalStateException()) - val retentionRule = new RetentionRule() - retentionRule.setType("expire") - retentionRule.setEverySeconds(3600L) + val retentionRule = new BucketRetentionRules() + retentionRule.setType(BucketRetentionRules.TypeEnum.EXPIRE) + retentionRule.setEverySeconds(3600) val bucket = client.getBucketsApi.createBucket(influxDBUtils.generateName("h2o"), retentionRule, organization) fluxPrefix = "from(bucket:\"" + bucket.getName + "\")\n\t" @@ -75,16 +73,16 @@ class ITQueryScalaApiQuery extends AbstractITQueryScalaApi with Matchers { val resource = new PermissionResource resource.setOrgID(organization.getId) - resource.setType(ResourceType.BUCKETS) + resource.setType(PermissionResource.TypeEnum.BUCKETS) resource.setId(bucket.getId) val readBucket = new Permission readBucket.setResource(resource) - readBucket.setAction(Permission.READ_ACTION) + readBucket.setAction(Permission.ActionEnum.READ) val writeBucket = new Permission writeBucket.setResource(resource) - writeBucket.setAction(Permission.WRITE_ACTION) + writeBucket.setAction(Permission.ActionEnum.WRITE) val authorization = client.getAuthorizationsApi .createAuthorization(organization, List(readBucket, writeBucket).asJava) @@ -101,7 +99,7 @@ class ITQueryScalaApiQuery extends AbstractITQueryScalaApi with Matchers { .mkString("\n") val writeApi = client.getWriteApi - writeApi.writeRecord(bucket.getName, organization.getId, ChronoUnit.NANOS, records) + writeApi.writeRecord(bucket.getName, organization.getId, WritePrecision.NS, records) writeApi.close() client.close() @@ -141,16 +139,16 @@ class ITQueryScalaApiQuery extends AbstractITQueryScalaApi with Matchers { val source = queryScalaApi.query(flux, organization.getId).map(it => it.getValue).runWith(TestSink.probe[Object]) - source.requestNext() should be(10L) - source.requestNext() should be(11L) - source.requestNext() should be(20L) - source.requestNext() should be(22L) + source.requestNext() should be(55L) + source.requestNext() should be(65L) source.requestNext() should be(35L) source.requestNext() should be(38L) - source.requestNext() should be(55L) source.requestNext() should be(45L) source.requestNext() should be(49L) - source.requestNext() should be(65L) + source.requestNext() should be(10L) + source.requestNext() should be(11L) + source.requestNext() should be(20L) + source.requestNext() should be(22L) source.expectComplete() } @@ -260,9 +258,8 @@ class ITQueryScalaApiQuery extends AbstractITQueryScalaApi with Matchers { "|> filter(fn: (r) => (r[\"_measurement\"] == \"mem\" and r[\"_field\"] == \"free\"))\n\t" + "|> sum()" - val dialect = new JSONObject() - .put("header", false) - .toString() + val dialect = new Dialect() + .header( false) val source = queryScalaApi.queryRaw(flux, dialect, organization.getId).runWith(TestSink.probe[String]) diff --git a/client/README.md b/client/README.md index fa22a398f01..3e943687a20 100644 --- a/client/README.md +++ b/client/README.md @@ -572,8 +572,7 @@ import org.influxdata.client.domain.Authorization; import org.influxdata.client.domain.Bucket; import org.influxdata.client.domain.Permission; import org.influxdata.client.domain.PermissionResource; -import org.influxdata.client.domain.ResourceType; -import org.influxdata.client.domain.RetentionRule; +import org.influxdata.client.domain.BucketRetentionRules; public class InfluxDB2ManagementExample { @@ -597,17 +596,17 @@ public class InfluxDB2ManagementExample { PermissionResource resource = new PermissionResource(); resource.setId(bucket.getId()); resource.setOrgID("org_id"); - resource.setType(ResourceType.BUCKETS); + resource.setType(PermissionResource.TypeEnum.BUCKETS); // Read permission Permission read = new Permission(); read.setResource(resource); - read.setAction(Permission.READ_ACTION); + read.setAction(Permission.ActionEnum.READ); // Write permission Permission write = new Permission(); write.setResource(resource); - write.setAction(Permission.WRITE_ACTION); + write.setAction(Permission.ActionEnum.WRITE); Authorization authorization = influxDBClient.getAuthorizationsApi() .createAuthorization("org_id", Arrays.asList(read, write)); diff --git a/client/pom.xml b/client/pom.xml index 3aae052d559..c06af726d63 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -50,6 +50,57 @@
../scripts/license_header.txt
+ + org.openapitools + openapi-generator-maven-plugin + 3.0.3 + + ${project.basedir}/src/main/resources/swagger.yml + influx-java + retrofit2 + + java + java8 + true + + false + false + true + false + true + false + ${project.basedir}/src/generated + false + org.influxdata.client.domain + org.influxdata.client.service + + + + org.influxdata + openapi-generator + 1.0.0 + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add-source + generate-sources + + add-source + + + + ${project.basedir}/src/generated/java + + + + + @@ -72,20 +123,35 @@ - com.squareup.retrofit2 - adapter-rxjava2 + com.squareup.okio + okio - com.squareup.retrofit2 - converter-moshi + com.google.code.gson + gson - com.squareup.okio - okio + io.swagger + swagger-annotations + + io.gsonfire + gson-fire + + + + com.squareup.retrofit2 + converter-scalars + + + + com.squareup.retrofit2 + converter-gson + + \ No newline at end of file diff --git a/client/src/generated/java/org/influxdata/client/JSON.java b/client/src/generated/java/org/influxdata/client/JSON.java new file mode 100644 index 00000000000..7969f6b5830 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/JSON.java @@ -0,0 +1,388 @@ +/* + * 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 org.influxdata.client; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + +import org.influxdata.client.domain.*; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +public class JSON { + private Gson gson; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + + ; + fireBuilder.registerTypeSelector(TelegrafRequestPlugin.class, new TypeSelector() { + + private final Map> classByDiscriminatorValue = new HashMap>() { { + put("diskio", TelegrafPluginInputDiskioRequest.class); + put("kubernetes", TelegrafPluginInputKubernetesRequest.class); + put("processes", TelegrafPluginInputProcessesRequest.class); + put("influxdb_v2", TelegrafPluginOutputInfluxDBV2Request.class); + put("nginx", TelegrafPluginInputNginxRequest.class); + put("swap", TelegrafPluginInputSwapRequest.class); + put("kernel", TelegrafPluginInputKernelRequest.class); + put("tail", TelegrafPluginInputTailRequest.class); + put("cpu", TelegrafPluginInputCpuRequest.class); + put("syslog", TelegrafPluginInputSyslogRequest.class); + put("logparser", TelegrafPluginInputLogParserRequest.class); + put("redis", TelegrafPluginInputRedisRequest.class); + put("docker", TelegrafPluginInputDockerRequest.class); + put("net_response", TelegrafPluginInputNetResponseRequest.class); + put("disk", TelegrafPluginInputDiskRequest.class); + put("file", TelegrafPluginOutputFileRequest.class); + put("system", TelegrafPluginInputSystemRequest.class); + put("mem", TelegrafPluginInputMemRequest.class); + put("procstat", TelegrafPluginInputProcstatRequest.class); + put("prometheus", TelegrafPluginInputPrometheusRequest.class); + put("net", TelegrafPluginInputNetRequest.class); + } }; + + @Override + public Class getClassForElement(JsonElement readElement) { + + String value = getDiscriminatorValue(readElement, "name"); + + return classByDiscriminatorValue.getOrDefault(value, TelegrafRequestPlugin.class); + } + }); + fireBuilder.registerTypeSelector(TelegrafPlugin.class, new TypeSelector() { + + private final Map> classByDiscriminatorValue = new HashMap>() { { + put("diskio", TelegrafPluginInputDiskio.class); + put("kubernetes", TelegrafPluginInputKubernetes.class); + put("processes", TelegrafPluginInputProcesses.class); + put("influxdb_v2", TelegrafPluginOutputInfluxDBV2.class); + put("nginx", TelegrafPluginInputNginx.class); + put("swap", TelegrafPluginInputSwap.class); + put("kernel", TelegrafPluginInputKernel.class); + put("tail", TelegrafPluginInputTail.class); + put("cpu", TelegrafPluginInputCpu.class); + put("syslog", TelegrafPluginInputSyslog.class); + put("logparser", TelegrafPluginInputLogParser.class); + put("redis", TelegrafPluginInputRedis.class); + put("docker", TelegrafPluginInputDocker.class); + put("net_response", TelegrafPluginInputNetResponse.class); + put("disk", TelegrafPluginInputDisk.class); + put("file", TelegrafPluginOutputFile.class); + put("system", TelegrafPluginInputSystem.class); + put("mem", TelegrafPluginInputMem.class); + put("procstat", TelegrafPluginInputProcstat.class); + put("prometheus", TelegrafPluginInputPrometheus.class); + put("net", TelegrafPluginInputNet.class); + } }; + + @Override + public Class getClassForElement(JsonElement readElement) { + + String value = getDiscriminatorValue(readElement, "name"); + + return classByDiscriminatorValue.getOrDefault(value, TelegrafPlugin.class); + } + }); + return fireBuilder.createGsonBuilder(); + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if(null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); + if(null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + public JSON() { + gson = createGson() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() { + } + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() { + } + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } + +} diff --git a/client/src/generated/java/org/influxdata/client/domain/ASTResponse.java b/client/src/generated/java/org/influxdata/client/domain/ASTResponse.java new file mode 100644 index 00000000000..ada6060bd54 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/ASTResponse.java @@ -0,0 +1,96 @@ +/* + * 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 org.influxdata.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; +import org.influxdata.client.domain.ModelPackage; + +/** + * contains the AST for the supplied Flux query + */ +@ApiModel(description = "contains the AST for the supplied Flux query") + +public class ASTResponse { + public static final String SERIALIZED_NAME_AST = "ast"; + @SerializedName(SERIALIZED_NAME_AST) + private ModelPackage ast = null; + + public ASTResponse ast(ModelPackage ast) { + this.ast = ast; + return this; + } + + /** + * Get ast + * @return ast + **/ + @ApiModelProperty(value = "") + public ModelPackage getAst() { + return ast; + } + + public void setAst(ModelPackage ast) { + this.ast = ast; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ASTResponse asTResponse = (ASTResponse) o; + return Objects.equals(this.ast, asTResponse.ast); + } + + @Override + public int hashCode() { + return Objects.hash(ast); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ASTResponse {\n"); + sb.append(" ast: ").append(toIndentedString(ast)).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/org/influxdata/client/domain/AddResourceMemberRequestBody.java b/client/src/generated/java/org/influxdata/client/domain/AddResourceMemberRequestBody.java new file mode 100644 index 00000000000..c003954aca6 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/AddResourceMemberRequestBody.java @@ -0,0 +1,118 @@ +/* + * 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 org.influxdata.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; + +/** + * AddResourceMemberRequestBody + */ + +public class AddResourceMemberRequestBody { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id = null; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name = null; + + public AddResourceMemberRequestBody id(String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(required = true, value = "") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public AddResourceMemberRequestBody 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; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddResourceMemberRequestBody addResourceMemberRequestBody = (AddResourceMemberRequestBody) o; + return Objects.equals(this.id, addResourceMemberRequestBody.id) && + Objects.equals(this.name, addResourceMemberRequestBody.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddResourceMemberRequestBody {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/org/influxdata/client/domain/AnalyzeQueryResponse.java b/client/src/generated/java/org/influxdata/client/domain/AnalyzeQueryResponse.java new file mode 100644 index 00000000000..b821cebe094 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/AnalyzeQueryResponse.java @@ -0,0 +1,105 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.AnalyzeQueryResponseErrors; + +/** + * AnalyzeQueryResponse + */ + +public class AnalyzeQueryResponse { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + private List errors = new ArrayList<>(); + + public AnalyzeQueryResponse errors(List errors) { + this.errors = errors; + return this; + } + + public AnalyzeQueryResponse addErrorsItem(AnalyzeQueryResponseErrors errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + **/ + @ApiModelProperty(value = "") + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalyzeQueryResponse analyzeQueryResponse = (AnalyzeQueryResponse) o; + return Objects.equals(this.errors, analyzeQueryResponse.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalyzeQueryResponse {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).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/org/influxdata/client/domain/AnalyzeQueryResponseErrors.java b/client/src/generated/java/org/influxdata/client/domain/AnalyzeQueryResponseErrors.java new file mode 100644 index 00000000000..863825ed7c1 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/AnalyzeQueryResponseErrors.java @@ -0,0 +1,166 @@ +/* + * 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 org.influxdata.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; + +/** + * AnalyzeQueryResponseErrors + */ + +public class AnalyzeQueryResponseErrors { + public static final String SERIALIZED_NAME_LINE = "line"; + @SerializedName(SERIALIZED_NAME_LINE) + private Integer line = null; + + public static final String SERIALIZED_NAME_COLUMN = "column"; + @SerializedName(SERIALIZED_NAME_COLUMN) + private Integer column = null; + + public static final String SERIALIZED_NAME_CHARACTER = "character"; + @SerializedName(SERIALIZED_NAME_CHARACTER) + private Integer character = null; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message = null; + + public AnalyzeQueryResponseErrors line(Integer line) { + this.line = line; + return this; + } + + /** + * Get line + * @return line + **/ + @ApiModelProperty(value = "") + public Integer getLine() { + return line; + } + + public void setLine(Integer line) { + this.line = line; + } + + public AnalyzeQueryResponseErrors column(Integer column) { + this.column = column; + return this; + } + + /** + * Get column + * @return column + **/ + @ApiModelProperty(value = "") + public Integer getColumn() { + return column; + } + + public void setColumn(Integer column) { + this.column = column; + } + + public AnalyzeQueryResponseErrors character(Integer character) { + this.character = character; + return this; + } + + /** + * Get character + * @return character + **/ + @ApiModelProperty(value = "") + public Integer getCharacter() { + return character; + } + + public void setCharacter(Integer character) { + this.character = character; + } + + public AnalyzeQueryResponseErrors message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalyzeQueryResponseErrors analyzeQueryResponseErrors = (AnalyzeQueryResponseErrors) o; + return Objects.equals(this.line, analyzeQueryResponseErrors.line) && + Objects.equals(this.column, analyzeQueryResponseErrors.column) && + Objects.equals(this.character, analyzeQueryResponseErrors.character) && + Objects.equals(this.message, analyzeQueryResponseErrors.message); + } + + @Override + public int hashCode() { + return Objects.hash(line, column, character, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalyzeQueryResponseErrors {\n"); + sb.append(" line: ").append(toIndentedString(line)).append("\n"); + sb.append(" column: ").append(toIndentedString(column)).append("\n"); + sb.append(" character: ").append(toIndentedString(character)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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/org/influxdata/client/domain/Authorization.java b/client/src/generated/java/org/influxdata/client/domain/Authorization.java new file mode 100644 index 00000000000..65a3e007561 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Authorization.java @@ -0,0 +1,321 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.AuthorizationLinks; +import org.influxdata.client.domain.Permission; + +/** + * Authorization + */ + +public class Authorization { + public static final String SERIALIZED_NAME_ORG_I_D = "orgID"; + @SerializedName(SERIALIZED_NAME_ORG_I_D) + private String orgID = null; + + /** + * if inactive the token is inactive and requests using the token will be rejected. + */ + @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 = StatusEnum.ACTIVE; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description = null; + + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id = null; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token = null; + + public static final String SERIALIZED_NAME_USER_I_D = "userID"; + @SerializedName(SERIALIZED_NAME_USER_I_D) + private String userID = null; + + public static final String SERIALIZED_NAME_USER = "user"; + @SerializedName(SERIALIZED_NAME_USER) + private String user = null; + + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private String org = null; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private AuthorizationLinks links = null; + + public Authorization orgID(String orgID) { + this.orgID = orgID; + return this; + } + + /** + * ID of org that authorization is scoped to. + * @return orgID + **/ + @ApiModelProperty(required = true, value = "ID of org that authorization is scoped to.") + public String getOrgID() { + return orgID; + } + + public void setOrgID(String orgID) { + this.orgID = orgID; + } + + public Authorization status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * if inactive the token is inactive and requests using the token will be rejected. + * @return status + **/ + @ApiModelProperty(value = "if inactive the token is inactive and requests using the token will be rejected.") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Authorization description(String description) { + this.description = description; + return this; + } + + /** + * A description of the token. + * @return description + **/ + @ApiModelProperty(value = "A description of the token.") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Authorization permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public Authorization addPermissionsItem(Permission permissionsItem) { + this.permissions.add(permissionsItem); + return this; + } + + /** + * List of permissions for an auth. An auth must have at least one Permission. + * @return permissions + **/ + @ApiModelProperty(required = true, value = "List of permissions for an auth. An auth must have at least one Permission.") + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public String getId() { + return id; + } + + /** + * Passed via the Authorization Header and Token Authentication type. + * @return token + **/ + @ApiModelProperty(value = "Passed via the Authorization Header and Token Authentication type.") + public String getToken() { + return token; + } + + /** + * ID of user that created and owns the token. + * @return userID + **/ + @ApiModelProperty(value = "ID of user that created and owns the token.") + public String getUserID() { + return userID; + } + + /** + * Name of user that created and owns the token. + * @return user + **/ + @ApiModelProperty(value = "Name of user that created and owns the token.") + public String getUser() { + return user; + } + + /** + * Name of the org token is scoped to. + * @return org + **/ + @ApiModelProperty(value = "Name of the org token is scoped to.") + public String getOrg() { + return org; + } + + public Authorization links(AuthorizationLinks links) { + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @ApiModelProperty(value = "") + public AuthorizationLinks getLinks() { + return links; + } + + public void setLinks(AuthorizationLinks links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Authorization authorization = (Authorization) o; + return Objects.equals(this.orgID, authorization.orgID) && + Objects.equals(this.status, authorization.status) && + Objects.equals(this.description, authorization.description) && + Objects.equals(this.permissions, authorization.permissions) && + Objects.equals(this.id, authorization.id) && + Objects.equals(this.token, authorization.token) && + Objects.equals(this.userID, authorization.userID) && + Objects.equals(this.user, authorization.user) && + Objects.equals(this.org, authorization.org) && + Objects.equals(this.links, authorization.links); + } + + @Override + public int hashCode() { + return Objects.hash(orgID, status, description, permissions, id, token, userID, user, org, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Authorization {\n"); + sb.append(" orgID: ").append(toIndentedString(orgID)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" userID: ").append(toIndentedString(userID)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).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/org/influxdata/client/domain/AuthorizationLinks.java b/client/src/generated/java/org/influxdata/client/domain/AuthorizationLinks.java new file mode 100644 index 00000000000..5ce7e100699 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/AuthorizationLinks.java @@ -0,0 +1,100 @@ +/* + * 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 org.influxdata.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; + +/** + * AuthorizationLinks + */ + +public class AuthorizationLinks { + public static final String SERIALIZED_NAME_SELF = "self"; + @SerializedName(SERIALIZED_NAME_SELF) + private String self = null; + + public static final String SERIALIZED_NAME_USER = "user"; + @SerializedName(SERIALIZED_NAME_USER) + private String user = null; + + /** + * Get self + * @return self + **/ + @ApiModelProperty(value = "") + public String getSelf() { + return self; + } + + /** + * Get user + * @return user + **/ + @ApiModelProperty(value = "") + public String getUser() { + return user; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorizationLinks authorizationLinks = (AuthorizationLinks) o; + return Objects.equals(this.self, authorizationLinks.self) && + Objects.equals(this.user, authorizationLinks.user); + } + + @Override + public int hashCode() { + return Objects.hash(self, user); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorizationLinks {\n"); + sb.append(" self: ").append(toIndentedString(self)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).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/org/influxdata/client/domain/Authorizations.java b/client/src/generated/java/org/influxdata/client/domain/Authorizations.java new file mode 100644 index 00000000000..5f857cf0717 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Authorizations.java @@ -0,0 +1,130 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.Authorization; +import org.influxdata.client.domain.Links; + +/** + * Authorizations + */ + +public class Authorizations { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Links links = null; + + public static final String SERIALIZED_NAME_AUTHORIZATIONS = "authorizations"; + @SerializedName(SERIALIZED_NAME_AUTHORIZATIONS) + private List authorizations = new ArrayList<>(); + + public Authorizations links(Links links) { + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @ApiModelProperty(value = "") + public Links getLinks() { + return links; + } + + public void setLinks(Links links) { + this.links = links; + } + + public Authorizations authorizations(List authorizations) { + this.authorizations = authorizations; + return this; + } + + public Authorizations addAuthorizationsItem(Authorization authorizationsItem) { + if (this.authorizations == null) { + this.authorizations = new ArrayList<>(); + } + this.authorizations.add(authorizationsItem); + return this; + } + + /** + * Get authorizations + * @return authorizations + **/ + @ApiModelProperty(value = "") + public List getAuthorizations() { + return authorizations; + } + + public void setAuthorizations(List authorizations) { + this.authorizations = authorizations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Authorizations authorizations = (Authorizations) o; + return Objects.equals(this.links, authorizations.links) && + Objects.equals(this.authorizations, authorizations.authorizations); + } + + @Override + public int hashCode() { + return Objects.hash(links, authorizations); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Authorizations {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" authorizations: ").append(toIndentedString(authorizations)).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/org/influxdata/client/domain/Bucket.java b/client/src/generated/java/org/influxdata/client/domain/Bucket.java new file mode 100644 index 00000000000..9146cc81d4b --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Bucket.java @@ -0,0 +1,263 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.BucketLinks; +import org.influxdata.client.domain.BucketRetentionRules; +import org.influxdata.client.domain.Labels; + +/** + * Bucket + */ + +public class Bucket { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private BucketLinks links = null; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id = null; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name = null; + + public static final String SERIALIZED_NAME_ORGANIZATION_I_D = "organizationID"; + @SerializedName(SERIALIZED_NAME_ORGANIZATION_I_D) + private String organizationID = null; + + public static final String SERIALIZED_NAME_ORGANIZATION = "organization"; + @SerializedName(SERIALIZED_NAME_ORGANIZATION) + private String organization = null; + + public static final String SERIALIZED_NAME_RP = "rp"; + @SerializedName(SERIALIZED_NAME_RP) + private String rp = null; + + public static final String SERIALIZED_NAME_RETENTION_RULES = "retentionRules"; + @SerializedName(SERIALIZED_NAME_RETENTION_RULES) + private List retentionRules = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LABELS = "labels"; + @SerializedName(SERIALIZED_NAME_LABELS) + private Labels labels = null; + + public Bucket links(BucketLinks links) { + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @ApiModelProperty(value = "") + public BucketLinks getLinks() { + return links; + } + + public void setLinks(BucketLinks links) { + this.links = links; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public String getId() { + return id; + } + + public Bucket name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Bucket organizationID(String organizationID) { + this.organizationID = organizationID; + return this; + } + + /** + * Get organizationID + * @return organizationID + **/ + @ApiModelProperty(value = "") + public String getOrganizationID() { + return organizationID; + } + + public void setOrganizationID(String organizationID) { + this.organizationID = organizationID; + } + + public Bucket organization(String organization) { + this.organization = organization; + return this; + } + + /** + * Get organization + * @return organization + **/ + @ApiModelProperty(value = "") + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public Bucket rp(String rp) { + this.rp = rp; + return this; + } + + /** + * Get rp + * @return rp + **/ + @ApiModelProperty(value = "") + public String getRp() { + return rp; + } + + public void setRp(String rp) { + this.rp = rp; + } + + public Bucket retentionRules(List retentionRules) { + this.retentionRules = retentionRules; + return this; + } + + public Bucket addRetentionRulesItem(BucketRetentionRules retentionRulesItem) { + this.retentionRules.add(retentionRulesItem); + return this; + } + + /** + * rules to expire or retain data. No rules means data never expires. + * @return retentionRules + **/ + @ApiModelProperty(required = true, value = "rules to expire or retain data. No rules means data never expires.") + public List getRetentionRules() { + return retentionRules; + } + + public void setRetentionRules(List retentionRules) { + this.retentionRules = retentionRules; + } + + public Bucket labels(Labels labels) { + this.labels = labels; + return this; + } + + /** + * Get labels + * @return labels + **/ + @ApiModelProperty(value = "") + public Labels getLabels() { + return labels; + } + + public void setLabels(Labels labels) { + this.labels = labels; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Bucket bucket = (Bucket) o; + return Objects.equals(this.links, bucket.links) && + Objects.equals(this.id, bucket.id) && + Objects.equals(this.name, bucket.name) && + Objects.equals(this.organizationID, bucket.organizationID) && + Objects.equals(this.organization, bucket.organization) && + Objects.equals(this.rp, bucket.rp) && + Objects.equals(this.retentionRules, bucket.retentionRules) && + Objects.equals(this.labels, bucket.labels); + } + + @Override + public int hashCode() { + return Objects.hash(links, id, name, organizationID, organization, rp, retentionRules, labels); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Bucket {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" organizationID: ").append(toIndentedString(organizationID)).append("\n"); + sb.append(" organization: ").append(toIndentedString(organization)).append("\n"); + sb.append(" rp: ").append(toIndentedString(rp)).append("\n"); + sb.append(" retentionRules: ").append(toIndentedString(retentionRules)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).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/org/influxdata/client/domain/BucketLinks.java b/client/src/generated/java/org/influxdata/client/domain/BucketLinks.java new file mode 100644 index 00000000000..11cf101fc2c --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/BucketLinks.java @@ -0,0 +1,238 @@ +/* + * 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 org.influxdata.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; + +/** + * BucketLinks + */ + +public class BucketLinks { + public static final String SERIALIZED_NAME_LABELS = "labels"; + @SerializedName(SERIALIZED_NAME_LABELS) + private String labels = null; + + public static final String SERIALIZED_NAME_LOGS = "logs"; + @SerializedName(SERIALIZED_NAME_LOGS) + private String logs = null; + + public static final String SERIALIZED_NAME_MEMBERS = "members"; + @SerializedName(SERIALIZED_NAME_MEMBERS) + private String members = null; + + public static final String SERIALIZED_NAME_ORG = "org"; + @SerializedName(SERIALIZED_NAME_ORG) + private String org = null; + + public static final String SERIALIZED_NAME_OWNERS = "owners"; + @SerializedName(SERIALIZED_NAME_OWNERS) + private String owners = null; + + public static final String SERIALIZED_NAME_SELF = "self"; + @SerializedName(SERIALIZED_NAME_SELF) + private String self = null; + + public static final String SERIALIZED_NAME_WRITE = "write"; + @SerializedName(SERIALIZED_NAME_WRITE) + private String write = null; + + public BucketLinks labels(String labels) { + this.labels = labels; + return this; + } + + /** + * Get labels + * @return labels + **/ + @ApiModelProperty(value = "") + public String getLabels() { + return labels; + } + + public void setLabels(String labels) { + this.labels = labels; + } + + public BucketLinks logs(String logs) { + this.logs = logs; + return this; + } + + /** + * Get logs + * @return logs + **/ + @ApiModelProperty(value = "") + public String getLogs() { + return logs; + } + + public void setLogs(String logs) { + this.logs = logs; + } + + public BucketLinks members(String members) { + this.members = members; + return this; + } + + /** + * Get members + * @return members + **/ + @ApiModelProperty(value = "") + public String getMembers() { + return members; + } + + public void setMembers(String members) { + this.members = members; + } + + public BucketLinks org(String org) { + this.org = org; + return this; + } + + /** + * Get org + * @return org + **/ + @ApiModelProperty(value = "") + public String getOrg() { + return org; + } + + public void setOrg(String org) { + this.org = org; + } + + public BucketLinks owners(String owners) { + this.owners = owners; + return this; + } + + /** + * Get owners + * @return owners + **/ + @ApiModelProperty(value = "") + public String getOwners() { + return owners; + } + + public void setOwners(String owners) { + this.owners = owners; + } + + public BucketLinks self(String self) { + this.self = self; + return this; + } + + /** + * Get self + * @return self + **/ + @ApiModelProperty(value = "") + public String getSelf() { + return self; + } + + public void setSelf(String self) { + this.self = self; + } + + public BucketLinks write(String write) { + this.write = write; + return this; + } + + /** + * Get write + * @return write + **/ + @ApiModelProperty(value = "") + public String getWrite() { + return write; + } + + public void setWrite(String write) { + this.write = write; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BucketLinks bucketLinks = (BucketLinks) o; + return Objects.equals(this.labels, bucketLinks.labels) && + Objects.equals(this.logs, bucketLinks.logs) && + Objects.equals(this.members, bucketLinks.members) && + Objects.equals(this.org, bucketLinks.org) && + Objects.equals(this.owners, bucketLinks.owners) && + Objects.equals(this.self, bucketLinks.self) && + Objects.equals(this.write, bucketLinks.write); + } + + @Override + public int hashCode() { + return Objects.hash(labels, logs, members, org, owners, self, write); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BucketLinks {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" logs: ").append(toIndentedString(logs)).append("\n"); + sb.append(" members: ").append(toIndentedString(members)).append("\n"); + sb.append(" org: ").append(toIndentedString(org)).append("\n"); + sb.append(" owners: ").append(toIndentedString(owners)).append("\n"); + sb.append(" self: ").append(toIndentedString(self)).append("\n"); + sb.append(" write: ").append(toIndentedString(write)).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/org/influxdata/client/domain/BucketRetentionRules.java b/client/src/generated/java/org/influxdata/client/domain/BucketRetentionRules.java new file mode 100644 index 00000000000..8f9200f5944 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/BucketRetentionRules.java @@ -0,0 +1,164 @@ +/* + * 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 org.influxdata.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; + +/** + * BucketRetentionRules + */ + +public class BucketRetentionRules { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + EXPIRE("expire"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String text) { + for (TypeEnum b : TypeEnum.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 TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(String.valueOf(value)); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.EXPIRE; + + public static final String SERIALIZED_NAME_EVERY_SECONDS = "everySeconds"; + @SerializedName(SERIALIZED_NAME_EVERY_SECONDS) + private Integer everySeconds = null; + + public BucketRetentionRules type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public BucketRetentionRules everySeconds(Integer everySeconds) { + this.everySeconds = everySeconds; + return this; + } + + /** + * duration in seconds for how long data will be kept in the database. + * minimum: 1 + * @return everySeconds + **/ + @ApiModelProperty(example = "86400", value = "duration in seconds for how long data will be kept in the database.") + public Integer getEverySeconds() { + return everySeconds; + } + + public void setEverySeconds(Integer everySeconds) { + this.everySeconds = everySeconds; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BucketRetentionRules bucketRetentionRules = (BucketRetentionRules) o; + return Objects.equals(this.type, bucketRetentionRules.type) && + Objects.equals(this.everySeconds, bucketRetentionRules.everySeconds); + } + + @Override + public int hashCode() { + return Objects.hash(type, everySeconds); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BucketRetentionRules {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" everySeconds: ").append(toIndentedString(everySeconds)).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/org/influxdata/client/domain/Buckets.java b/client/src/generated/java/org/influxdata/client/domain/Buckets.java new file mode 100644 index 00000000000..9a9495b4a5e --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Buckets.java @@ -0,0 +1,130 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.Bucket; +import org.influxdata.client.domain.Links; + +/** + * Buckets + */ + +public class Buckets { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Links links = null; + + public static final String SERIALIZED_NAME_BUCKETS = "buckets"; + @SerializedName(SERIALIZED_NAME_BUCKETS) + private List buckets = new ArrayList<>(); + + public Buckets links(Links links) { + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @ApiModelProperty(value = "") + public Links getLinks() { + return links; + } + + public void setLinks(Links links) { + this.links = links; + } + + public Buckets buckets(List buckets) { + this.buckets = buckets; + return this; + } + + public Buckets addBucketsItem(Bucket bucketsItem) { + if (this.buckets == null) { + this.buckets = new ArrayList<>(); + } + this.buckets.add(bucketsItem); + return this; + } + + /** + * Get buckets + * @return buckets + **/ + @ApiModelProperty(value = "") + public List getBuckets() { + return buckets; + } + + public void setBuckets(List buckets) { + this.buckets = buckets; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Buckets buckets = (Buckets) o; + return Objects.equals(this.links, buckets.links) && + Objects.equals(this.buckets, buckets.buckets); + } + + @Override + public int hashCode() { + return Objects.hash(links, buckets); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Buckets {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" buckets: ").append(toIndentedString(buckets)).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/org/influxdata/client/domain/Check.java b/client/src/generated/java/org/influxdata/client/domain/Check.java new file mode 100644 index 00000000000..fa9a249455d --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Check.java @@ -0,0 +1,224 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.Check; + +/** + * Check + */ + +public class Check { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name = null; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message = null; + + public static final String SERIALIZED_NAME_CHECKS = "checks"; + @SerializedName(SERIALIZED_NAME_CHECKS) + private List checks = new ArrayList<>(); + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PASS("pass"), + + FAIL("fail"); + + 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 = null; + + public Check name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Check message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Check checks(List checks) { + this.checks = checks; + return this; + } + + public Check addChecksItem(Check checksItem) { + if (this.checks == null) { + this.checks = new ArrayList<>(); + } + this.checks.add(checksItem); + return this; + } + + /** + * Get checks + * @return checks + **/ + @ApiModelProperty(value = "") + public List getChecks() { + return checks; + } + + public void setChecks(List checks) { + this.checks = checks; + } + + public Check status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @ApiModelProperty(required = true, 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; + } + Check check = (Check) o; + return Objects.equals(this.name, check.name) && + Objects.equals(this.message, check.message) && + Objects.equals(this.checks, check.checks) && + Objects.equals(this.status, check.status); + } + + @Override + public int hashCode() { + return Objects.hash(name, message, checks, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Check {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" checks: ").append(toIndentedString(checks)).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/org/influxdata/client/domain/Dialect.java b/client/src/generated/java/org/influxdata/client/domain/Dialect.java new file mode 100644 index 00000000000..8c7ee549ce4 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Dialect.java @@ -0,0 +1,297 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; + +/** + * dialect are options to change the default CSV output format; https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions + */ +@ApiModel(description = "dialect are options to change the default CSV output format; https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions") + +public class Dialect { + public static final String SERIALIZED_NAME_HEADER = "header"; + @SerializedName(SERIALIZED_NAME_HEADER) + private Boolean header = true; + + public static final String SERIALIZED_NAME_DELIMITER = "delimiter"; + @SerializedName(SERIALIZED_NAME_DELIMITER) + private String delimiter = ","; + + /** + * Gets or Sets annotations + */ + @JsonAdapter(AnnotationsEnum.Adapter.class) + public enum AnnotationsEnum { + GROUP("group"), + + DATATYPE("datatype"), + + DEFAULT("default"); + + private String value; + + AnnotationsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AnnotationsEnum fromValue(String text) { + for (AnnotationsEnum b : AnnotationsEnum.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 AnnotationsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AnnotationsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AnnotationsEnum.fromValue(String.valueOf(value)); + } + } + } + + public static final String SERIALIZED_NAME_ANNOTATIONS = "annotations"; + @SerializedName(SERIALIZED_NAME_ANNOTATIONS) + private List annotations = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COMMENT_PREFIX = "commentPrefix"; + @SerializedName(SERIALIZED_NAME_COMMENT_PREFIX) + private String commentPrefix = "#"; + + /** + * format of timestamps + */ + @JsonAdapter(DateTimeFormatEnum.Adapter.class) + public enum DateTimeFormatEnum { + RFC3339("RFC3339"), + + RFC3339NANO("RFC3339Nano"); + + private String value; + + DateTimeFormatEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DateTimeFormatEnum fromValue(String text) { + for (DateTimeFormatEnum b : DateTimeFormatEnum.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 DateTimeFormatEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DateTimeFormatEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DateTimeFormatEnum.fromValue(String.valueOf(value)); + } + } + } + + public static final String SERIALIZED_NAME_DATE_TIME_FORMAT = "dateTimeFormat"; + @SerializedName(SERIALIZED_NAME_DATE_TIME_FORMAT) + private DateTimeFormatEnum dateTimeFormat = DateTimeFormatEnum.RFC3339; + + public Dialect header(Boolean header) { + this.header = header; + return this; + } + + /** + * if true, the results will contain a header row + * @return header + **/ + @ApiModelProperty(value = "if true, the results will contain a header row") + public Boolean isHeader() { + return header; + } + + public void setHeader(Boolean header) { + this.header = header; + } + + public Dialect delimiter(String delimiter) { + this.delimiter = delimiter; + return this; + } + + /** + * separator between cells; the default is , + * @return delimiter + **/ + @ApiModelProperty(value = "separator between cells; the default is ,") + public String getDelimiter() { + return delimiter; + } + + public void setDelimiter(String delimiter) { + this.delimiter = delimiter; + } + + public Dialect annotations(List annotations) { + this.annotations = annotations; + return this; + } + + public Dialect addAnnotationsItem(AnnotationsEnum annotationsItem) { + if (this.annotations == null) { + this.annotations = new ArrayList<>(); + } + this.annotations.add(annotationsItem); + return this; + } + + /** + * https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns + * @return annotations + **/ + @ApiModelProperty(value = "https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns") + public List getAnnotations() { + return annotations; + } + + public void setAnnotations(List annotations) { + this.annotations = annotations; + } + + public Dialect commentPrefix(String commentPrefix) { + this.commentPrefix = commentPrefix; + return this; + } + + /** + * character prefixed to comment strings + * @return commentPrefix + **/ + @ApiModelProperty(value = "character prefixed to comment strings") + public String getCommentPrefix() { + return commentPrefix; + } + + public void setCommentPrefix(String commentPrefix) { + this.commentPrefix = commentPrefix; + } + + public Dialect dateTimeFormat(DateTimeFormatEnum dateTimeFormat) { + this.dateTimeFormat = dateTimeFormat; + return this; + } + + /** + * format of timestamps + * @return dateTimeFormat + **/ + @ApiModelProperty(value = "format of timestamps") + public DateTimeFormatEnum getDateTimeFormat() { + return dateTimeFormat; + } + + public void setDateTimeFormat(DateTimeFormatEnum dateTimeFormat) { + this.dateTimeFormat = dateTimeFormat; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dialect dialect = (Dialect) o; + return Objects.equals(this.header, dialect.header) && + Objects.equals(this.delimiter, dialect.delimiter) && + Objects.equals(this.annotations, dialect.annotations) && + Objects.equals(this.commentPrefix, dialect.commentPrefix) && + Objects.equals(this.dateTimeFormat, dialect.dateTimeFormat); + } + + @Override + public int hashCode() { + return Objects.hash(header, delimiter, annotations, commentPrefix, dateTimeFormat); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dialect {\n"); + sb.append(" header: ").append(toIndentedString(header)).append("\n"); + sb.append(" delimiter: ").append(toIndentedString(delimiter)).append("\n"); + sb.append(" annotations: ").append(toIndentedString(annotations)).append("\n"); + sb.append(" commentPrefix: ").append(toIndentedString(commentPrefix)).append("\n"); + sb.append(" dateTimeFormat: ").append(toIndentedString(dateTimeFormat)).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/org/influxdata/client/domain/Error.java b/client/src/generated/java/org/influxdata/client/domain/Error.java new file mode 100644 index 00000000000..6e94d2a241e --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Error.java @@ -0,0 +1,193 @@ +/* + * 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 org.influxdata.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; + +/** + * Error + */ + +public class Error { + /** + * code is the machine-readable error code. + */ + @JsonAdapter(CodeEnum.Adapter.class) + public enum CodeEnum { + INTERNAL_ERROR("internal error"), + + NOT_FOUND("not found"), + + CONFLICT("conflict"), + + INVALID("invalid"), + + UNPROCESSABLE_ENTITY("unprocessable entity"), + + EMPTY_VALUE("empty value"), + + UNAVAILABLE("unavailable"), + + FORBIDDEN("forbidden"), + + UNAUTHORIZED("unauthorized"), + + METHOD_NOT_ALLOWED("method not allowed"); + + private String value; + + CodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CodeEnum fromValue(String text) { + for (CodeEnum b : CodeEnum.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 CodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CodeEnum.fromValue(String.valueOf(value)); + } + } + } + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private CodeEnum code = null; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message = null; + + public static final String SERIALIZED_NAME_OP = "op"; + @SerializedName(SERIALIZED_NAME_OP) + private String op = null; + + public static final String SERIALIZED_NAME_ERR = "err"; + @SerializedName(SERIALIZED_NAME_ERR) + private String err = null; + + /** + * code is the machine-readable error code. + * @return code + **/ + @ApiModelProperty(required = true, value = "code is the machine-readable error code.") + public CodeEnum getCode() { + return code; + } + + /** + * message is a human-readable message. + * @return message + **/ + @ApiModelProperty(required = true, value = "message is a human-readable message.") + public String getMessage() { + return message; + } + + /** + * op describes the logical code operation during error. Useful for debugging. + * @return op + **/ + @ApiModelProperty(value = "op describes the logical code operation during error. Useful for debugging.") + public String getOp() { + return op; + } + + /** + * err is a stack of errors that occurred during processing of the request. Useful for debugging. + * @return err + **/ + @ApiModelProperty(value = "err is a stack of errors that occurred during processing of the request. Useful for debugging.") + public String getErr() { + return err; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.op, error.op) && + Objects.equals(this.err, error.err); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, op, err); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" op: ").append(toIndentedString(op)).append("\n"); + sb.append(" err: ").append(toIndentedString(err)).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/org/influxdata/client/domain/Field.java b/client/src/generated/java/org/influxdata/client/domain/Field.java new file mode 100644 index 00000000000..59440420e16 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Field.java @@ -0,0 +1,232 @@ +/* + * 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 org.influxdata.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; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.Field; + +/** + * Field + */ + +public class Field { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value = null; + + /** + * type describes the field type. func is a function; field is a field reference + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + FUNC("func"), + + FIELD("field"), + + INTEGER("integer"), + + NUMBER("number"), + + REGEX("regex"), + + WILDCARD("wildcard"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String text) { + for (TypeEnum b : TypeEnum.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 TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(String.valueOf(value)); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = null; + + public static final String SERIALIZED_NAME_ALIAS = "alias"; + @SerializedName(SERIALIZED_NAME_ALIAS) + private String alias = null; + + public static final String SERIALIZED_NAME_ARGS = "args"; + @SerializedName(SERIALIZED_NAME_ARGS) + private List args = new ArrayList<>(); + + public Field value(String value) { + this.value = value; + return this; + } + + /** + * value is the value of the field. Meaning of the value is implied by the `type` key + * @return value + **/ + @ApiModelProperty(value = "value is the value of the field. Meaning of the value is implied by the `type` key") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public Field type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * type describes the field type. func is a function; field is a field reference + * @return type + **/ + @ApiModelProperty(value = "type describes the field type. func is a function; field is a field reference") + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public Field alias(String alias) { + this.alias = alias; + return this; + } + + /** + * Alias overrides the field name in the returned response. Applies only if type is `func` + * @return alias + **/ + @ApiModelProperty(value = "Alias overrides the field name in the returned response. Applies only if type is `func`") + public String getAlias() { + return alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public Field args(List args) { + this.args = args; + return this; + } + + public Field addArgsItem(Field argsItem) { + if (this.args == null) { + this.args = new ArrayList<>(); + } + this.args.add(argsItem); + return this; + } + + /** + * Args are the arguments to the function + * @return args + **/ + @ApiModelProperty(value = "Args are the arguments to the function") + public List getArgs() { + return args; + } + + public void setArgs(List args) { + this.args = args; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Field field = (Field) o; + return Objects.equals(this.value, field.value) && + Objects.equals(this.type, field.type) && + Objects.equals(this.alias, field.alias) && + Objects.equals(this.args, field.args); + } + + @Override + public int hashCode() { + return Objects.hash(value, type, alias, args); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Field {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); + sb.append(" args: ").append(toIndentedString(args)).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/org/influxdata/client/domain/FluxSuggestions.java b/client/src/generated/java/org/influxdata/client/domain/FluxSuggestions.java new file mode 100644 index 00000000000..bdf36899835 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/FluxSuggestions.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 org.influxdata.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; +import org.influxdata.client.domain.FluxSuggestionsFuncs; + +/** + * FluxSuggestions + */ + +public class FluxSuggestions { + public static final String SERIALIZED_NAME_FUNCS = "funcs"; + @SerializedName(SERIALIZED_NAME_FUNCS) + private FluxSuggestionsFuncs funcs = null; + + public FluxSuggestions funcs(FluxSuggestionsFuncs funcs) { + this.funcs = funcs; + return this; + } + + /** + * Get funcs + * @return funcs + **/ + @ApiModelProperty(value = "") + public FluxSuggestionsFuncs getFuncs() { + return funcs; + } + + public void setFuncs(FluxSuggestionsFuncs funcs) { + this.funcs = funcs; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FluxSuggestions fluxSuggestions = (FluxSuggestions) o; + return Objects.equals(this.funcs, fluxSuggestions.funcs); + } + + @Override + public int hashCode() { + return Objects.hash(funcs); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FluxSuggestions {\n"); + sb.append(" funcs: ").append(toIndentedString(funcs)).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/org/influxdata/client/domain/FluxSuggestionsFuncs.java b/client/src/generated/java/org/influxdata/client/domain/FluxSuggestionsFuncs.java new file mode 100644 index 00000000000..91f587dfa93 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/FluxSuggestionsFuncs.java @@ -0,0 +1,118 @@ +/* + * 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 org.influxdata.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; + +/** + * FluxSuggestionsFuncs + */ + +public class FluxSuggestionsFuncs { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name = null; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + @SerializedName(SERIALIZED_NAME_PARAMS) + private Object params = null; + + public FluxSuggestionsFuncs 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 FluxSuggestionsFuncs params(Object params) { + this.params = params; + return this; + } + + /** + * Get params + * @return params + **/ + @ApiModelProperty(value = "") + public Object getParams() { + return params; + } + + public void setParams(Object params) { + this.params = params; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FluxSuggestionsFuncs fluxSuggestionsFuncs = (FluxSuggestionsFuncs) o; + return Objects.equals(this.name, fluxSuggestionsFuncs.name) && + Objects.equals(this.params, fluxSuggestionsFuncs.params); + } + + @Override + public int hashCode() { + return Objects.hash(name, params); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FluxSuggestionsFuncs {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).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/org/influxdata/client/domain/IsOnboarding.java b/client/src/generated/java/org/influxdata/client/domain/IsOnboarding.java new file mode 100644 index 00000000000..c1d064a445c --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/IsOnboarding.java @@ -0,0 +1,94 @@ +/* + * 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 org.influxdata.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; + +/** + * IsOnboarding + */ + +public class IsOnboarding { + public static final String SERIALIZED_NAME_ALLOWED = "allowed"; + @SerializedName(SERIALIZED_NAME_ALLOWED) + private Boolean allowed = null; + + public IsOnboarding allowed(Boolean allowed) { + this.allowed = allowed; + return this; + } + + /** + * true means that the influxdb instance has NOT had initial setup; false means that the database has been setup. + * @return allowed + **/ + @ApiModelProperty(value = "true means that the influxdb instance has NOT had initial setup; false means that the database has been setup.") + public Boolean isAllowed() { + return allowed; + } + + public void setAllowed(Boolean allowed) { + this.allowed = allowed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IsOnboarding isOnboarding = (IsOnboarding) o; + return Objects.equals(this.allowed, isOnboarding.allowed); + } + + @Override + public int hashCode() { + return Objects.hash(allowed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IsOnboarding {\n"); + sb.append(" allowed: ").append(toIndentedString(allowed)).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/org/influxdata/client/domain/Label.java b/client/src/generated/java/org/influxdata/client/domain/Label.java new file mode 100644 index 00000000000..20ea70f1a92 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Label.java @@ -0,0 +1,159 @@ +/* + * 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 org.influxdata.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; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Label + */ + +public class Label { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id = null; + + public static final String SERIALIZED_NAME_ORG_I_D = "orgID"; + @SerializedName(SERIALIZED_NAME_ORG_I_D) + private String orgID = null; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name = null; + + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Map properties = new HashMap<>(); + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public String getId() { + return id; + } + + /** + * Get orgID + * @return orgID + **/ + @ApiModelProperty(value = "") + public String getOrgID() { + return orgID; + } + + public Label 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 Label properties(Map properties) { + this.properties = properties; + return this; + } + + public Label putPropertiesItem(String key, String propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + * @return properties + **/ + @ApiModelProperty(example = "{\"color\":\"ffb3b3\",\"description\":\"this is a description\"}", value = "Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value.") + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Label label = (Label) o; + return Objects.equals(this.id, label.id) && + Objects.equals(this.orgID, label.orgID) && + Objects.equals(this.name, label.name) && + Objects.equals(this.properties, label.properties); + } + + @Override + public int hashCode() { + return Objects.hash(id, orgID, name, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Label {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" orgID: ").append(toIndentedString(orgID)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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/org/influxdata/client/domain/LabelCreateRequest.java b/client/src/generated/java/org/influxdata/client/domain/LabelCreateRequest.java new file mode 100644 index 00000000000..63cab440d21 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/LabelCreateRequest.java @@ -0,0 +1,153 @@ +/* + * 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 org.influxdata.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; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * LabelCreateRequest + */ + +public class LabelCreateRequest { + public static final String SERIALIZED_NAME_ORG_I_D = "orgID"; + @SerializedName(SERIALIZED_NAME_ORG_I_D) + private String orgID = null; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name = null; + + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Map properties = new HashMap<>(); + + public LabelCreateRequest orgID(String orgID) { + this.orgID = orgID; + return this; + } + + /** + * Get orgID + * @return orgID + **/ + @ApiModelProperty(required = true, value = "") + public String getOrgID() { + return orgID; + } + + public void setOrgID(String orgID) { + this.orgID = orgID; + } + + public LabelCreateRequest 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 LabelCreateRequest properties(Map properties) { + this.properties = properties; + return this; + } + + public LabelCreateRequest putPropertiesItem(String key, String propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + * @return properties + **/ + @ApiModelProperty(example = "{\"color\":\"ffb3b3\",\"description\":\"this is a description\"}", value = "Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value.") + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LabelCreateRequest labelCreateRequest = (LabelCreateRequest) o; + return Objects.equals(this.orgID, labelCreateRequest.orgID) && + Objects.equals(this.name, labelCreateRequest.name) && + Objects.equals(this.properties, labelCreateRequest.properties); + } + + @Override + public int hashCode() { + return Objects.hash(orgID, name, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LabelCreateRequest {\n"); + sb.append(" orgID: ").append(toIndentedString(orgID)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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/org/influxdata/client/domain/LabelMapping.java b/client/src/generated/java/org/influxdata/client/domain/LabelMapping.java new file mode 100644 index 00000000000..2abe03ba0e4 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/LabelMapping.java @@ -0,0 +1,94 @@ +/* + * 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 org.influxdata.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; + +/** + * LabelMapping + */ + +public class LabelMapping { + public static final String SERIALIZED_NAME_LABEL_I_D = "labelID"; + @SerializedName(SERIALIZED_NAME_LABEL_I_D) + private String labelID = null; + + public LabelMapping labelID(String labelID) { + this.labelID = labelID; + return this; + } + + /** + * Get labelID + * @return labelID + **/ + @ApiModelProperty(value = "") + public String getLabelID() { + return labelID; + } + + public void setLabelID(String labelID) { + this.labelID = labelID; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LabelMapping labelMapping = (LabelMapping) o; + return Objects.equals(this.labelID, labelMapping.labelID); + } + + @Override + public int hashCode() { + return Objects.hash(labelID); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LabelMapping {\n"); + sb.append(" labelID: ").append(toIndentedString(labelID)).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/org/influxdata/client/domain/LabelResponse.java b/client/src/generated/java/org/influxdata/client/domain/LabelResponse.java new file mode 100644 index 00000000000..e37177aebb6 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/LabelResponse.java @@ -0,0 +1,120 @@ +/* + * 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 org.influxdata.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; +import org.influxdata.client.domain.Label; +import org.influxdata.client.domain.Links; + +/** + * LabelResponse + */ + +public class LabelResponse { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private Label label = null; + + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Links links = null; + + public LabelResponse label(Label label) { + this.label = label; + return this; + } + + /** + * Get label + * @return label + **/ + @ApiModelProperty(value = "") + public Label getLabel() { + return label; + } + + public void setLabel(Label label) { + this.label = label; + } + + public LabelResponse links(Links links) { + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @ApiModelProperty(value = "") + public Links getLinks() { + return links; + } + + public void setLinks(Links links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LabelResponse labelResponse = (LabelResponse) o; + return Objects.equals(this.label, labelResponse.label) && + Objects.equals(this.links, labelResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(label, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LabelResponse {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).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/org/influxdata/client/domain/LabelUpdate.java b/client/src/generated/java/org/influxdata/client/domain/LabelUpdate.java new file mode 100644 index 00000000000..505dede5676 --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/LabelUpdate.java @@ -0,0 +1,118 @@ +/* + * 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 org.influxdata.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; + +/** + * LabelUpdate + */ + +public class LabelUpdate { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name = null; + + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Object properties = null; + + public LabelUpdate 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 LabelUpdate properties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + * @return properties + **/ + @ApiModelProperty(example = "{\"color\":\"ffb3b3\",\"description\":\"this is a description\"}", value = "Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value.") + public Object getProperties() { + return properties; + } + + public void setProperties(Object properties) { + this.properties = properties; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LabelUpdate labelUpdate = (LabelUpdate) o; + return Objects.equals(this.name, labelUpdate.name) && + Objects.equals(this.properties, labelUpdate.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LabelUpdate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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/org/influxdata/client/domain/Labels.java b/client/src/generated/java/org/influxdata/client/domain/Labels.java new file mode 100644 index 00000000000..cf9dc19c59e --- /dev/null +++ b/client/src/generated/java/org/influxdata/client/domain/Labels.java @@ -0,0 +1,66 @@ +/* + * 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 org.influxdata.client.domain; + +import java.util.Objects; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import org.influxdata.client.domain.Label; + +/** + * Labels + */ + +public class Labels extends ArrayList