outerbounds 0.3.166__py3-none-any.whl → 0.3.168__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.
- outerbounds/command_groups/cli.py +2 -0
- outerbounds/command_groups/secrets_cli.py +111 -0
- {outerbounds-0.3.166.dist-info → outerbounds-0.3.168.dist-info}/METADATA +4 -4
- {outerbounds-0.3.166.dist-info → outerbounds-0.3.168.dist-info}/RECORD +6 -5
- {outerbounds-0.3.166.dist-info → outerbounds-0.3.168.dist-info}/WHEEL +0 -0
- {outerbounds-0.3.166.dist-info → outerbounds-0.3.168.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
import json
|
2
|
+
import os
|
3
|
+
from os import path
|
4
|
+
from typing import Any, Dict
|
5
|
+
from outerbounds._vendor import click
|
6
|
+
from collections import OrderedDict
|
7
|
+
from ..utils.utils import safe_write_to_disk
|
8
|
+
|
9
|
+
|
10
|
+
def _get_ob_provider():
|
11
|
+
from metaflow.plugins import SECRETS_PROVIDERS
|
12
|
+
|
13
|
+
ob_provider = [i for i in SECRETS_PROVIDERS if i.TYPE == "outerbounds"][0]
|
14
|
+
return ob_provider()
|
15
|
+
|
16
|
+
|
17
|
+
class SecretOutput:
|
18
|
+
def __init__(self, type):
|
19
|
+
self.type = type
|
20
|
+
self._secrets = OrderedDict()
|
21
|
+
|
22
|
+
def consume(self, secret_id, secret_dict):
|
23
|
+
self._secrets[secret_id] = secret_dict
|
24
|
+
|
25
|
+
def parse(self):
|
26
|
+
if self.type == "text":
|
27
|
+
return "\n".join(
|
28
|
+
[
|
29
|
+
f"{k}={v}"
|
30
|
+
for _, secret in self._secrets.items()
|
31
|
+
for k, v in secret.items()
|
32
|
+
]
|
33
|
+
)
|
34
|
+
elif self.type == "json":
|
35
|
+
return json.dumps(self._secrets)
|
36
|
+
|
37
|
+
|
38
|
+
@click.group()
|
39
|
+
def cli(**kwargs):
|
40
|
+
pass
|
41
|
+
|
42
|
+
|
43
|
+
@click.group(help="Manage secrets")
|
44
|
+
def secrets(**kwargs):
|
45
|
+
pass
|
46
|
+
|
47
|
+
|
48
|
+
FORMAT_HELP = """
|
49
|
+
Format of the output. When you specify:
|
50
|
+
- `text`: The output will be in `key=value` format. Each key-value pair in each secret will in a new line.
|
51
|
+
- `json`: The output will be in JSON format. The secrets will be in a dictionary with the structure `{<secret-id>: {<key>: <value>, ...}, ...}`.
|
52
|
+
"""
|
53
|
+
|
54
|
+
|
55
|
+
@secrets.command(
|
56
|
+
help="Get secrets. The `secret_ids` correspond to the name of the integrations configured on the Outerbounds platform."
|
57
|
+
)
|
58
|
+
# command should be like :
|
59
|
+
# `outerbounds secrets get <secret-id-0> <secret-id-1> ... --output [text|json] --config-dir <config-dir> --profile <profile> --role <role> --output-file <output-file>`
|
60
|
+
@click.argument("secret_ids", type=str, nargs=-1)
|
61
|
+
@click.option(
|
62
|
+
"--format",
|
63
|
+
type=click.Choice(["text", "json", "shell"]),
|
64
|
+
default="text",
|
65
|
+
help=FORMAT_HELP,
|
66
|
+
)
|
67
|
+
@click.option(
|
68
|
+
"--profile",
|
69
|
+
type=str,
|
70
|
+
default=None,
|
71
|
+
help="The named metaflow profile to use.",
|
72
|
+
)
|
73
|
+
@click.option(
|
74
|
+
"--role",
|
75
|
+
type=str,
|
76
|
+
default=None,
|
77
|
+
help="Any additional IAM role required to access the secrets.",
|
78
|
+
)
|
79
|
+
@click.option(
|
80
|
+
"--file",
|
81
|
+
"-f",
|
82
|
+
"output_file",
|
83
|
+
type=str,
|
84
|
+
default=None,
|
85
|
+
help="The file to write the output to. If not specified, the output will be printed to standard out.",
|
86
|
+
)
|
87
|
+
def get(
|
88
|
+
secret_ids,
|
89
|
+
format,
|
90
|
+
profile,
|
91
|
+
role,
|
92
|
+
output_file,
|
93
|
+
):
|
94
|
+
|
95
|
+
if profile != "" and profile is not None:
|
96
|
+
os.environ["METAFLOW_PROFILE"] = profile
|
97
|
+
|
98
|
+
provider = _get_ob_provider()
|
99
|
+
output = SecretOutput(format)
|
100
|
+
for secret_id in secret_ids:
|
101
|
+
secret = provider.get_secret_as_dict(secret_id, role=role)
|
102
|
+
output.consume(secret_id, secret)
|
103
|
+
output_str = output.parse()
|
104
|
+
if output_file:
|
105
|
+
output_file = os.path.abspath(output_file)
|
106
|
+
safe_write_to_disk(output_file, output_str)
|
107
|
+
else:
|
108
|
+
print(output_str)
|
109
|
+
|
110
|
+
|
111
|
+
cli.add_command(secrets, name="secrets")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: outerbounds
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.168
|
4
4
|
Summary: More Data Science, Less Administration
|
5
5
|
License: Proprietary
|
6
6
|
Keywords: data science,machine learning,MLOps
|
@@ -28,9 +28,9 @@ Requires-Dist: google-auth (>=2.27.0,<3.0.0) ; extra == "gcp"
|
|
28
28
|
Requires-Dist: google-cloud-secret-manager (>=2.20.0,<3.0.0) ; extra == "gcp"
|
29
29
|
Requires-Dist: google-cloud-storage (>=2.14.0,<3.0.0) ; extra == "gcp"
|
30
30
|
Requires-Dist: metaflow-checkpoint (==0.2.1)
|
31
|
-
Requires-Dist: ob-metaflow (==2.15.
|
32
|
-
Requires-Dist: ob-metaflow-extensions (==1.1.
|
33
|
-
Requires-Dist: ob-metaflow-stubs (==6.0.3.
|
31
|
+
Requires-Dist: ob-metaflow (==2.15.13.1)
|
32
|
+
Requires-Dist: ob-metaflow-extensions (==1.1.155)
|
33
|
+
Requires-Dist: ob-metaflow-stubs (==6.0.3.168)
|
34
34
|
Requires-Dist: opentelemetry-distro (>=0.41b0) ; extra == "otel"
|
35
35
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.20.0) ; extra == "otel"
|
36
36
|
Requires-Dist: opentelemetry-instrumentation-requests (>=0.41b0) ; extra == "otel"
|
@@ -42,10 +42,11 @@ outerbounds/_vendor/yaml/tokens.py,sha256=JBSu38wihGr4l73JwbfMA7Ks1-X84g8-NskTz7
|
|
42
42
|
outerbounds/cli_main.py,sha256=e9UMnPysmc7gbrimq2I4KfltggyU7pw59Cn9aEguVcU,74
|
43
43
|
outerbounds/command_groups/__init__.py,sha256=QPWtj5wDRTINDxVUL7XPqG3HoxHNvYOg08EnuSZB2Hc,21
|
44
44
|
outerbounds/command_groups/apps_cli.py,sha256=v9OlQ1b4BGB-cBZiHB6W5gDocDoMmrQ7zdK11QiJ-B8,20847
|
45
|
-
outerbounds/command_groups/cli.py,sha256=
|
45
|
+
outerbounds/command_groups/cli.py,sha256=de4_QY1UeoKX6y-IXIbmklAi6bz0DsdBSmAoCg6lq1o,482
|
46
46
|
outerbounds/command_groups/fast_bakery_cli.py,sha256=5kja7v6C651XAY6dsP_IkBPJQgfU4hA4S9yTOiVPhW0,6213
|
47
47
|
outerbounds/command_groups/local_setup_cli.py,sha256=tuuqJRXQ_guEwOuQSIf9wkUU0yg8yAs31myGViAK15s,36364
|
48
48
|
outerbounds/command_groups/perimeters_cli.py,sha256=iF_Uw7ROiSctf6FgoJEy30iDBLVE1j9FKuR3shgJRmc,19050
|
49
|
+
outerbounds/command_groups/secrets_cli.py,sha256=Vgn_aiTo76a0s5hCJhNWEOrCVhyYeivD08ooQxz0y7c,2952
|
49
50
|
outerbounds/command_groups/tutorials_cli.py,sha256=UInFyiMqtscHFfi8YQwiY_6Sdw9quJOtRu5OukEBccw,3522
|
50
51
|
outerbounds/command_groups/workstations_cli.py,sha256=V5Jbj1cVb4IRllI7fOgNgL6OekRpuFDv6CEhDb4xC6w,22016
|
51
52
|
outerbounds/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -54,7 +55,7 @@ outerbounds/utils/metaflowconfig.py,sha256=l2vJbgPkLISU-XPGZFaC8ZKmYFyJemlD6bwB-
|
|
54
55
|
outerbounds/utils/schema.py,sha256=lMUr9kNgn9wy-sO_t_Tlxmbt63yLeN4b0xQXbDUDj4A,2331
|
55
56
|
outerbounds/utils/utils.py,sha256=4Z8cszNob_8kDYCLNTrP-wWads_S_MdL3Uj3ju4mEsk,501
|
56
57
|
outerbounds/vendor.py,sha256=gRLRJNXtZBeUpPEog0LOeIsl6GosaFFbCxUvR4bW6IQ,5093
|
57
|
-
outerbounds-0.3.
|
58
|
-
outerbounds-0.3.
|
59
|
-
outerbounds-0.3.
|
60
|
-
outerbounds-0.3.
|
58
|
+
outerbounds-0.3.168.dist-info/METADATA,sha256=QATl9NjzmuLt7w2v-ZrYHpeX3zxfJLf0a90oNUortzM,1837
|
59
|
+
outerbounds-0.3.168.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
60
|
+
outerbounds-0.3.168.dist-info/entry_points.txt,sha256=7ye0281PKlvqxu15rjw60zKg2pMsXI49_A8BmGqIqBw,47
|
61
|
+
outerbounds-0.3.168.dist-info/RECORD,,
|
File without changes
|
File without changes
|