stackit-objectstorage 1.6.0__tar.gz → 1.7.0__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 (47) hide show
  1. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/PKG-INFO +1 -1
  2. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/pyproject.toml +1 -1
  3. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/__init__.py +4 -0
  4. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/api/default_api.py +283 -0
  5. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/__init__.py +1 -0
  6. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/project_status.py +5 -2
  7. stackit_objectstorage-1.7.0/src/stackit/objectstorage/models/update_service_payload.py +82 -0
  8. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/.gitignore +0 -0
  9. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/LICENSE.md +0 -0
  10. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/NOTICE.txt +0 -0
  11. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/README.md +0 -0
  12. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/api/__init__.py +0 -0
  13. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/api_client.py +0 -0
  14. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/api_response.py +0 -0
  15. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/configuration.py +0 -0
  16. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/exceptions.py +0 -0
  17. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/access_key.py +0 -0
  18. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/bucket.py +0 -0
  19. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/compliance_lock_response.py +0 -0
  20. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/create_access_key_payload.py +0 -0
  21. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/create_access_key_response.py +0 -0
  22. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/create_bucket_response.py +0 -0
  23. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/create_credentials_group_payload.py +0 -0
  24. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/create_credentials_group_response.py +0 -0
  25. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/credentials_group.py +0 -0
  26. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/credentials_group_extended.py +0 -0
  27. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/default_retention_response.py +0 -0
  28. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/delete_access_key_response.py +0 -0
  29. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/delete_bucket_response.py +0 -0
  30. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/delete_credentials_group_response.py +0 -0
  31. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/delete_default_retention_response.py +0 -0
  32. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/detailed_error.py +0 -0
  33. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/error_message.py +0 -0
  34. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/get_bucket_response.py +0 -0
  35. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/get_credentials_group_response.py +0 -0
  36. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/http_validation_error.py +0 -0
  37. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/list_access_keys_response.py +0 -0
  38. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/list_buckets_response.py +0 -0
  39. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/list_credentials_groups_response.py +0 -0
  40. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/location_inner.py +0 -0
  41. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/project_scope.py +0 -0
  42. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/rate_limit_error.py +0 -0
  43. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/retention_mode.py +0 -0
  44. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/set_default_retention_payload.py +0 -0
  45. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/models/validation_error.py +0 -0
  46. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/py.typed +0 -0
  47. {stackit_objectstorage-1.6.0 → stackit_objectstorage-1.7.0}/src/stackit/objectstorage/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: stackit-objectstorage
3
- Version: v1.6.0
3
+ Version: v1.7.0
4
4
  Summary: STACKIT Object Storage API
5
5
  Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
6
  Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stackit-objectstorage"
3
- version = "v1.6.0"
3
+ version = "v1.7.0"
4
4
  description = "STACKIT Object Storage API"
5
5
  authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
6
  requires-python = ">=3.10,<4.0"
@@ -56,6 +56,7 @@ __all__ = [
56
56
  "RateLimitError",
57
57
  "RetentionMode",
58
58
  "SetDefaultRetentionPayload",
59
+ "UpdateServicePayload",
59
60
  "ValidationError",
60
61
  ]
61
62
 
@@ -145,6 +146,9 @@ from stackit.objectstorage.models.retention_mode import RetentionMode as Retenti
145
146
  from stackit.objectstorage.models.set_default_retention_payload import (
146
147
  SetDefaultRetentionPayload as SetDefaultRetentionPayload,
147
148
  )
149
+ from stackit.objectstorage.models.update_service_payload import (
150
+ UpdateServicePayload as UpdateServicePayload,
151
+ )
148
152
  from stackit.objectstorage.models.validation_error import (
149
153
  ValidationError as ValidationError,
150
154
  )
@@ -61,6 +61,7 @@ from stackit.objectstorage.models.project_status import ProjectStatus
61
61
  from stackit.objectstorage.models.set_default_retention_payload import (
62
62
  SetDefaultRetentionPayload,
63
63
  )
64
+ from stackit.objectstorage.models.update_service_payload import UpdateServicePayload
64
65
  from stackit.objectstorage.rest import RESTResponseType
65
66
 
66
67
 
@@ -5519,3 +5520,285 @@ class DefaultApi:
5519
5520
  _host=_host,
5520
5521
  _request_auth=_request_auth,
5521
5522
  )
