stackit-runcommand 0.0.1a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,89 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Run Commands Service API
5
+
6
+ API endpoints for the STACKIT Run Commands Service API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@stackit.de
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ 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
22
+ from typing_extensions import Self
23
+
24
+ from stackit.runcommand.models.properties import Properties
25
+
26
+
27
+ class ParametersSchema(BaseModel):
28
+ """
29
+ ParametersSchema
30
+ """
31
+
32
+ properties: Optional[Properties] = None
33
+ __properties: ClassVar[List[str]] = ["properties"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
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 ParametersSchema 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
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of properties
73
+ if self.properties:
74
+ _dict["properties"] = self.properties.to_dict()
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of ParametersSchema 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
+ {"properties": Properties.from_dict(obj["properties"]) if obj.get("properties") is not None else None}
88
+ )
89
+ return _obj
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Run Commands Service API
5
+
6
+ API endpoints for the STACKIT Run Commands Service API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@stackit.de
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ 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
22
+ from typing_extensions import Self
23
+
24
+ from stackit.runcommand.models.model_field import ModelField
25
+
26
+
27
+ class Properties(BaseModel):
28
+ """
29
+ Properties
30
+ """
31
+
32
+ confirm_password: Optional[ModelField] = Field(default=None, alias="ConfirmPassword")
33
+ password: Optional[ModelField] = Field(default=None, alias="Password")
34
+ script: Optional[ModelField] = Field(default=None, alias="Script")
35
+ username: Optional[ModelField] = Field(default=None, alias="Username")
36
+ required: Optional[List[StrictStr]] = None
37
+ type: Optional[StrictStr] = None
38
+ __properties: ClassVar[List[str]] = ["ConfirmPassword", "Password", "Script", "Username", "required", "type"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of Properties from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # override the default output from pydantic by calling `to_dict()` of confirm_password
78
+ if self.confirm_password:
79
+ _dict["ConfirmPassword"] = self.confirm_password.to_dict()
80
+ # override the default output from pydantic by calling `to_dict()` of password
81
+ if self.password:
82
+ _dict["Password"] = self.password.to_dict()
83
+ # override the default output from pydantic by calling `to_dict()` of script
84
+ if self.script:
85
+ _dict["Script"] = self.script.to_dict()
86
+ # override the default output from pydantic by calling `to_dict()` of username
87
+ if self.username:
88
+ _dict["Username"] = self.username.to_dict()
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of Properties from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate(
101
+ {
102
+ "ConfirmPassword": (
103
+ ModelField.from_dict(obj["ConfirmPassword"]) if obj.get("ConfirmPassword") is not None else None
104
+ ),
105
+ "Password": ModelField.from_dict(obj["Password"]) if obj.get("Password") is not None else None,
106
+ "Script": ModelField.from_dict(obj["Script"]) if obj.get("Script") is not None else None,
107
+ "Username": ModelField.from_dict(obj["Username"]) if obj.get("Username") is not None else None,
108
+ "required": obj.get("required"),
109
+ "type": obj.get("type"),
110
+ }
111
+ )
112
+ return _obj
File without changes
@@ -0,0 +1,149 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Run Commands Service API
5
+
6
+ API endpoints for the STACKIT Run Commands Service API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@stackit.de
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ import io
16
+ import json
17
+ import re
18
+
19
+ import requests
20
+ from stackit.core.authorization import Authorization
21
+ from stackit.core.configuration import Configuration
22
+
23
+ from stackit.runcommand.exceptions import ApiException, ApiValueError
24
+
25
+
26
+ RESTResponseType = requests.Response
27
+
28
+
29
+ class RESTResponse(io.IOBase):
30
+
31
+ def __init__(self, resp) -> None:
32
+ self.response = resp
33
+ self.status = resp.status_code
34
+ self.reason = resp.reason
35
+ self.data = None
36
+
37
+ def read(self):
38
+ if self.data is None:
39
+ self.data = self.response.content
40
+ return self.data
41
+
42
+ def getheaders(self):
43
+ """Returns a dictionary of the response headers."""
44
+ return self.response.headers
45
+
46
+ def getheader(self, name, default=None):
47
+ """Returns a given response header."""
48
+ return self.response.headers.get(name, default)
49
+
50
+
51
+ class RESTClientObject:
52
+ def __init__(self, config: Configuration) -> None:
53
+ self.session = config.custom_http_session if config.custom_http_session else requests.Session()
54
+ authorization = Authorization(config)
55
+ self.session.auth = authorization.auth_method
56
+
57
+ def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None):
58
+ """Perform requests.
59
+
60
+ :param method: http request method
61
+ :param url: http request url
62
+ :param headers: http request headers
63
+ :param body: request json body, for `application/json`
64
+ :param post_params: request post parameters,
65
+ `application/x-www-form-urlencoded`
66
+ and `multipart/form-data`
67
+ :param _request_timeout: timeout setting for this request. If one
68
+ number provided, it will be total request
69
+ timeout. It can also be a pair (tuple) of
70
+ (connection, read) timeouts.
71
+ """
72
+ method = method.upper()
73
+ if method not in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]:
74
+ raise ValueError("Method %s not allowed", method)
75
+
76
+ if post_params and body:
77
+ raise ApiValueError("body parameter cannot be used with post_params parameter.")
78
+
79
+ post_params = post_params or {}
80
+ headers = headers or {}
81
+
82
+ try:
83
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
84
+ if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
85
+
86
+ # no content type provided or payload is json
87
+ content_type = headers.get("Content-Type")
88
+ if not content_type or re.search("json", content_type, re.IGNORECASE):
89
+ request_body = None
90
+ if body is not None:
91
+ request_body = json.dumps(body)
92
+ r = self.session.request(
93
+ method,
94
+ url,
95
+ data=request_body,
96
+ headers=headers,
97
+ )
98
+ elif content_type == "application/x-www-form-urlencoded":
99
+ r = self.session.request(
100
+ method,
101
+ url,
102
+ params=post_params,
103
+ headers=headers,
104
+ )
105
+ elif content_type == "multipart/form-data":
106
+ # must del headers['Content-Type'], or the correct
107
+ # Content-Type which generated by urllib3 will be
108
+ # overwritten.
109
+ del headers["Content-Type"]
110
+ # Ensures that dict objects are serialized
111
+ post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params]
112
+ r = self.session.request(
113
+ method,
114
+ url,
115
+ files=post_params,
116
+ headers=headers,
117
+ )
118
+ # Pass a `string` parameter directly in the body to support
119
+ # other content types than JSON when `body` argument is
120
+ # provided in serialized form.
121
+ elif isinstance(body, str) or isinstance(body, bytes):
122
+ r = self.session.request(
123
+ method,
124
+ url,
125
+ data=body,
126
+ headers=headers,
127
+ )
128
+ elif headers["Content-Type"] == "text/plain" and isinstance(body, bool):
129
+ request_body = "true" if body else "false"
130
+ r = self.session.request(method, url, data=request_body, headers=headers)
131
+ else:
132
+ # Cannot generate the request from given parameters
133
+ msg = """Cannot prepare a request message for provided
134
+ arguments. Please check that your arguments match
135
+ declared content type."""
136
+ raise ApiException(status=0, reason=msg)
137
+ # For `GET`, `HEAD`
138
+ else:
139
+ r = self.session.request(
140
+ method,
141
+ url,
142
+ params={},
143
+ headers=headers,
144
+ )
145
+ except requests.exceptions.SSLError as e:
146
+ msg = "\n".join([type(e).__name__, str(e)])
147
+ raise ApiException(status=0, reason=msg)
148
+
149
+ return RESTResponse(r)
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.1
2
+ Name: stackit-runcommand
3
+ Version: 0.0.1a0
4
+ Summary: STACKIT Run Commands Service API
5
+ Author: STACKIT Developer Tools
6
+ Author-email: developer-tools@stackit.cloud
7
+ Requires-Python: >=3.8,<4.0
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Dist: pydantic (>=2.9.2)
18
+ Requires-Dist: python-dateutil (>=2.9.0.post0)
19
+ Requires-Dist: requests (>=2.32.3)
20
+ Requires-Dist: stackit-core (>=0.0.1a)
21
+ Description-Content-Type: text/markdown
22
+
23
+ # stackit.runcommand
24
+ API endpoints for the STACKIT Run Commands Service API
25
+
26
+
27
+ This package is part of the STACKIT Python SDK. For additional information, please visit the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
28
+
29
+
30
+ ## Installation & Usage
31
+ ### pip install
32
+
33
+ ```sh
34
+ pip install stackit-runcommand
35
+ ```
36
+
37
+ Then import the package:
38
+ ```python
39
+ import stackit.runcommand
40
+ ```
41
+
42
+ ## Getting Started
43
+
44
+ [Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
@@ -0,0 +1,25 @@
1
+ stackit/runcommand/__init__.py,sha256=OF8dCJm8dLHGxj-_IANtFbaseL0ufOyV2fDBmv7x4po,1734
2
+ stackit/runcommand/api/__init__.py,sha256=O-WDFpOgx6B55T02W-JUoG02zuSKFHZcszlw16eLV04,105
3
+ stackit/runcommand/api/default_api.py,sha256=r-VaNCCLnH2_HrOI9-fNPELkFswyADbkPUDKOivEr24,58467
4
+ stackit/runcommand/api_client.py,sha256=_NA5aYHQ0WNSDuFBMP1GdY97DiYuRNPj6F-sUYP6yUg,22729
5
+ stackit/runcommand/api_response.py,sha256=HRYkVqMNIlfODacTQPTbiVj2YdcnutpQrKJdeAoCSpM,642
6
+ stackit/runcommand/configuration.py,sha256=gqWKibB_vkiGmBSAQ7Nu8gpnAHWrSHLIa9swAQ36hyI,3861
7
+ stackit/runcommand/exceptions.py,sha256=lGPHNHUnPFhdXVi0w8gdSM1UUYRqOQM4OCWwA1B50Qc,5952
8
+ stackit/runcommand/models/__init__.py,sha256=-HIBaDzfhB2RBWD4B3L16Ft-k5dm2lTHXA80H3et5j4,1268
9
+ stackit/runcommand/models/command_details.py,sha256=fYVMOKVxDXduObQ2TXIo9jvAjQ24FRflAWddkaXga5c,4047
10
+ stackit/runcommand/models/command_template.py,sha256=Pxz1U0PQ6vG0rYTGXX8GSaewBVnJIwNyDlRnsAjgDrI,2634
11
+ stackit/runcommand/models/command_template_response.py,sha256=3QQaqRUW0bAUHfb8WJnR0YhVxxwCo44vj_v73ihe3YQ,3061
12
+ stackit/runcommand/models/command_template_schema.py,sha256=SXkQBGWYVWpND_nclXqYFbBI4gPQjfZfildp6uXFxpE,3465
13
+ stackit/runcommand/models/commands.py,sha256=Fl_X9djiI3TvEEOEpU8VcVbThQ9H9I5Ud4RRpSKKRtU,3675
14
+ stackit/runcommand/models/create_command_payload.py,sha256=83bzNAnkKufKqa7wLLIZCIVUBZtPemtRsxeJvXSN0m4,2673
15
+ stackit/runcommand/models/error_response.py,sha256=3GkbqbG7PE7KDjFNpaIXcAKueJbwkrAlkZnhJCOkzx8,2661
16
+ stackit/runcommand/models/get_commands_response.py,sha256=skVJu0vEdU1QrVsmuDopjKqeAhewFeWxDZcMIpKPCqU,2906
17
+ stackit/runcommand/models/model_field.py,sha256=Gt9hG0_XWgZP8M94Jw17Hxi80kPYRT8TwXYXJybimRE,3191
18
+ stackit/runcommand/models/new_command_response.py,sha256=mH3ocI-svEGqt19p2Q4gMtcw4LI5pvmTmZQNNmCxE78,2441
19
+ stackit/runcommand/models/parameters_schema.py,sha256=N1xmtLZ3kUceZKkdO1b53zkTLi9y3WdrASvKMYAgg14,2780
20
+ stackit/runcommand/models/properties.py,sha256=HwkgILzcTzsf7m7nIGaH7UCqPC-vLYUCNZPjHDCOGfQ,4213
21
+ stackit/runcommand/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ stackit/runcommand/rest.py,sha256=a0X2D3GMynQZrdWxcNmHhpiYeo_-4-YW79k5YG5mb0U,5835
23
+ stackit_runcommand-0.0.1a0.dist-info/METADATA,sha256=enE8FMEGuDc_8xYnueandM8hRIUKaSriYkklRYiVzio,1509
24
+ stackit_runcommand-0.0.1a0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
25
+ stackit_runcommand-0.0.1a0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any