stackit-git 0.4.0__tar.gz → 0.5.1__tar.gz

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.
Files changed (24) hide show
  1. {stackit_git-0.4.0 → stackit_git-0.5.1}/PKG-INFO +5 -2
  2. {stackit_git-0.4.0 → stackit_git-0.5.1}/pyproject.toml +2 -2
  3. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/__init__.py +2 -0
  4. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/api/default_api.py +291 -0
  5. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/__init__.py +1 -0
  6. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/create_instance_payload.py +2 -2
  7. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/instance.py +14 -0
  8. stackit_git-0.5.1/src/stackit/git/models/patch_operation.py +93 -0
  9. {stackit_git-0.4.0 → stackit_git-0.5.1}/LICENSE.md +0 -0
  10. {stackit_git-0.4.0 → stackit_git-0.5.1}/NOTICE.txt +0 -0
  11. {stackit_git-0.4.0 → stackit_git-0.5.1}/README.md +0 -0
  12. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/api/__init__.py +0 -0
  13. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/api_client.py +0 -0
  14. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/api_response.py +0 -0
  15. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/configuration.py +0 -0
  16. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/exceptions.py +0 -0
  17. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/flavor.py +0 -0
  18. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/generic_error_response.py +0 -0
  19. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/internal_server_error_response.py +0 -0
  20. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/list_flavors.py +0 -0
  21. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/list_instances.py +0 -0
  22. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/models/unauthorized_response.py +0 -0
  23. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/py.typed +0 -0
  24. {stackit_git-0.4.0 → stackit_git-0.5.1}/src/stackit/git/rest.py +0 -0
@@ -1,7 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: stackit-git
3
- Version: 0.4.0
3
+ Version: 0.5.1
4
4
  Summary: STACKIT Git API
5
+ License-File: LICENSE.md
6
+ License-File: NOTICE.txt
5
7
  Author: STACKIT Developer Tools
6
8
  Author-email: developer-tools@stackit.cloud
7
9
  Requires-Python: >=3.9,<4.0
@@ -13,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
13
15
  Classifier: Programming Language :: Python :: 3.11
14
16
  Classifier: Programming Language :: Python :: 3.12
15
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
16
19
  Requires-Dist: pydantic (>=2.9.2)
17
20
  Requires-Dist: python-dateutil (>=2.9.0.post0)
18
21
  Requires-Dist: requests (>=2.32.3)
@@ -3,7 +3,7 @@ name = "stackit-git"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "stackit-git"
6
- version = "v0.4.0"
6
+ version = "v0.5.1"
7
7
  authors = [
8
8
  "STACKIT Developer Tools <developer-tools@stackit.cloud>",
9
9
  ]
@@ -96,4 +96,4 @@ docstring-quotes = '"""'
96
96
  multiline-quotes = '"""'
97
97
  ban-relative-imports = true
98
98
  # Exclude generated code
99
- extend-exclude = [ "src/stackit/*/models/*", "src/stackit/*/api/*", "src/stackit/*/*.py" ]
99
+ extend-exclude = [ "src/stackit/*/models/*", "src/stackit/*/api/*", "src/stackit/*/*.py" ]
@@ -36,6 +36,7 @@ __all__ = [
36
36
  "InternalServerErrorResponse",
37
37
  "ListFlavors",
38
38
  "ListInstances",
39
+ "PatchOperation",
39
40
  "UnauthorizedResponse",
40
41
  ]
41
42
 
@@ -67,6 +68,7 @@ from stackit.git.models.internal_server_error_response import (
67
68
  )
68
69
  from stackit.git.models.list_flavors import ListFlavors as ListFlavors
69
70
  from stackit.git.models.list_instances import ListInstances as ListInstances
71
+ from stackit.git.models.patch_operation import PatchOperation as PatchOperation
70
72
  from stackit.git.models.unauthorized_response import (
71
73
  UnauthorizedResponse as UnauthorizedResponse,
72
74
  )
@@ -30,6 +30,7 @@ from stackit.git.models.create_instance_payload import CreateInstancePayload
30
30
  from stackit.git.models.instance import Instance
31
31
  from stackit.git.models.list_flavors import ListFlavors
32
32
  from stackit.git.models.list_instances import ListInstances
33
+ from stackit.git.models.patch_operation import PatchOperation
33
34
  from stackit.git.rest import RESTResponseType
34
35
 
35
36
 
@@ -1300,3 +1301,293 @@ class DefaultApi:
1300
1301
  _host=_host,
1301
1302
  _request_auth=_request_auth,
1302
1303
  )
1304
+
1305
+ @validate_call
1306
+ def patch_instance(
1307
+ self,
1308
+ project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")],
1309
+ instance_id: Annotated[
1310
+ str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.")
1311
+ ],
1312
+ patch_operation: List[PatchOperation],
1313
+ _request_timeout: Union[
1314
+ None,
1315
+ Annotated[StrictFloat, Field(gt=0)],
1316
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1317
+ ] = None,
1318
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1319
+ _content_type: Optional[StrictStr] = None,
1320
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1321
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1322
+ ) -> Instance:
1323
+ """Patch Instance.
1324
+
1325
+ Patches the Instance.
1326
+
1327
+ :param project_id: Project identifier. (required)
1328
+ :type project_id: str
1329
+ :param instance_id: Instance identifier. (required)
1330
+ :type instance_id: str
1331
+ :param patch_operation: (required)
1332
+ :type patch_operation: List[PatchOperation]
1333
+ :param _request_timeout: timeout setting for this request. If one
1334
+ number provided, it will be total request
1335
+ timeout. It can also be a pair (tuple) of
1336
+ (connection, read) timeouts.
1337
+ :type _request_timeout: int, tuple(int, int), optional
1338
+ :param _request_auth: set to override the auth_settings for an a single
1339
+ request; this effectively ignores the
1340
+ authentication in the spec for a single request.
1341
+ :type _request_auth: dict, optional
1342
+ :param _content_type: force content-type for the request.
1343
+ :type _content_type: str, Optional
1344
+ :param _headers: set to override the headers for a single
1345
+ request; this effectively ignores the headers
1346
+ in the spec for a single request.
1347
+ :type _headers: dict, optional
1348
+ :param _host_index: set to override the host_index for a single
1349
+ request; this effectively ignores the host_index
1350
+ in the spec for a single request.
1351
+ :type _host_index: int, optional
1352
+ :return: Returns the result object.
1353
+ """ # noqa: E501
1354
+
1355
+ _param = self._patch_instance_serialize(
1356
+ project_id=project_id,
1357
+ instance_id=instance_id,
1358
+ patch_operation=patch_operation,
1359
+ _request_auth=_request_auth,
1360
+ _content_type=_content_type,
1361
+ _headers=_headers,
1362
+ _host_index=_host_index,
1363
+ )
1364
+
1365
+ _response_types_map: Dict[str, Optional[str]] = {
1366
+ "200": "Instance",
1367
+ "202": None,
1368
+ "400": "GenericErrorResponse",
1369
+ "401": "UnauthorizedResponse",
1370
+ "404": None,
1371
+ "409": None,
1372
+ "500": "GenericErrorResponse",
1373
+ }
1374
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1375
+ response_data.read()
1376
+ return self.api_client.response_deserialize(
1377
+ response_data=response_data,
1378
+ response_types_map=_response_types_map,
1379
+ ).data
1380
+
1381
+ @validate_call
1382
+ def patch_instance_with_http_info(
1383
+ self,
1384
+ project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")],
1385
+ instance_id: Annotated[
1386
+ str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.")
1387
+ ],
1388
+ patch_operation: List[PatchOperation],
1389
+ _request_timeout: Union[
1390
+ None,
1391
+ Annotated[StrictFloat, Field(gt=0)],
1392
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1393
+ ] = None,
1394
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1395
+ _content_type: Optional[StrictStr] = None,
1396
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1397
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1398
+ ) -> ApiResponse[Instance]:
1399
+ """Patch Instance.
1400
+
1401
+ Patches the Instance.
1402
+
1403
+ :param project_id: Project identifier. (required)
1404
+ :type project_id: str
1405
+ :param instance_id: Instance identifier. (required)
1406
+ :type instance_id: str
1407
+ :param patch_operation: (required)
1408
+ :type patch_operation: List[PatchOperation]
1409
+ :param _request_timeout: timeout setting for this request. If one
1410
+ number provided, it will be total request
1411
+ timeout. It can also be a pair (tuple) of
1412
+ (connection, read) timeouts.
1413
+ :type _request_timeout: int, tuple(int, int), optional
1414
+ :param _request_auth: set to override the auth_settings for an a single
1415
+ request; this effectively ignores the
1416
+ authentication in the spec for a single request.
1417
+ :type _request_auth: dict, optional
1418
+ :param _content_type: force content-type for the request.
1419
+ :type _content_type: str, Optional
1420
+ :param _headers: set to override the headers for a single
1421
+ request; this effectively ignores the headers
1422
+ in the spec for a single request.
1423
+ :type _headers: dict, optional
1424
+ :param _host_index: set to override the host_index for a single
1425
+ request; this effectively ignores the host_index
1426
+ in the spec for a single request.
1427
+ :type _host_index: int, optional
1428
+ :return: Returns the result object.
1429
+ """ # noqa: E501
1430
+
1431
+ _param = self._patch_instance_serialize(
1432
+ project_id=project_id,
1433
+ instance_id=instance_id,
1434
+ patch_operation=patch_operation,
1435
+ _request_auth=_request_auth,
1436
+ _content_type=_content_type,
1437
+ _headers=_headers,
1438
+ _host_index=_host_index,
1439
+ )
1440
+
1441
+ _response_types_map: Dict[str, Optional[str]] = {
1442
+ "200": "Instance",
1443
+ "202": None,
1444
+ "400": "GenericErrorResponse",
1445
+ "401": "UnauthorizedResponse",
1446
+ "404": None,
1447
+ "409": None,
1448
+ "500": "GenericErrorResponse",
1449
+ }
1450
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1451
+ response_data.read()
1452
+ return self.api_client.response_deserialize(
1453
+ response_data=response_data,
1454
+ response_types_map=_response_types_map,
1455
+ )
1456
+
1457
+ @validate_call
1458
+ def patch_instance_without_preload_content(
1459
+ self,
1460
+ project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")],
1461
+ instance_id: Annotated[
1462
+ str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.")
1463
+ ],
1464
+ patch_operation: List[PatchOperation],
1465
+ _request_timeout: Union[
1466
+ None,
1467
+ Annotated[StrictFloat, Field(gt=0)],
1468
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1469
+ ] = None,
1470
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1471
+ _content_type: Optional[StrictStr] = None,
1472
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1473
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1474
+ ) -> RESTResponseType:
1475
+ """Patch Instance.
1476
+
1477
+ Patches the Instance.
1478
+
1479
+ :param project_id: Project identifier. (required)
1480
+ :type project_id: str
1481
+ :param instance_id: Instance identifier. (required)
1482
+ :type instance_id: str
1483
+ :param patch_operation: (required)
1484
+ :type patch_operation: List[PatchOperation]
1485
+ :param _request_timeout: timeout setting for this request. If one
1486
+ number provided, it will be total request
1487
+ timeout. It can also be a pair (tuple) of
1488
+ (connection, read) timeouts.
1489
+ :type _request_timeout: int, tuple(int, int), optional
1490
+ :param _request_auth: set to override the auth_settings for an a single
1491
+ request; this effectively ignores the
1492
+ authentication in the spec for a single request.
1493
+ :type _request_auth: dict, optional
1494
+ :param _content_type: force content-type for the request.
1495
+ :type _content_type: str, Optional
1496
+ :param _headers: set to override the headers for a single
1497
+ request; this effectively ignores the headers
1498
+ in the spec for a single request.
1499
+ :type _headers: dict, optional
1500
+ :param _host_index: set to override the host_index for a single
1501
+ request; this effectively ignores the host_index
1502
+ in the spec for a single request.
1503
+ :type _host_index: int, optional
1504
+ :return: Returns the result object.
1505
+ """ # noqa: E501
1506
+
1507
+ _param = self._patch_instance_serialize(
1508
+ project_id=project_id,
1509
+ instance_id=instance_id,
1510
+ patch_operation=patch_operation,
1511
+ _request_auth=_request_auth,
1512
+ _content_type=_content_type,
1513
+ _headers=_headers,
1514
+ _host_index=_host_index,
1515
+ )
1516
+
1517
+ _response_types_map: Dict[str, Optional[str]] = {
1518
+ "200": "Instance",
1519
+ "202": None,
1520
+ "400": "GenericErrorResponse",
1521
+ "401": "UnauthorizedResponse",
1522
+ "404": None,
1523
+ "409": None,
1524
+ "500": "GenericErrorResponse",
1525
+ }
1526
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1527
+ return response_data.response
1528
+
1529
+ def _patch_instance_serialize(
1530
+ self,
1531
+ project_id,
1532
+ instance_id,
1533
+ patch_operation,
1534
+ _request_auth,
1535
+ _content_type,
1536
+ _headers,
1537
+ _host_index,
1538
+ ) -> RequestSerialized:
1539
+
1540
+ _host = None
1541
+
1542
+ _collection_formats: Dict[str, str] = {
1543
+ "PatchOperation": "",
1544
+ }
1545
+
1546
+ _path_params: Dict[str, str] = {}
1547
+ _query_params: List[Tuple[str, str]] = []
1548
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1549
+ _form_params: List[Tuple[str, str]] = []
1550
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1551
+ _body_params: Optional[bytes] = None
1552
+
1553
+ # process the path parameters
1554
+ if project_id is not None:
1555
+ _path_params["projectId"] = project_id
1556
+ if instance_id is not None:
1557
+ _path_params["instanceId"] = instance_id
1558
+ # process the query parameters
1559
+ # process the header parameters
1560
+ # process the form parameters
1561
+ # process the body parameter
1562
+ if patch_operation is not None:
1563
+ _body_params = patch_operation
1564
+
1565
+ # set the HTTP header `Accept`
1566
+ if "Accept" not in _header_params:
1567
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1568
+
1569
+ # set the HTTP header `Content-Type`
1570
+ if _content_type:
1571
+ _header_params["Content-Type"] = _content_type
1572
+ else:
1573
+ _default_content_type = self.api_client.select_header_content_type(["application/json-patch+json"])
1574
+ if _default_content_type is not None:
1575
+ _header_params["Content-Type"] = _default_content_type
1576
+
1577
+ # authentication setting
1578
+ _auth_settings: List[str] = []
1579
+
1580
+ return self.api_client.param_serialize(
1581
+ method="PATCH",
1582
+ resource_path="/v1beta/projects/{projectId}/instances/{instanceId}",
1583
+ path_params=_path_params,
1584
+ query_params=_query_params,
1585
+ header_params=_header_params,
1586
+ body=_body_params,
1587
+ post_params=_form_params,
1588
+ files=_files,
1589
+ auth_settings=_auth_settings,
1590
+ collection_formats=_collection_formats,
1591
+ _host=_host,
1592
+ _request_auth=_request_auth,
1593
+ )
@@ -24,4 +24,5 @@ from stackit.git.models.internal_server_error_response import (
24
24
  )
