automizor 0.4.6__py3-none-any.whl → 0.4.8__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.
- automizor/__init__.py +1 -1
- automizor/datastore/__init__.py +44 -53
- automizor/datastore/_container.py +28 -0
- automizor/datastore/_datastore.py +25 -16
- automizor/job/__init__.py +10 -9
- automizor/job/_job.py +15 -6
- automizor/storage/__init__.py +19 -17
- automizor/storage/_storage.py +16 -6
- automizor/utils/__init__.py +11 -8
- automizor/vault/__init__.py +10 -9
- automizor/vault/_vault.py +14 -2
- {automizor-0.4.6.dist-info → automizor-0.4.8.dist-info}/METADATA +1 -1
- automizor-0.4.8.dist-info/RECORD +20 -0
- {automizor-0.4.6.dist-info → automizor-0.4.8.dist-info}/WHEEL +1 -1
- automizor-0.4.6.dist-info/RECORD +0 -19
- {automizor-0.4.6.dist-info → automizor-0.4.8.dist-info}/LICENSE +0 -0
- {automizor-0.4.6.dist-info → automizor-0.4.8.dist-info}/top_level.txt +0 -0
automizor/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = "0.4.
|
1
|
+
version = "0.4.8"
|
automizor/datastore/__init__.py
CHANGED
@@ -1,27 +1,19 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
from functools import lru_cache
|
1
|
+
from ._container import DataStoreContainer
|
2
|
+
from ._datastore import DataStore
|
4
3
|
|
5
|
-
from ._datastore import JSON
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
return DataStore()
|
5
|
+
def configure(api_token: str):
|
6
|
+
"""
|
7
|
+
Configures the DataStore instance with the provided API token.
|
8
|
+
"""
|
9
|
+
DataStore.configure(api_token)
|
13
10
|
|
14
11
|
|
15
|
-
|
12
|
+
def get_store(name: str) -> "DataStoreContainer":
|
16
13
|
"""
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
This class leverages the `Automizor DataStore` module to fetch and update data,
|
22
|
-
utilizing a caching mechanism to enhance performance. The primary interaction is
|
23
|
-
through attribute access and assignment, making it simple to work with different
|
24
|
-
data structures.
|
14
|
+
Get a store container by name. The `DataStoreContainer` is a wrapper
|
15
|
+
around the data store that provides a get and set method to interact
|
16
|
+
with the data store.
|
25
17
|
|
26
18
|
Example usage:
|
27
19
|
|
@@ -29,41 +21,43 @@ class DataStoreProxy(types.ModuleType):
|
|
29
21
|
|
30
22
|
from automizor import datastore
|
31
23
|
|
24
|
+
# Get a data store countries
|
25
|
+
countries = datastore.get_store("countries")
|
26
|
+
|
32
27
|
# Initialize or update json store
|
33
|
-
|
34
|
-
|
28
|
+
countries.set([
|
29
|
+
{
|
35
30
|
"name": "United States",
|
36
|
-
"
|
37
|
-
"population": 331449281,
|
38
|
-
"area": 9833520
|
31
|
+
"code": "US",
|
39
32
|
},
|
40
|
-
|
33
|
+
{
|
41
34
|
"name": "Canada",
|
42
|
-
"
|
43
|
-
|
44
|
-
|
45
|
-
}
|
46
|
-
}
|
35
|
+
"code": "CA",
|
36
|
+
},
|
37
|
+
])
|
47
38
|
|
48
39
|
# Get values from json store
|
49
|
-
|
40
|
+
result = countries.get()
|
41
|
+
|
42
|
+
# Get a data store movies
|
43
|
+
movies = datastore.get_store("movies")
|
50
44
|
|
51
45
|
# Initialize or update kkv store
|
52
|
-
|
46
|
+
movies.set({
|
53
47
|
"US": {
|
54
48
|
"action": {
|
55
49
|
"Die Hard": 1988,
|
56
50
|
"The Matrix": 1999
|
57
51
|
}
|
58
52
|
}
|
59
|
-
}
|
53
|
+
})
|
60
54
|
|
61
55
|
# Get values from kkv store
|
62
|
-
|
63
|
-
|
56
|
+
result = movies.get("US")
|
57
|
+
result = movies.get("US", "action")
|
64
58
|
|
65
59
|
# Insert or update values
|
66
|
-
|
60
|
+
movies.set({
|
67
61
|
"US": {
|
68
62
|
"action": {
|
69
63
|
"Die Hard": 1988,
|
@@ -75,33 +69,30 @@ class DataStoreProxy(types.ModuleType):
|
|
75
69
|
"Superbad": 2007
|
76
70
|
}
|
77
71
|
}
|
78
|
-
}
|
72
|
+
})
|
79
73
|
|
80
74
|
# Delete secondary key
|
81
|
-
|
75
|
+
movies.set({
|
82
76
|
"US": {
|
83
77
|
"action": None
|
84
78
|
}
|
85
|
-
}
|
79
|
+
})
|
86
80
|
|
87
81
|
# Delete primary key
|
88
|
-
|
82
|
+
movies.set({
|
89
83
|
"US": None
|
90
|
-
}
|
84
|
+
})
|
91
85
|
|
92
86
|
"""
|
93
87
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
return wrapper
|
101
|
-
|
102
|
-
def __setattr__(self, name, values: JSON):
|
103
|
-
datastore = _get_datastore()
|
104
|
-
datastore.set_values(name, values)
|
88
|
+
datastore = DataStore.get_instance()
|
89
|
+
return DataStoreContainer(
|
90
|
+
datastore=datastore,
|
91
|
+
name=name,
|
92
|
+
)
|
105
93
|
|
106
94
|
|
107
|
-
|
95
|
+
__all__ = [
|
96
|
+
"configure",
|
97
|
+
"get_store",
|
98
|
+
]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
|
3
|
+
from automizor.utils import JSON
|
4
|
+
|
5
|
+
|
6
|
+
@dataclass
|
7
|
+
class DataStoreContainer:
|
8
|
+
"""
|
9
|
+
The `DataStoreContainer` is a wrapper around the data store that
|
10
|
+
provides a get and set method to interact with the data store.
|
11
|
+
|
12
|
+
Attributes:
|
13
|
+
datastore: The data store.
|
14
|
+
name: The name of the data store.
|
15
|
+
"""
|
16
|
+
|
17
|
+
from ._datastore import DataStore
|
18
|
+
|
19
|
+
datastore: DataStore
|
20
|
+
name: str
|
21
|
+
|
22
|
+
def get(self, primary_key=None, secondary_key=None):
|
23
|
+
"""Get values from the datastore."""
|
24
|
+
return self.datastore.get_values(self.name, primary_key, secondary_key)
|
25
|
+
|
26
|
+
def set(self, values: JSON):
|
27
|
+
"""Set values in the datastore."""
|
28
|
+
self.datastore.set_values(self.name, values)
|
@@ -1,33 +1,42 @@
|
|
1
|
-
from typing import Dict, List, Union
|
2
|
-
|
3
1
|
import requests
|
4
2
|
|
5
3
|
from automizor.exceptions import AutomizorError
|
6
|
-
from automizor.utils import get_api_config, get_headers
|
7
|
-
|
8
|
-
JSON = Union[str, int, float, bool, None, Dict[str, "JSON"], List["JSON"]]
|
4
|
+
from automizor.utils import JSON, get_api_config, get_headers
|
9
5
|
|
10
6
|
|
11
7
|
class DataStore:
|
12
8
|
"""
|
13
|
-
`DataStore` is a class designed to interface with the `Automizor Platform`
|
14
|
-
manipulate data stored in various formats. It supports
|
15
|
-
data using a unified API.
|
9
|
+
`DataStore` is a class designed to interface with the `Automizor Platform`
|
10
|
+
to manage and manipulate data stored in various formats. It supports
|
11
|
+
operations to retrieve and update data using a unified API.
|
16
12
|
|
17
|
-
The class initializes an HTTP session with the necessary headers for
|
18
|
-
provides methods to retrieve values, and set values in
|
13
|
+
The class initializes an HTTP session with the necessary headers for
|
14
|
+
authentication, and provides methods to retrieve values, and set values in
|
15
|
+
the store.
|
19
16
|
|
20
17
|
Attributes:
|
21
18
|
url (str): The base URL for the API endpoint.
|
22
19
|
token (str): The authentication token for API access.
|
23
|
-
session (requests.Session): The HTTP session used
|
20
|
+
session (requests.Session): The HTTP session used to make API requests.
|
24
21
|
"""
|
25
22
|
|
26
|
-
|
27
|
-
|
23
|
+
_instance = None
|
24
|
+
|
25
|
+
@classmethod
|
26
|
+
def configure(cls, api_token: str | None = None):
|
27
|
+
cls._instance = cls(api_token)
|
28
|
+
|
29
|
+
def __init__(self, api_token: str | None = None):
|
30
|
+
self.url, self.token = get_api_config(api_token)
|
28
31
|
self.session = requests.Session()
|
29
32
|
self.session.headers.update(get_headers(self.token))
|
30
33
|
|
34
|
+
@classmethod
|
35
|
+
def get_instance(cls):
|
36
|
+
if cls._instance is None:
|
37
|
+
cls.configure()
|
38
|
+
return cls._instance
|
39
|
+
|
31
40
|
def get_values(
|
32
41
|
self,
|
33
42
|
name: str,
|
@@ -39,8 +48,8 @@ class DataStore:
|
|
39
48
|
|
40
49
|
Parameters:
|
41
50
|
name (str): The name of the data store.
|
42
|
-
primary_key (str, optional): The primary key for the values.
|
43
|
-
secondary_key (str, optional): The secondary key for the values.
|
51
|
+
primary_key (str, optional): The primary key for the values.
|
52
|
+
secondary_key (str, optional): The secondary key for the values.
|
44
53
|
|
45
54
|
Returns:
|
46
55
|
JSON: The values from the data store.
|
@@ -64,7 +73,7 @@ class DataStore:
|
|
64
73
|
name: str,
|
65
74
|
primary_key: str | None = None,
|
66
75
|
secondary_key: str | None = None,
|
67
|
-
) ->
|
76
|
+
) -> JSON:
|
68
77
|
params = (
|
69
78
|
{"primary_key": primary_key, "secondary_key": secondary_key}
|
70
79
|
if primary_key or secondary_key
|
automizor/job/__init__.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
from
|
1
|
+
from automizor.utils import JSON
|
2
2
|
|
3
|
-
from ._job import
|
3
|
+
from ._job import Job
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
def configure(api_token: str):
|
7
|
+
"""
|
8
|
+
Configures the Job instance with the provided API token.
|
9
|
+
"""
|
10
|
+
Job.configure(api_token)
|
11
11
|
|
12
12
|
|
13
13
|
def get_context() -> dict:
|
@@ -22,7 +22,7 @@ def get_context() -> dict:
|
|
22
22
|
AutomizorJobError: If retrieving the job context fails.
|
23
23
|
"""
|
24
24
|
|
25
|
-
job =
|
25
|
+
job = Job.get_instance()
|
26
26
|
return job.get_context()
|
27
27
|
|
28
28
|
|
@@ -38,11 +38,12 @@ def set_result(name: str, value: JSON):
|
|
38
38
|
Note: Errors during file operations will raise unhandled exceptions.
|
39
39
|
"""
|
40
40
|
|
41
|
-
job =
|
41
|
+
job = Job.get_instance()
|
42
42
|
return job.set_result(name, value)
|
43
43
|
|
44
44
|
|
45
45
|
__all__ = [
|
46
|
+
"configure",
|
46
47
|
"get_context",
|
47
48
|
"set_result",
|
48
49
|
]
|
automizor/job/_job.py
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
import json
|
2
2
|
import os
|
3
|
-
from typing import Dict, List, Union
|
4
3
|
|
5
4
|
import requests
|
6
5
|
|
7
6
|
from automizor.exceptions import AutomizorError
|
8
|
-
from automizor.utils import get_api_config, get_headers
|
9
|
-
|
10
|
-
JSON = Union[str, int, float, bool, None, Dict[str, "JSON"], List["JSON"]]
|
7
|
+
from automizor.utils import JSON, get_api_config, get_headers
|
11
8
|
|
12
9
|
|
13
10
|
class Job:
|
@@ -49,14 +46,26 @@ class Job:
|
|
49
46
|
job.set_result("result_name", {"key": "value"})
|
50
47
|
"""
|
51
48
|
|
52
|
-
|
49
|
+
_instance = None
|
50
|
+
|
51
|
+
@classmethod
|
52
|
+
def configure(cls, api_token: str | None = None):
|
53
|
+
cls._instance = cls(api_token)
|
54
|
+
|
55
|
+
def __init__(self, api_token: str | None = None):
|
53
56
|
self._context_file = os.getenv("AUTOMIZOR_CONTEXT_FILE", None)
|
54
57
|
self._job_id = os.getenv("AUTOMIZOR_JOB_ID", None)
|
55
58
|
|
56
|
-
self.url, self.token = get_api_config()
|
59
|
+
self.url, self.token = get_api_config(api_token)
|
57
60
|
self.session = requests.Session()
|
58
61
|
self.session.headers.update(get_headers(self.token))
|
59
62
|
|
63
|
+
@classmethod
|
64
|
+
def get_instance(cls):
|
65
|
+
if cls._instance is None:
|
66
|
+
cls.configure()
|
67
|
+
return cls._instance
|
68
|
+
|
60
69
|
def get_context(self) -> dict:
|
61
70
|
"""
|
62
71
|
Retrieves the context of the current job, which contains necessary information
|
automizor/storage/__init__.py
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
import json
|
2
2
|
import mimetypes
|
3
|
-
from functools import lru_cache
|
4
3
|
from pathlib import Path
|
5
4
|
from typing import List
|
6
5
|
|
7
|
-
from .
|
6
|
+
from automizor.utils import JSON
|
8
7
|
|
8
|
+
from ._storage import Storage
|
9
9
|
|
10
|
-
@lru_cache
|
11
|
-
def _get_storage():
|
12
|
-
from ._storage import Storage
|
13
10
|
|
14
|
-
|
11
|
+
def configure(api_token: str):
|
12
|
+
"""
|
13
|
+
Configures the Storage instance with the provided API token.
|
14
|
+
"""
|
15
|
+
Storage.configure(api_token)
|
15
16
|
|
16
17
|
|
17
18
|
def list_assets() -> List[str]:
|
@@ -22,7 +23,7 @@ def list_assets() -> List[str]:
|
|
22
23
|
A list of all asset names.
|
23
24
|
"""
|
24
25
|
|
25
|
-
storage =
|
26
|
+
storage = Storage.get_instance()
|
26
27
|
return storage.list_assets()
|
27
28
|
|
28
29
|
|
@@ -34,7 +35,7 @@ def delete_asset(name: str):
|
|
34
35
|
name: The name identifier of the asset to delete.
|
35
36
|
"""
|
36
37
|
|
37
|
-
storage =
|
38
|
+
storage = Storage.get_instance()
|
38
39
|
storage.delete_asset(name)
|
39
40
|
|
40
41
|
|
@@ -49,7 +50,7 @@ def get_bytes(name: str) -> bytes:
|
|
49
50
|
The raw byte content of the asset.
|
50
51
|
"""
|
51
52
|
|
52
|
-
storage =
|
53
|
+
storage = Storage.get_instance()
|
53
54
|
return storage.get_bytes(name)
|
54
55
|
|
55
56
|
|
@@ -65,7 +66,7 @@ def get_file(name: str, path: str) -> str:
|
|
65
66
|
The path to the saved file, confirming the operation's success.
|
66
67
|
"""
|
67
68
|
|
68
|
-
storage =
|
69
|
+
storage = Storage.get_instance()
|
69
70
|
return storage.get_file(name, path)
|
70
71
|
|
71
72
|
|
@@ -80,7 +81,7 @@ def get_json(name: str) -> JSON:
|
|
80
81
|
The parsed JSON data, which can be a dict, list, or primitive data type.
|
81
82
|
"""
|
82
83
|
|
83
|
-
storage =
|
84
|
+
storage = Storage.get_instance()
|
84
85
|
return storage.get_json(name)
|
85
86
|
|
86
87
|
|
@@ -95,7 +96,7 @@ def get_text(name: str) -> str:
|
|
95
96
|
The content of the asset as a text string.
|
96
97
|
"""
|
97
98
|
|
98
|
-
storage =
|
99
|
+
storage = Storage.get_instance()
|
99
100
|
return storage.get_text(name)
|
100
101
|
|
101
102
|
|
@@ -109,7 +110,7 @@ def set_bytes(name: str, data: bytes, content_type="application/octet-stream"):
|
|
109
110
|
content_type: The MIME type of the asset.
|
110
111
|
"""
|
111
112
|
|
112
|
-
storage =
|
113
|
+
storage = Storage.get_instance()
|
113
114
|
storage.set_bytes(name, data, content_type)
|
114
115
|
|
115
116
|
|
@@ -124,12 +125,12 @@ def set_file(name: str, path: str, content_type: str = None):
|
|
124
125
|
"""
|
125
126
|
|
126
127
|
content = Path(path).read_bytes()
|
127
|
-
if content_type
|
128
|
+
if not content_type:
|
128
129
|
content_type, _ = mimetypes.guess_type(path)
|
129
130
|
if content_type is None:
|
130
131
|
content_type = "application/octet-stream"
|
131
132
|
|
132
|
-
storage =
|
133
|
+
storage = Storage.get_instance()
|
133
134
|
storage.set_bytes(name, content, content_type)
|
134
135
|
|
135
136
|
|
@@ -146,7 +147,7 @@ def set_json(name: str, value: JSON, **kwargs):
|
|
146
147
|
content = json.dumps(value, **kwargs).encode("utf-8")
|
147
148
|
content_type = "application/json"
|
148
149
|
|
149
|
-
storage =
|
150
|
+
storage = Storage.get_instance()
|
150
151
|
storage.set_bytes(name, content, content_type)
|
151
152
|
|
152
153
|
|
@@ -162,11 +163,12 @@ def set_text(name: str, text: str):
|
|
162
163
|
content = text.encode("utf-8")
|
163
164
|
content_type = "text/plain"
|
164
165
|
|
165
|
-
storage =
|
166
|
+
storage = Storage.get_instance()
|
166
167
|
storage.set_bytes(name, content, content_type)
|
167
168
|
|
168
169
|
|
169
170
|
__all__ = [
|
171
|
+
"configure",
|
170
172
|
"list_assets",
|
171
173
|
"delete_asset",
|
172
174
|
"get_bytes",
|
automizor/storage/_storage.py
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import List
|
2
2
|
|
3
3
|
import requests
|
4
4
|
|
5
5
|
from automizor.exceptions import AutomizorError, NotFound
|
6
|
-
from automizor.utils import get_api_config, get_headers
|
7
|
-
|
8
|
-
JSON = Union[str, int, float, bool, None, Dict[str, "JSON"], List["JSON"]]
|
6
|
+
from automizor.utils import JSON, get_api_config, get_headers
|
9
7
|
|
10
8
|
|
11
9
|
class Storage:
|
@@ -50,11 +48,23 @@ class Storage:
|
|
50
48
|
text_data = storage.get_text("AssetName")
|
51
49
|
"""
|
52
50
|
|
53
|
-
|
54
|
-
|
51
|
+
_instance = None
|
52
|
+
|
53
|
+
@classmethod
|
54
|
+
def configure(cls, api_token: str | None = None):
|
55
|
+
cls._instance = cls(api_token)
|
56
|
+
|
57
|
+
def __init__(self, api_token: str | None = None):
|
58
|
+
self.url, self.token = get_api_config(api_token)
|
55
59
|
self.session = requests.Session()
|
56
60
|
self.session.headers.update(get_headers(self.token))
|
57
61
|
|
62
|
+
@classmethod
|
63
|
+
def get_instance(cls):
|
64
|
+
if cls._instance is None:
|
65
|
+
cls.configure()
|
66
|
+
return cls._instance
|
67
|
+
|
58
68
|
def list_assets(self) -> List[str]:
|
59
69
|
"""
|
60
70
|
Retrieves a list of all asset names.
|
automizor/utils/__init__.py
CHANGED
@@ -1,26 +1,29 @@
|
|
1
1
|
import os
|
2
2
|
import platform
|
3
|
+
from typing import Dict, List, Union
|
3
4
|
|
4
5
|
from automizor import version
|
5
6
|
from automizor.exceptions import AutomizorError
|
6
7
|
|
8
|
+
JSON = Union[str, int, float, bool, None, Dict[str, "JSON"], List["JSON"]]
|
9
|
+
|
10
|
+
|
7
11
|
OS_SYSTEM, OS_RELEASE, _ = platform.system_alias(
|
8
12
|
platform.system(), platform.release(), platform.version()
|
9
13
|
)
|
10
14
|
|
11
15
|
|
12
|
-
def get_api_config() -> tuple[str, str]:
|
13
|
-
|
16
|
+
def get_api_config(api_token: str | None = None) -> tuple[str, str]:
|
17
|
+
if api_token is None:
|
18
|
+
api_token = os.getenv("AUTOMIZOR_AGENT_TOKEN")
|
14
19
|
|
15
|
-
|
16
|
-
|
20
|
+
if not api_token:
|
21
|
+
raise AutomizorError("AUTOMIZOR_AGENT_TOKEN is not set.")
|
17
22
|
|
18
23
|
try:
|
19
|
-
token, url =
|
24
|
+
token, url = api_token.strip().split("@")
|
20
25
|
except ValueError as exc:
|
21
|
-
raise AutomizorError(
|
22
|
-
"AUTOMIZOR_AGENT_TOKEN is not in the correct format."
|
23
|
-
) from exc
|
26
|
+
raise AutomizorError("The API token is not in the correct format.") from exc
|
24
27
|
return url, token
|
25
28
|
|
26
29
|
|
automizor/vault/__init__.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
from functools import lru_cache
|
2
1
|
from typing import Any, Dict
|
3
2
|
|
4
3
|
from ._container import SecretContainer
|
4
|
+
from ._vault import Vault
|
5
5
|
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
def configure(api_token: str):
|
8
|
+
"""
|
9
|
+
Configures the Vault instance with the provided API token.
|
10
|
+
"""
|
11
|
+
Vault.configure(api_token)
|
12
12
|
|
13
13
|
|
14
14
|
def create_secret(
|
@@ -38,7 +38,7 @@ def create_secret(
|
|
38
38
|
value=value,
|
39
39
|
)
|
40
40
|
|
41
|
-
vault =
|
41
|
+
vault = Vault.get_instance()
|
42
42
|
return vault.create_secret(secret)
|
43
43
|
|
44
44
|
|
@@ -56,7 +56,7 @@ def get_secret(name: str) -> SecretContainer:
|
|
56
56
|
AutomizorVaultError: If retrieving the secret fails.
|
57
57
|
"""
|
58
58
|
|
59
|
-
vault =
|
59
|
+
vault = Vault.get_instance()
|
60
60
|
return vault.get_secret(name)
|
61
61
|
|
62
62
|
|
@@ -74,12 +74,13 @@ def set_secret(secret: SecretContainer) -> SecretContainer:
|
|
74
74
|
AutomizorVaultError: If updating the secret fails.
|
75
75
|
"""
|
76
76
|
|
77
|
-
vault =
|
77
|
+
vault = Vault.get_instance()
|
78
78
|
return vault.set_secret(secret)
|
79
79
|
|
80
80
|
|
81
81
|
__all__ = [
|
82
82
|
"SecretContainer",
|
83
|
+
"configure",
|
83
84
|
"create_secret",
|
84
85
|
"get_secret",
|
85
86
|
"set_secret",
|
automizor/vault/_vault.py
CHANGED
@@ -42,11 +42,23 @@ class Vault:
|
|
42
42
|
vault.set_secret(secret)
|
43
43
|
"""
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
_instance = None
|
46
|
+
|
47
|
+
@classmethod
|
48
|
+
def configure(cls, api_token: str | None = None):
|
49
|
+
cls._instance = cls(api_token)
|
50
|
+
|
51
|
+
def __init__(self, api_token: str | None = None):
|
52
|
+
self.url, self.token = get_api_config(api_token)
|
47
53
|
self.session = requests.Session()
|
48
54
|
self.session.headers.update(get_headers(self.token))
|
49
55
|
|
56
|
+
@classmethod
|
57
|
+
def get_instance(cls):
|
58
|
+
if cls._instance is None:
|
59
|
+
cls.configure()
|
60
|
+
return cls._instance
|
61
|
+
|
50
62
|
def create_secret(self, secret: SecretContainer) -> SecretContainer:
|
51
63
|
"""
|
52
64
|
Creates a new secret. Stores the secret in the `Automizor API`.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
automizor/__init__.py,sha256=U86LejrmMsdC6N-YT7_w8TPLE0rJkGNw9YkhBt378b8,18
|
2
|
+
automizor/exceptions.py,sha256=P5imySIOtG3ZIk2kh41Yod4RnlgTj7Vf0P3M-RuxQJs,1382
|
3
|
+
automizor/datastore/__init__.py,sha256=_rAdRfKnTa4SuSLl9GkAYziBPPLsy6yGfS0HprgokOk,2418
|
4
|
+
automizor/datastore/_container.py,sha256=rHRkSWaRgy2rk6Qy-7ADFKvuET_COZ2i9VD7gvRDnlM,745
|
5
|
+
automizor/datastore/_datastore.py,sha256=WzWDxQ0ecSca7VEdjyKAtFxe2Ix0xnatjbKpgKmDzyc,3536
|
6
|
+
automizor/job/__init__.py,sha256=pDqSfR4lAyJNCi-fpG6byUPidHz8sntBs0bB2lJFVAY,1118
|
7
|
+
automizor/job/_job.py,sha256=6U1Sd7aZLyoQW8wFkQMUr4HLEgljACe_sP2BTMSoyMU,5436
|
8
|
+
automizor/log/__init__.py,sha256=gEr2SuwN1FgX1NMnbphjg8_gfSic9L15H3WC868A-TQ,2104
|
9
|
+
automizor/log/_log.py,sha256=P9jAFXVANs5bAGH6-S0pzuSbRKEcX8VlQ_3uu690awE,2948
|
10
|
+
automizor/storage/__init__.py,sha256=RF4ccSAd0UepvJx5NFiotKt9mVr5WiZCb_4qrJ5OKx0,4140
|
11
|
+
automizor/storage/_storage.py,sha256=85LFN5Ed5ovvQgyFDmPL7RHaQUYjSTCn3-5nnkuTytA,11214
|
12
|
+
automizor/utils/__init__.py,sha256=W0JNrn7GByjJXi60djS6vluo__Tj6AyJioqu9D41tto,952
|
13
|
+
automizor/vault/__init__.py,sha256=21Ag2zQk7x27Bh0yt_kSO2MkgT3eafbdlKe0NuQEqr8,1796
|
14
|
+
automizor/vault/_container.py,sha256=-2y7kASigoIVAebuQBk-0R_sI4gfmvjsMLuMg_tR1xA,1945
|
15
|
+
automizor/vault/_vault.py,sha256=xyTaHbHEh4mMPmVuXHmPOSYvPm8h6QplrWeM1JUGLjk,4996
|
16
|
+
automizor-0.4.8.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
17
|
+
automizor-0.4.8.dist-info/METADATA,sha256=OIDwp9YdYFKFcUM5JJnvPaTJ_vDMC1hbeVwW3CMDfCI,668
|
18
|
+
automizor-0.4.8.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
19
|
+
automizor-0.4.8.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
|
20
|
+
automizor-0.4.8.dist-info/RECORD,,
|
automizor-0.4.6.dist-info/RECORD
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
automizor/__init__.py,sha256=DWNNbWBv-hyqVy76bKbnHWaDUbqL0BOtdkPSV_88dx0,18
|
2
|
-
automizor/exceptions.py,sha256=P5imySIOtG3ZIk2kh41Yod4RnlgTj7Vf0P3M-RuxQJs,1382
|
3
|
-
automizor/datastore/__init__.py,sha256=lOCAgf-976kgD1bo7rBi43Ahh9NK8TahOktTfHi0DBA,3016
|
4
|
-
automizor/datastore/_datastore.py,sha256=f2SAmsn5HWMYN_WGar6q0PioIfEJQdWbGC-REKFI5Cw,3371
|
5
|
-
automizor/job/__init__.py,sha256=DNRuT6cyPQBaPRG4vNalCmEvcJQl-73b5ZDFOfNOwIg,1019
|
6
|
-
automizor/job/_job.py,sha256=_-ehqPwJdY89mWm3_VAuh7KRJdv-8iUu6iMAzwGLHM0,5235
|
7
|
-
automizor/log/__init__.py,sha256=gEr2SuwN1FgX1NMnbphjg8_gfSic9L15H3WC868A-TQ,2104
|
8
|
-
automizor/log/_log.py,sha256=P9jAFXVANs5bAGH6-S0pzuSbRKEcX8VlQ_3uu690awE,2948
|
9
|
-
automizor/storage/__init__.py,sha256=bEY2R0Vk0cqscKYNnX-MM222XrxbLXOvOSBDgFmVPLo,3984
|
10
|
-
automizor/storage/_storage.py,sha256=DXcARkFZ3edoDRrDiR02zkO7LmGkRtcKTHmgPsal0lc,10989
|
11
|
-
automizor/utils/__init__.py,sha256=2trRoR5lljYKbYdxmioSlvzajjQM0Wnoq3bvF9lEZ6w,811
|
12
|
-
automizor/vault/__init__.py,sha256=UjRiW3J0R9ABXc1gXIPyS3cqNCwMWxx0l-C0PsIg7R0,1699
|
13
|
-
automizor/vault/_container.py,sha256=-2y7kASigoIVAebuQBk-0R_sI4gfmvjsMLuMg_tR1xA,1945
|
14
|
-
automizor/vault/_vault.py,sha256=uRsjOjzsstZpYwJoHNg_cpv803Dzo4T2oF6hwiG3Eww,4688
|
15
|
-
automizor-0.4.6.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
16
|
-
automizor-0.4.6.dist-info/METADATA,sha256=7njCCq1Bqgh7kwvoBAr-cdwr-vdNUxjPPS-DfvAWKMs,668
|
17
|
-
automizor-0.4.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
18
|
-
automizor-0.4.6.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
|
19
|
-
automizor-0.4.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|