stackit-objectstorage 0.0.1a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stackit/objectstorage/__init__.py +73 -0
- stackit/objectstorage/api/__init__.py +4 -0
- stackit/objectstorage/api/default_api.py +3349 -0
- stackit/objectstorage/api_client.py +626 -0
- stackit/objectstorage/api_response.py +23 -0
- stackit/objectstorage/configuration.py +111 -0
- stackit/objectstorage/exceptions.py +198 -0
- stackit/objectstorage/models/__init__.py +54 -0
- stackit/objectstorage/models/access_key.py +87 -0
- stackit/objectstorage/models/bucket.py +93 -0
- stackit/objectstorage/models/create_access_key_payload.py +82 -0
- stackit/objectstorage/models/create_access_key_response.py +97 -0
- stackit/objectstorage/models/create_bucket_response.py +82 -0
- stackit/objectstorage/models/create_credentials_group_payload.py +83 -0
- stackit/objectstorage/models/create_credentials_group_response.py +96 -0
- stackit/objectstorage/models/credentials_group.py +89 -0
- stackit/objectstorage/models/delete_access_key_response.py +84 -0
- stackit/objectstorage/models/delete_bucket_response.py +82 -0
- stackit/objectstorage/models/delete_credentials_group_response.py +82 -0
- stackit/objectstorage/models/detailed_error.py +82 -0
- stackit/objectstorage/models/error_message.py +98 -0
- stackit/objectstorage/models/get_bucket_response.py +92 -0
- stackit/objectstorage/models/http_validation_error.py +98 -0
- stackit/objectstorage/models/list_access_keys_response.py +100 -0
- stackit/objectstorage/models/list_buckets_response.py +98 -0
- stackit/objectstorage/models/list_credentials_groups_response.py +100 -0
- stackit/objectstorage/models/location_inner.py +147 -0
- stackit/objectstorage/models/project_scope.py +36 -0
- stackit/objectstorage/models/project_status.py +84 -0
- stackit/objectstorage/models/validation_error.py +98 -0
- stackit/objectstorage/py.typed +0 -0
- stackit/objectstorage/rest.py +148 -0
- stackit_objectstorage-0.0.1a0.dist-info/METADATA +45 -0
- stackit_objectstorage-0.0.1a0.dist-info/RECORD +35 -0
- stackit_objectstorage-0.0.1a0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Object Storage API
|
|
5
|
+
|
|
6
|
+
STACKIT API to manage the Object Storage
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.9
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class HostConfiguration:
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
region=None,
|
|
19
|
+
server_index=None,
|
|
20
|
+
server_variables=None,
|
|
21
|
+
server_operation_index=None,
|
|
22
|
+
server_operation_variables=None,
|
|
23
|
+
ignore_operation_servers=False,
|
|
24
|
+
) -> None:
|
|
25
|
+
"""Constructor"""
|
|
26
|
+
self._base_path = "https://object-storage.api.eu01.stackit.cloud"
|
|
27
|
+
"""Default Base url
|
|
28
|
+
"""
|
|
29
|
+
self.server_index = 0 if server_index is None else server_index
|
|
30
|
+
self.server_operation_index = server_operation_index or {}
|
|
31
|
+
"""Default server index
|
|
32
|
+
"""
|
|
33
|
+
self.server_variables = server_variables or {}
|
|
34
|
+
if region:
|
|
35
|
+
self.server_variables["region"] = "{}.".format(region)
|
|
36
|
+
self.server_operation_variables = server_operation_variables or {}
|
|
37
|
+
"""Default server variables
|
|
38
|
+
"""
|
|
39
|
+
self.ignore_operation_servers = ignore_operation_servers
|
|
40
|
+
"""Ignore operation servers
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
def get_host_settings(self):
|
|
44
|
+
"""Gets an array of host settings
|
|
45
|
+
|
|
46
|
+
:return: An array of host settings
|
|
47
|
+
"""
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
"url": "https://object-storage.api.{region}stackit.cloud",
|
|
51
|
+
"description": "No description provided",
|
|
52
|
+
"variables": {
|
|
53
|
+
"region": {
|
|
54
|
+
"description": "No description provided",
|
|
55
|
+
"default_value": "eu01.",
|
|
56
|
+
"enum_values": ["eu01."],
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
def get_host_from_settings(self, index, variables=None, servers=None):
|
|
63
|
+
"""Gets host URL based on the index and variables
|
|
64
|
+
:param index: array index of the host settings
|
|
65
|
+
:param variables: hash of variable and the corresponding value
|
|
66
|
+
:param servers: an array of host settings or None
|
|
67
|
+
:return: URL based on host settings
|
|
68
|
+
"""
|
|
69
|
+
if index is None:
|
|
70
|
+
return self._base_path
|
|
71
|
+
|
|
72
|
+
variables = {} if variables is None else variables
|
|
73
|
+
servers = self.get_host_settings() if servers is None else servers
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
server = servers[index]
|
|
77
|
+
except IndexError:
|
|
78
|
+
raise ValueError(
|
|
79
|
+
"Invalid index {0} when selecting the host settings. "
|
|
80
|
+
"Must be less than {1}".format(index, len(servers))
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
url = server["url"]
|
|
84
|
+
|
|
85
|
+
# go through variables and replace placeholders
|
|
86
|
+
for variable_name, variable in server.get("variables", {}).items():
|
|
87
|
+
used_value = variables.get(variable_name, variable["default_value"])
|
|
88
|
+
|
|
89
|
+
if "enum_values" in variable and used_value not in variable["enum_values"]:
|
|
90
|
+
given_value = variables[variable_name].replace(".", "")
|
|
91
|
+
valid_values = [v.replace(".", "") for v in variable["enum_values"]]
|
|
92
|
+
raise ValueError(
|
|
93
|
+
"The variable `{0}` in the host URL has invalid value '{1}'. Must be '{2}'.".format(
|
|
94
|
+
variable_name, given_value, valid_values
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
url = url.replace("{" + variable_name + "}", used_value)
|
|
99
|
+
|
|
100
|
+
return url
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def host(self):
|
|
104
|
+
"""Return generated host."""
|
|
105
|
+
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
|
106
|
+
|
|
107
|
+
@host.setter
|
|
108
|
+
def host(self, value):
|
|
109
|
+
"""Fix base path."""
|
|
110
|
+
self._base_path = value
|
|
111
|
+
self.server_index = None
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Object Storage API
|
|
5
|
+
|
|
6
|
+
STACKIT API to manage the Object Storage
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.9
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from typing import Any, Optional
|
|
15
|
+
|
|
16
|
+
from typing_extensions import Self
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class OpenApiException(Exception):
|
|
20
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
24
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
|
|
25
|
+
"""Raises an exception for TypeErrors
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
msg (str): the exception message
|
|
29
|
+
|
|
30
|
+
Keyword Args:
|
|
31
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
32
|
+
current_item
|
|
33
|
+
None if unset
|
|
34
|
+
valid_classes (tuple): the primitive classes that current item
|
|
35
|
+
should be an instance of
|
|
36
|
+
None if unset
|
|
37
|
+
key_type (bool): False if our value is a value in a dict
|
|
38
|
+
True if it is a key in a dict
|
|
39
|
+
False if our item is an item in a list
|
|
40
|
+
None if unset
|
|
41
|
+
"""
|
|
42
|
+
self.path_to_item = path_to_item
|
|
43
|
+
self.valid_classes = valid_classes
|
|
44
|
+
self.key_type = key_type
|
|
45
|
+
full_msg = msg
|
|
46
|
+
if path_to_item:
|
|
47
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
48
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
52
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
53
|
+
"""
|
|
54
|
+
Args:
|
|
55
|
+
msg (str): the exception message
|
|
56
|
+
|
|
57
|
+
Keyword Args:
|
|
58
|
+
path_to_item (list) the path to the exception in the
|
|
59
|
+
received_data dict. None if unset
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
self.path_to_item = path_to_item
|
|
63
|
+
full_msg = msg
|
|
64
|
+
if path_to_item:
|
|
65
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
66
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
70
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
71
|
+
"""
|
|
72
|
+
Raised when an attribute reference or assignment fails.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
msg (str): the exception message
|
|
76
|
+
|
|
77
|
+
Keyword Args:
|
|
78
|
+
path_to_item (None/list) the path to the exception in the
|
|
79
|
+
received_data dict
|
|
80
|
+
"""
|
|
81
|
+
self.path_to_item = path_to_item
|
|
82
|
+
full_msg = msg
|
|
83
|
+
if path_to_item:
|
|
84
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
85
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
89
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
90
|
+
"""
|
|
91
|
+
Args:
|
|
92
|
+
msg (str): the exception message
|
|
93
|
+
|
|
94
|
+
Keyword Args:
|
|
95
|
+
path_to_item (None/list) the path to the exception in the
|
|
96
|
+
received_data dict
|
|
97
|
+
"""
|
|
98
|
+
self.path_to_item = path_to_item
|
|
99
|
+
full_msg = msg
|
|
100
|
+
if path_to_item:
|
|
101
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
102
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class ApiException(OpenApiException):
|
|
106
|
+
|
|
107
|
+
def __init__(
|
|
108
|
+
self,
|
|
109
|
+
status=None,
|
|
110
|
+
reason=None,
|
|
111
|
+
http_resp=None,
|
|
112
|
+
*,
|
|
113
|
+
body: Optional[str] = None,
|
|
114
|
+
data: Optional[Any] = None,
|
|
115
|
+
) -> None:
|
|
116
|
+
self.status = status
|
|
117
|
+
self.reason = reason
|
|
118
|
+
self.body = body
|
|
119
|
+
self.data = data
|
|
120
|
+
self.headers = None
|
|
121
|
+
|
|
122
|
+
if http_resp:
|
|
123
|
+
if self.status is None:
|
|
124
|
+
self.status = http_resp.status
|
|
125
|
+
if self.reason is None:
|
|
126
|
+
self.reason = http_resp.reason
|
|
127
|
+
if self.body is None:
|
|
128
|
+
try:
|
|
129
|
+
self.body = http_resp.data.decode("utf-8")
|
|
130
|
+
except Exception: # noqa: S110
|
|
131
|
+
pass
|
|
132
|
+
self.headers = http_resp.getheaders()
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_response(
|
|
136
|
+
cls,
|
|
137
|
+
*,
|
|
138
|
+
http_resp,
|
|
139
|
+
body: Optional[str],
|
|
140
|
+
data: Optional[Any],
|
|
141
|
+
) -> Self:
|
|
142
|
+
if http_resp.status == 400:
|
|
143
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
144
|
+
|
|
145
|
+
if http_resp.status == 401:
|
|
146
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
147
|
+
|
|
148
|
+
if http_resp.status == 403:
|
|
149
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
150
|
+
|
|
151
|
+
if http_resp.status == 404:
|
|
152
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
153
|
+
|
|
154
|
+
if 500 <= http_resp.status <= 599:
|
|
155
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
156
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
157
|
+
|
|
158
|
+
def __str__(self):
|
|
159
|
+
"""Custom error messages for exception"""
|
|
160
|
+
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
|
|
161
|
+
if self.headers:
|
|
162
|
+
error_message += "HTTP response headers: {0}\n".format(self.headers)
|
|
163
|
+
|
|
164
|
+
if self.data or self.body:
|
|
165
|
+
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
|
166
|
+
|
|
167
|
+
return error_message
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class BadRequestException(ApiException):
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class NotFoundException(ApiException):
|
|
175
|
+
pass
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class UnauthorizedException(ApiException):
|
|
179
|
+
pass
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class ForbiddenException(ApiException):
|
|
183
|
+
pass
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class ServiceException(ApiException):
|
|
187
|
+
pass
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def render_path(path_to_item):
|
|
191
|
+
"""Returns a string representation of a path"""
|
|
192
|
+
result = ""
|
|
193
|
+
for pth in path_to_item:
|
|
194
|
+
if isinstance(pth, int):
|
|
195
|
+
result += "[{0}]".format(pth)
|
|
196
|
+
else:
|
|
197
|
+
result += "['{0}']".format(pth)
|
|
198
|
+
return result
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
"""
|
|
5
|
+
STACKIT Object Storage API
|
|
6
|
+
|
|
7
|
+
STACKIT API to manage the Object Storage
|
|
8
|
+
|
|
9
|
+
The version of the OpenAPI document: 1.0.9
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501 docstring might be too long
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# import models into model package
|
|
17
|
+
from stackit.objectstorage.models.access_key import AccessKey
|
|
18
|
+
from stackit.objectstorage.models.bucket import Bucket
|
|
19
|
+
from stackit.objectstorage.models.create_access_key_payload import (
|
|
20
|
+
CreateAccessKeyPayload,
|
|
21
|
+
)
|
|
22
|
+
from stackit.objectstorage.models.create_access_key_response import (
|
|
23
|
+
CreateAccessKeyResponse,
|
|
24
|
+
)
|
|
25
|
+
from stackit.objectstorage.models.create_bucket_response import CreateBucketResponse
|
|
26
|
+
from stackit.objectstorage.models.create_credentials_group_payload import (
|
|
27
|
+
CreateCredentialsGroupPayload,
|
|
28
|
+
)
|
|
29
|
+
from stackit.objectstorage.models.create_credentials_group_response import (
|
|
30
|
+
CreateCredentialsGroupResponse,
|
|
31
|
+
)
|
|
32
|
+
from stackit.objectstorage.models.credentials_group import CredentialsGroup
|
|
33
|
+
from stackit.objectstorage.models.delete_access_key_response import (
|
|
34
|
+
DeleteAccessKeyResponse,
|
|
35
|
+
)
|
|
36
|
+
from stackit.objectstorage.models.delete_bucket_response import DeleteBucketResponse
|
|
37
|
+
from stackit.objectstorage.models.delete_credentials_group_response import (
|
|
38
|
+
DeleteCredentialsGroupResponse,
|
|
39
|
+
)
|
|
40
|
+
from stackit.objectstorage.models.detailed_error import DetailedError
|
|
41
|
+
from stackit.objectstorage.models.error_message import ErrorMessage
|
|
42
|
+
from stackit.objectstorage.models.get_bucket_response import GetBucketResponse
|
|
43
|
+
from stackit.objectstorage.models.http_validation_error import HTTPValidationError
|
|
44
|
+
from stackit.objectstorage.models.list_access_keys_response import (
|
|
45
|
+
ListAccessKeysResponse,
|
|
46
|
+
)
|
|
47
|
+
from stackit.objectstorage.models.list_buckets_response import ListBucketsResponse
|
|
48
|
+
from stackit.objectstorage.models.list_credentials_groups_response import (
|
|
49
|
+
ListCredentialsGroupsResponse,
|
|
50
|
+
)
|
|
51
|
+
from stackit.objectstorage.models.location_inner import LocationInner
|
|
52
|
+
from stackit.objectstorage.models.project_scope import ProjectScope
|
|
53
|
+
from stackit.objectstorage.models.project_status import ProjectStatus
|
|
54
|
+
from stackit.objectstorage.models.validation_error import ValidationError
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Object Storage API
|
|
5
|
+
|
|
6
|
+
STACKIT API to manage the Object Storage
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.9
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AccessKey(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
AccessKey
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
display_name: StrictStr = Field(alias="displayName")
|
|
30
|
+
expires: StrictStr
|
|
31
|
+
key_id: StrictStr = Field(
|
|
32
|
+
description="Identifies the pair of access key and secret access key for deletion", alias="keyId"
|
|
33
|
+
)
|
|
34
|
+
__properties: ClassVar[List[str]] = ["displayName", "expires", "keyId"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of AccessKey from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of AccessKey from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate(
|
|
85
|
+
{"displayName": obj.get("displayName"), "expires": obj.get("expires"), "keyId": obj.get("keyId")}
|
|
86
|
+
)
|
|
87
|
+
return _obj
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Object Storage API
|
|
5
|
+
|
|
6
|
+
STACKIT API to manage the Object Storage
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.9
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Bucket(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
Bucket
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
name: StrictStr
|
|
30
|
+
region: StrictStr
|
|
31
|
+
url_path_style: StrictStr = Field(description="URL in path style", alias="urlPathStyle")
|
|
32
|
+
url_virtual_hosted_style: StrictStr = Field(
|
|
33
|
+
description="URL in virtual hosted style", alias="urlVirtualHostedStyle"
|
|
34
|
+
)
|
|
35
|
+
__properties: ClassVar[List[str]] = ["name", "region", "urlPathStyle", "urlVirtualHostedStyle"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of Bucket from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of Bucket from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate(
|
|
86
|
+
{
|
|
87
|
+
"name": obj.get("name"),
|
|
88
|
+
"region": obj.get("region"),
|
|
89
|
+
"urlPathStyle": obj.get("urlPathStyle"),
|
|
90
|
+
"urlVirtualHostedStyle": obj.get("urlVirtualHostedStyle"),
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
return _obj
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Object Storage API
|
|
5
|
+
|
|
6
|
+
STACKIT API to manage the Object Storage
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.9
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CreateAccessKeyPayload(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
CreateAccessKeyPayload
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
expires: Optional[datetime] = Field(default=None, description="Expiration date. Null means never expires.")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["expires"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of CreateAccessKeyPayload from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([])
|
|
64
|
+
|
|
65
|
+
_dict = self.model_dump(
|
|
66
|
+
by_alias=True,
|
|
67
|
+
exclude=excluded_fields,
|
|
68
|
+
exclude_none=True,
|
|
69
|
+
)
|
|
70
|
+
return _dict
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of CreateAccessKeyPayload from a dict"""
|
|
75
|
+
if obj is None:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
if not isinstance(obj, dict):
|
|
79
|
+
return cls.model_validate(obj)
|
|
80
|
+
|
|
81
|
+
_obj = cls.model_validate({"expires": obj.get("expires")})
|
|
82
|
+
return _obj
|