Skip to content

Replication Create/Update Request is Missing the 'maxAgeSeconds' Parameter #587

New issue

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

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

Already on GitHub? Sign in to your account

Closed
chrmel opened this issue Jun 29, 2023 · 4 comments · Fixed by #588
Closed

Replication Create/Update Request is Missing the 'maxAgeSeconds' Parameter #587

chrmel opened this issue Jun 29, 2023 · 4 comments · Fixed by #588
Labels
bug Something isn't working
Milestone

Comments

@chrmel
Copy link

chrmel commented Jun 29, 2023

Specifications

  • Client Version: all
  • InfluxDB Version: 2.6, 2.7

Code sample to reproduce problem

Run 2 InflxuDB Instances

docker run -dit --rm --name influxdb1 -p 8086:8086 -e DOCKER_INFLUXDB_INIT_MODE=setup -e DOCKER_INFLUXDB_INIT_USERNAME=my-user -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password -e DOCKER_INFLUXDB_INIT_ORG=my-org -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket -e DOCKER_INFLUXDB_INIT_RETENTION=1h -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token influxdb:2.6
docker run -dit --rm --name influxdb2 -p 8096:8086 -e DOCKER_INFLUXDB_INIT_MODE=setup -e DOCKER_INFLUXDB_INIT_USERNAME=my-user -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password -e DOCKER_INFLUXDB_INIT_ORG=my-org -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket -e DOCKER_INFLUXDB_INIT_RETENTION=1h -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token influxdb:2.6

Create Replication

import influxdb_client
from influxdb_client.service import remote_connections_service, replications_service
from influxdb_client.domain.remote_connection_creation_request import RemoteConnectionCreationRequest
from influxdb_client.domain.replication_creation_request import ReplicationCreationRequest


# connect to influxdb
client = influxdb_client.InfluxDBClient(
    url='http://localhost:8086/', token='my-super-secret-auth-token', org='my-org',
    verify_ssl=False, timeout=180_000, debug=False,
)
client.ping()
print(client)

# get remote connections and replications services
rcs = remote_connections_service.RemoteConnectionsService(client.api_client)
rps = replications_service.ReplicationsService(client.api_client)
print(rcs, rps)

# create remote connection
remote = rcs.post_remote_connection(
    RemoteConnectionCreationRequest(
        org_id=client.organizations_api().find_organizations(org='my-org').pop().id,
        name='my-remote',
        remote_url='http://localhost:8096',
        remote_api_token='my-super-secret-auth-token',
        remote_org_id='6e3fd6b1a1113a50',
        allow_insecure_tls=True,
    )
)
print(remote)

# create replication
replication = rps.post_replication(
    ReplicationCreationRequest(
        org_id=client.organizations_api().find_organizations(org='my-org').pop().id,
        name='my-replication',
        local_bucket_id=client.buckets_api().find_buckets(name='my-bucket').buckets.pop().id,
        remote_id=remote.id,
        remote_bucket_id='1f61610ba134d6a1',
        max_age_seconds=0,
    )
)
print(replication)

Expected behavior

Create replication with maxAgeSeconds set to provided parameter.

Actual behavior

Fails becaus API parameter maxAgeSeconds (see API docs) is not reflected in python-client:

TypeError: ReplicationCreationRequest.__init__() got an unexpected keyword argument `max_age_seconds`

This means the replication parameter maxAgeSeconds cannot be set via the python client, thus defaults to 604800 seconds which might not be wanted.

Additional info

If there is a Python client it would be nice if it would also reflect the API. In my opinion the maxAgeSeconds parameter is kind of essential for a replication.

@chrmel chrmel added the bug Something isn't working label Jun 29, 2023
@powersj
Copy link
Contributor

powersj commented Jun 29, 2023

@bednar is resolving this a matter of updating the API with the apigen?

@bednar
Copy link
Contributor

bednar commented Jun 30, 2023

@powersj Yes, I've prepared the following PR #588

@bednar bednar added this to the 1.35.0 milestone Jul 1, 2023
@bednar
Copy link
Contributor

bednar commented Jul 1, 2023

Hi @chrmel,

I've prepared PR #588. If you would like to use the development version of the client, you can install it via:

pip install git+https://github.com/influxdata/influxdb-client-python.git@master

The stable version of the client will be available in our regular release cycle.

Regards

@chrmel
Copy link
Author

chrmel commented Jul 8, 2023

Hi @bednar,

thank you for the quick response and fix, it is much appreciated!

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants