dapla-toolbelt-metadata 0.2.1__py3-none-any.whl → 0.9.11__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.

Potentially problematic release.


This version of dapla-toolbelt-metadata might be problematic. Click here for more details.

Files changed (97) hide show
  1. dapla_metadata/__init__.py +11 -1
  2. dapla_metadata/_shared/__init__.py +1 -0
  3. dapla_metadata/_shared/config.py +109 -0
  4. dapla_metadata/_shared/enums.py +27 -0
  5. dapla_metadata/_shared/py.typed +0 -0
  6. dapla_metadata/dapla/__init__.py +4 -0
  7. dapla_metadata/dapla/user_info.py +138 -0
  8. dapla_metadata/datasets/__init__.py +1 -1
  9. dapla_metadata/datasets/_merge.py +333 -0
  10. dapla_metadata/datasets/code_list.py +5 -6
  11. dapla_metadata/datasets/compatibility/__init__.py +10 -0
  12. dapla_metadata/datasets/compatibility/_handlers.py +363 -0
  13. dapla_metadata/datasets/compatibility/_utils.py +259 -0
  14. dapla_metadata/datasets/compatibility/model_backwards_compatibility.py +135 -0
  15. dapla_metadata/datasets/core.py +136 -182
  16. dapla_metadata/datasets/dapla_dataset_path_info.py +145 -19
  17. dapla_metadata/datasets/dataset_parser.py +41 -28
  18. dapla_metadata/datasets/model_validation.py +29 -20
  19. dapla_metadata/datasets/statistic_subject_mapping.py +5 -1
  20. dapla_metadata/datasets/utility/constants.py +22 -15
  21. dapla_metadata/datasets/utility/enums.py +8 -20
  22. dapla_metadata/datasets/utility/urn.py +234 -0
  23. dapla_metadata/datasets/utility/utils.py +183 -111
  24. dapla_metadata/standards/__init__.py +4 -0
  25. dapla_metadata/standards/name_validator.py +250 -0
  26. dapla_metadata/standards/standard_validators.py +98 -0
  27. dapla_metadata/standards/utils/__init__.py +1 -0
  28. dapla_metadata/standards/utils/constants.py +49 -0
  29. dapla_metadata/variable_definitions/__init__.py +11 -0
  30. dapla_metadata/variable_definitions/_generated/.openapi-generator/FILES +20 -0
  31. dapla_metadata/variable_definitions/_generated/.openapi-generator/VERSION +1 -0
  32. dapla_metadata/variable_definitions/_generated/.openapi-generator-ignore +6 -0
  33. dapla_metadata/variable_definitions/_generated/README.md +148 -0
  34. dapla_metadata/variable_definitions/_generated/__init__.py +0 -0
  35. dapla_metadata/variable_definitions/_generated/vardef_client/__init__.py +47 -0
  36. dapla_metadata/variable_definitions/_generated/vardef_client/api/__init__.py +8 -0
  37. dapla_metadata/variable_definitions/_generated/vardef_client/api/data_migration_api.py +766 -0
  38. dapla_metadata/variable_definitions/_generated/vardef_client/api/draft_variable_definitions_api.py +888 -0
  39. dapla_metadata/variable_definitions/_generated/vardef_client/api/patches_api.py +888 -0
  40. dapla_metadata/variable_definitions/_generated/vardef_client/api/validity_periods_api.py +583 -0
  41. dapla_metadata/variable_definitions/_generated/vardef_client/api/variable_definitions_api.py +613 -0
  42. dapla_metadata/variable_definitions/_generated/vardef_client/api_client.py +779 -0
  43. dapla_metadata/variable_definitions/_generated/vardef_client/api_response.py +27 -0
  44. dapla_metadata/variable_definitions/_generated/vardef_client/configuration.py +474 -0
  45. dapla_metadata/variable_definitions/_generated/vardef_client/docs/CompleteResponse.md +51 -0
  46. dapla_metadata/variable_definitions/_generated/vardef_client/docs/Contact.md +30 -0
  47. dapla_metadata/variable_definitions/_generated/vardef_client/docs/DataMigrationApi.md +90 -0
  48. dapla_metadata/variable_definitions/_generated/vardef_client/docs/Draft.md +42 -0
  49. dapla_metadata/variable_definitions/_generated/vardef_client/docs/DraftVariableDefinitionsApi.md +259 -0
  50. dapla_metadata/variable_definitions/_generated/vardef_client/docs/LanguageStringType.md +31 -0
  51. dapla_metadata/variable_definitions/_generated/vardef_client/docs/Owner.md +31 -0
  52. dapla_metadata/variable_definitions/_generated/vardef_client/docs/Patch.md +43 -0
  53. dapla_metadata/variable_definitions/_generated/vardef_client/docs/PatchesApi.md +249 -0
  54. dapla_metadata/variable_definitions/_generated/vardef_client/docs/PublicApi.md +218 -0
  55. dapla_metadata/variable_definitions/_generated/vardef_client/docs/SupportedLanguages.md +15 -0
  56. dapla_metadata/variable_definitions/_generated/vardef_client/docs/UpdateDraft.md +44 -0
  57. dapla_metadata/variable_definitions/_generated/vardef_client/docs/ValidityPeriod.md +42 -0
  58. dapla_metadata/variable_definitions/_generated/vardef_client/docs/ValidityPeriodsApi.md +236 -0
  59. dapla_metadata/variable_definitions/_generated/vardef_client/docs/VariableDefinitionsApi.md +304 -0
  60. dapla_metadata/variable_definitions/_generated/vardef_client/docs/VariableStatus.md +17 -0
  61. dapla_metadata/variable_definitions/_generated/vardef_client/exceptions.py +193 -0
  62. dapla_metadata/variable_definitions/_generated/vardef_client/models/__init__.py +31 -0
  63. dapla_metadata/variable_definitions/_generated/vardef_client/models/complete_response.py +260 -0
  64. dapla_metadata/variable_definitions/_generated/vardef_client/models/contact.py +94 -0
  65. dapla_metadata/variable_definitions/_generated/vardef_client/models/draft.py +228 -0
  66. dapla_metadata/variable_definitions/_generated/vardef_client/models/get_vardok_vardef_mapping_by_id200_response.py +158 -0
  67. dapla_metadata/variable_definitions/_generated/vardef_client/models/language_string_type.py +101 -0
  68. dapla_metadata/variable_definitions/_generated/vardef_client/models/owner.py +87 -0
  69. dapla_metadata/variable_definitions/_generated/vardef_client/models/patch.py +244 -0
  70. dapla_metadata/variable_definitions/_generated/vardef_client/models/problem.py +118 -0
  71. dapla_metadata/variable_definitions/_generated/vardef_client/models/update_draft.py +274 -0
  72. dapla_metadata/variable_definitions/_generated/vardef_client/models/validity_period.py +225 -0
  73. dapla_metadata/variable_definitions/_generated/vardef_client/models/vardok_id_response.py +81 -0
  74. dapla_metadata/variable_definitions/_generated/vardef_client/models/vardok_vardef_id_pair_response.py +84 -0
  75. dapla_metadata/variable_definitions/_generated/vardef_client/models/variable_status.py +33 -0
  76. dapla_metadata/variable_definitions/_generated/vardef_client/py.typed +0 -0
  77. dapla_metadata/variable_definitions/_generated/vardef_client/rest.py +249 -0
  78. dapla_metadata/variable_definitions/_utils/__init__.py +1 -0
  79. dapla_metadata/variable_definitions/_utils/_client.py +32 -0
  80. dapla_metadata/variable_definitions/_utils/config.py +54 -0
  81. dapla_metadata/variable_definitions/_utils/constants.py +80 -0
  82. dapla_metadata/variable_definitions/_utils/files.py +309 -0
  83. dapla_metadata/variable_definitions/_utils/template_files.py +99 -0
  84. dapla_metadata/variable_definitions/_utils/variable_definition_files.py +143 -0
  85. dapla_metadata/variable_definitions/exceptions.py +255 -0
  86. dapla_metadata/variable_definitions/vardef.py +372 -0
  87. dapla_metadata/variable_definitions/vardok_id.py +48 -0
  88. dapla_metadata/variable_definitions/vardok_vardef_id_pair.py +47 -0
  89. dapla_metadata/variable_definitions/variable_definition.py +422 -0
  90. {dapla_toolbelt_metadata-0.2.1.dist-info → dapla_toolbelt_metadata-0.9.11.dist-info}/METADATA +34 -36
  91. dapla_toolbelt_metadata-0.9.11.dist-info/RECORD +97 -0
  92. {dapla_toolbelt_metadata-0.2.1.dist-info → dapla_toolbelt_metadata-0.9.11.dist-info}/WHEEL +1 -1
  93. dapla_metadata/datasets/config.py +0 -80
  94. dapla_metadata/datasets/model_backwards_compatibility.py +0 -520
  95. dapla_metadata/datasets/user_info.py +0 -88
  96. dapla_toolbelt_metadata-0.2.1.dist-info/RECORD +0 -22
  97. {dapla_toolbelt_metadata-0.2.1.dist-info → dapla_toolbelt_metadata-0.9.11.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,888 @@
1
+ """Internal Variable Definitions Administration API
2
+
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
+
5
+ The version of the OpenAPI document: 0.1
6
+ Contact: metadata@ssb.no
7
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+
9
+ Do not edit the class manually.
10
+ """
11
+
12
+ from typing import Annotated
13
+ from typing import Any
14
+
15
+ from pydantic import Field
16
+ from pydantic import StrictFloat
17
+ from pydantic import StrictInt
18
+ from pydantic import StrictStr
19
+ from pydantic import validate_call
20
+
21
+ from ..api_client import ApiClient
22
+ from ..api_client import RequestSerialized
23
+ from ..api_response import ApiResponse
24
+ from ..models.complete_response import CompleteResponse
25
+ from ..models.draft import Draft
26
+ from ..models.update_draft import UpdateDraft
27
+ from ..rest import RESTResponseType
28
+
29
+
30
+ class DraftVariableDefinitionsApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+ @validate_call
43
+ def create_variable_definition(
44
+ self,
45
+ active_group: Annotated[
46
+ StrictStr,
47
+ Field(description="The group which the user currently represents."),
48
+ ],
49
+ draft: Draft | None = None,
50
+ _request_timeout: None
51
+ | Annotated[StrictFloat, Field(gt=0)]
52
+ | tuple[
53
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
54
+ ] = None,
55
+ _request_auth: dict[StrictStr, Any] | None = None,
56
+ _content_type: StrictStr | None = None,
57
+ _headers: dict[StrictStr, Any] | None = None,
58
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
59
+ ) -> CompleteResponse:
60
+ """Create a variable definition.
61
+
62
+ Create a variable definition. New variable definitions are automatically assigned status DRAFT and must include all required fields. Attempts to specify id or variable_status in a request will receive 400 BAD REQUEST responses.
63
+
64
+ :param active_group: The group which the user currently represents. (required)
65
+ :type active_group: str
66
+ :param draft:
67
+ :type draft: Draft
68
+ :param _request_timeout: timeout setting for this request. If one
69
+ number provided, it will be total request
70
+ timeout. It can also be a pair (tuple) of
71
+ (connection, read) timeouts.
72
+ :type _request_timeout: int, tuple(int, int), optional
73
+ :param _request_auth: set to override the auth_settings for an a single
74
+ request; this effectively ignores the
75
+ authentication in the spec for a single request.
76
+ :type _request_auth: dict, optional
77
+ :param _content_type: force content-type for the request.
78
+ :type _content_type: str, Optional
79
+ :param _headers: set to override the headers for a single
80
+ request; this effectively ignores the headers
81
+ in the spec for a single request.
82
+ :type _headers: dict, optional
83
+ :param _host_index: set to override the host_index for a single
84
+ request; this effectively ignores the host_index
85
+ in the spec for a single request.
86
+ :type _host_index: int, optional
87
+ :return: Returns the result object.
88
+ """
89
+ _param = self._create_variable_definition_serialize(
90
+ active_group=active_group,
91
+ draft=draft,
92
+ _request_auth=_request_auth,
93
+ _content_type=_content_type,
94
+ _headers=_headers,
95
+ _host_index=_host_index,
96
+ )
97
+
98
+ _response_types_map: dict[str, str | None] = {
99
+ "201": "CompleteResponse",
100
+ "400": "Problem",
101
+ "409": "Problem",
102
+ }
103
+ response_data = self.api_client.call_api(
104
+ *_param, _request_timeout=_request_timeout
105
+ )
106
+ response_data.read()
107
+ return self.api_client.response_deserialize(
108
+ response_data=response_data,
109
+ response_types_map=_response_types_map,
110
+ ).data
111
+
112
+ @validate_call
113
+ def create_variable_definition_with_http_info(
114
+ self,
115
+ active_group: Annotated[
116
+ StrictStr,
117
+ Field(description="The group which the user currently represents."),
118
+ ],
119
+ draft: Draft | None = None,
120
+ _request_timeout: None
121
+ | Annotated[StrictFloat, Field(gt=0)]
122
+ | tuple[
123
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
124
+ ] = None,
125
+ _request_auth: dict[StrictStr, Any] | None = None,
126
+ _content_type: StrictStr | None = None,
127
+ _headers: dict[StrictStr, Any] | None = None,
128
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
129
+ ) -> ApiResponse[CompleteResponse]:
130
+ """Create a variable definition.
131
+
132
+ Create a variable definition. New variable definitions are automatically assigned status DRAFT and must include all required fields. Attempts to specify id or variable_status in a request will receive 400 BAD REQUEST responses.
133
+
134
+ :param active_group: The group which the user currently represents. (required)
135
+ :type active_group: str
136
+ :param draft:
137
+ :type draft: Draft
138
+ :param _request_timeout: timeout setting for this request. If one
139
+ number provided, it will be total request
140
+ timeout. It can also be a pair (tuple) of
141
+ (connection, read) timeouts.
142
+ :type _request_timeout: int, tuple(int, int), optional
143
+ :param _request_auth: set to override the auth_settings for an a single
144
+ request; this effectively ignores the
145
+ authentication in the spec for a single request.
146
+ :type _request_auth: dict, optional
147
+ :param _content_type: force content-type for the request.
148
+ :type _content_type: str, Optional
149
+ :param _headers: set to override the headers for a single
150
+ request; this effectively ignores the headers
151
+ in the spec for a single request.
152
+ :type _headers: dict, optional
153
+ :param _host_index: set to override the host_index for a single
154
+ request; this effectively ignores the host_index
155
+ in the spec for a single request.
156
+ :type _host_index: int, optional
157
+ :return: Returns the result object.
158
+ """
159
+ _param = self._create_variable_definition_serialize(
160
+ active_group=active_group,
161
+ draft=draft,
162
+ _request_auth=_request_auth,
163
+ _content_type=_content_type,
164
+ _headers=_headers,
165
+ _host_index=_host_index,
166
+ )
167
+
168
+ _response_types_map: dict[str, str | None] = {
169
+ "201": "CompleteResponse",
170
+ "400": "Problem",
171
+ "409": "Problem",
172
+ }
173
+ response_data = self.api_client.call_api(
174
+ *_param, _request_timeout=_request_timeout
175
+ )
176
+ response_data.read()
177
+ return self.api_client.response_deserialize(
178
+ response_data=response_data,
179
+ response_types_map=_response_types_map,
180
+ )
181
+
182
+ @validate_call
183
+ def create_variable_definition_without_preload_content(
184
+ self,
185
+ active_group: Annotated[
186
+ StrictStr,
187
+ Field(description="The group which the user currently represents."),
188
+ ],
189
+ draft: Draft | None = None,
190
+ _request_timeout: None
191
+ | Annotated[StrictFloat, Field(gt=0)]
192
+ | tuple[
193
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
194
+ ] = None,
195
+ _request_auth: dict[StrictStr, Any] | None = None,
196
+ _content_type: StrictStr | None = None,
197
+ _headers: dict[StrictStr, Any] | None = None,
198
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
199
+ ) -> RESTResponseType:
200
+ """Create a variable definition.
201
+
202
+ Create a variable definition. New variable definitions are automatically assigned status DRAFT and must include all required fields. Attempts to specify id or variable_status in a request will receive 400 BAD REQUEST responses.
203
+
204
+ :param active_group: The group which the user currently represents. (required)
205
+ :type active_group: str
206
+ :param draft:
207
+ :type draft: Draft
208
+ :param _request_timeout: timeout setting for this request. If one
209
+ number provided, it will be total request
210
+ timeout. It can also be a pair (tuple) of
211
+ (connection, read) timeouts.
212
+ :type _request_timeout: int, tuple(int, int), optional
213
+ :param _request_auth: set to override the auth_settings for an a single
214
+ request; this effectively ignores the
215
+ authentication in the spec for a single request.
216
+ :type _request_auth: dict, optional
217
+ :param _content_type: force content-type for the request.
218
+ :type _content_type: str, Optional
219
+ :param _headers: set to override the headers for a single
220
+ request; this effectively ignores the headers
221
+ in the spec for a single request.
222
+ :type _headers: dict, optional
223
+ :param _host_index: set to override the host_index for a single
224
+ request; this effectively ignores the host_index
225
+ in the spec for a single request.
226
+ :type _host_index: int, optional
227
+ :return: Returns the result object.
228
+ """
229
+ _param = self._create_variable_definition_serialize(
230
+ active_group=active_group,
231
+ draft=draft,
232
+ _request_auth=_request_auth,
233
+ _content_type=_content_type,
234
+ _headers=_headers,
235
+ _host_index=_host_index,
236
+ )
237
+
238
+ _response_types_map: dict[str, str | None] = {
239
+ "201": "CompleteResponse",
240
+ "400": "Problem",
241
+ "409": "Problem",
242
+ }
243
+ response_data = self.api_client.call_api(
244
+ *_param, _request_timeout=_request_timeout
245
+ )
246
+ return response_data.response
247
+
248
+ def _create_variable_definition_serialize(
249
+ self,
250
+ active_group,
251
+ draft,
252
+ _request_auth,
253
+ _content_type,
254
+ _headers,
255
+ _host_index,
256
+ ) -> RequestSerialized:
257
+ _host = None
258
+
259
+ _collection_formats: dict[str, str] = {}
260
+
261
+ _path_params: dict[str, str] = {}
262
+ _query_params: list[tuple[str, str]] = []
263
+ _header_params: dict[str, str | None] = _headers or {}
264
+ _form_params: list[tuple[str, str]] = []
265
+ _files: dict[
266
+ str, str | bytes | list[str] | list[bytes] | list[tuple[str, bytes]]
267
+ ] = {}
268
+ _body_params: bytes | None = None
269
+
270
+ # process the path parameters
271
+ # process the query parameters
272
+ if active_group is not None:
273
+ _query_params.append(("active_group", active_group))
274
+
275
+ # process the header parameters
276
+ # process the form parameters
277
+ # process the body parameter
278
+ if draft is not None:
279
+ _body_params = draft
280
+
281
+ # set the HTTP header `Accept`
282
+ if "Accept" not in _header_params:
283
+ _header_params["Accept"] = self.api_client.select_header_accept(
284
+ ["application/json", "application/problem+json"]
285
+ )
286
+
287
+ # set the HTTP header `Content-Type`
288
+ if _content_type:
289
+ _header_params["Content-Type"] = _content_type
290
+ else:
291
+ _default_content_type = self.api_client.select_header_content_type(
292
+ ["application/json"]
293
+ )
294
+ if _default_content_type is not None:
295
+ _header_params["Content-Type"] = _default_content_type
296
+
297
+ # authentication setting
298
+ _auth_settings: list[str] = ["keycloak_token"]
299
+
300
+ return self.api_client.param_serialize(
301
+ method="POST",
302
+ resource_path="/variable-definitions",
303
+ path_params=_path_params,
304
+ query_params=_query_params,
305
+ header_params=_header_params,
306
+ body=_body_params,
307
+ post_params=_form_params,
308
+ files=_files,
309
+ auth_settings=_auth_settings,
310
+ collection_formats=_collection_formats,
311
+ _host=_host,
312
+ _request_auth=_request_auth,
313
+ )
314
+
315
+ @validate_call
316
+ def delete_variable_definition_by_id(
317
+ self,
318
+ variable_definition_id: Annotated[
319
+ StrictStr,
320
+ Field(description="Unique identifier for the variable definition."),
321
+ ],
322
+ active_group: Annotated[
323
+ StrictStr,
324
+ Field(description="The group which the user currently represents."),
325
+ ],
326
+ _request_timeout: None
327
+ | Annotated[StrictFloat, Field(gt=0)]
328
+ | tuple[
329
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
330
+ ] = None,
331
+ _request_auth: dict[StrictStr, Any] | None = None,
332
+ _content_type: StrictStr | None = None,
333
+ _headers: dict[StrictStr, Any] | None = None,
334
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
335
+ ) -> None:
336
+ """Delete a variable definition.
337
+
338
+ Delete a variable definition.
339
+
340
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
341
+ :type variable_definition_id: str
342
+ :param active_group: The group which the user currently represents. (required)
343
+ :type active_group: str
344
+ :param _request_timeout: timeout setting for this request. If one
345
+ number provided, it will be total request
346
+ timeout. It can also be a pair (tuple) of
347
+ (connection, read) timeouts.
348
+ :type _request_timeout: int, tuple(int, int), optional
349
+ :param _request_auth: set to override the auth_settings for an a single
350
+ request; this effectively ignores the
351
+ authentication in the spec for a single request.
352
+ :type _request_auth: dict, optional
353
+ :param _content_type: force content-type for the request.
354
+ :type _content_type: str, Optional
355
+ :param _headers: set to override the headers for a single
356
+ request; this effectively ignores the headers
357
+ in the spec for a single request.
358
+ :type _headers: dict, optional
359
+ :param _host_index: set to override the host_index for a single
360
+ request; this effectively ignores the host_index
361
+ in the spec for a single request.
362
+ :type _host_index: int, optional
363
+ :return: Returns the result object.
364
+ """
365
+ _param = self._delete_variable_definition_by_id_serialize(
366
+ variable_definition_id=variable_definition_id,
367
+ active_group=active_group,
368
+ _request_auth=_request_auth,
369
+ _content_type=_content_type,
370
+ _headers=_headers,
371
+ _host_index=_host_index,
372
+ )
373
+
374
+ _response_types_map: dict[str, str | None] = {
375
+ "204": None,
376
+ "404": "Problem",
377
+ "405": "Problem",
378
+ }
379
+ response_data = self.api_client.call_api(
380
+ *_param, _request_timeout=_request_timeout
381
+ )
382
+ response_data.read()
383
+ return self.api_client.response_deserialize(
384
+ response_data=response_data,
385
+ response_types_map=_response_types_map,
386
+ ).data
387
+
388
+ @validate_call
389
+ def delete_variable_definition_by_id_with_http_info(
390
+ self,
391
+ variable_definition_id: Annotated[
392
+ StrictStr,
393
+ Field(description="Unique identifier for the variable definition."),
394
+ ],
395
+ active_group: Annotated[
396
+ StrictStr,
397
+ Field(description="The group which the user currently represents."),
398
+ ],
399
+ _request_timeout: None
400
+ | Annotated[StrictFloat, Field(gt=0)]
401
+ | tuple[
402
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
403
+ ] = None,
404
+ _request_auth: dict[StrictStr, Any] | None = None,
405
+ _content_type: StrictStr | None = None,
406
+ _headers: dict[StrictStr, Any] | None = None,
407
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
408
+ ) -> ApiResponse[None]:
409
+ """Delete a variable definition.
410
+
411
+ Delete a variable definition.
412
+
413
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
414
+ :type variable_definition_id: str
415
+ :param active_group: The group which the user currently represents. (required)
416
+ :type active_group: str
417
+ :param _request_timeout: timeout setting for this request. If one
418
+ number provided, it will be total request
419
+ timeout. It can also be a pair (tuple) of
420
+ (connection, read) timeouts.
421
+ :type _request_timeout: int, tuple(int, int), optional
422
+ :param _request_auth: set to override the auth_settings for an a single
423
+ request; this effectively ignores the
424
+ authentication in the spec for a single request.
425
+ :type _request_auth: dict, optional
426
+ :param _content_type: force content-type for the request.
427
+ :type _content_type: str, Optional
428
+ :param _headers: set to override the headers for a single
429
+ request; this effectively ignores the headers
430
+ in the spec for a single request.
431
+ :type _headers: dict, optional
432
+ :param _host_index: set to override the host_index for a single
433
+ request; this effectively ignores the host_index
434
+ in the spec for a single request.
435
+ :type _host_index: int, optional
436
+ :return: Returns the result object.
437
+ """
438
+ _param = self._delete_variable_definition_by_id_serialize(
439
+ variable_definition_id=variable_definition_id,
440
+ active_group=active_group,
441
+ _request_auth=_request_auth,
442
+ _content_type=_content_type,
443
+ _headers=_headers,
444
+ _host_index=_host_index,
445
+ )
446
+
447
+ _response_types_map: dict[str, str | None] = {
448
+ "204": None,
449
+ "404": "Problem",
450
+ "405": "Problem",
451
+ }
452
+ response_data = self.api_client.call_api(
453
+ *_param, _request_timeout=_request_timeout
454
+ )
455
+ response_data.read()
456
+ return self.api_client.response_deserialize(
457
+ response_data=response_data,
458
+ response_types_map=_response_types_map,
459
+ )
460
+
461
+ @validate_call
462
+ def delete_variable_definition_by_id_without_preload_content(
463
+ self,
464
+ variable_definition_id: Annotated[
465
+ StrictStr,
466
+ Field(description="Unique identifier for the variable definition."),
467
+ ],
468
+ active_group: Annotated[
469
+ StrictStr,
470
+ Field(description="The group which the user currently represents."),
471
+ ],
472
+ _request_timeout: None
473
+ | Annotated[StrictFloat, Field(gt=0)]
474
+ | tuple[
475
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
476
+ ] = None,
477
+ _request_auth: dict[StrictStr, Any] | None = None,
478
+ _content_type: StrictStr | None = None,
479
+ _headers: dict[StrictStr, Any] | None = None,
480
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
481
+ ) -> RESTResponseType:
482
+ """Delete a variable definition.
483
+
484
+ Delete a variable definition.
485
+
486
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
487
+ :type variable_definition_id: str
488
+ :param active_group: The group which the user currently represents. (required)
489
+ :type active_group: str
490
+ :param _request_timeout: timeout setting for this request. If one
491
+ number provided, it will be total request
492
+ timeout. It can also be a pair (tuple) of
493
+ (connection, read) timeouts.
494
+ :type _request_timeout: int, tuple(int, int), optional
495
+ :param _request_auth: set to override the auth_settings for an a single
496
+ request; this effectively ignores the
497
+ authentication in the spec for a single request.
498
+ :type _request_auth: dict, optional
499
+ :param _content_type: force content-type for the request.
500
+ :type _content_type: str, Optional
501
+ :param _headers: set to override the headers for a single
502
+ request; this effectively ignores the headers
503
+ in the spec for a single request.
504
+ :type _headers: dict, optional
505
+ :param _host_index: set to override the host_index for a single
506
+ request; this effectively ignores the host_index
507
+ in the spec for a single request.
508
+ :type _host_index: int, optional
509
+ :return: Returns the result object.
510
+ """
511
+ _param = self._delete_variable_definition_by_id_serialize(
512
+ variable_definition_id=variable_definition_id,
513
+ active_group=active_group,
514
+ _request_auth=_request_auth,
515
+ _content_type=_content_type,
516
+ _headers=_headers,
517
+ _host_index=_host_index,
518
+ )
519
+
520
+ _response_types_map: dict[str, str | None] = {
521
+ "204": None,
522
+ "404": "Problem",
523
+ "405": "Problem",
524
+ }
525
+ response_data = self.api_client.call_api(
526
+ *_param, _request_timeout=_request_timeout
527
+ )
528
+ return response_data.response
529
+
530
+ def _delete_variable_definition_by_id_serialize(
531
+ self,
532
+ variable_definition_id,
533
+ active_group,
534
+ _request_auth,
535
+ _content_type,
536
+ _headers,
537
+ _host_index,
538
+ ) -> RequestSerialized:
539
+ _host = None
540
+
541
+ _collection_formats: dict[str, str] = {}
542
+
543
+ _path_params: dict[str, str] = {}
544
+ _query_params: list[tuple[str, str]] = []
545
+ _header_params: dict[str, str | None] = _headers or {}
546
+ _form_params: list[tuple[str, str]] = []
547
+ _files: dict[
548
+ str, str | bytes | list[str] | list[bytes] | list[tuple[str, bytes]]
549
+ ] = {}
550
+ _body_params: bytes | None = None
551
+
552
+ # process the path parameters
553
+ if variable_definition_id is not None:
554
+ _path_params["variable-definition-id"] = variable_definition_id
555
+ # process the query parameters
556
+ if active_group is not None:
557
+ _query_params.append(("active_group", active_group))
558
+
559
+ # process the header parameters
560
+ # process the form parameters
561
+ # process the body parameter
562
+
563
+ # set the HTTP header `Accept`
564
+ if "Accept" not in _header_params:
565
+ _header_params["Accept"] = self.api_client.select_header_accept(
566
+ ["application/json", "application/problem+json"]
567
+ )
568
+
569
+ # authentication setting
570
+ _auth_settings: list[str] = ["keycloak_token"]
571
+
572
+ return self.api_client.param_serialize(
573
+ method="DELETE",
574
+ resource_path="/variable-definitions/{variable-definition-id}",
575
+ path_params=_path_params,
576
+ query_params=_query_params,
577
+ header_params=_header_params,
578
+ body=_body_params,
579
+ post_params=_form_params,
580
+ files=_files,
581
+ auth_settings=_auth_settings,
582
+ collection_formats=_collection_formats,
583
+ _host=_host,
584
+ _request_auth=_request_auth,
585
+ )
586
+
587
+ @validate_call
588
+ def update_variable_definition_by_id(
589
+ self,
590
+ variable_definition_id: Annotated[
591
+ StrictStr,
592
+ Field(description="Unique identifier for the variable definition."),
593
+ ],
594
+ active_group: Annotated[
595
+ StrictStr,
596
+ Field(description="The group which the user currently represents."),
597
+ ],
598
+ update_draft: UpdateDraft | None = None,
599
+ _request_timeout: None
600
+ | Annotated[StrictFloat, Field(gt=0)]
601
+ | tuple[
602
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
603
+ ] = None,
604
+ _request_auth: dict[StrictStr, Any] | None = None,
605
+ _content_type: StrictStr | None = None,
606
+ _headers: dict[StrictStr, Any] | None = None,
607
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
608
+ ) -> CompleteResponse:
609
+ """Update a variable definition.
610
+
611
+ Update a variable definition. Only the fields which need updating should be supplied.
612
+
613
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
614
+ :type variable_definition_id: str
615
+ :param active_group: The group which the user currently represents. (required)
616
+ :type active_group: str
617
+ :param update_draft:
618
+ :type update_draft: UpdateDraft
619
+ :param _request_timeout: timeout setting for this request. If one
620
+ number provided, it will be total request
621
+ timeout. It can also be a pair (tuple) of
622
+ (connection, read) timeouts.
623
+ :type _request_timeout: int, tuple(int, int), optional
624
+ :param _request_auth: set to override the auth_settings for an a single
625
+ request; this effectively ignores the
626
+ authentication in the spec for a single request.
627
+ :type _request_auth: dict, optional
628
+ :param _content_type: force content-type for the request.
629
+ :type _content_type: str, Optional
630
+ :param _headers: set to override the headers for a single
631
+ request; this effectively ignores the headers
632
+ in the spec for a single request.
633
+ :type _headers: dict, optional
634
+ :param _host_index: set to override the host_index for a single
635
+ request; this effectively ignores the host_index
636
+ in the spec for a single request.
637
+ :type _host_index: int, optional
638
+ :return: Returns the result object.
639
+ """
640
+ _param = self._update_variable_definition_by_id_serialize(
641
+ variable_definition_id=variable_definition_id,
642
+ active_group=active_group,
643
+ update_draft=update_draft,
644
+ _request_auth=_request_auth,
645
+ _content_type=_content_type,
646
+ _headers=_headers,
647
+ _host_index=_host_index,
648
+ )
649
+
650
+ _response_types_map: dict[str, str | None] = {
651
+ "200": "CompleteResponse",
652
+ "400": "Problem",
653
+ "404": "Problem",
654
+ "405": "Problem",
655
+ "409": "Problem",
656
+ }
657
+ response_data = self.api_client.call_api(
658
+ *_param, _request_timeout=_request_timeout
659
+ )
660
+ response_data.read()
661
+ return self.api_client.response_deserialize(
662
+ response_data=response_data,
663
+ response_types_map=_response_types_map,
664
+ ).data
665
+
666
+ @validate_call
667
+ def update_variable_definition_by_id_with_http_info(
668
+ self,
669
+ variable_definition_id: Annotated[
670
+ StrictStr,
671
+ Field(description="Unique identifier for the variable definition."),
672
+ ],
673
+ active_group: Annotated[
674
+ StrictStr,
675
+ Field(description="The group which the user currently represents."),
676
+ ],
677
+ update_draft: UpdateDraft | None = None,
678
+ _request_timeout: None
679
+ | Annotated[StrictFloat, Field(gt=0)]
680
+ | tuple[
681
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
682
+ ] = None,
683
+ _request_auth: dict[StrictStr, Any] | None = None,
684
+ _content_type: StrictStr | None = None,
685
+ _headers: dict[StrictStr, Any] | None = None,
686
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
687
+ ) -> ApiResponse[CompleteResponse]:
688
+ """Update a variable definition.
689
+
690
+ Update a variable definition. Only the fields which need updating should be supplied.
691
+
692
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
693
+ :type variable_definition_id: str
694
+ :param active_group: The group which the user currently represents. (required)
695
+ :type active_group: str
696
+ :param update_draft:
697
+ :type update_draft: UpdateDraft
698
+ :param _request_timeout: timeout setting for this request. If one
699
+ number provided, it will be total request
700
+ timeout. It can also be a pair (tuple) of
701
+ (connection, read) timeouts.
702
+ :type _request_timeout: int, tuple(int, int), optional
703
+ :param _request_auth: set to override the auth_settings for an a single
704
+ request; this effectively ignores the
705
+ authentication in the spec for a single request.
706
+ :type _request_auth: dict, optional
707
+ :param _content_type: force content-type for the request.
708
+ :type _content_type: str, Optional
709
+ :param _headers: set to override the headers for a single
710
+ request; this effectively ignores the headers
711
+ in the spec for a single request.
712
+ :type _headers: dict, optional
713
+ :param _host_index: set to override the host_index for a single
714
+ request; this effectively ignores the host_index
715
+ in the spec for a single request.
716
+ :type _host_index: int, optional
717
+ :return: Returns the result object.
718
+ """
719
+ _param = self._update_variable_definition_by_id_serialize(
720
+ variable_definition_id=variable_definition_id,
721
+ active_group=active_group,
722
+ update_draft=update_draft,
723
+ _request_auth=_request_auth,
724
+ _content_type=_content_type,
725
+ _headers=_headers,
726
+ _host_index=_host_index,
727
+ )
728
+
729
+ _response_types_map: dict[str, str | None] = {
730
+ "200": "CompleteResponse",
731
+ "400": "Problem",
732
+ "404": "Problem",
733
+ "405": "Problem",
734
+ "409": "Problem",
735
+ }
736
+ response_data = self.api_client.call_api(
737
+ *_param, _request_timeout=_request_timeout
738
+ )
739
+ response_data.read()
740
+ return self.api_client.response_deserialize(
741
+ response_data=response_data,
742
+ response_types_map=_response_types_map,
743
+ )
744
+
745
+ @validate_call
746
+ def update_variable_definition_by_id_without_preload_content(
747
+ self,
748
+ variable_definition_id: Annotated[
749
+ StrictStr,
750
+ Field(description="Unique identifier for the variable definition."),
751
+ ],
752
+ active_group: Annotated[
753
+ StrictStr,
754
+ Field(description="The group which the user currently represents."),
755
+ ],
756
+ update_draft: UpdateDraft | None = None,
757
+ _request_timeout: None
758
+ | Annotated[StrictFloat, Field(gt=0)]
759
+ | tuple[
760
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
761
+ ] = None,
762
+ _request_auth: dict[StrictStr, Any] | None = None,
763
+ _content_type: StrictStr | None = None,
764
+ _headers: dict[StrictStr, Any] | None = None,
765
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
766
+ ) -> RESTResponseType:
767
+ """Update a variable definition.
768
+
769
+ Update a variable definition. Only the fields which need updating should be supplied.
770
+
771
+ :param variable_definition_id: Unique identifier for the variable definition. (required)
772
+ :type variable_definition_id: str
773
+ :param active_group: The group which the user currently represents. (required)
774
+ :type active_group: str
775
+ :param update_draft:
776
+ :type update_draft: UpdateDraft
777
+ :param _request_timeout: timeout setting for this request. If one
778
+ number provided, it will be total request
779
+ timeout. It can also be a pair (tuple) of
780
+ (connection, read) timeouts.
781
+ :type _request_timeout: int, tuple(int, int), optional
782
+ :param _request_auth: set to override the auth_settings for an a single
783
+ request; this effectively ignores the
784
+ authentication in the spec for a single request.
785
+ :type _request_auth: dict, optional
786
+ :param _content_type: force content-type for the request.
787
+ :type _content_type: str, Optional
788
+ :param _headers: set to override the headers for a single
789
+ request; this effectively ignores the headers
790
+ in the spec for a single request.
791
+ :type _headers: dict, optional
792
+ :param _host_index: set to override the host_index for a single
793
+ request; this effectively ignores the host_index
794
+ in the spec for a single request.
795
+ :type _host_index: int, optional
796
+ :return: Returns the result object.
797
+ """
798
+ _param = self._update_variable_definition_by_id_serialize(
799
+ variable_definition_id=variable_definition_id,
800
+ active_group=active_group,
801
+ update_draft=update_draft,
802
+ _request_auth=_request_auth,
803
+ _content_type=_content_type,
804
+ _headers=_headers,
805
+ _host_index=_host_index,
806
+ )
807
+
808
+ _response_types_map: dict[str, str | None] = {
809
+ "200": "CompleteResponse",
810
+ "400": "Problem",
811
+ "404": "Problem",
812
+ "405": "Problem",
813
+ "409": "Problem",
814
+ }
815
+ response_data = self.api_client.call_api(
816
+ *_param, _request_timeout=_request_timeout
817
+ )
818
+ return response_data.response
819
+
820
+ def _update_variable_definition_by_id_serialize(
821
+ self,
822
+ variable_definition_id,
823
+ active_group,
824
+ update_draft,
825
+ _request_auth,
826
+ _content_type,
827
+ _headers,
828
+ _host_index,
829
+ ) -> RequestSerialized:
830
+ _host = None
831
+
832
+ _collection_formats: dict[str, str] = {}
833
+
834
+ _path_params: dict[str, str] = {}
835
+ _query_params: list[tuple[str, str]] = []
836
+ _header_params: dict[str, str | None] = _headers or {}
837
+ _form_params: list[tuple[str, str]] = []
838
+ _files: dict[
839
+ str, str | bytes | list[str] | list[bytes] | list[tuple[str, bytes]]
840
+ ] = {}
841
+ _body_params: bytes | None = None
842
+
843
+ # process the path parameters
844
+ if variable_definition_id is not None:
845
+ _path_params["variable-definition-id"] = variable_definition_id
846
+ # process the query parameters
847
+ if active_group is not None:
848
+ _query_params.append(("active_group", active_group))
849
+
850
+ # process the header parameters
851
+ # process the form parameters
852
+ # process the body parameter
853
+ if update_draft is not None:
854
+ _body_params = update_draft
855
+
856
+ # set the HTTP header `Accept`
857
+ if "Accept" not in _header_params:
858
+ _header_params["Accept"] = self.api_client.select_header_accept(
859
+ ["application/json", "application/problem+json"]
860
+ )
861
+
862
+ # set the HTTP header `Content-Type`
863
+ if _content_type:
864
+ _header_params["Content-Type"] = _content_type
865
+ else:
866
+ _default_content_type = self.api_client.select_header_content_type(
867
+ ["application/json"]
868
+ )
869
+ if _default_content_type is not None:
870
+ _header_params["Content-Type"] = _default_content_type
871
+
872
+ # authentication setting
873
+ _auth_settings: list[str] = ["keycloak_token"]
874
+
875
+ return self.api_client.param_serialize(
876
+ method="PATCH",
877
+ resource_path="/variable-definitions/{variable-definition-id}",
878
+ path_params=_path_params,
879
+ query_params=_query_params,
880
+ header_params=_header_params,
881
+ body=_body_params,
882
+ post_params=_form_params,
883
+ files=_files,
884
+ auth_settings=_auth_settings,
885
+ collection_formats=_collection_formats,
886
+ _host=_host,
887
+ _request_auth=_request_auth,
888
+ )