Skip to content

Commit 0a78566

Browse files
authored
feat(swagger): Allow setting shard-group durations for buckets via API (influxdata#209)
1 parent e453f34 commit 0a78566

File tree

4 files changed

+41
-12
lines changed

4 files changed

+41
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
### Bug Fixes
77
1. [#206](https://github.com/influxdata/influxdb-client-python/pull/207): Use default (system) certificates instead of Mozilla's root certificates (certifi.where())
88

9+
### API
10+
1. [#209](https://github.com/influxdata/influxdb-client-python/pull/209): Allow setting shard-group durations for buckets via API
11+
912
### Documentation
1013
1. [#202](https://github.com/influxdata/influxdb-client-python/pull/202): Added an example how to use RxPY and sync batching
1114

influxdb_client/domain/bucket_retention_rules.py

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,27 @@ class BucketRetentionRules(object):
3333
"""
3434
openapi_types = {
3535
'type': 'str',
36-
'every_seconds': 'int'
36+
'every_seconds': 'int',
37+
'shard_group_duration_seconds': 'int'
3738
}
3839

3940
attribute_map = {
4041
'type': 'type',
41-
'every_seconds': 'everySeconds'
42+
'every_seconds': 'everySeconds',
43+
'shard_group_duration_seconds': 'shardGroupDurationSeconds'
4244
}
4345

44-
def __init__(self, type='expire', every_seconds=None): # noqa: E501,D401,D403
46+
def __init__(self, type='expire', every_seconds=None, shard_group_duration_seconds=None): # noqa: E501,D401,D403
4547
"""BucketRetentionRules - a model defined in OpenAPI.""" # noqa: E501
4648
self._type = None
4749
self._every_seconds = None
50+
self._shard_group_duration_seconds = None
4851
self.discriminator = None
4952

5053
self.type = type
5154
self.every_seconds = every_seconds
55+
if shard_group_duration_seconds is not None:
56+
self.shard_group_duration_seconds = shard_group_duration_seconds
5257

5358
@property
5459
def type(self):
@@ -74,7 +79,7 @@ def type(self, type):
7479
def every_seconds(self):
7580
"""Get the every_seconds of this BucketRetentionRules.
7681
77-
Duration in seconds for how long data will be kept in the database.
82+
Duration in seconds for how long data will be kept in the database. 0 means infinite.
7883
7984
:return: The every_seconds of this BucketRetentionRules.
8085
:rtype: int
@@ -85,17 +90,39 @@ def every_seconds(self):
8590
def every_seconds(self, every_seconds):
8691
"""Set the every_seconds of this BucketRetentionRules.
8792
88-
Duration in seconds for how long data will be kept in the database.
93+
Duration in seconds for how long data will be kept in the database. 0 means infinite.
8994
9095
:param every_seconds: The every_seconds of this BucketRetentionRules.
9196
:type: int
9297
""" # noqa: E501
9398
if every_seconds is None:
9499
raise ValueError("Invalid value for `every_seconds`, must not be `None`") # noqa: E501
95-
if every_seconds is not None and every_seconds < 1: # noqa: E501
96-
raise ValueError("Invalid value for `every_seconds`, must be a value greater than or equal to `1`") # noqa: E501
100+
if every_seconds is not None and every_seconds < 0: # noqa: E501
101+
raise ValueError("Invalid value for `every_seconds`, must be a value greater than or equal to `0`") # noqa: E501
97102
self._every_seconds = every_seconds
98103

104+
@property
105+
def shard_group_duration_seconds(self):
106+
"""Get the shard_group_duration_seconds of this BucketRetentionRules.
107+
108+
Shard duration measured in seconds.
109+
110+
:return: The shard_group_duration_seconds of this BucketRetentionRules.
111+
:rtype: int
112+
""" # noqa: E501
113+
return self._shard_group_duration_seconds
114+
115+
@shard_group_duration_seconds.setter
116+
def shard_group_duration_seconds(self, shard_group_duration_seconds):
117+
"""Set the shard_group_duration_seconds of this BucketRetentionRules.
118+
119+
Shard duration measured in seconds.
120+
121+
:param shard_group_duration_seconds: The shard_group_duration_seconds of this BucketRetentionRules.
122+
:type: int
123+
""" # noqa: E501
124+
self._shard_group_duration_seconds = shard_group_duration_seconds
125+
99126
def to_dict(self):
100127
"""Return the model properties as a dict."""
101128
result = {}

influxdb_client/domain/date_time_literal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DateTimeLiteral(object):
3333
"""
3434
openapi_types = {
3535
'type': 'str',
36-
'value': 'str'
36+
'value': 'datetime'
3737
}
3838

3939
attribute_map = {
@@ -79,7 +79,7 @@ def value(self):
7979
"""Get the value of this DateTimeLiteral.
8080
8181
:return: The value of this DateTimeLiteral.
82-
:rtype: str
82+
:rtype: datetime
8383
""" # noqa: E501
8484
return self._value
8585

@@ -88,7 +88,7 @@ def value(self, value):
8888
"""Set the value of this DateTimeLiteral.
8989
9090
:param value: The value of this DateTimeLiteral.
91-
:type: str
91+
:type: datetime
9292
""" # noqa: E501
9393
self._value = value
9494

tests/test_BucketsApi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ def test_create_bucket_retention_list(self):
7171

7272
bucket_name = generate_bucket_name()
7373

74-
retention = BucketRetentionRules
7574
ret_list = []
76-
retention.every_seconds = 3600
75+
retention = BucketRetentionRules(every_seconds=3600)
7776
retention.type = "expire"
7877
ret_list.append(retention)
7978

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy