Skip to content

Issue creating objectstorage access key without an expiry #809

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

Open
sebastianelsner opened this issue Mar 28, 2025 · 1 comment
Open

Issue creating objectstorage access key without an expiry #809

sebastianelsner opened this issue Mar 28, 2025 · 1 comment
Labels
bug Something isn't working has internal tracking issue

Comments

@sebastianelsner
Copy link

Hello,

I want to create a access key without an expiry. But I keep running into an pydantic problem.

I am running this code:

    config = Configuration()
    client = DefaultApi(config)
    name = "abc"
    project_id = os.getenv("OS_PROJECT_NAME")
    cred_grp_resp = client.create_credentials_group(
        project_id, "eu01", CreateCredentialsGroupPayload(displayName=name)
    )
    acc_key_resp = client.create_access_key(
        project_id,
        "eu01",
        CreateAccessKeyPayload(),
        cred_grp_resp.credentials_group.credentials_group_id,
    )

The error I am getting is:

  File "/app/pylfc/s3.py", line 196, in create_bucket_credentials
    acc_key_resp = client.create_access_key(
  File "/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_validate_call.py", line 39, in wrapper_function
    return wrapper(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_validate_call.py", line 136, in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
  File "/usr/local/lib/python3.10/dist-packages/stackit/objectstorage/api/default_api.py", line 139, in create_access_key
    return self.api_client.response_deserialize(
  File "/usr/local/lib/python3.10/dist-packages/stackit/objectstorage/api_client.py", line 275, in response_deserialize
    return_data = self.deserialize(response_text, response_type, content_type)
  File "/usr/local/lib/python3.10/dist-packages/stackit/objectstorage/api_client.py", line 363, in deserialize
    return self.__deserialize(data, response_type)
  File "/usr/local/lib/python3.10/dist-packages/stackit/objectstorage/api_client.py", line 408, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/usr/local/lib/python3.10/dist-packages/stackit/objectstorage/api_client.py", line 626, in __deserialize_model
    return klass.from_dict(data)
  File "/usr/local/lib/python3.10/dist-packages/stackit/objectstorage/models/create_access_key_response.py", line 87, in from_dict
    _obj = cls.model_validate(
  File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 693, in model_validate
    return cls.__pydantic_validator__.validate_python(
pydantic_core._pydantic_core.ValidationError: 1 validation error for CreateAccessKeyResponse
expires
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.11/v/string_type

I seems the "CreateAccessKeyPayload" accepts an "None" expiry date, which is allowed looing at the api docs, but the CreateAccessKeyResponse requires it the field to be a string and not None.

Using the same code but setting an "expires" allows me to create the key:

    acc_key_resp = client.create_access_key(
        project_id,
        "eu01",
        CreateAccessKeyPayload(expires=datetime(2026, 1, 1)),
        cred_grp_resp.credentials_group.credentials_group_id,
    )

Asking for a fix. Kind regards, Sebastian

@rubenhoenle
Copy link
Member

Hi Sebastian,

thanks for your report. We will investigate this.

@rubenhoenle rubenhoenle added has internal tracking issue bug Something isn't working labels Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has internal tracking issue
Projects
None yet
Development

No branches or pull requests

2 participants