25
25
  from stackit.git.models.list_flavors import ListFlavors
26
26
  from stackit.git.models.list_instances import ListInstances
27
+ from stackit.git.models.patch_operation import PatchOperation
27
28
  from stackit.git.models.unauthorized_response import UnauthorizedResponse
@@ -28,8 +28,8 @@ class CreateInstancePayload(BaseModel):
28
28
  Request a STACKIT Git instance to be created with these properties.
29
29
  """ # noqa: E501
30
30
 
31
- acl: Optional[Annotated[List[StrictStr], Field(max_length=5)]] = Field(
32
- default=None, description="Restricted ACL for instance access."
31
+ acl: Optional[Annotated[List[StrictStr], Field(max_length=50)]] = Field(
32
+ default=None, description="A list of CIDR network addresses that are allowed to access the instance."
33
33
  )
34
34
  flavor: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(
35
35
  default=None, description="Desired instance flavor. Must be one of the defined enum values"
@@ -16,6 +16,7 @@ from __future__ import annotations
16
16
 
17
17
  import json
18
18
  import pprint
19
+ import re # noqa: F401
19
20
  from datetime import datetime
20
21
  from typing import Any, ClassVar, Dict, List, Optional, Set
21
22
 
@@ -61,6 +62,19 @@ class Instance(BaseModel):
61
62
  "version",
62
63
  ]
63
64
 
65
+ @field_validator("created", mode="before")
66
+ def created_change_year_zero_to_one(cls, value):
67
+ """Workaround which prevents year 0 issue"""
68
+ if isinstance(value, str):
69
+ # Check for year "0000" at the beginning of the string
70
+ # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
71
+ if value.startswith("0000-01-01T") and re.match(
72
+ r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
73
+ ):
74
+ # Workaround: Replace "0000" with "0001"
75
+ return "0001" + value[4:] # Take "0001" and append the rest of the string
76
+ return value
77
+
64
78
  @field_validator("state")
65
79
  def state_validate_enum(cls, value):
66
80
  """Validates the enum"""
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Git API
5
+
6
+ STACKIT Git management API.
7
+
8
+ The version of the OpenAPI document: 1beta.0.4
9
+ Contact: git@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing_extensions import Self
23
+
24
+
25
+ class PatchOperation(BaseModel):
26
+ """
27
+ Request a STACKIT Git instance to be patch with these properties.
28
+ """ # noqa: E501
29
+
30
+ op: StrictStr = Field(description="The patch operation to perform.")
31
+ path: StrictStr = Field(description="An RFC6901 JSON Pointer to the target location.")
32
+ value: Optional[StrictStr] = Field(
33
+ default=None, description="The value to be used for 'add' and 'remove' operations."
34
+ )
35
+ __properties: ClassVar[List[str]] = ["op", "path", "value"]
36
+
37
+ @field_validator("op")
38
+ def op_validate_enum(cls, value):
39
+ """Validates the enum"""
40
+ if value not in set(["add", "remove"]):
41
+ raise ValueError("must be one of enum values ('add', 'remove')")
42
+ return value
43
+
44
+ model_config = ConfigDict(
45
+ populate_by_name=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of PatchOperation from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of PatchOperation from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({"op": obj.get("op"), "path": obj.get("path"), "value": obj.get("value")})
93
+ return _obj
File without changes
File without changes
File without changes