5523
+
5524
+ @validate_call
5525
+ def update_service(
5526
+ self,
5527
+ project_id: Annotated[StrictStr, Field(description="STACKIT project ID")],
5528
+ region: Annotated[StrictStr, Field(description="STACKIT Region")],
5529
+ update_service_payload: UpdateServicePayload,
5530
+ _request_timeout: Union[
5531
+ None,
5532
+ Annotated[StrictFloat, Field(gt=0)],
5533
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
5534
+ ] = None,
5535
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
5536
+ _content_type: Optional[StrictStr] = None,
5537
+ _headers: Optional[Dict[StrictStr, Any]] = None,
5538
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
5539
+ ) -> ProjectStatus:
5540
+ """Update Project
5541
+
5542
+ Update project details.
5543
+
5544
+ :param project_id: STACKIT project ID (required)
5545
+ :type project_id: str
5546
+ :param region: STACKIT Region (required)
5547
+ :type region: str
5548
+ :param update_service_payload: (required)
5549
+ :type update_service_payload: UpdateServicePayload
5550
+ :param _request_timeout: timeout setting for this request. If one
5551
+ number provided, it will be total request
5552
+ timeout. It can also be a pair (tuple) of
5553
+ (connection, read) timeouts.
5554
+ :type _request_timeout: int, tuple(int, int), optional
5555
+ :param _request_auth: set to override the auth_settings for an a single
5556
+ request; this effectively ignores the
5557
+ authentication in the spec for a single request.
5558
+ :type _request_auth: dict, optional
5559
+ :param _content_type: force content-type for the request.
5560
+ :type _content_type: str, Optional
5561
+ :param _headers: set to override the headers for a single
5562
+ request; this effectively ignores the headers
5563
+ in the spec for a single request.
5564
+ :type _headers: dict, optional
5565
+ :param _host_index: set to override the host_index for a single
5566
+ request; this effectively ignores the host_index
5567
+ in the spec for a single request.
5568
+ :type _host_index: int, optional
5569
+ :return: Returns the result object.
5570
+ """ # noqa: E501
5571
+
5572
+ _param = self._update_service_serialize(
5573
+ project_id=project_id,
5574
+ region=region,
5575
+ update_service_payload=update_service_payload,
5576
+ _request_auth=_request_auth,
5577
+ _content_type=_content_type,
5578
+ _headers=_headers,
5579
+ _host_index=_host_index,
5580
+ )
5581
+
5582
+ _response_types_map: Dict[str, Optional[str]] = {
5583
+ "200": "ProjectStatus",
5584
+ "401": "ErrorMessage",
5585
+ "403": "ErrorMessage",
5586
+ "404": "ErrorMessage",
5587
+ "422": "HTTPValidationError",
5588
+ "429": "RateLimitError",
5589
+ "500": "ErrorMessage",
5590
+ }
5591
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
5592
+ response_data.read()
5593
+ return self.api_client.response_deserialize(
5594
+ response_data=response_data,
5595
+ response_types_map=_response_types_map,
5596
+ ).data
5597
+
5598
+ @validate_call
5599
+ def update_service_with_http_info(
5600
+ self,
5601
+ project_id: Annotated[StrictStr, Field(description="STACKIT project ID")],
5602
+ region: Annotated[StrictStr, Field(description="STACKIT Region")],
5603
+ update_service_payload: UpdateServicePayload,
5604
+ _request_timeout: Union[
5605
+ None,
5606
+ Annotated[StrictFloat, Field(gt=0)],
5607
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
5608
+ ] = None,
5609
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
5610
+ _content_type: Optional[StrictStr] = None,
5611
+ _headers: Optional[Dict[StrictStr, Any]] = None,
5612
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
5613
+ ) -> ApiResponse[ProjectStatus]:
5614
+ """Update Project
5615
+
5616
+ Update project details.
5617
+
5618
+ :param project_id: STACKIT project ID (required)
5619
+ :type project_id: str
5620
+ :param region: STACKIT Region (required)
5621
+ :type region: str
5622
+ :param update_service_payload: (required)
5623
+ :type update_service_payload: UpdateServicePayload
5624
+ :param _request_timeout: timeout setting for this request. If one
5625
+ number provided, it will be total request
5626
+ timeout. It can also be a pair (tuple) of
5627
+ (connection, read) timeouts.
5628
+ :type _request_timeout: int, tuple(int, int), optional
5629
+ :param _request_auth: set to override the auth_settings for an a single
5630
+ request; this effectively ignores the
5631
+ authentication in the spec for a single request.
5632
+ :type _request_auth: dict, optional
5633
+ :param _content_type: force content-type for the request.
5634
+ :type _content_type: str, Optional
5635
+ :param _headers: set to override the headers for a single
5636
+ request; this effectively ignores the headers
5637
+ in the spec for a single request.
5638
+ :type _headers: dict, optional
5639
+ :param _host_index: set to override the host_index for a single
5640
+ request; this effectively ignores the host_index
5641
+ in the spec for a single request.
5642
+ :type _host_index: int, optional
5643
+ :return: Returns the result object.
5644
+ """ # noqa: E501
5645
+
5646
+ _param = self._update_service_serialize(
5647
+ project_id=project_id,
5648
+ region=region,
5649
+ update_service_payload=update_service_payload,
5650
+ _request_auth=_request_auth,
5651
+ _content_type=_content_type,
5652
+ _headers=_headers,
5653
+ _host_index=_host_index,
5654
+ )
5655
+
5656
+ _response_types_map: Dict[str, Optional[str]] = {
5657
+ "200": "ProjectStatus",
5658
+ "401": "ErrorMessage",
5659
+ "403": "ErrorMessage",
5660
+ "404": "ErrorMessage",
5661
+ "422": "HTTPValidationError",
5662
+ "429": "RateLimitError",
5663
+ "500": "ErrorMessage",
5664
+ }
5665
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
5666
+ response_data.read()
5667
+ return self.api_client.response_deserialize(
5668
+ response_data=response_data,
5669
+ response_types_map=_response_types_map,
5670
+ )
5671
+
5672
+ @validate_call
5673
+ def update_service_without_preload_content(
5674
+ self,
5675
+ project_id: Annotated[StrictStr, Field(description="STACKIT project ID")],
5676
+ region: Annotated[StrictStr, Field(description="STACKIT Region")],
5677
+ update_service_payload: UpdateServicePayload,
5678
+ _request_timeout: Union[
5679
+ None,
5680
+ Annotated[StrictFloat, Field(gt=0)],
5681
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
5682
+ ] = None,
5683
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
5684
+ _content_type: Optional[StrictStr] = None,
5685
+ _headers: Optional[Dict[StrictStr, Any]] = None,
5686
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
5687
+ ) -> RESTResponseType:
5688
+ """Update Project
5689
+
5690
+ Update project details.
5691
+
5692
+ :param project_id: STACKIT project ID (required)
5693
+ :type project_id: str
5694
+ :param region: STACKIT Region (required)
5695
+ :type region: str
5696
+ :param update_service_payload: (required)
5697
+ :type update_service_payload: UpdateServicePayload
5698
+ :param _request_timeout: timeout setting for this request. If one
5699
+ number provided, it will be total request
5700
+ timeout. It can also be a pair (tuple) of
5701
+ (connection, read) timeouts.
5702
+ :type _request_timeout: int, tuple(int, int), optional
5703
+ :param _request_auth: set to override the auth_settings for an a single
5704
+ request; this effectively ignores the
5705
+ authentication in the spec for a single request.
5706
+ :type _request_auth: dict, optional
5707
+ :param _content_type: force content-type for the request.
5708
+ :type _content_type: str, Optional
5709
+ :param _headers: set to override the headers for a single
5710
+ request; this effectively ignores the headers
5711
+ in the spec for a single request.
5712
+ :type _headers: dict, optional
5713
+ :param _host_index: set to override the host_index for a single
5714
+ request; this effectively ignores the host_index
5715
+ in the spec for a single request.
5716
+ :type _host_index: int, optional
5717
+ :return: Returns the result object.
5718
+ """ # noqa: E501
5719
+
5720
+ _param = self._update_service_serialize(
5721
+ project_id=project_id,
5722
+ region=region,
5723
+ update_service_payload=update_service_payload,
5724
+ _request_auth=_request_auth,
5725
+ _content_type=_content_type,
5726
+ _headers=_headers,
5727
+ _host_index=_host_index,
5728
+ )
5729
+
5730
+ _response_types_map: Dict[str, Optional[str]] = {
5731
+ "200": "ProjectStatus",
5732
+ "401": "ErrorMessage",
5733
+ "403": "ErrorMessage",
5734
+ "404": "ErrorMessage",
5735
+ "422": "HTTPValidationError",
5736
+ "429": "RateLimitError",
5737
+ "500": "ErrorMessage",
5738
+ }
5739
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
5740
+ return response_data.response
5741
+
5742
+ def _update_service_serialize(
5743
+ self,
5744
+ project_id,
5745
+ region,
5746
+ update_service_payload,
5747
+ _request_auth,
5748
+ _content_type,
5749
+ _headers,
5750
+ _host_index,
5751
+ ) -> RequestSerialized:
5752
+
5753
+ _host = None
5754
+
5755
+ _collection_formats: Dict[str, str] = {}
5756
+
5757
+ _path_params: Dict[str, str] = {}
5758
+ _query_params: List[Tuple[str, str]] = []
5759
+ _header_params: Dict[str, Optional[str]] = _headers or {}
5760
+ _form_params: List[Tuple[str, str]] = []
5761
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
5762
+ _body_params: Optional[bytes] = None
5763
+
5764
+ # process the path parameters
5765
+ if project_id is not None:
5766
+ _path_params["projectId"] = project_id
5767
+ if region is not None:
5768
+ _path_params["region"] = region
5769
+ # process the query parameters
5770
+ # process the header parameters
5771
+ # process the form parameters
5772
+ # process the body parameter
5773
+ if update_service_payload is not None:
5774
+ _body_params = update_service_payload
5775
+
5776
+ # set the HTTP header `Accept`
5777
+ if "Accept" not in _header_params:
5778
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
5779
+
5780
+ # set the HTTP header `Content-Type`
5781
+ if _content_type:
5782
+ _header_params["Content-Type"] = _content_type
5783
+ else:
5784
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
5785
+ if _default_content_type is not None:
5786
+ _header_params["Content-Type"] = _default_content_type
5787
+
5788
+ # authentication setting
5789
+ _auth_settings: List[str] = []
5790
+
5791
+ return self.api_client.param_serialize(
5792
+ method="PUT",
5793
+ resource_path="/v2/project/{projectId}/regions/{region}",
5794
+ path_params=_path_params,
5795
+ query_params=_query_params,
5796
+ header_params=_header_params,
5797
+ body=_body_params,
5798
+ post_params=_form_params,
5799
+ files=_files,
5800
+ auth_settings=_auth_settings,
5801
+ collection_formats=_collection_formats,
5802
+ _host=_host,
5803
+ _request_auth=_request_auth,
5804
+ )
@@ -68,4 +68,5 @@ from stackit.objectstorage.models.retention_mode import RetentionMode
68
68
  from stackit.objectstorage.models.set_default_retention_payload import (
69
69
  SetDefaultRetentionPayload,
70
70
  )
71
+ from stackit.objectstorage.models.update_service_payload import UpdateServicePayload
71
72
  from stackit.objectstorage.models.validation_error import ValidationError
@@ -29,9 +29,10 @@ class ProjectStatus(BaseModel):
29
29
  ProjectStatus
30
30
  """ # noqa: E501
31
31
 
32
+ labels: Optional[Dict[str, StrictStr]] = Field(default=None, description="Project labels")
32
33
  project: StrictStr = Field(description="Project ID")
33
34
  scope: ProjectScope = Field(description="Project Scope")
34
- __properties: ClassVar[List[str]] = ["project", "scope"]
35
+ __properties: ClassVar[List[str]] = ["labels", "project", "scope"]
35
36
 
36
37
  model_config = ConfigDict(
37
38
  validate_by_name=True,
@@ -81,5 +82,7 @@ class ProjectStatus(BaseModel):
81
82
  if not isinstance(obj, dict):
82
83
  return cls.model_validate(obj)
83
84
 
84
- _obj = cls.model_validate({"project": obj.get("project"), "scope": obj.get("scope")})
85
+ _obj = cls.model_validate(
86
+ {"labels": obj.get("labels"), "project": obj.get("project"), "scope": obj.get("scope")}
87
+ )
85
88
  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: 2.0.1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
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 pydantic_core import to_jsonable_python
22
+ from typing_extensions import Self
23
+
24
+
25
+ class UpdateServicePayload(BaseModel):
26
+ """
27
+ UpdateServicePayload
28
+ """ # noqa: E501
29
+
30
+ labels: Dict[str, StrictStr] = Field(description="Project labels")
31
+ __properties: ClassVar[List[str]] = ["labels"]
32
+
33
+ model_config = ConfigDict(
34
+ validate_by_name=True,
35
+ validate_by_alias=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ return json.dumps(to_jsonable_python(self.to_dict()))
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of UpdateServicePayload 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 UpdateServicePayload 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({"labels": obj.get("labels")})
82
+ return _obj