├── client-scala ├── cross │ ├── 2.12 │ │ └── src │ └── 2.13 │ │ └── src └── src │ └── test │ ├── resources │ └── influx2.properties │ └── scala │ └── com │ └── influxdb │ └── client │ └── scala │ ├── AbstractITQueryScalaApi.scala │ └── InfluxDBUtils.scala ├── client-legacy └── src │ ├── main │ ├── resources │ │ └── PLACEHOLDER │ └── java │ │ └── com │ │ └── influxdb │ │ └── client │ │ └── flux │ │ └── internal │ │ └── FluxService.java │ └── test │ ├── resources │ └── PLACEHOLDER │ └── java │ └── com │ └── influxdb │ └── client │ └── flux │ ├── FluxClientFactoryTest.java │ └── FluxClientPingTest.java ├── client-reactive └── src │ ├── main │ └── resources │ │ └── PLACEHOLDER │ └── test │ └── resources │ └── influx2.properties ├── client-core └── src │ ├── test │ └── java │ │ └── com │ │ └── influxdb │ │ └── query │ │ └── PLACEHOLDER │ └── main │ └── java │ └── com │ └── influxdb │ ├── annotations │ ├── Measurement.java │ └── Column.java │ ├── exceptions │ ├── ForbiddenException.java │ ├── NotFoundException.java │ ├── BadGatewayException.java │ ├── BadRequestException.java │ ├── UnauthorizedException.java │ ├── NotAcceptableException.java │ ├── NotImplementedException.java │ ├── PaymentRequiredException.java │ ├── RequestTimeoutException.java │ ├── MethodNotAllowedException.java │ ├── GatewayTimeoutException.java │ ├── ServiceUnavailableException.java │ ├── InternalServerErrorException.java │ ├── RequestEntityTooLargeException.java │ ├── ProxyAuthenticationRequiredException.java │ └── UnprocessableEntityException.java │ ├── Cancellable.java │ ├── query │ └── exceptions │ │ ├── FluxCsvParserException.java │ │ └── FluxQueryException.java │ └── LogLevel.java ├── client-test └── src │ ├── test │ └── java │ │ └── com │ │ └── influxdb │ │ └── test │ │ └── PLACEHOLDER │ └── main │ └── java │ └── com │ └── influxdb │ └── test │ └── MockServerExtension.java ├── scripts ├── site │ ├── markdown │ │ └── structure.md │ └── resources │ │ └── images │ │ └── influxdb-client-java.png ├── license_header.txt ├── logging.properties ├── deploy-snapshot.sh ├── influxdb-onboarding.sh ├── influxdb.conf └── deploy-settings.xml ├── codecov.yml ├── spring └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ └── java │ └── com │ └── influxdb │ └── spring │ └── influx │ └── InfluxDB2OkHttpClientBuilderProvider.java ├── .gitignore ├── .github ├── workflows │ └── semantic.yml ├── PULL_REQUEST_TEMPLATE ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── dependabot.yml ├── client └── src │ ├── generated │ └── java │ │ └── com │ │ └── influxdb │ │ └── client │ │ ├── service │ │ ├── MetricsService.java │ │ ├── RoutesService.java │ │ ├── ReadyService.java │ │ ├── HealthService.java │ │ ├── ConfigService.java │ │ ├── ResourcesService.java │ │ ├── SignoutService.java │ │ ├── PingService.java │ │ ├── TelegrafPluginsService.java │ │ ├── RulesService.java │ │ ├── SigninService.java │ │ ├── InfluxQLQueryService.java │ │ ├── DeleteService.java │ │ ├── SetupService.java │ │ └── ViewsService.java │ │ └── domain │ │ ├── Node.java │ │ ├── Check.java │ │ ├── NotificationRule.java │ │ ├── PropertyKey.java │ │ ├── NotificationEndpoint.java │ │ ├── VariableProperties.java │ │ ├── Threshold.java │ │ ├── SchemaType.java │ │ ├── ScriptLanguage.java │ │ ├── AxisScale.java │ │ ├── QueryEditMode.java │ │ ├── XYGeom.java │ │ ├── TaskStatusType.java │ │ ├── Statement.java │ │ ├── WritePrecision.java │ │ ├── HTTPNotificationRule.java │ │ ├── SMTPNotificationRule.java │ │ ├── SlackNotificationRule.java │ │ ├── WriteConsistency.java │ │ ├── TelegramNotificationRule.java │ │ ├── PagerDutyNotificationRule.java │ │ ├── CheckStatusLevel.java │ │ └── RuleStatusLevel.java │ ├── main │ └── java │ │ └── com │ │ └── influxdb │ │ └── client │ │ ├── write │ │ └── events │ │ │ ├── ListenerRegistration.java │ │ │ ├── AbstractWriteEvent.java │ │ │ └── EventListener.java │ │ └── InvokableScriptsQuery.java │ └── test │ ├── java │ └── com │ │ └── influxdb │ │ └── client │ │ ├── GeneratedCodeTest.java │ │ ├── internal │ │ └── AbstractInfluxDBClientTest.java │ │ └── MockLogHandler.java │ └── resources │ └── influx2.properties ├── LICENSE ├── client-osgi ├── README.md └── src │ └── test │ ├── resources │ └── logback-test.xml │ └── java │ └── com │ └── influxdb │ └── client │ └── osgi │ └── ITConnectionTest.java ├── client-kotlin └── src │ └── test │ ├── resources │ └── influx2.properties │ └── kotlin │ └── com │ └── influxdb │ └── client │ └── kotlin │ └── AbstractITInfluxDBClientKotlin.kt ├── flux-dsl └── src │ ├── main │ └── java │ │ └── com │ │ └── influxdb │ │ └── query │ │ └── dsl │ │ ├── HasImports.java │ │ ├── IsVariableAssignment.java │ │ ├── Expression.java │ │ ├── functions │ │ ├── FirstFlux.java │ │ ├── ArrayFromFlux.java │ │ ├── ToIntFlux.java │ │ ├── ToBoolFlux.java │ │ ├── ToTimeFlux.java │ │ ├── ToFloatFlux.java │ │ ├── ToUIntFlux.java │ │ ├── ToStringFlux.java │ │ └── ToDurationFlux.java │ │ └── utils │ │ └── ImportUtils.java │ └── test │ └── java │ └── com │ └── influxdb │ └── query │ └── dsl │ └── functions │ ├── FirstFluxTest.java │ ├── ToIntFluxTest.java │ ├── ToBoolFluxTest.java │ ├── ToTimeFluxTest.java │ ├── ToUIntFluxTest.java │ ├── ToFloatFluxTest.java │ ├── ToStringFluxTest.java │ ├── ToDurationFluxTest.java │ ├── TruncateTimeColumnTest.java │ ├── ExpressionFluxTest.java │ ├── YieldFluxTest.java │ └── SetFluxTest.java ├── examples └── src │ └── main │ └── java │ └── example │ ├── Cpu.java │ ├── FluxDslExample.java │ ├── RawQuery.java │ └── KotlinQueryRaw.kt └── karaf └── karaf-features └── src └── main └── feature └── feature.xml /client-scala/cross/2.12/src: -------------------------------------------------------------------------------- 1 | ../../src -------------------------------------------------------------------------------- /client-scala/cross/2.13/src: -------------------------------------------------------------------------------- 1 | ../../src -------------------------------------------------------------------------------- /client-legacy/src/main/resources/PLACEHOLDER: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client-legacy/src/test/resources/PLACEHOLDER: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client-reactive/src/main/resources/PLACEHOLDER: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client-core/src/test/java/com/influxdb/query/PLACEHOLDER: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client-test/src/test/java/com/influxdb/test/PLACEHOLDER: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/site/markdown/structure.md: -------------------------------------------------------------------------------- 1 | ![influxdb-client-java](./images/influxdb-client-java.png "influxdb-client-java") -------------------------------------------------------------------------------- /scripts/site/resources/images/influxdb-client-java.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/influxdata/influxdb-client-java/HEAD/scripts/site/resources/images/influxdb-client-java.png -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | allow_coverage_offsets: True 2 | ignore: 3 | - "client/src/generated/java/com/influxdb/client/**/*" 4 | - "client/src/generated/java/com/influxdb/client/JSON.java" 5 | -------------------------------------------------------------------------------- /spring/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | com.influxdb.spring.health.InfluxDB2HealthIndicatorAutoConfiguration 2 | com.influxdb.spring.influx.InfluxDB2AutoConfiguration 3 | com.influxdb.spring.influx.InfluxDB2AutoConfigurationReactive -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Maven 2 | **/target/** 3 | .m2/** 4 | tree.txt 5 | 6 | # IntelliJ 7 | .idea/** 8 | *.iml 9 | 10 | .java-version 11 | 12 | **nightly** 13 | **/influxd.bolt 14 | 15 | **/.openapi-generator* 16 | **/swagger2.yml 17 | **/response.json 18 | **/test.txt 19 | 20 | # Mac OS 21 | .DS_Store 22 | client/.DS_Store -------------------------------------------------------------------------------- /.github/workflows/semantic.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Semantic PR and Commit Messages" 3 | 4 | on: 5 | pull_request: 6 | types: [opened, reopened, synchronize, edited] 7 | branches: 8 | - master 9 | 10 | jobs: 11 | semantic: 12 | uses: influxdata/validate-semantic-github-messages/.github/workflows/semantic.yml@main 13 | with: 14 | CHECK_PR_TITLE_OR_ONE_COMMIT: true 15 | 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE: -------------------------------------------------------------------------------- 1 | Closes # 2 | 3 | ## Proposed Changes 4 | 5 | _Briefly describe your proposed changes:_ 6 | 7 | ## Checklist 8 | 9 | 10 | 11 | - [ ] CHANGELOG.md updated 12 | - [ ] Rebased/mergeable 13 | - [ ] A test has been added if appropriate 14 | - [ ] `mvn test` completes successfully 15 | - [ ] Commit messages are [conventional](https://www.conventionalcommits.org/en/v1.0.0/) 16 | - [ ] Sign [CLA](https://www.influxdata.com/legal/cla/) (if not already signed) 17 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/MetricsService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | public interface MetricsService { 17 | /** 18 | * Get metrics of an instance 19 | * 20 | * @param zapTraceSpan OpenTracing span context (optional) 21 | * @return Call<String> 22 | */ 23 | @GET("metrics") 24 | Call getMetrics( 25 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 26 | ); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/RoutesService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Routes; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public interface RoutesService { 18 | /** 19 | * List all top level routes 20 | * 21 | * @param zapTraceSpan OpenTracing span context (optional) 22 | * @return Call<Routes> 23 | */ 24 | @GET("api/v2/") 25 | Call getRoutes( 26 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 27 | ); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/ReadyService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Ready; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public interface ReadyService { 18 | /** 19 | * Get the readiness of an instance at startup 20 | * 21 | * @param zapTraceSpan OpenTracing span context (optional) 22 | * @return Call<Ready> 23 | */ 24 | @GET("ready") 25 | Call getReady( 26 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 27 | ); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/HealthService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.HealthCheck; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public interface HealthService { 18 | /** 19 | * Get the health of an instance 20 | * 21 | * @param zapTraceSpan OpenTracing span context (optional) 22 | * @return Call<HealthCheck> 23 | */ 24 | @GET("health") 25 | Call getHealth( 26 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 27 | ); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/ConfigService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Config; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public interface ConfigService { 18 | /** 19 | * Get the run-time configuration of the instance 20 | * 21 | * @param zapTraceSpan OpenTracing span context (optional) 22 | * @return Call<Config> 23 | */ 24 | @GET("api/v2/config") 25 | Call getConfig( 26 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 27 | ); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/ResourcesService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Error; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public interface ResourcesService { 18 | /** 19 | * List all known resources 20 | * 21 | * @param zapTraceSpan OpenTracing span context (optional) 22 | * @return Call<List<String>> 23 | */ 24 | @GET("api/v2/resources") 25 | Call> getResources( 26 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 27 | ); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/SignoutService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Error; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public interface SignoutService { 18 | /** 19 | * Expire the current UI session 20 | * Expires the current UI session for the user. 21 | * @param zapTraceSpan OpenTracing span context (optional) 22 | * @return Call<Void> 23 | */ 24 | @POST("api/v2/signout") 25 | Call postSignout( 26 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 27 | ); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Opening a feature request kicks off a discussion 4 | --- 5 | 6 | 14 | 15 | __Proposal:__ 16 | Short summary of the feature. 17 | 18 | __Current behavior:__ 19 | Describe what currently happens. 20 | 21 | __Desired behavior:__ 22 | Describe what you want. 23 | 24 | __Alternatives considered:__ 25 | Describe other solutions or features you considered. 26 | 27 | __Use case:__ 28 | Why is this important (helps with prioritizing requests)? 29 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/PingService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | public interface PingService { 17 | /** 18 | * Checks the status of InfluxDB instance and version of InfluxDB. 19 | * 20 | * @return Call<ResponseBody> 21 | */ 22 | @GET("ping") 23 | Call getPing(); 24 | 25 | 26 | /** 27 | * Checks the status of InfluxDB instance and version of InfluxDB. 28 | * 29 | * @return Call<ResponseBody> 30 | */ 31 | @HEAD("ping") 32 | Call headPing(); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/TelegrafPluginsService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Error; 11 | import com.influxdb.client.domain.TelegrafPlugins; 12 | 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | public interface TelegrafPluginsService { 19 | /** 20 | * List all Telegraf plugins 21 | * 22 | * @param zapTraceSpan OpenTracing span context (optional) 23 | * @param type The type of plugin desired. (optional) 24 | * @return Call<TelegrafPlugins> 25 | */ 26 | @GET("api/v2/telegraf/plugins") 27 | Call getTelegrafPlugins( 28 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan, @retrofit2.http.Query("type") String type 29 | ); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/RulesService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Error; 11 | import com.influxdb.client.domain.FluxResponse; 12 | 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | public interface RulesService { 19 | /** 20 | * Retrieve a notification rule query 21 | * 22 | * @param ruleID The notification rule ID. (required) 23 | * @param zapTraceSpan OpenTracing span context (optional) 24 | * @return Call<FluxResponse> 25 | */ 26 | @GET("api/v2/notificationRules/{ruleID}/query") 27 | Call getNotificationRulesIDQuery( 28 | @retrofit2.http.Path("ruleID") String ruleID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 29 | ); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | --- 5 | 6 | 17 | 18 | __Steps to reproduce:__ 19 | List the minimal actions needed to reproduce the behavior. 20 | 21 | 1. ... 22 | 2. ... 23 | 3. ... 24 | 25 | __Expected behavior:__ 26 | Describe what you expected to happen. 27 | 28 | __Actual behavior:__ 29 | Describe What actually happened. 30 | 31 | __Specifications:__ 32 | - Client Version: 33 | - InfluxDB Version: 34 | - JDK Version: 35 | - Platform: 36 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/SigninService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Error; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | public interface SigninService { 18 | /** 19 | * Create a user session. 20 | * Authenticates ***Basic Auth*** credentials for a user. If successful, creates a new UI session for the user. 21 | * @param zapTraceSpan OpenTracing span context (optional) 22 | * @param authorization An auth credential for the Basic scheme (optional) 23 | * @return Call<Void> 24 | */ 25 | @POST("api/v2/signin") 26 | Call postSignin( 27 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan, @retrofit2.http.Header("Authorization") String authorization 28 | ); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/InfluxQLQueryService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | import okhttp3.ResponseBody; 6 | import retrofit2.Call; 7 | import retrofit2.http.*; 8 | 9 | public interface InfluxQLQueryService { 10 | 11 | /** 12 | * @param db Bucket to query (required) 13 | * @param query (required) 14 | * @param retentionPolicy Retention policy name (optional) 15 | * @param zapTraceSpan OpenTracing span context (optional) 16 | * @return response in csv format 17 | */ 18 | @Headers({"Content-Type:application/x-www-form-urlencoded"}) 19 | @FormUrlEncoded 20 | @POST("query") 21 | Call query( 22 | @Field("q") String query, 23 | @Nonnull @Query("db") String db, 24 | @Query("rp") String retentionPolicy, 25 | @Query("epoch") String epoch, 26 | @Header("Zap-Trace-Span") String zapTraceSpan, 27 | @Header("Accept") String accept 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /scripts/license_header.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Influxdata, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /client-osgi/README.md: -------------------------------------------------------------------------------- 1 | # OSGi Client Bundle for InfluxDB 2.x 2 | 3 | [![javadoc](https://img.shields.io/badge/javadoc-link-brightgreen.svg)](https://influxdata.github.io/influxdb-client-java/influxdb-client-osgi/apidocs/index.html) 4 | 5 | OSGi (R6) client bundle contains InfluxDB 2.x client and dependencies excluding Kotlin and JSR-305 (FindBugs). 6 | 7 | ## Services 8 | 9 | The following declarative services are implemented by OSGi Client Bundle: InfluxDBConnector, LineProtocolWriter and PointWriter. 10 | 11 | See [JavaDoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-osgi/apidocs/index.html) for details. 12 | 13 | ## Configuration 14 | 15 | Metadata are generated for declarative services, so administration UIs (i.e. Apache Karaf [web console](https://karaf.apache.org/manual/latest/webconsole) or [Hawtio](https://hawt.io/)) support specifying configurations in a type safe way: 16 | 17 | - com.influxdb.client.osgi.InfluxDBConnector 18 | - com.influxdb.client.osgi.LineProtocolWriter 19 | - com.influxdb.client.osgi.PointWriter 20 | 21 | See [JavaDoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-osgi/apidocs/index.html) for details. 22 | -------------------------------------------------------------------------------- /client-kotlin/src/test/resources/influx2.properties: -------------------------------------------------------------------------------- 1 | # 2 | # The MIT License 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | # THE SOFTWARE. 21 | # 22 | 23 | influx2.url=http://localhost:9999 24 | influx2.org=my-org 25 | influx2.bucket=my-bucket 26 | influx2.token=my-token 27 | influx2.logLevel=BASIC 28 | influx2.readTimeout=5s 29 | influx2.writeTimeout=1m 30 | influx2.connectTimeout=5s -------------------------------------------------------------------------------- /client-scala/src/test/resources/influx2.properties: -------------------------------------------------------------------------------- 1 | # 2 | # The MIT License 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | # THE SOFTWARE. 21 | # 22 | 23 | influx2.url=http://localhost:9999 24 | influx2.org=my-org 25 | influx2.bucket=my-bucket 26 | influx2.token=my-token 27 | influx2.logLevel=BODY 28 | influx2.readTimeout=5s 29 | influx2.writeTimeout=10s 30 | influx2.connectTimeout=18s -------------------------------------------------------------------------------- /client-reactive/src/test/resources/influx2.properties: -------------------------------------------------------------------------------- 1 | # 2 | # The MIT License 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | # THE SOFTWARE. 21 | # 22 | 23 | influx2.url=http://localhost:9999 24 | influx2.org=my-org 25 | influx2.bucket=my-bucket 26 | influx2.token=my-token 27 | influx2.logLevel=BODY 28 | influx2.readTimeout=5s 29 | influx2.writeTimeout=10s 30 | influx2.connectTimeout=5s -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # 2 | # The MIT License 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | # THE SOFTWARE. 21 | # 22 | 23 | version: 2 24 | updates: 25 | - package-ecosystem: "maven" 26 | directory: "/" 27 | schedule: 28 | interval: "monthly" 29 | open-pull-requests-limit: 10 30 | ignore: 31 | - dependency-name: "org.scala-lang:scala-library" 32 | update-types: ["version-update:semver-major", "version-update:semver-minor"] 33 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/HasImports.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl; 23 | 24 | import java.util.Set; 25 | 26 | /** 27 | * Marker interface indicating existence of potential imports. 28 | */ 29 | public interface HasImports { 30 | /** 31 | * @return the imports 32 | */ 33 | Set getImports(); 34 | } 35 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/DeleteService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.DeletePredicateRequest; 11 | import com.influxdb.client.domain.Error; 12 | 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | public interface DeleteService { 19 | /** 20 | * Delete data 21 | * 22 | * @param deletePredicateRequest Deletes data from an InfluxDB bucket. (required) 23 | * @param zapTraceSpan OpenTracing span context (optional) 24 | * @param org Specifies the organization to delete data from. (optional) 25 | * @param bucket Specifies the bucket to delete data from. (optional) 26 | * @param orgID Specifies the organization ID of the resource. (optional) 27 | * @param bucketID Specifies the bucket ID to delete data from. (optional) 28 | * @return Call<Void> 29 | */ 30 | @Headers({ 31 | "Content-Type:application/json" 32 | }) 33 | @POST("api/v2/delete") 34 | Call postDelete( 35 | @retrofit2.http.Body DeletePredicateRequest deletePredicateRequest, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan, @retrofit2.http.Query("org") String org, @retrofit2.http.Query("bucket") String bucket, @retrofit2.http.Query("orgID") String orgID, @retrofit2.http.Query("bucketID") String bucketID 36 | ); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /scripts/logging.properties: -------------------------------------------------------------------------------- 1 | # 2 | # The MIT License 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | # THE SOFTWARE. 21 | # 22 | 23 | handlers=java.util.logging.ConsoleHandler 24 | .level=INFO 25 | 26 | java.util.logging.ConsoleHandler.level = ALL 27 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 28 | java.util.logging.SimpleFormatter.format=[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS] [%4$s] [%2$s]: %5$s%6$s%n 29 | 30 | com.influxdb.level=FINEST 31 | com.influxdb.handler=java.util.logging.ConsoleHandler -------------------------------------------------------------------------------- /client/src/main/java/com/influxdb/client/write/events/ListenerRegistration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.write.events; 23 | 24 | /** 25 | * Represent a listener registration. 26 | * 27 | * @author Jakub Bednar (bednar@github) (10/12/2018 09:31) 28 | */ 29 | public interface ListenerRegistration { 30 | 31 | /** 32 | * Dispose the listener registration. The repeatable calls has no effect. 33 | */ 34 | void dispose(); 35 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/SetupService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.IsOnboarding; 11 | import com.influxdb.client.domain.OnboardingRequest; 12 | import com.influxdb.client.domain.OnboardingResponse; 13 | 14 | import java.util.ArrayList; 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | public interface SetupService { 20 | /** 21 | * Check if database has default user, org, bucket 22 | * Returns `true` if no default user, organization, or bucket has been created. 23 | * @param zapTraceSpan OpenTracing span context (optional) 24 | * @return Call<IsOnboarding> 25 | */ 26 | @GET("api/v2/setup") 27 | Call getSetup( 28 | @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 29 | ); 30 | 31 | /** 32 | * Set up initial user, org and bucket 33 | * Post an onboarding request to set up initial user, org and bucket. 34 | * @param onboardingRequest Source to create (required) 35 | * @param zapTraceSpan OpenTracing span context (optional) 36 | * @return Call<OnboardingResponse> 37 | */ 38 | @Headers({ 39 | "Content-Type:application/json" 40 | }) 41 | @POST("api/v2/setup") 42 | Call postSetup( 43 | @retrofit2.http.Body OnboardingRequest onboardingRequest, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 44 | ); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /client/src/test/java/com/influxdb/client/GeneratedCodeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client; 23 | 24 | import com.influxdb.client.domain.File; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (26/08/2021 6:24) 31 | */ 32 | class GeneratedCodeTest { 33 | @Test 34 | void adapterCanBeInstantiateWithoutParameters() { 35 | Assertions.assertThat(new File.FileBodyAdapter()).isNotNull(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /scripts/deploy-snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # The MIT License 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in 13 | # all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | # THE SOFTWARE. 22 | # 23 | 24 | 25 | set -e 26 | 27 | #Parse project version from pom.xml 28 | export PROJECT_VERSION=$(xmllint --xpath "//*[local-name()='project']/*[local-name()='version']/text()" pom.xml) 29 | echo "Project version: $PROJECT_VERSION" 30 | 31 | #Skip if not *SNAPSHOT 32 | if [[ $PROJECT_VERSION != *SNAPSHOT ]]; then 33 | echo "$PROJECT_VERSION is not SNAPSHOT - skip deploy."; 34 | exit; 35 | fi 36 | 37 | mvn clean deploy -DskipTests -s scripts/deploy-settings.xml 38 | -------------------------------------------------------------------------------- /client/src/main/java/com/influxdb/client/write/events/AbstractWriteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.write.events; 23 | 24 | import com.influxdb.client.WriteApi; 25 | 26 | /** 27 | * The Base event triggered by {@link WriteApi}. 28 | * 29 | * @author Jakub Bednar (bednar@github) (26/06/2018 13:58) 30 | */ 31 | public abstract class AbstractWriteEvent { 32 | 33 | /** 34 | * Log current event by {@link java.util.logging.Logger}. 35 | */ 36 | public abstract void logEvent(); 37 | } 38 | -------------------------------------------------------------------------------- /client/src/test/resources/influx2.properties: -------------------------------------------------------------------------------- 1 | # 2 | # The MIT License 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | # THE SOFTWARE. 21 | # 22 | 23 | influx2.url=http://localhost:9999 24 | influx2.org=my-org 25 | influx2.bucket=my-bucket 26 | influx2.token=my-token 27 | influx2.logLevel=BODY 28 | influx2.readTimeout=5s 29 | influx2.writeTimeout=10s 30 | influx2.connectTimeout=5s 31 | influx2.precision=US 32 | influx2.consistency=QUORUM 33 | influx2.clientType=properties-service 34 | 35 | influx2.tags.id = 132-987-655 36 | influx2.tags.customer = California Miner 37 | influx2.tags.hostname = ${env.hostname} 38 | influx2.tags.version = ${version} -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/annotations/Measurement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.annotations; 23 | 24 | import java.lang.annotation.ElementType; 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.RetentionPolicy; 27 | import java.lang.annotation.Target; 28 | 29 | /** 30 | * The annotation is used for mapping POJO class into line protocol. 31 | */ 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Target(ElementType.TYPE) 34 | public @interface Measurement { 35 | 36 | String name(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/ForbiddenException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 403 response code arrived - Forbidden. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class ForbiddenException extends InfluxException { 34 | 35 | public ForbiddenException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/NotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 404 response code arrived - Not Found. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class NotFoundException extends InfluxException { 34 | 35 | public NotFoundException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-legacy/src/test/java/com/influxdb/client/flux/FluxClientFactoryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.flux; 23 | 24 | import org.assertj.core.api.Assertions; 25 | import org.junit.jupiter.api.Test; 26 | 27 | /** 28 | * @author Jakub Bednar (bednar@github) (31/07/2018 13:12) 29 | */ 30 | class FluxClientFactoryTest { 31 | 32 | @Test 33 | void connect() { 34 | 35 | FluxClient fluxClient = FluxClientFactory.create("http://localhost:8093"); 36 | 37 | Assertions.assertThat(fluxClient).isNotNull(); 38 | } 39 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/BadGatewayException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 502 response code arrived - Bad Gateway. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class BadGatewayException extends InfluxException { 34 | 35 | public BadGatewayException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 400 response code arrived - Bad Request. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class BadRequestException extends InfluxException { 34 | 35 | public BadRequestException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /examples/src/main/java/example/Cpu.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package example; 23 | 24 | import java.time.Instant; 25 | 26 | import com.influxdb.annotations.Column; 27 | 28 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 29 | 30 | public class Cpu { 31 | 32 | @Column(timestamp = true) 33 | Instant time; 34 | 35 | @Column(name = "_value") 36 | double usage; 37 | 38 | String host; 39 | 40 | @Override 41 | public String toString() { 42 | return ReflectionToStringBuilder.toString(this); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/UnauthorizedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 401 response code arrived - Unauthorized. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class UnauthorizedException extends InfluxException { 34 | 35 | public UnauthorizedException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/NotAcceptableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 406 response code arrived - Not Acceptable. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class NotAcceptableException extends InfluxException { 34 | 35 | public NotAcceptableException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/IsVariableAssignment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.functions.AbstractFunctionCallFlux; 27 | 28 | /** 29 | * Marker interface for variable assignments. 30 | * 31 | * @see AbstractFunctionCallFlux 32 | * @see VariableAssignment 33 | */ 34 | public interface IsVariableAssignment { 35 | 36 | /** 37 | * @return the name of the variable 38 | */ 39 | @Nonnull 40 | String getVariableName(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/NotImplementedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 501 response code arrived - Not Implemented. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class NotImplementedException extends InfluxException { 34 | 35 | public NotImplementedException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/PaymentRequiredException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 402 response code arrived - Payment Required. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class PaymentRequiredException extends InfluxException { 34 | 35 | public PaymentRequiredException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/RequestTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 408 response code arrived - Request Timeout. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class RequestTimeoutException extends InfluxException { 34 | 35 | public RequestTimeoutException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/MethodNotAllowedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 405 response code arrived - Method Not Allowed. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class MethodNotAllowedException extends InfluxException { 34 | 35 | public MethodNotAllowedException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/Node.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.Block; 19 | import com.influxdb.client.domain.Expression; 20 | import com.influxdb.client.domain.Statement; 21 | import java.util.List; 22 | 23 | /** 24 | * Node 25 | */ 26 | 27 | public class Node { 28 | 29 | @Override 30 | public boolean equals(java.lang.Object o) { 31 | if (this == o) { 32 | return true; 33 | } 34 | if (o == null || getClass() != o.getClass()) { 35 | return false; 36 | } 37 | return true; 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | return Objects.hash(); 43 | } 44 | 45 | 46 | @Override 47 | public String toString() { 48 | StringBuilder sb = new StringBuilder(); 49 | sb.append("class Node {\n"); 50 | sb.append("}"); 51 | return sb.toString(); 52 | } 53 | 54 | /** 55 | * Convert the given object to string with each line indented by 4 spaces 56 | * (except the first line). 57 | */ 58 | private String toIndentedString(java.lang.Object o) { 59 | if (o == null) { 60 | return "null"; 61 | } 62 | return o.toString().replace("\n", "\n "); 63 | } 64 | 65 | } 66 | 67 | -------------------------------------------------------------------------------- /client/src/main/java/com/influxdb/client/write/events/EventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.write.events; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | /** 27 | * @author Jakub Bednar (bednar@github) (10/12/2018 09:37) 28 | */ 29 | public interface EventListener extends java.util.EventListener { 30 | 31 | /** 32 | * onEvent will be called with the new value. It's guaranteed 33 | * that the value will be non-null. 34 | * 35 | * @param value The value of the event. 36 | */ 37 | void onEvent(@Nonnull final T value); 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/GatewayTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import org.jetbrains.annotations.Nullable; 25 | import retrofit2.Response; 26 | 27 | /** 28 | * The exception is thrown if an HTTP 504 response code arrived - Gateway Timeout. 29 | * 30 | * @author Jakub Bednar (bednar@github) (06/23/2022 13:16) 31 | */ 32 | public class GatewayTimeoutException extends InfluxException { 33 | 34 | public GatewayTimeoutException(@Nullable final Response cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/ServiceUnavailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 503 response code arrived - Service Unavailable. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class ServiceUnavailableException extends InfluxException { 34 | 35 | public ServiceUnavailableException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/InternalServerErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 500 response code arrived - Internal Server Error. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class InternalServerErrorException extends InfluxException { 34 | 35 | public InternalServerErrorException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/RequestEntityTooLargeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 413 response code arrived - Request Entity Too Large. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/03/2019 11:37) 32 | */ 33 | public class RequestEntityTooLargeException extends InfluxException { 34 | public RequestEntityTooLargeException(@Nullable final Response cause) { 35 | super(cause); 36 | } 37 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/Check.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.CheckDiscriminator; 19 | 20 | /** 21 | * Check 22 | */ 23 | 24 | public class Check extends CheckDiscriminator { 25 | 26 | @Override 27 | public boolean equals(java.lang.Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (o == null || getClass() != o.getClass()) { 32 | return false; 33 | } 34 | return super.equals(o); 35 | } 36 | 37 | @Override 38 | public int hashCode() { 39 | return Objects.hash(super.hashCode()); 40 | } 41 | 42 | 43 | @Override 44 | public String toString() { 45 | StringBuilder sb = new StringBuilder(); 46 | sb.append("class Check {\n"); 47 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 48 | sb.append("}"); 49 | return sb.toString(); 50 | } 51 | 52 | /** 53 | * Convert the given object to string with each line indented by 4 spaces 54 | * (except the first line). 55 | */ 56 | private String toIndentedString(java.lang.Object o) { 57 | if (o == null) { 58 | return "null"; 59 | } 60 | return o.toString().replace("\n", "\n "); 61 | } 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/ProxyAuthenticationRequiredException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * The exception is thrown if a HTTP 407 response code arrived - Proxy Authentication Required. 30 | * 31 | * @author Jakub Bednar (bednar@github) (04/10/2018 13:16) 32 | */ 33 | public class ProxyAuthenticationRequiredException extends InfluxException { 34 | 35 | public ProxyAuthenticationRequiredException(@Nullable final Response cause) { 36 | super(cause); 37 | } 38 | } -------------------------------------------------------------------------------- /spring/src/main/java/com/influxdb/spring/influx/InfluxDB2OkHttpClientBuilderProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.spring.influx; 23 | 24 | import java.util.function.Supplier; 25 | 26 | import okhttp3.OkHttpClient; 27 | 28 | /** 29 | * Provide the {@link okhttp3.OkHttpClient.Builder OkHttpClient.Builder} to use to 30 | * customize the auto-configured {@link com.influxdb.client.InfluxDBClient} instance. 31 | * 32 | * @author Jakub Bednar (bednar@github) (06/05/2019 13:11) 33 | */ 34 | @FunctionalInterface 35 | public interface InfluxDB2OkHttpClientBuilderProvider extends Supplier { 36 | 37 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/Cancellable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb; 23 | 24 | /** 25 | * Asynchronous query that can be cancelled. Cancellation is perform by the {@code cancel} method. 26 | * 27 | * @author Jakub Bednar (bednar@github) (03/10/2018 13:12) 28 | */ 29 | public interface Cancellable { 30 | 31 | /** 32 | * Attempt to cancel execution of this query. 33 | */ 34 | void cancel(); 35 | 36 | /** 37 | * Returns {@link Boolean#TRUE} if query was cancelled. 38 | * 39 | * @return {@link Boolean#TRUE} if query was cancelled 40 | */ 41 | boolean isCancelled(); 42 | } -------------------------------------------------------------------------------- /client-osgi/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 29 | 30 | %black(%d{ISO8601}) %highlight(%-5level) %gray([%t]) %yellow(%C{0}): %msg%n%throwable 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/FirstFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (25/06/2018 09:40) 31 | */ 32 | class FirstFluxTest { 33 | 34 | @Test 35 | void first() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .first(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> first()"); 42 | } 43 | } -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ToIntFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (25/06/2018 16:09) 31 | */ 32 | class ToIntFluxTest { 33 | 34 | @Test 35 | void toInt() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .toInt(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> toInt()"); 42 | } 43 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/NotificationRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.NotificationRuleDiscriminator; 19 | 20 | /** 21 | * NotificationRule 22 | */ 23 | 24 | public class NotificationRule extends NotificationRuleDiscriminator { 25 | 26 | @Override 27 | public boolean equals(java.lang.Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (o == null || getClass() != o.getClass()) { 32 | return false; 33 | } 34 | return super.equals(o); 35 | } 36 | 37 | @Override 38 | public int hashCode() { 39 | return Objects.hash(super.hashCode()); 40 | } 41 | 42 | 43 | @Override 44 | public String toString() { 45 | StringBuilder sb = new StringBuilder(); 46 | sb.append("class NotificationRule {\n"); 47 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 48 | sb.append("}"); 49 | return sb.toString(); 50 | } 51 | 52 | /** 53 | * Convert the given object to string with each line indented by 4 spaces 54 | * (except the first line). 55 | */ 56 | private String toIndentedString(java.lang.Object o) { 57 | if (o == null) { 58 | return "null"; 59 | } 60 | return o.toString().replace("\n", "\n "); 61 | } 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/PropertyKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.Identifier; 19 | import com.influxdb.client.domain.StringLiteral; 20 | 21 | /** 22 | * PropertyKey 23 | */ 24 | 25 | public class PropertyKey extends Expression { 26 | 27 | @Override 28 | public boolean equals(java.lang.Object o) { 29 | if (this == o) { 30 | return true; 31 | } 32 | if (o == null || getClass() != o.getClass()) { 33 | return false; 34 | } 35 | return super.equals(o); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return Objects.hash(super.hashCode()); 41 | } 42 | 43 | 44 | @Override 45 | public String toString() { 46 | StringBuilder sb = new StringBuilder(); 47 | sb.append("class PropertyKey {\n"); 48 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 49 | sb.append("}"); 50 | return sb.toString(); 51 | } 52 | 53 | /** 54 | * Convert the given object to string with each line indented by 4 spaces 55 | * (except the first line). 56 | */ 57 | private String toIndentedString(java.lang.Object o) { 58 | if (o == null) { 59 | return "null"; 60 | } 61 | return o.toString().replace("\n", "\n "); 62 | } 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ToBoolFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (25/06/2018 16:01) 31 | */ 32 | class ToBoolFluxTest { 33 | 34 | @Test 35 | void toBool() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .toBool(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> toBool()"); 42 | } 43 | } -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ToTimeFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (26/06/2018 06:39) 31 | */ 32 | class ToTimeFluxTest { 33 | 34 | @Test 35 | void toTime() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .toTime(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> toTime()"); 42 | } 43 | } -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ToUIntFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (26/06/2018 06:43) 31 | */ 32 | class ToUIntFluxTest { 33 | 34 | @Test 35 | void toUInt() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .toUInt(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> toUInt()"); 42 | } 43 | } -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ToFloatFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (25/06/2018 16:09) 31 | */ 32 | class ToFloatFluxTest { 33 | 34 | @Test 35 | void toFloat() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .toFloat(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> toFloat()"); 42 | } 43 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/service/ViewsService.java: -------------------------------------------------------------------------------- 1 | package com.influxdb.client.service; 2 | 3 | import retrofit2.Call; 4 | import retrofit2.http.*; 5 | 6 | import okhttp3.RequestBody; 7 | import okhttp3.ResponseBody; 8 | import okhttp3.MultipartBody; 9 | 10 | import com.influxdb.client.domain.Error; 11 | import com.influxdb.client.domain.View; 12 | 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | public interface ViewsService { 19 | /** 20 | * Retrieve the view for a cell 21 | * 22 | * @param dashboardID The dashboard ID. (required) 23 | * @param cellID The cell ID. (required) 24 | * @param zapTraceSpan OpenTracing span context (optional) 25 | * @return Call<View> 26 | */ 27 | @GET("api/v2/dashboards/{dashboardID}/cells/{cellID}/view") 28 | Call getDashboardsIDCellsIDView( 29 | @retrofit2.http.Path("dashboardID") String dashboardID, @retrofit2.http.Path("cellID") String cellID, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 30 | ); 31 | 32 | /** 33 | * Update the view for a cell 34 | * 35 | * @param dashboardID The ID of the dashboard to update. (required) 36 | * @param cellID The ID of the cell to update. (required) 37 | * @param view (required) 38 | * @param zapTraceSpan OpenTracing span context (optional) 39 | * @return Call<View> 40 | */ 41 | @Headers({ 42 | "Content-Type:application/json" 43 | }) 44 | @PATCH("api/v2/dashboards/{dashboardID}/cells/{cellID}/view") 45 | Call patchDashboardsIDCellsIDView( 46 | @retrofit2.http.Path("dashboardID") String dashboardID, @retrofit2.http.Path("cellID") String cellID, @retrofit2.http.Body View view, @retrofit2.http.Header("Zap-Trace-Span") String zapTraceSpan 47 | ); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ToStringFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (26/06/2018 06:35) 31 | */ 32 | class ToStringFluxTest { 33 | 34 | @Test 35 | void toBool() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .toStringConvert(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> toString()"); 42 | } 43 | } -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ToDurationFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (26/06/2018 06:30) 31 | */ 32 | class ToDurationFluxTest { 33 | 34 | @Test 35 | void toDuration() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .toDuration(); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> toDuration()"); 42 | } 43 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/NotificationEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.NotificationEndpointDiscriminator; 19 | 20 | /** 21 | * NotificationEndpoint 22 | */ 23 | 24 | public class NotificationEndpoint extends NotificationEndpointDiscriminator { 25 | 26 | @Override 27 | public boolean equals(java.lang.Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (o == null || getClass() != o.getClass()) { 32 | return false; 33 | } 34 | return super.equals(o); 35 | } 36 | 37 | @Override 38 | public int hashCode() { 39 | return Objects.hash(super.hashCode()); 40 | } 41 | 42 | 43 | @Override 44 | public String toString() { 45 | StringBuilder sb = new StringBuilder(); 46 | sb.append("class NotificationEndpoint {\n"); 47 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 48 | sb.append("}"); 49 | return sb.toString(); 50 | } 51 | 52 | /** 53 | * Convert the given object to string with each line indented by 4 spaces 54 | * (except the first line). 55 | */ 56 | private String toIndentedString(java.lang.Object o) { 57 | if (o == null) { 58 | return "null"; 59 | } 60 | return o.toString().replace("\n", "\n "); 61 | } 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/exceptions/UnprocessableEntityException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import retrofit2.Response; 27 | 28 | /** 29 | * Indicates that the server understands the content type of the request entity, and the syntax of the request entity 30 | * is correct, but it was unable to process the contained instructions. 31 | * 32 | * @author Jakub Bednar (bednar@github) (01/02/2019 12:18) 33 | */ 34 | public class UnprocessableEntityException extends InfluxException { 35 | 36 | public UnprocessableEntityException(@Nullable final Response cause) { 37 | super(cause); 38 | } 39 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/VariableProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.ConstantVariableProperties; 19 | import com.influxdb.client.domain.MapVariableProperties; 20 | import com.influxdb.client.domain.QueryVariableProperties; 21 | import java.util.List; 22 | import java.util.Map; 23 | 24 | /** 25 | * VariableProperties 26 | */ 27 | 28 | public class VariableProperties { 29 | 30 | @Override 31 | public boolean equals(java.lang.Object o) { 32 | if (this == o) { 33 | return true; 34 | } 35 | if (o == null || getClass() != o.getClass()) { 36 | return false; 37 | } 38 | return true; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | return Objects.hash(); 44 | } 45 | 46 | 47 | @Override 48 | public String toString() { 49 | StringBuilder sb = new StringBuilder(); 50 | sb.append("class VariableProperties {\n"); 51 | sb.append("}"); 52 | return sb.toString(); 53 | } 54 | 55 | /** 56 | * Convert the given object to string with each line indented by 4 spaces 57 | * (except the first line). 58 | */ 59 | private String toIndentedString(java.lang.Object o) { 60 | if (o == null) { 61 | return "null"; 62 | } 63 | return o.toString().replace("\n", "\n "); 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /client/src/test/java/com/influxdb/client/internal/AbstractInfluxDBClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.internal; 23 | 24 | import com.influxdb.client.InfluxDBClient; 25 | import com.influxdb.client.InfluxDBClientFactory; 26 | import com.influxdb.test.AbstractMockServerTest; 27 | 28 | import org.junit.jupiter.api.BeforeEach; 29 | 30 | /** 31 | * @author Jakub Bednar (bednar@github) (05/09/2018 12:29) 32 | */ 33 | public class AbstractInfluxDBClientTest extends AbstractMockServerTest { 34 | 35 | protected InfluxDBClient influxDBClient; 36 | 37 | @BeforeEach 38 | protected void setUp() { 39 | 40 | influxDBClient = InfluxDBClientFactory.create(startMockServer()); 41 | } 42 | } -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/TruncateTimeColumnTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import java.time.temporal.ChronoUnit; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | import org.assertj.core.api.Assertions; 29 | import org.junit.jupiter.api.Test; 30 | 31 | 32 | class TruncateTimeColumnTest { 33 | 34 | @Test 35 | void truncateTimeColumn() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .truncateTimeColumn(ChronoUnit.SECONDS); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> truncateTimeColumn(unit:1s)"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client-scala/src/test/scala/com/influxdb/client/scala/AbstractITQueryScalaApi.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.scala 23 | 24 | import org.scalatest.BeforeAndAfter 25 | import org.scalatest.funsuite.AnyFunSuite 26 | 27 | /** 28 | * @author Jakub Bednar (bednar@github) (06/11/2018 09:34) 29 | */ 30 | abstract class AbstractITQueryScalaApi extends AnyFunSuite with BeforeAndAfter { 31 | 32 | var influxDBUtils: InfluxDBUtils = _ 33 | 34 | var influxDBClient: InfluxDBClientScala = _ 35 | 36 | def setUp() { 37 | influxDBUtils = new InfluxDBUtils {} 38 | 39 | influxDBClient = InfluxDBClientScalaFactory.create(influxDBUtils.getUrl) 40 | } 41 | 42 | after { 43 | influxDBClient.close() 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/query/exceptions/FluxCsvParserException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import com.influxdb.exceptions.InfluxException; 27 | import com.influxdb.query.FluxColumn; 28 | import com.influxdb.query.FluxRecord; 29 | import com.influxdb.query.FluxTable; 30 | 31 | /** 32 | * The error that occurs during mapping response to {@link FluxTable}, {@link FluxRecord} or {@link FluxColumn}. 33 | * 34 | * @author Jakub Bednar (bednar@github) (02/10/2018 13:00) 35 | */ 36 | public class FluxCsvParserException extends InfluxException { 37 | 38 | public FluxCsvParserException(@Nullable final String message) { 39 | super(message); 40 | } 41 | } -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/LogLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb; 23 | 24 | /** 25 | * This enum represents REST client verbosity levels. 26 | */ 27 | public enum LogLevel { 28 | 29 | /** 30 | * Disable logging. 31 | */ 32 | NONE, 33 | 34 | /** 35 | * Logs request and response lines. 36 | */ 37 | BASIC, 38 | 39 | /** 40 | * Logs request and response lines including headers. 41 | */ 42 | HEADERS, 43 | 44 | /** 45 | * Logs request and response lines including headers and body (if present). 46 | * 47 | * Note that applying the `BODY` LogLevel will disable chunking while streaming 48 | * and will load the whole response into memory. 49 | */ 50 | BODY 51 | } 52 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/query/exceptions/FluxQueryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.exceptions; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | import com.influxdb.exceptions.InfluxException; 27 | 28 | /** 29 | * The error that occurs during execution Flux query. 30 | * 31 | * @author Jakub Bednar (bednar@github) (02/10/2018 12:43) 32 | */ 33 | public class FluxQueryException extends InfluxException { 34 | 35 | private final int reference; 36 | 37 | public FluxQueryException(@Nullable final String message, final int reference) { 38 | super(message); 39 | 40 | this.reference = reference; 41 | } 42 | 43 | @Override 44 | public int reference() { 45 | return reference; 46 | } 47 | } -------------------------------------------------------------------------------- /client-kotlin/src/test/kotlin/com/influxdb/client/kotlin/AbstractITInfluxDBClientKotlin.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.kotlin 23 | 24 | import com.influxdb.test.AbstractTest 25 | import org.junit.jupiter.api.AfterEach 26 | import org.junit.jupiter.api.BeforeEach 27 | 28 | /** 29 | * @author Jakub Bednar (bednar@github) (30/10/2018 09:13) 30 | */ 31 | internal abstract class AbstractITInfluxDBClientKotlin : AbstractTest() { 32 | 33 | internal lateinit var influxDBClient: InfluxDBClientKotlin 34 | 35 | @BeforeEach 36 | protected fun setUp() { 37 | 38 | influxDBClient = InfluxDBClientKotlinFactory.create(influxDb2Url) 39 | } 40 | 41 | @AfterEach 42 | protected fun after() { 43 | 44 | influxDBClient.close() 45 | } 46 | } -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/Expression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl; 23 | 24 | import java.util.Map; 25 | import javax.annotation.Nonnull; 26 | 27 | import com.influxdb.query.dsl.functions.FreestyleExpression; 28 | 29 | /** 30 | * Marker interface for Expressions. 31 | * 32 | * @see com.influxdb.query.dsl.Flux 33 | * @see FreestyleExpression 34 | */ 35 | public interface Expression extends HasImports { 36 | 37 | /** 38 | * @param parameters parameters to resolve 39 | * @param prependImports true, if the imports should be prepended 40 | * @return the string representation of the expression 41 | */ 42 | String toString(@Nonnull final Map parameters, final boolean prependImports); 43 | } 44 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/Threshold.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.CheckStatusLevel; 19 | import com.influxdb.client.domain.GreaterThreshold; 20 | import com.influxdb.client.domain.LesserThreshold; 21 | import com.influxdb.client.domain.RangeThreshold; 22 | 23 | /** 24 | * Threshold 25 | */ 26 | 27 | public class Threshold extends ThresholdBase { 28 | 29 | @Override 30 | public boolean equals(java.lang.Object o) { 31 | if (this == o) { 32 | return true; 33 | } 34 | if (o == null || getClass() != o.getClass()) { 35 | return false; 36 | } 37 | return super.equals(o); 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | return Objects.hash(super.hashCode()); 43 | } 44 | 45 | 46 | @Override 47 | public String toString() { 48 | StringBuilder sb = new StringBuilder(); 49 | sb.append("class Threshold {\n"); 50 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 51 | sb.append("}"); 52 | return sb.toString(); 53 | } 54 | 55 | /** 56 | * Convert the given object to string with each line indented by 4 spaces 57 | * (except the first line). 58 | */ 59 | private String toIndentedString(java.lang.Object o) { 60 | if (o == null) { 61 | return "null"; 62 | } 63 | return o.toString().replace("\n", "\n "); 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /scripts/influxdb-onboarding.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # The MIT License 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in 13 | # all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | # THE SOFTWARE. 22 | # 23 | 24 | set -e 25 | 26 | echo "Wait to start InfluxDB" 27 | wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:8086/ping 28 | 29 | echo "Wait to start InfluxDB 2.x" 30 | wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9999/metrics 31 | 32 | echo 33 | echo "Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)" 34 | echo 35 | curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \ 36 | -d '{ 37 | "username": "my-user", 38 | "password": "my-password", 39 | "org": "my-org", 40 | "bucket": "my-bucket", 41 | "token": "my-token" 42 | }' 43 | -------------------------------------------------------------------------------- /client-test/src/main/java/com/influxdb/test/MockServerExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.test; 23 | 24 | import java.io.IOException; 25 | 26 | import okhttp3.mockwebserver.MockWebServer; 27 | 28 | public final class MockServerExtension { 29 | 30 | public MockWebServer server; 31 | public String baseURL; 32 | 33 | public void start() { 34 | 35 | server = new MockWebServer(); 36 | try { 37 | server.start(); 38 | } catch (IOException e) { 39 | throw new RuntimeException(e); 40 | } 41 | 42 | baseURL = server.url("/").url().toString(); 43 | } 44 | 45 | public void shutdown() throws IOException { 46 | if (server != null) { 47 | server.shutdown(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /examples/src/main/java/example/FluxDslExample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package example; 23 | 24 | import java.time.temporal.ChronoUnit; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | import com.influxdb.query.dsl.functions.restriction.Restrictions; 28 | 29 | @SuppressWarnings("CheckStyle") 30 | public class FluxDslExample { 31 | public static void main(String[] args) { 32 | 33 | Flux sampleFlux = Flux.from("telegraf") 34 | .filter( 35 | Restrictions.and( 36 | Restrictions.measurement().equal("cpu"), 37 | Restrictions.field().equal("usage_system")) 38 | ) 39 | .range(-1L, ChronoUnit.DAYS) 40 | .sample(5, 1); 41 | 42 | System.out.println(sampleFlux.toString()); 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/ExpressionFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (27/06/2018 11:30) 31 | */ 32 | class ExpressionFluxTest { 33 | 34 | @Test 35 | void expression() { 36 | 37 | Flux flux = Flux.from("telegraf") 38 | .expression("map(fn: (r) => r._value * r._value)") 39 | .expression("sum()"); 40 | 41 | String expected = "from(bucket:\"telegraf\") |> map(fn: (r) => r._value * r._value) |> sum()"; 42 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace(expected); 43 | } 44 | } -------------------------------------------------------------------------------- /client-legacy/src/main/java/com/influxdb/client/flux/internal/FluxService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.flux.internal; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import okhttp3.RequestBody; 27 | import okhttp3.ResponseBody; 28 | import retrofit2.Call; 29 | import retrofit2.http.Body; 30 | import retrofit2.http.GET; 31 | import retrofit2.http.Headers; 32 | import retrofit2.http.POST; 33 | import retrofit2.http.Streaming; 34 | 35 | /** 36 | * @author Jakub Bednar (bednar@github) (04/10/2018 07:47) 37 | */ 38 | public interface FluxService { 39 | 40 | @Streaming 41 | @POST("api/v2/query") 42 | @Nonnull 43 | @Headers("Content-Type: application/json") 44 | Call query(@Nonnull @Body final RequestBody query); 45 | 46 | @GET("ping") 47 | Call ping(); 48 | } 49 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/FirstFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Returns the first result of the query. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  * Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .first();
38 |  * 
39 | * 40 | * @author Jakub Bednar (bednar@github) (25/06/2018 09:28) 41 | */ 42 | public final class FirstFlux extends AbstractParametrizedFlux { 43 | 44 | public FirstFlux(@Nonnull final Flux source) { 45 | super(source); 46 | } 47 | 48 | @Nonnull 49 | @Override 50 | protected String operatorName() { 51 | return "first"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /client/src/main/java/com/influxdb/client/InvokableScriptsQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client; 23 | 24 | import javax.annotation.Nullable; 25 | 26 | public class InvokableScriptsQuery { 27 | 28 | /** 29 | * Offset. (optional) 30 | */ 31 | @Nullable 32 | private Integer offset; 33 | 34 | /** 35 | * Limit. (optional, default to 20) 36 | */ 37 | @Nullable 38 | private Integer limit; 39 | 40 | @Nullable 41 | public Integer getOffset() { 42 | return offset; 43 | } 44 | 45 | public void setOffset(@Nullable final Integer offset) { 46 | this.offset = offset; 47 | } 48 | 49 | @Nullable 50 | public Integer getLimit() { 51 | return limit; 52 | } 53 | 54 | public void setLimit(@Nullable final Integer limit) { 55 | this.limit = limit; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/utils/ImportUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.utils; 23 | 24 | import java.util.Set; 25 | import java.util.stream.Collectors; 26 | import javax.annotation.Nonnull; 27 | 28 | import com.influxdb.query.dsl.HasImports; 29 | 30 | public final class ImportUtils { 31 | 32 | private ImportUtils() { 33 | } 34 | 35 | public static String getImportsString(@Nonnull final HasImports hasImports) { 36 | String importString = ""; 37 | Set collectedImports = hasImports.getImports(); 38 | if (!collectedImports.isEmpty()) { 39 | importString = collectedImports 40 | .stream() 41 | .map(s -> "import \"" + s + "\"") 42 | .collect(Collectors.joining("\n", "", "\n")); 43 | } 44 | return importString; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ArrayFromFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import java.util.Map; 25 | import javax.annotation.Nonnull; 26 | 27 | /** 28 | * Constructs a table from an array of records. 29 | */ 30 | public final class ArrayFromFlux extends AbstractParametrizedFlux { 31 | 32 | public ArrayFromFlux() { 33 | addImport("array"); 34 | } 35 | 36 | @Nonnull 37 | @Override 38 | protected String operatorName() { 39 | return "array.from"; 40 | } 41 | 42 | 43 | /** 44 | * @param rows Array of records to construct a table with. 45 | * @return {@link ArrayFromFlux} 46 | */ 47 | @Nonnull 48 | @SafeVarargs 49 | public final ArrayFromFlux withRow(@Nonnull final Map... rows) { 50 | withPropertyValue("rows", rows); 51 | return this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ToIntFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Convert a value to a int. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  * Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .filter(and(measurement().equal("mem"), field().equal("used")))
38 |  *     .toInt();
39 |  * 
40 | * 41 | * @author Jakub Bednar (bednar@github) (25/06/2018 16:06) 42 | */ 43 | public final class ToIntFlux extends AbstractParametrizedFlux { 44 | 45 | public ToIntFlux(@Nonnull final Flux source) { 46 | super(source); 47 | } 48 | 49 | @Nonnull 50 | @Override 51 | protected String operatorName() { 52 | return "toInt"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /examples/src/main/java/example/RawQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package example; 23 | 24 | import com.influxdb.client.InfluxDBClient; 25 | import com.influxdb.client.InfluxDBClientFactory; 26 | import com.influxdb.client.QueryApi; 27 | 28 | public class RawQuery { 29 | 30 | private static char[] token = "my-token".toCharArray(); 31 | private static String org = "my-org"; 32 | 33 | public static void main(final String[] args) { 34 | 35 | InfluxDBClient influxDBClient = InfluxDBClientFactory.create("http://localhost:8086", token, org); 36 | 37 | // 38 | // Query data 39 | // 40 | String flux = "from(bucket:\"my-bucket\") |> range(start: 0)"; 41 | 42 | QueryApi queryApi = influxDBClient.getQueryApi(); 43 | 44 | String csv = queryApi.queryRaw(flux); 45 | 46 | System.out.println("CSV response: " + csv); 47 | 48 | influxDBClient.close(); 49 | } 50 | } -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ToBoolFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Convert a value to a bool. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  * Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .filter(and(measurement().equal("mem"), field().equal("used")))
38 |  *     .toBool();
39 |  * 
40 | * 41 | * @author Jakub Bednar (bednar@github) (25/06/2018 15:57) 42 | */ 43 | public final class ToBoolFlux extends AbstractParametrizedFlux { 44 | 45 | public ToBoolFlux(@Nonnull final Flux source) { 46 | super(source); 47 | } 48 | 49 | @Nonnull 50 | @Override 51 | protected String operatorName() { 52 | return "toBool"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ToTimeFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Convert a value to a time. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  *  Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .filter(and(measurement().equal("mem"), field().equal("used")))
38 |  *     .toTime();
39 |  * 
40 | * 41 | * @author Jakub Bednar (bednar@github) (26/06/2018 06:37) 42 | */ 43 | public final class ToTimeFlux extends AbstractParametrizedFlux { 44 | 45 | public ToTimeFlux(@Nonnull final Flux source) { 46 | super(source); 47 | } 48 | 49 | @Nonnull 50 | @Override 51 | protected String operatorName() { 52 | return "toTime"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ToFloatFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Convert a value to a float. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  * Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .filter(and(measurement().equal("mem"), field().equal("used")))
38 |  *     .toFloat();
39 |  * 
40 | * 41 | * @author Jakub Bednar (bednar@github) (25/06/2018 16:06) 42 | */ 43 | public final class ToFloatFlux extends AbstractParametrizedFlux { 44 | 45 | public ToFloatFlux(@Nonnull final Flux source) { 46 | super(source); 47 | } 48 | 49 | @Nonnull 50 | @Override 51 | protected String operatorName() { 52 | return "toFloat"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ToUIntFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Convert a value to a duration. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  * Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .filter(and(measurement().equal("mem"), field().equal("used")))
38 |  *     .toUInt();
39 |  * 
40 | * 41 | * @author Jakub Bednar (bednar@github) (26/06/2018 06:40) 42 | */ 43 | public final class ToUIntFlux extends AbstractParametrizedFlux { 44 | 45 | public ToUIntFlux(@Nonnull final Flux source) { 46 | super(source); 47 | } 48 | 49 | @Nonnull 50 | @Override 51 | protected String operatorName() { 52 | return "toUInt"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ToStringFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Convert a value to a string. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  *  Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .filter(and(measurement().equal("mem"), field().equal("used")))
38 |  *     .toString();
39 |  * 
40 | * 41 | * @author Jakub Bednar (bednar@github) (26/06/2018 06:32) 42 | */ 43 | public final class ToStringFlux extends AbstractParametrizedFlux { 44 | 45 | public ToStringFlux(@Nonnull final Flux source) { 46 | super(source); 47 | } 48 | 49 | @Nonnull 50 | @Override 51 | protected String operatorName() { 52 | return "toString"; 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /karaf/karaf-features/src/main/feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | scr 28 | eventadmin 29 | kotlin 30 | mvn:com.google.code.findbugs/jsr305/3.0.2 31 | wrap:mvn:com.influxdb/influxdb-client-osgi/${project.version} 32 | 33 | 34 | mvn:org.jetbrains.kotlin/kotlin-osgi-bundle/${kotlin.version} 35 | 36 | 37 | -------------------------------------------------------------------------------- /scripts/influxdb.conf: -------------------------------------------------------------------------------- 1 | # 2 | # The MIT License 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy 5 | # of this software and associated documentation files (the "Software"), to deal 6 | # in the Software without restriction, including without limitation the rights 7 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the Software is 9 | # furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | # THE SOFTWARE. 21 | # 22 | 23 | 24 | [meta] 25 | dir = "/var/lib/influxdb/meta" 26 | 27 | [data] 28 | dir = "/var/lib/influxdb/data" 29 | engine = "tsm1" 30 | wal-dir = "/var/lib/influxdb/wal" 31 | 32 | [admin] 33 | enabled = true 34 | 35 | [[udp]] 36 | enabled = true 37 | bind-address = ":8089" 38 | database = "udp" 39 | retention-policy = "" 40 | 41 | [http] 42 | flux-enabled = true 43 | 44 | # These next lines control how batching works. You should have this enabled 45 | # otherwise you could get dropped metrics or poor performance. Batching 46 | # will buffer points in memory if you have many coming in. 47 | 48 | batch-size = 1000 # will flush if this many points get buffered 49 | batch-pending = 5 # number of batches that may be pending in memory 50 | batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit 51 | read-buffer = 0 # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. 52 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/SchemaType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Gets or Sets SchemaType 28 | */ 29 | @JsonAdapter(SchemaType.Adapter.class) 30 | public enum SchemaType { 31 | 32 | IMPLICIT("implicit"), 33 | 34 | EXPLICIT("explicit"); 35 | 36 | private String value; 37 | 38 | SchemaType(String value) { 39 | this.value = value; 40 | } 41 | 42 | public String getValue() { 43 | return value; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return String.valueOf(value); 49 | } 50 | 51 | public static SchemaType fromValue(String text) { 52 | for (SchemaType b : SchemaType.values()) { 53 | if (String.valueOf(b.value).equals(text)) { 54 | return b; 55 | } 56 | } 57 | return null; 58 | } 59 | 60 | public static class Adapter extends TypeAdapter { 61 | @Override 62 | public void write(final JsonWriter jsonWriter, final SchemaType enumeration) throws IOException { 63 | jsonWriter.value(enumeration.getValue()); 64 | } 65 | 66 | @Override 67 | public SchemaType read(final JsonReader jsonReader) throws IOException { 68 | String value = jsonReader.nextString(); 69 | return SchemaType.fromValue(String.valueOf(value)); 70 | } 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/ScriptLanguage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Gets or Sets ScriptLanguage 28 | */ 29 | @JsonAdapter(ScriptLanguage.Adapter.class) 30 | public enum ScriptLanguage { 31 | 32 | FLUX("flux"); 33 | 34 | private String value; 35 | 36 | ScriptLanguage(String value) { 37 | this.value = value; 38 | } 39 | 40 | public String getValue() { 41 | return value; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return String.valueOf(value); 47 | } 48 | 49 | public static ScriptLanguage fromValue(String text) { 50 | for (ScriptLanguage b : ScriptLanguage.values()) { 51 | if (String.valueOf(b.value).equals(text)) { 52 | return b; 53 | } 54 | } 55 | return null; 56 | } 57 | 58 | public static class Adapter extends TypeAdapter { 59 | @Override 60 | public void write(final JsonWriter jsonWriter, final ScriptLanguage enumeration) throws IOException { 61 | jsonWriter.value(enumeration.getValue()); 62 | } 63 | 64 | @Override 65 | public ScriptLanguage read(final JsonReader jsonReader) throws IOException { 66 | String value = jsonReader.nextString(); 67 | return ScriptLanguage.fromValue(String.valueOf(value)); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /flux-dsl/src/main/java/com/influxdb/query/dsl/functions/ToDurationFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import javax.annotation.Nonnull; 25 | 26 | import com.influxdb.query.dsl.Flux; 27 | 28 | /** 29 | * Convert a value to a duration. 30 | * See SPEC. 31 | * 32 | *

33 | * Example 34 | *

35 |  * Flux flux = Flux
36 |  *     .from("telegraf")
37 |  *     .filter(and(measurement().equal("mem"), field().equal("used")))
38 |  *     .toDuration();
39 |  * 
40 | * 41 | * @author Jakub Bednar (bednar@github) (25/06/2018 16:06) 42 | */ 43 | public final class ToDurationFlux extends AbstractParametrizedFlux { 44 | 45 | public ToDurationFlux(@Nonnull final Flux source) { 46 | super(source); 47 | } 48 | 49 | @Nonnull 50 | @Override 51 | protected String operatorName() { 52 | return "toDuration"; 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /client-osgi/src/test/java/com/influxdb/client/osgi/ITConnectionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.osgi; 23 | 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static org.hamcrest.CoreMatchers.equalTo; 27 | import static org.hamcrest.MatcherAssert.assertThat; 28 | 29 | public class ITConnectionTest extends InfluxDBConnectorTest { 30 | 31 | @Test 32 | @Override 33 | void testConnectorWithToken() { 34 | super.testConnectorWithToken(); 35 | 36 | assertThat(client.getValue().ping(), equalTo(true)); 37 | } 38 | 39 | @Test 40 | @Override 41 | void testConnectorV1() { 42 | super.testConnectorV1(); 43 | 44 | assertThat(client.getValue().ping(), equalTo(true)); 45 | } 46 | 47 | @Test 48 | @Override 49 | void testConnectorWithUsernameAndPassword() { 50 | super.testConnectorWithUsernameAndPassword(); 51 | 52 | assertThat(client.getValue().ping(), equalTo(true)); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /client-core/src/main/java/com/influxdb/annotations/Column.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.annotations; 23 | 24 | import java.lang.annotation.ElementType; 25 | import java.lang.annotation.Retention; 26 | import java.lang.annotation.RetentionPolicy; 27 | import java.lang.annotation.Target; 28 | 29 | 30 | /** 31 | * The annotation to customize bidirectional mapping between POJO and Flux query result or LineProtocol. 32 | */ 33 | @Retention(RetentionPolicy.RUNTIME) 34 | @Target(ElementType.FIELD) 35 | public @interface Column { 36 | 37 | String name() default ""; 38 | 39 | /** 40 | * @return {@link Boolean#TRUE} it an annotated field is Tag 41 | */ 42 | boolean tag() default false; 43 | 44 | /** 45 | * @return {@link Boolean#TRUE} it an annotated field is Measurement 46 | */ 47 | boolean measurement() default false; 48 | 49 | /** 50 | * @return {@link Boolean#TRUE} it an annotated field is Timestamp 51 | */ 52 | boolean timestamp () default false; 53 | } 54 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/AxisScale.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Scale is the axis formatting scale. Supported: \"log\", \"linear\" 28 | */ 29 | @JsonAdapter(AxisScale.Adapter.class) 30 | public enum AxisScale { 31 | 32 | LOG("log"), 33 | 34 | LINEAR("linear"); 35 | 36 | private String value; 37 | 38 | AxisScale(String value) { 39 | this.value = value; 40 | } 41 | 42 | public String getValue() { 43 | return value; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return String.valueOf(value); 49 | } 50 | 51 | public static AxisScale fromValue(String text) { 52 | for (AxisScale b : AxisScale.values()) { 53 | if (String.valueOf(b.value).equals(text)) { 54 | return b; 55 | } 56 | } 57 | return null; 58 | } 59 | 60 | public static class Adapter extends TypeAdapter { 61 | @Override 62 | public void write(final JsonWriter jsonWriter, final AxisScale enumeration) throws IOException { 63 | jsonWriter.value(enumeration.getValue()); 64 | } 65 | 66 | @Override 67 | public AxisScale read(final JsonReader jsonReader) throws IOException { 68 | String value = jsonReader.nextString(); 69 | return AxisScale.fromValue(String.valueOf(value)); 70 | } 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/QueryEditMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Gets or Sets QueryEditMode 28 | */ 29 | @JsonAdapter(QueryEditMode.Adapter.class) 30 | public enum QueryEditMode { 31 | 32 | BUILDER("builder"), 33 | 34 | ADVANCED("advanced"); 35 | 36 | private String value; 37 | 38 | QueryEditMode(String value) { 39 | this.value = value; 40 | } 41 | 42 | public String getValue() { 43 | return value; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return String.valueOf(value); 49 | } 50 | 51 | public static QueryEditMode fromValue(String text) { 52 | for (QueryEditMode b : QueryEditMode.values()) { 53 | if (String.valueOf(b.value).equals(text)) { 54 | return b; 55 | } 56 | } 57 | return null; 58 | } 59 | 60 | public static class Adapter extends TypeAdapter { 61 | @Override 62 | public void write(final JsonWriter jsonWriter, final QueryEditMode enumeration) throws IOException { 63 | jsonWriter.value(enumeration.getValue()); 64 | } 65 | 66 | @Override 67 | public QueryEditMode read(final JsonReader jsonReader) throws IOException { 68 | String value = jsonReader.nextString(); 69 | return QueryEditMode.fromValue(String.valueOf(value)); 70 | } 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/XYGeom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Gets or Sets XYGeom 28 | */ 29 | @JsonAdapter(XYGeom.Adapter.class) 30 | public enum XYGeom { 31 | 32 | LINE("line"), 33 | 34 | STEP("step"), 35 | 36 | STACKED("stacked"), 37 | 38 | BAR("bar"), 39 | 40 | MONOTONEX("monotoneX"); 41 | 42 | private String value; 43 | 44 | XYGeom(String value) { 45 | this.value = value; 46 | } 47 | 48 | public String getValue() { 49 | return value; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return String.valueOf(value); 55 | } 56 | 57 | public static XYGeom fromValue(String text) { 58 | for (XYGeom b : XYGeom.values()) { 59 | if (String.valueOf(b.value).equals(text)) { 60 | return b; 61 | } 62 | } 63 | return null; 64 | } 65 | 66 | public static class Adapter extends TypeAdapter { 67 | @Override 68 | public void write(final JsonWriter jsonWriter, final XYGeom enumeration) throws IOException { 69 | jsonWriter.value(enumeration.getValue()); 70 | } 71 | 72 | @Override 73 | public XYGeom read(final JsonReader jsonReader) throws IOException { 74 | String value = jsonReader.nextString(); 75 | return XYGeom.fromValue(String.valueOf(value)); 76 | } 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /scripts/deploy-settings.xml: -------------------------------------------------------------------------------- 1 | 24 | 26 | 27 | 28 | ossrh 29 | ${env.SONATYPE_USERNAME} 30 | ${env.SONATYPE_PASSWORD} 31 | 32 | 33 | 34 | 35 | 36 | ossrh 37 | 38 | true 39 | 40 | 41 | ${env.GPG_EXECUTABLE} 42 | ${env.GPG_PASSPHRASE} 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/TaskStatusType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Gets or Sets TaskStatusType 28 | */ 29 | @JsonAdapter(TaskStatusType.Adapter.class) 30 | public enum TaskStatusType { 31 | 32 | ACTIVE("active"), 33 | 34 | INACTIVE("inactive"); 35 | 36 | private String value; 37 | 38 | TaskStatusType(String value) { 39 | this.value = value; 40 | } 41 | 42 | public String getValue() { 43 | return value; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return String.valueOf(value); 49 | } 50 | 51 | public static TaskStatusType fromValue(String text) { 52 | for (TaskStatusType b : TaskStatusType.values()) { 53 | if (String.valueOf(b.value).equals(text)) { 54 | return b; 55 | } 56 | } 57 | return null; 58 | } 59 | 60 | public static class Adapter extends TypeAdapter { 61 | @Override 62 | public void write(final JsonWriter jsonWriter, final TaskStatusType enumeration) throws IOException { 63 | jsonWriter.value(enumeration.getValue()); 64 | } 65 | 66 | @Override 67 | public TaskStatusType read(final JsonReader jsonReader) throws IOException { 68 | String value = jsonReader.nextString(); 69 | return TaskStatusType.fromValue(String.valueOf(value)); 70 | } 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/YieldFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (29/06/2018 10:03) 31 | */ 32 | class YieldFluxTest { 33 | 34 | @Test 35 | void yield() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .yield("0"); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> yield(name: \"0\")"); 42 | } 43 | 44 | @Test 45 | void yieldByWith() { 46 | 47 | Flux flux = Flux 48 | .from("telegraf") 49 | .yield() 50 | .withName("1"); 51 | 52 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> yield(name: \"1\")"); 53 | } 54 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/Statement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.BadStatement; 19 | import com.influxdb.client.domain.BuiltinStatement; 20 | import com.influxdb.client.domain.Expression; 21 | import com.influxdb.client.domain.ExpressionStatement; 22 | import com.influxdb.client.domain.Identifier; 23 | import com.influxdb.client.domain.MemberAssignment; 24 | import com.influxdb.client.domain.MemberExpression; 25 | import com.influxdb.client.domain.OptionStatement; 26 | import com.influxdb.client.domain.ReturnStatement; 27 | import com.influxdb.client.domain.TestStatement; 28 | import com.influxdb.client.domain.VariableAssignment; 29 | 30 | /** 31 | * Statement 32 | */ 33 | 34 | public class Statement { 35 | 36 | @Override 37 | public boolean equals(java.lang.Object o) { 38 | if (this == o) { 39 | return true; 40 | } 41 | if (o == null || getClass() != o.getClass()) { 42 | return false; 43 | } 44 | return true; 45 | } 46 | 47 | @Override 48 | public int hashCode() { 49 | return Objects.hash(); 50 | } 51 | 52 | 53 | @Override 54 | public String toString() { 55 | StringBuilder sb = new StringBuilder(); 56 | sb.append("class Statement {\n"); 57 | sb.append("}"); 58 | return sb.toString(); 59 | } 60 | 61 | /** 62 | * Convert the given object to string with each line indented by 4 spaces 63 | * (except the first line). 64 | */ 65 | private String toIndentedString(java.lang.Object o) { 66 | if (o == null) { 67 | return "null"; 68 | } 69 | return o.toString().replace("\n", "\n "); 70 | } 71 | 72 | } 73 | 74 | -------------------------------------------------------------------------------- /examples/src/main/java/example/KotlinQueryRaw.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package example 23 | 24 | import com.influxdb.client.kotlin.InfluxDBClientKotlinFactory 25 | import kotlinx.coroutines.flow.collect 26 | import kotlinx.coroutines.flow.consumeAsFlow 27 | import kotlinx.coroutines.runBlocking 28 | 29 | fun main() = runBlocking { 30 | 31 | val influxDBClient = InfluxDBClientKotlinFactory 32 | .create("http://localhost:8086", "my-token".toCharArray(), "my-org") 33 | 34 | val fluxQuery = ("from(bucket: \"my-bucket\")\n" 35 | + " |> range(start: -5m)" 36 | + " |> filter(fn: (r) => (r[\"_measurement\"] == \"cpu\" and r[\"_field\"] == \"usage_system\"))" 37 | + " |> sample(n: 5, pos: 1)") 38 | 39 | //Result is returned as a stream 40 | val results = influxDBClient.getQueryKotlinApi().queryRaw(fluxQuery) 41 | 42 | //print results 43 | results 44 | .consumeAsFlow() 45 | .collect { println("Line: $it") } 46 | 47 | influxDBClient.close() 48 | } 49 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/WritePrecision.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Gets or Sets WritePrecision 28 | */ 29 | @JsonAdapter(WritePrecision.Adapter.class) 30 | public enum WritePrecision { 31 | 32 | MS("ms"), 33 | 34 | S("s"), 35 | 36 | US("us"), 37 | 38 | NS("ns"); 39 | 40 | private String value; 41 | 42 | WritePrecision(String value) { 43 | this.value = value; 44 | } 45 | 46 | public String getValue() { 47 | return value; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return String.valueOf(value); 53 | } 54 | 55 | public static WritePrecision fromValue(String text) { 56 | for (WritePrecision b : WritePrecision.values()) { 57 | if (String.valueOf(b.value).equals(text)) { 58 | return b; 59 | } 60 | } 61 | return null; 62 | } 63 | 64 | public static class Adapter extends TypeAdapter { 65 | @Override 66 | public void write(final JsonWriter jsonWriter, final WritePrecision enumeration) throws IOException { 67 | jsonWriter.value(enumeration.getValue()); 68 | } 69 | 70 | @Override 71 | public WritePrecision read(final JsonReader jsonReader) throws IOException { 72 | String value = jsonReader.nextString(); 73 | return WritePrecision.fromValue(String.valueOf(value)); 74 | } 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /client-legacy/src/test/java/com/influxdb/client/flux/FluxClientPingTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.flux; 23 | 24 | import java.io.IOException; 25 | 26 | import okhttp3.mockwebserver.MockResponse; 27 | import org.assertj.core.api.Assertions; 28 | import org.junit.jupiter.api.Test; 29 | 30 | /** 31 | * @author Jakub Bednar (bednar@github) (31/07/2018 09:19) 32 | */ 33 | class FluxClientPingTest extends AbstractFluxClientTest { 34 | 35 | @Test 36 | void healthy() { 37 | 38 | mockServer.enqueue(new MockResponse().setResponseCode(204)); 39 | 40 | Assertions.assertThat(fluxClient.ping()).isTrue(); 41 | } 42 | 43 | @Test 44 | void serverError() { 45 | 46 | mockServer.enqueue(createErrorResponse("")); 47 | 48 | Assertions.assertThat(fluxClient.ping()).isFalse(); 49 | } 50 | 51 | @Test 52 | void notRunningServer() throws IOException { 53 | 54 | mockServer.shutdown(); 55 | 56 | Assertions.assertThat(fluxClient.ping()).isFalse(); 57 | } 58 | } -------------------------------------------------------------------------------- /client/src/test/java/com/influxdb/client/MockLogHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client; 23 | 24 | import java.util.ArrayList; 25 | import java.util.HashMap; 26 | import java.util.List; 27 | import java.util.Map; 28 | import java.util.logging.Handler; 29 | import java.util.logging.Level; 30 | import java.util.logging.LogRecord; 31 | 32 | /** 33 | * @author Jakub Bednar (12/10/2020 13:49) 34 | */ 35 | public class MockLogHandler extends Handler { 36 | private final Map> levels = new HashMap<>(); 37 | 38 | @Override 39 | public void publish(final LogRecord record) { 40 | List records = levels.computeIfAbsent(record.getLevel(), level -> new ArrayList<>()); 41 | records.add(record); 42 | } 43 | 44 | @Override 45 | public void flush() { 46 | 47 | } 48 | 49 | @Override 50 | public void close() throws SecurityException { 51 | 52 | } 53 | 54 | public List getRecords(Level level) { 55 | return levels.get(level); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/HTTPNotificationRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.HTTPNotificationRuleBase; 19 | import com.influxdb.client.domain.Label; 20 | import com.influxdb.client.domain.NotificationRuleBase; 21 | import com.influxdb.client.domain.NotificationRuleBaseLinks; 22 | import com.influxdb.client.domain.StatusRule; 23 | import com.influxdb.client.domain.TagRule; 24 | import com.influxdb.client.domain.TaskStatusType; 25 | import java.time.OffsetDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * HTTPNotificationRule 30 | */ 31 | 32 | public class HTTPNotificationRule extends HTTPNotificationRuleBase { 33 | 34 | @Override 35 | public boolean equals(java.lang.Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | return super.equals(o); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return Objects.hash(super.hashCode()); 48 | } 49 | 50 | 51 | @Override 52 | public String toString() { 53 | StringBuilder sb = new StringBuilder(); 54 | sb.append("class HTTPNotificationRule {\n"); 55 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 56 | sb.append("}"); 57 | return sb.toString(); 58 | } 59 | 60 | /** 61 | * Convert the given object to string with each line indented by 4 spaces 62 | * (except the first line). 63 | */ 64 | private String toIndentedString(java.lang.Object o) { 65 | if (o == null) { 66 | return "null"; 67 | } 68 | return o.toString().replace("\n", "\n "); 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/SMTPNotificationRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.Label; 19 | import com.influxdb.client.domain.NotificationRuleBase; 20 | import com.influxdb.client.domain.NotificationRuleBaseLinks; 21 | import com.influxdb.client.domain.SMTPNotificationRuleBase; 22 | import com.influxdb.client.domain.StatusRule; 23 | import com.influxdb.client.domain.TagRule; 24 | import com.influxdb.client.domain.TaskStatusType; 25 | import java.time.OffsetDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * SMTPNotificationRule 30 | */ 31 | 32 | public class SMTPNotificationRule extends SMTPNotificationRuleBase { 33 | 34 | @Override 35 | public boolean equals(java.lang.Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | return super.equals(o); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return Objects.hash(super.hashCode()); 48 | } 49 | 50 | 51 | @Override 52 | public String toString() { 53 | StringBuilder sb = new StringBuilder(); 54 | sb.append("class SMTPNotificationRule {\n"); 55 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 56 | sb.append("}"); 57 | return sb.toString(); 58 | } 59 | 60 | /** 61 | * Convert the given object to string with each line indented by 4 spaces 62 | * (except the first line). 63 | */ 64 | private String toIndentedString(java.lang.Object o) { 65 | if (o == null) { 66 | return "null"; 67 | } 68 | return o.toString().replace("\n", "\n "); 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/SlackNotificationRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.Label; 19 | import com.influxdb.client.domain.NotificationRuleBase; 20 | import com.influxdb.client.domain.NotificationRuleBaseLinks; 21 | import com.influxdb.client.domain.SlackNotificationRuleBase; 22 | import com.influxdb.client.domain.StatusRule; 23 | import com.influxdb.client.domain.TagRule; 24 | import com.influxdb.client.domain.TaskStatusType; 25 | import java.time.OffsetDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * SlackNotificationRule 30 | */ 31 | 32 | public class SlackNotificationRule extends SlackNotificationRuleBase { 33 | 34 | @Override 35 | public boolean equals(java.lang.Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | return super.equals(o); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return Objects.hash(super.hashCode()); 48 | } 49 | 50 | 51 | @Override 52 | public String toString() { 53 | StringBuilder sb = new StringBuilder(); 54 | sb.append("class SlackNotificationRule {\n"); 55 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 56 | sb.append("}"); 57 | return sb.toString(); 58 | } 59 | 60 | /** 61 | * Convert the given object to string with each line indented by 4 spaces 62 | * (except the first line). 63 | */ 64 | private String toIndentedString(java.lang.Object o) { 65 | if (o == null) { 66 | return "null"; 67 | } 68 | return o.toString().replace("\n", "\n "); 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/WriteConsistency.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * Gets or Sets WriteConsistency 28 | */ 29 | @JsonAdapter(WriteConsistency.Adapter.class) 30 | public enum WriteConsistency { 31 | 32 | ANY("any"), 33 | 34 | ONE("one"), 35 | 36 | QUORUM("quorum"), 37 | 38 | ALL("all"); 39 | 40 | private String value; 41 | 42 | WriteConsistency(String value) { 43 | this.value = value; 44 | } 45 | 46 | public String getValue() { 47 | return value; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return String.valueOf(value); 53 | } 54 | 55 | public static WriteConsistency fromValue(String text) { 56 | for (WriteConsistency b : WriteConsistency.values()) { 57 | if (String.valueOf(b.value).equals(text)) { 58 | return b; 59 | } 60 | } 61 | return null; 62 | } 63 | 64 | public static class Adapter extends TypeAdapter { 65 | @Override 66 | public void write(final JsonWriter jsonWriter, final WriteConsistency enumeration) throws IOException { 67 | jsonWriter.value(enumeration.getValue()); 68 | } 69 | 70 | @Override 71 | public WriteConsistency read(final JsonReader jsonReader) throws IOException { 72 | String value = jsonReader.nextString(); 73 | return WriteConsistency.fromValue(String.valueOf(value)); 74 | } 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/TelegramNotificationRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.Label; 19 | import com.influxdb.client.domain.NotificationRuleBase; 20 | import com.influxdb.client.domain.NotificationRuleBaseLinks; 21 | import com.influxdb.client.domain.StatusRule; 22 | import com.influxdb.client.domain.TagRule; 23 | import com.influxdb.client.domain.TaskStatusType; 24 | import com.influxdb.client.domain.TelegramNotificationRuleBase; 25 | import java.time.OffsetDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * TelegramNotificationRule 30 | */ 31 | 32 | public class TelegramNotificationRule extends TelegramNotificationRuleBase { 33 | 34 | @Override 35 | public boolean equals(java.lang.Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | return super.equals(o); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return Objects.hash(super.hashCode()); 48 | } 49 | 50 | 51 | @Override 52 | public String toString() { 53 | StringBuilder sb = new StringBuilder(); 54 | sb.append("class TelegramNotificationRule {\n"); 55 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 56 | sb.append("}"); 57 | return sb.toString(); 58 | } 59 | 60 | /** 61 | * Convert the given object to string with each line indented by 4 spaces 62 | * (except the first line). 63 | */ 64 | private String toIndentedString(java.lang.Object o) { 65 | if (o == null) { 66 | return "null"; 67 | } 68 | return o.toString().replace("\n", "\n "); 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /flux-dsl/src/test/java/com/influxdb/query/dsl/functions/SetFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.query.dsl.functions; 23 | 24 | import com.influxdb.query.dsl.Flux; 25 | 26 | import org.assertj.core.api.Assertions; 27 | import org.junit.jupiter.api.Test; 28 | 29 | /** 30 | * @author Jakub Bednar (bednar@github) (29/06/2018 09:32) 31 | */ 32 | class SetFluxTest { 33 | 34 | @Test 35 | void set() { 36 | 37 | Flux flux = Flux 38 | .from("telegraf") 39 | .set("location", "Carolina"); 40 | 41 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> set(key: \"location\", value: \"Carolina\")"); 42 | } 43 | 44 | @Test 45 | void setByWith() { 46 | 47 | Flux flux = Flux 48 | .from("telegraf") 49 | .set() 50 | .withKeyValue("type", "telegraphs"); 51 | 52 | Assertions.assertThat(flux.toString()).isEqualToIgnoringWhitespace("from(bucket:\"telegraf\") |> set(key: \"type\", value: \"telegraphs\")"); 53 | } 54 | } -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/PagerDutyNotificationRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.influxdb.client.domain.Label; 19 | import com.influxdb.client.domain.NotificationRuleBase; 20 | import com.influxdb.client.domain.NotificationRuleBaseLinks; 21 | import com.influxdb.client.domain.PagerDutyNotificationRuleBase; 22 | import com.influxdb.client.domain.StatusRule; 23 | import com.influxdb.client.domain.TagRule; 24 | import com.influxdb.client.domain.TaskStatusType; 25 | import java.time.OffsetDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * PagerDutyNotificationRule 30 | */ 31 | 32 | public class PagerDutyNotificationRule extends PagerDutyNotificationRuleBase { 33 | 34 | @Override 35 | public boolean equals(java.lang.Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | return super.equals(o); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return Objects.hash(super.hashCode()); 48 | } 49 | 50 | 51 | @Override 52 | public String toString() { 53 | StringBuilder sb = new StringBuilder(); 54 | sb.append("class PagerDutyNotificationRule {\n"); 55 | sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 56 | sb.append("}"); 57 | return sb.toString(); 58 | } 59 | 60 | /** 61 | * Convert the given object to string with each line indented by 4 spaces 62 | * (except the first line). 63 | */ 64 | private String toIndentedString(java.lang.Object o) { 65 | if (o == null) { 66 | return "null"; 67 | } 68 | return o.toString().replace("\n", "\n "); 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /client-scala/src/test/scala/com/influxdb/client/scala/InfluxDBUtils.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.influxdb.client.scala 23 | 24 | import com.influxdb.test.AbstractMockServerTest 25 | import okhttp3.mockwebserver.RecordedRequest 26 | 27 | /** 28 | * @author Jakub Bednar (bednar@github) (25/06/2019 11:22) 29 | */ 30 | class InfluxDBUtils extends AbstractMockServerTest { 31 | 32 | def getUrl: String = super.getInfluxDb2Url 33 | 34 | def serverStart: String = super.startMockServer 35 | 36 | def serverStop(): Unit = super.after() 37 | 38 | def serverMockResponse(): Unit = super.enqueuedResponse() 39 | 40 | def serverMockErrorResponse(influxError: String): Unit = mockServer.enqueue(super.createErrorResponse(influxError)) 41 | 42 | def serverTakeRequest(): RecordedRequest = super.takeRequest() 43 | 44 | def getRequestCount: Int = mockServer.getRequestCount 45 | 46 | override def generateName(prefix: String): String = super.generateName(prefix) 47 | 48 | override def getDeclaredField[V](obj: Any, field: String, `type`: Class[_]): V = super.getDeclaredField(obj, field, `type`) 49 | } 50 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/CheckStatusLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * The state to record if check matches a criteria. 28 | */ 29 | @JsonAdapter(CheckStatusLevel.Adapter.class) 30 | public enum CheckStatusLevel { 31 | 32 | UNKNOWN("UNKNOWN"), 33 | 34 | OK("OK"), 35 | 36 | INFO("INFO"), 37 | 38 | CRIT("CRIT"), 39 | 40 | WARN("WARN"); 41 | 42 | private String value; 43 | 44 | CheckStatusLevel(String value) { 45 | this.value = value; 46 | } 47 | 48 | public String getValue() { 49 | return value; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return String.valueOf(value); 55 | } 56 | 57 | public static CheckStatusLevel fromValue(String text) { 58 | for (CheckStatusLevel b : CheckStatusLevel.values()) { 59 | if (String.valueOf(b.value).equals(text)) { 60 | return b; 61 | } 62 | } 63 | return null; 64 | } 65 | 66 | public static class Adapter extends TypeAdapter { 67 | @Override 68 | public void write(final JsonWriter jsonWriter, final CheckStatusLevel enumeration) throws IOException { 69 | jsonWriter.value(enumeration.getValue()); 70 | } 71 | 72 | @Override 73 | public CheckStatusLevel read(final JsonReader jsonReader) throws IOException { 74 | String value = jsonReader.nextString(); 75 | return CheckStatusLevel.fromValue(String.valueOf(value)); 76 | } 77 | } 78 | } 79 | 80 | -------------------------------------------------------------------------------- /client/src/generated/java/com/influxdb/client/domain/RuleStatusLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InfluxDB OSS API Service 3 | * The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. 4 | * 5 | * OpenAPI spec version: 2.0.0 6 | * 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package com.influxdb.client.domain; 15 | 16 | import java.util.Objects; 17 | import java.util.Arrays; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | import java.io.IOException; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.annotations.JsonAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | /** 27 | * The state to record if check matches a criteria. 28 | */ 29 | @JsonAdapter(RuleStatusLevel.Adapter.class) 30 | public enum RuleStatusLevel { 31 | 32 | UNKNOWN("UNKNOWN"), 33 | 34 | OK("OK"), 35 | 36 | INFO("INFO"), 37 | 38 | CRIT("CRIT"), 39 | 40 | WARN("WARN"), 41 | 42 | ANY("ANY"); 43 | 44 | private String value; 45 | 46 | RuleStatusLevel(String value) { 47 | this.value = value; 48 | } 49 | 50 | public String getValue() { 51 | return value; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return String.valueOf(value); 57 | } 58 | 59 | public static RuleStatusLevel fromValue(String text) { 60 | for (RuleStatusLevel b : RuleStatusLevel.values()) { 61 | if (String.valueOf(b.value).equals(text)) { 62 | return b; 63 | } 64 | } 65 | return null; 66 | } 67 | 68 | public static class Adapter extends TypeAdapter { 69 | @Override 70 | public void write(final JsonWriter jsonWriter, final RuleStatusLevel enumeration) throws IOException { 71 | jsonWriter.value(enumeration.getValue()); 72 | } 73 | 74 | @Override 75 | public RuleStatusLevel read(final JsonReader jsonReader) throws IOException { 76 | String value = jsonReader.nextString(); 77 | return RuleStatusLevel.fromValue(String.valueOf(value)); 78 | } 79 | } 80 | } 81 | 82 | --------------------------------------------------------------------------------