Skip to content

Commit 7e4b969

Browse files
authored
feat: add query method with all params for BucketsApi, OrganizationApi and TasksApi (#278)
1 parent 59b0d63 commit 7e4b969

10 files changed

Lines changed: 453 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
### Features
99
1. [#272](https://github.com/influxdata/influxdb-client-java/pull/272): Add `PingService` to check status of OSS and Cloud instance
10+
2. [#278](https://github.com/influxdata/influxdb-client-java/pull/278): Add query method with all params for BucketsApi, OrganizationApi and TasksApi
1011

1112
### CI
1213
1. [#275](https://github.com/influxdata/influxdb-client-java/pull/275): Deploy `influxdb-client-test` package into Maven repository

client/src/main/java/com/influxdb/client/BucketsApi.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,14 @@ Bucket createBucket(@Nonnull final String name,
207207
@Nonnull
208208
List<Bucket> findBucketsByOrgName(@Nullable final String orgName);
209209

210+
/**
211+
* List all buckets.
212+
*
213+
* @return List all buckets
214+
*/
215+
@Nonnull
216+
List<Bucket> findBuckets(@Nonnull final BucketsQuery query);
217+
210218
/**
211219
* List all users with member privileges for a bucket.
212220
*
@@ -368,4 +376,4 @@ Bucket createBucket(@Nonnull final String name,
368376
* @param labelID the ID of a label
369377
*/
370378
void deleteLabel(@Nonnull final String labelID, @Nonnull final String bucketID);
371-
}
379+
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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 BucketsQuery {
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+
/**
41+
* The last resource ID from which to seek from (but not including).
42+
* This is to be used instead of &#x60;offset&#x60;. (optional)
43+
*/
44+
@Nullable
45+
private String after;
46+
47+
/**
48+
* The name of the organization. (optional)
49+
*/
50+
@Nullable
51+
private String org;
52+
53+
/**
54+
* The organization ID. (optional)
55+
*/
56+
@Nullable
57+
private String orgID;
58+
59+
/**
60+
* Only returns buckets with a specific name. (optional)
61+
*/
62+
@Nullable
63+
private String name;
64+
65+
/**
66+
* Only returns buckets with a specific ID. (optional)
67+
*/
68+
@Nullable
69+
private String id;
70+
71+
@Nullable
72+
public Integer getOffset() {
73+
return offset;
74+
}
75+
76+
public void setOffset(@Nullable final Integer offset) {
77+
this.offset = offset;
78+
}
79+
80+
@Nullable
81+
public Integer getLimit() {
82+
return limit;
83+
}
84+
85+
public void setLimit(@Nullable final Integer limit) {
86+
this.limit = limit;
87+
}
88+
89+
@Nullable
90+
public String getAfter() {
91+
return after;
92+
}
93+
94+
public void setAfter(@Nullable final String after) {
95+
this.after = after;
96+
}
97+
98+
@Nullable
99+
public String getOrg() {
100+
return org;
101+
}
102+
103+
public void setOrg(@Nullable final String org) {
104+
this.org = org;
105+
}
106+
107+
@Nullable
108+
public String getOrgID() {
109+
return orgID;
110+
}
111+
112+
public void setOrgID(@Nullable final String orgID) {
113+
this.orgID = orgID;
114+
}
115+
116+
@Nullable
117+
public String getName() {
118+
return name;
119+
}
120+
121+
public void setName(@Nullable final String name) {
122+
this.name = name;
123+
}
124+
125+
@Nullable
126+
public String getId() {
127+
return id;
128+
}
129+
130+
public void setId(@Nullable final String id) {
131+
this.id = id;
132+
}
133+
134+
}

client/src/main/java/com/influxdb/client/OrganizationsApi.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ public interface OrganizationsApi {
119119
@Nonnull
120120
List<Organization> findOrganizations();
121121

122+
/**
123+
* List all organizations.
124+
*
125+
* @return List all organizations
126+
*/
127+
@Nonnull
128+
List<Organization> findOrganizations(@Nonnull final OrganizationsQuery query);
129+
122130
/**
123131
* List of secret keys the are stored for Organization.
124132
* <p>
@@ -185,7 +193,7 @@ public interface OrganizationsApi {
185193
* Delete provided secrets.
186194
*
187195
* @param secretKeys secret key to deleted (required)
188-
* @param orgID ID of the organization (required)
196+
* @param orgID ID of the organization (required)
189197
*/
190198
void deleteSecrets(@Nonnull final SecretKeys secretKeys, @Nonnull final String orgID);
191199

@@ -297,4 +305,4 @@ public interface OrganizationsApi {
297305
*/
298306
void deleteOwner(@Nonnull final String ownerID, @Nonnull final String orgID);
299307

300-
}
308+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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 OrganizationsQuery {
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+
/**
41+
* Descending. (optional, default to false)
42+
*/
43+
@Nullable
44+
private Boolean descending;
45+
46+
/**
47+
* Filter organizations to a specific organization name. (optional)
48+
*/
49+
@Nullable
50+
private String org;
51+
/**
52+
* Filter organizations to a specific organization ID. (optional)
53+
*/
54+
@Nullable
55+
private String orgID;
56+
57+
/**
58+
* Filter organizations to a specific user ID. (optional)
59+
*/
60+
@Nullable
61+
private String userID;
62+
63+
@Nullable
64+
public Integer getOffset() {
65+
return offset;
66+
}
67+
68+
public void setOffset(@Nullable final Integer offset) {
69+
this.offset = offset;
70+
}
71+
72+
@Nullable
73+
public Integer getLimit() {
74+
return limit;
75+
}
76+
77+
public void setLimit(@Nullable final Integer limit) {
78+
this.limit = limit;
79+
}
80+
81+
@Nullable
82+
public Boolean getDescending() {
83+
return descending;
84+
}
85+
86+
public void setDescending(@Nullable final Boolean descending) {
87+
this.descending = descending;
88+
}
89+
90+
@Nullable
91+
public String getOrg() {
92+
return org;
93+
}
94+
95+
public void setOrg(@Nullable final String org) {
96+
this.org = org;
97+
}
98+
99+
@Nullable
100+
public String getOrgID() {
101+
return orgID;
102+
}
103+
104+
public void setOrgID(@Nullable final String orgID) {
105+
this.orgID = orgID;
106+
}
107+
108+
@Nullable
109+
public String getUserID() {
110+
return userID;
111+
}
112+
113+
public void setUserID(@Nullable final String userID) {
114+
this.userID = userID;
115+
}
116+
117+
}

client/src/main/java/com/influxdb/client/TasksApi.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,15 @@ List<Task> findTasks(@Nullable final String afterID,
266266
@Nullable final String userID,
267267
@Nullable final String orgID);
268268

269+
/**
270+
* Lists tasks, limit 100.
271+
*
272+
* @param query query params for task
273+
* @return A list of tasks
274+
*/
275+
@Nonnull
276+
List<Task> findTasks(@Nonnull final TasksQuery query);
277+
269278
/**
270279
* List all task members.
271280
*
@@ -402,7 +411,6 @@ List<Run> getRuns(@Nonnull final Task task,
402411
* Retrieve list of run records for a task.
403412
*
404413
* @param taskID ID of task to get runs for
405-
*
406414
* @return the list of run records for a task
407415
*/
408416
@Nonnull
@@ -585,4 +593,4 @@ List<Run> getRuns(@Nonnull final String taskID,
585593
* @param labelID the ID of a label
586594
*/
587595
void deleteLabel(@Nonnull final String labelID, @Nonnull final String taskID);
588-
}
596+
}

0 commit comments

Comments
 (0)