crc-pulp-npm-client 20250819.1__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 crc-pulp-npm-client might be problematic. Click here for more details.

Files changed (86) hide show
  1. crc-pulp_npm-client/__init__.py +2 -0
  2. crc-pulp_npm-client/api/__init__.py +9 -0
  3. crc-pulp_npm-client/api/content_packages_api.py +1964 -0
  4. crc-pulp_npm-client/api/distributions_npm_api.py +2934 -0
  5. crc-pulp_npm-client/api/remotes_npm_api.py +2962 -0
  6. crc-pulp_npm-client/api/repositories_npm_api.py +3604 -0
  7. crc-pulp_npm-client/api/repositories_npm_versions_api.py +1670 -0
  8. crc-pulp_npm-client/api_client.py +798 -0
  9. crc-pulp_npm-client/api_response.py +21 -0
  10. crc-pulp_npm-client/configuration.py +628 -0
  11. crc-pulp_npm-client/exceptions.py +200 -0
  12. crc-pulp_npm-client/models/__init__.py +44 -0
  13. crc-pulp_npm-client/models/async_operation_response.py +88 -0
  14. crc-pulp_npm-client/models/content_summary_response.py +92 -0
  15. crc-pulp_npm-client/models/npm_npm_distribution.py +116 -0
  16. crc-pulp_npm-client/models/npm_npm_distribution_response.py +140 -0
  17. crc-pulp_npm-client/models/npm_npm_remote.py +205 -0
  18. crc-pulp_npm-client/models/npm_npm_remote_response.py +199 -0
  19. crc-pulp_npm-client/models/npm_npm_remote_response_hidden_fields_inner.py +90 -0
  20. crc-pulp_npm-client/models/npm_npm_repository.py +112 -0
  21. crc-pulp_npm-client/models/npm_npm_repository_response.py +137 -0
  22. crc-pulp_npm-client/models/npm_package_response.py +113 -0
  23. crc-pulp_npm-client/models/paginated_repository_version_response_list.py +112 -0
  24. crc-pulp_npm-client/models/paginatednpm_npm_distribution_response_list.py +112 -0
  25. crc-pulp_npm-client/models/paginatednpm_npm_remote_response_list.py +112 -0
  26. crc-pulp_npm-client/models/paginatednpm_npm_repository_response_list.py +112 -0
  27. crc-pulp_npm-client/models/paginatednpm_package_response_list.py +112 -0
  28. crc-pulp_npm-client/models/patchednpm_npm_distribution.py +116 -0
  29. crc-pulp_npm-client/models/patchednpm_npm_remote.py +205 -0
  30. crc-pulp_npm-client/models/patchednpm_npm_repository.py +112 -0
  31. crc-pulp_npm-client/models/policy_enum.py +39 -0
  32. crc-pulp_npm-client/models/repair.py +88 -0
  33. crc-pulp_npm-client/models/repository_add_remove_content.py +93 -0
  34. crc-pulp_npm-client/models/repository_sync_url.py +90 -0
  35. crc-pulp_npm-client/models/repository_version_response.py +121 -0
  36. crc-pulp_npm-client/models/set_label.py +103 -0
  37. crc-pulp_npm-client/models/set_label_response.py +103 -0
  38. crc-pulp_npm-client/models/unset_label.py +96 -0
  39. crc-pulp_npm-client/models/unset_label_response.py +100 -0
  40. crc-pulp_npm-client/py.typed +0 -0
  41. crc-pulp_npm-client/rest.py +258 -0
  42. crc_pulp_npm_client-20250819.1.dist-info/METADATA +25 -0
  43. crc_pulp_npm_client-20250819.1.dist-info/RECORD +86 -0
  44. crc_pulp_npm_client-20250819.1.dist-info/WHEEL +5 -0
  45. crc_pulp_npm_client-20250819.1.dist-info/top_level.txt +2 -0
  46. services-pulp_npm-client/__init__.py +2 -0
  47. services-pulp_npm-client/api/__init__.py +9 -0
  48. services-pulp_npm-client/api/content_packages_api.py +1964 -0
  49. services-pulp_npm-client/api/distributions_npm_api.py +2934 -0
  50. services-pulp_npm-client/api/remotes_npm_api.py +2962 -0
  51. services-pulp_npm-client/api/repositories_npm_api.py +3604 -0
  52. services-pulp_npm-client/api/repositories_npm_versions_api.py +1670 -0
  53. services-pulp_npm-client/api_client.py +798 -0
  54. services-pulp_npm-client/api_response.py +21 -0
  55. services-pulp_npm-client/configuration.py +628 -0
  56. services-pulp_npm-client/exceptions.py +200 -0
  57. services-pulp_npm-client/models/__init__.py +44 -0
  58. services-pulp_npm-client/models/async_operation_response.py +88 -0
  59. services-pulp_npm-client/models/content_summary_response.py +92 -0
  60. services-pulp_npm-client/models/npm_npm_distribution.py +116 -0
  61. services-pulp_npm-client/models/npm_npm_distribution_response.py +140 -0
  62. services-pulp_npm-client/models/npm_npm_remote.py +205 -0
  63. services-pulp_npm-client/models/npm_npm_remote_response.py +199 -0
  64. services-pulp_npm-client/models/npm_npm_remote_response_hidden_fields_inner.py +90 -0
  65. services-pulp_npm-client/models/npm_npm_repository.py +112 -0
  66. services-pulp_npm-client/models/npm_npm_repository_response.py +137 -0
  67. services-pulp_npm-client/models/npm_package_response.py +113 -0
  68. services-pulp_npm-client/models/paginated_repository_version_response_list.py +112 -0
  69. services-pulp_npm-client/models/paginatednpm_npm_distribution_response_list.py +112 -0
  70. services-pulp_npm-client/models/paginatednpm_npm_remote_response_list.py +112 -0
  71. services-pulp_npm-client/models/paginatednpm_npm_repository_response_list.py +112 -0
  72. services-pulp_npm-client/models/paginatednpm_package_response_list.py +112 -0
  73. services-pulp_npm-client/models/patchednpm_npm_distribution.py +116 -0
  74. services-pulp_npm-client/models/patchednpm_npm_remote.py +205 -0
  75. services-pulp_npm-client/models/patchednpm_npm_repository.py +112 -0
  76. services-pulp_npm-client/models/policy_enum.py +39 -0
  77. services-pulp_npm-client/models/repair.py +88 -0
  78. services-pulp_npm-client/models/repository_add_remove_content.py +93 -0
  79. services-pulp_npm-client/models/repository_sync_url.py +90 -0
  80. services-pulp_npm-client/models/repository_version_response.py +121 -0
  81. services-pulp_npm-client/models/set_label.py +103 -0
  82. services-pulp_npm-client/models/set_label_response.py +103 -0
  83. services-pulp_npm-client/models/unset_label.py +96 -0
  84. services-pulp_npm-client/models/unset_label_response.py +100 -0
  85. services-pulp_npm-client/py.typed +0 -0
  86. services-pulp_npm-client/rest.py +258 -0
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import json
18
+ from enum import Enum
19
+ from typing_extensions import Self
20
+
21
+
22
+ class PolicyEnum(str, Enum):
23
+ """
24
+ * `immediate` - When syncing, download all metadata and content now. * `on_demand` - When syncing, download metadata, but do not download content now. Instead, download content as clients request it, and save it in Pulp to be served for future client requests. * `streamed` - When syncing, download metadata, but do not download content now. Instead,download content as clients request it, but never save it in Pulp. This causes future requests for that same content to have to be downloaded again.
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ IMMEDIATE = 'immediate'
31
+ ON_DEMAND = 'on_demand'
32
+ STREAMED = 'streamed'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of PolicyEnum from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -0,0 +1,88 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class Repair(BaseModel):
27
+ """
28
+ Repair
29
+ """ # noqa: E501
30
+ verify_checksums: Optional[StrictBool] = Field(default=True, description="Will verify that the checksum of all stored files matches what saved in the database. Otherwise only the existence of the files will be checked. Enabled by default")
31
+ __properties: ClassVar[List[str]] = ["verify_checksums"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
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
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of Repair from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of Repair from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({
84
+ "verify_checksums": obj.get("verify_checksums") if obj.get("verify_checksums") is not None else True
85
+ })
86
+ return _obj
87
+
88
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class RepositoryAddRemoveContent(BaseModel):
28
+ """
29
+ Base serializer for use with [pulpcore.app.models.Model][] This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
30
+ """ # noqa: E501
31
+ add_content_units: Optional[List[Annotated[str, Field(min_length=1, strict=True)]]] = Field(default=None, description="A list of content units to add to a new repository version. This content is added after remove_content_units are removed.")
32
+ remove_content_units: Optional[List[Annotated[str, Field(min_length=1, strict=True)]]] = Field(default=None, description="A list of content units to remove from the latest repository version. You may also specify '*' as an entry to remove all content. This content is removed before add_content_units are added.")
33
+ base_version: Optional[StrictStr] = Field(default=None, description="A repository version whose content will be used as the initial set of content for the new repository version")
34
+ __properties: ClassVar[List[str]] = ["add_content_units", "remove_content_units", "base_version"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
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 RepositoryAddRemoveContent 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
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of RepositoryAddRemoveContent from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "add_content_units": obj.get("add_content_units"),
88
+ "remove_content_units": obj.get("remove_content_units"),
89
+ "base_version": obj.get("base_version")
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,90 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class RepositorySyncURL(BaseModel):
27
+ """
28
+ A mixin for validating unknown serializers' fields.
29
+ """ # noqa: E501
30
+ remote: Optional[StrictStr] = Field(default=None, description="A remote to sync from. This will override a remote set on repository.")
31
+ mirror: Optional[StrictBool] = Field(default=False, description="If ``True``, synchronization will remove all content that is not present in the remote repository. If ``False``, sync will be additive only.")
32
+ __properties: ClassVar[List[str]] = ["remote", "mirror"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of RepositorySyncURL from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
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 RepositorySyncURL 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
+ "remote": obj.get("remote"),
86
+ "mirror": obj.get("mirror") if obj.get("mirror") is not None else False
87
+ })
88
+ return _obj
89
+
90
+
@@ -0,0 +1,121 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from datetime import datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from services-pulp_npm-client.models.content_summary_response import ContentSummaryResponse
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class RepositoryVersionResponse(BaseModel):
29
+ """
30
+ Base serializer for use with [pulpcore.app.models.Model][] This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
31
+ """ # noqa: E501
32
+ pulp_href: Optional[StrictStr] = None
33
+ prn: Optional[StrictStr] = Field(default=None, description="The Pulp Resource Name (PRN).")
34
+ pulp_created: Optional[datetime] = Field(default=None, description="Timestamp of creation.")
35
+ pulp_last_updated: Optional[datetime] = Field(default=None, description="Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.")
36
+ number: Optional[StrictInt] = None
37
+ repository: Optional[StrictStr] = None
38
+ base_version: Optional[StrictStr] = Field(default=None, description="A repository version whose content was used as the initial set of content for this repository version")
39
+ content_summary: Optional[ContentSummaryResponse] = Field(default=None, description="Various count summaries of the content in the version and the HREF to view them.")
40
+ __properties: ClassVar[List[str]] = ["pulp_href", "prn", "pulp_created", "pulp_last_updated", "number", "repository", "base_version", "content_summary"]
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of RepositoryVersionResponse from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ * OpenAPI `readOnly` fields are excluded.
73
+ * OpenAPI `readOnly` fields are excluded.
74
+ * OpenAPI `readOnly` fields are excluded.
75
+ * OpenAPI `readOnly` fields are excluded.
76
+ * OpenAPI `readOnly` fields are excluded.
77
+ * OpenAPI `readOnly` fields are excluded.
78
+ * OpenAPI `readOnly` fields are excluded.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ "pulp_href",
82
+ "prn",
83
+ "pulp_created",
84
+ "pulp_last_updated",
85
+ "number",
86
+ "repository",
87
+ "content_summary",
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # override the default output from pydantic by calling `to_dict()` of content_summary
96
+ if self.content_summary:
97
+ _dict['content_summary'] = self.content_summary.to_dict()
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of RepositoryVersionResponse from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "pulp_href": obj.get("pulp_href"),
111
+ "prn": obj.get("prn"),
112
+ "pulp_created": obj.get("pulp_created"),
113
+ "pulp_last_updated": obj.get("pulp_last_updated"),
114
+ "number": obj.get("number"),
115
+ "repository": obj.get("repository"),
116
+ "base_version": obj.get("base_version"),
117
+ "content_summary": ContentSummaryResponse.from_dict(obj["content_summary"]) if obj.get("content_summary") is not None else None
118
+ })
119
+ return _obj
120
+
121
+
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SetLabel(BaseModel):
28
+ """
29
+ Serializer for synchronously setting a label.
30
+ """ # noqa: E501
31
+ key: Annotated[str, Field(min_length=1, strict=True)]
32
+ value: Optional[StrictStr]
33
+ __properties: ClassVar[List[str]] = ["key", "value"]
34
+
35
+ @field_validator('key')
36
+ def key_validate_regular_expression(cls, value):
37
+ """Validates the regular expression"""
38
+ if not re.match(r"^[-a-zA-Z0-9_]+$", value):
39
+ raise ValueError(r"must validate the regular expression /^[-a-zA-Z0-9_]+$/")
40
+ return value
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of SetLabel from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # set to None if value (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.value is None and "value" in self.model_fields_set:
84
+ _dict['value'] = None
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of SetLabel from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "key": obj.get("key"),
99
+ "value": obj.get("value")
100
+ })
101
+ return _obj
102
+
103
+
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Pulp 3 API
5
+
6
+ Fetch, Upload, Organize, and Distribute Software Packages
7
+
8
+ The version of the OpenAPI document: v3
9
+ Contact: pulp-list@redhat.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SetLabelResponse(BaseModel):
28
+ """
29
+ Serializer for synchronously setting a label.
30
+ """ # noqa: E501
31
+ key: Annotated[str, Field(strict=True)]
32
+ value: Optional[StrictStr]
33
+ __properties: ClassVar[List[str]] = ["key", "value"]
34
+
35
+ @field_validator('key')
36
+ def key_validate_regular_expression(cls, value):
37
+ """Validates the regular expression"""
38
+ if not re.match(r"^[-a-zA-Z0-9_]+$", value):
39
+ raise ValueError(r"must validate the regular expression /^[-a-zA-Z0-9_]+$/")
40
+ return value
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of SetLabelResponse from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # set to None if value (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.value is None and "value" in self.model_fields_set:
84
+ _dict['value'] = None
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of SetLabelResponse from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "key": obj.get("key"),
99
+ "value": obj.get("value")
100
+ })
101
+ return _obj
102
+
103
+