pulumi-thoth 0.1.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 (37) hide show
  1. pulumi_thoth-0.1.0/PKG-INFO +25 -0
  2. pulumi_thoth-0.1.0/pulumi_thoth/__init__.py +133 -0
  3. pulumi_thoth-0.1.0/pulumi_thoth/_utilities.py +328 -0
  4. pulumi_thoth-0.1.0/pulumi_thoth/access/__init__.py +10 -0
  5. pulumi_thoth-0.1.0/pulumi_thoth/access/api_key.py +616 -0
  6. pulumi_thoth-0.1.0/pulumi_thoth/access/get_api_key_metrics.py +125 -0
  7. pulumi_thoth-0.1.0/pulumi_thoth/browser/__init__.py +11 -0
  8. pulumi_thoth-0.1.0/pulumi_thoth/browser/enrollment.py +569 -0
  9. pulumi_thoth-0.1.0/pulumi_thoth/browser/policy.py +691 -0
  10. pulumi_thoth-0.1.0/pulumi_thoth/browser/provider.py +475 -0
  11. pulumi_thoth-0.1.0/pulumi_thoth/config/__init__.py +9 -0
  12. pulumi_thoth-0.1.0/pulumi_thoth/config/__init__.pyi +66 -0
  13. pulumi_thoth-0.1.0/pulumi_thoth/config/vars.py +92 -0
  14. pulumi_thoth-0.1.0/pulumi_thoth/governance/__init__.py +16 -0
  15. pulumi_thoth-0.1.0/pulumi_thoth/governance/approval_decision.py +314 -0
  16. pulumi_thoth-0.1.0/pulumi_thoth/governance/get_feed.py +272 -0
  17. pulumi_thoth-0.1.0/pulumi_thoth/governance/get_tenant_settings.py +147 -0
  18. pulumi_thoth-0.1.0/pulumi_thoth/governance/get_tools.py +122 -0
  19. pulumi_thoth-0.1.0/pulumi_thoth/governance/pack_assignment.py +539 -0
  20. pulumi_thoth-0.1.0/pulumi_thoth/governance/policy_sync.py +602 -0
  21. pulumi_thoth-0.1.0/pulumi_thoth/governance/tenant_settings.py +1809 -0
  22. pulumi_thoth-0.1.0/pulumi_thoth/governance/webhook_test.py +293 -0
  23. pulumi_thoth-0.1.0/pulumi_thoth/mdm/__init__.py +11 -0
  24. pulumi_thoth-0.1.0/pulumi_thoth/mdm/get_sync_job.py +195 -0
  25. pulumi_thoth-0.1.0/pulumi_thoth/mdm/provider.py +549 -0
  26. pulumi_thoth-0.1.0/pulumi_thoth/mdm/sync.py +594 -0
  27. pulumi_thoth-0.1.0/pulumi_thoth/provider.py +350 -0
  28. pulumi_thoth-0.1.0/pulumi_thoth/pulumi-plugin.json +4 -0
  29. pulumi_thoth-0.1.0/pulumi_thoth/py.typed +0 -0
  30. pulumi_thoth-0.1.0/pulumi_thoth.egg-info/PKG-INFO +25 -0
  31. pulumi_thoth-0.1.0/pulumi_thoth.egg-info/SOURCES.txt +35 -0
  32. pulumi_thoth-0.1.0/pulumi_thoth.egg-info/dependency_links.txt +1 -0
  33. pulumi_thoth-0.1.0/pulumi_thoth.egg-info/not-zip-safe +1 -0
  34. pulumi_thoth-0.1.0/pulumi_thoth.egg-info/requires.txt +6 -0
  35. pulumi_thoth-0.1.0/pulumi_thoth.egg-info/top_level.txt +1 -0
  36. pulumi_thoth-0.1.0/setup.cfg +4 -0
  37. pulumi_thoth-0.1.0/setup.py +46 -0
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.4
2
+ Name: pulumi_thoth
3
+ Version: 0.1.0
4
+ Summary: Pulumi provider for Aten Security Thoth AI governance control plane.
5
+ Home-page: https://atensecurity.com
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/atensecurity/pulumi-thoth
8
+ Keywords: pulumi thoth atensecurity governance ai
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: parver>=0.2.1
12
+ Requires-Dist: pulumi<4.0.0,>=3.0.0
13
+ Requires-Dist: semver>=2.8.1
14
+ Requires-Dist: typing-extensions<5,>=4.11; python_version < "3.11"
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: home-page
18
+ Dynamic: keywords
19
+ Dynamic: license
20
+ Dynamic: project-url
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ thoth Pulumi Package - Development Version
@@ -0,0 +1,133 @@
1
+ # coding=utf-8
2
+ # *** WARNING: this file was generated by pulumi-language-python. ***
3
+ # *** Do not edit by hand unless you're certain you know what you are doing! ***
4
+
5
+ import builtins as _builtins
6
+ from . import _utilities
7
+ import typing
8
+ # Export this package's modules as members:
9
+ from .provider import *
10
+
11
+ # Make subpackages available:
12
+ if typing.TYPE_CHECKING:
13
+ import pulumi_thoth.access as __access
14
+ access = __access
15
+ import pulumi_thoth.browser as __browser
16
+ browser = __browser
17
+ import pulumi_thoth.config as __config
18
+ config = __config
19
+ import pulumi_thoth.governance as __governance
20
+ governance = __governance
21
+ import pulumi_thoth.mdm as __mdm
22
+ mdm = __mdm
23
+ else:
24
+ access = _utilities.lazy_import('pulumi_thoth.access')
25
+ browser = _utilities.lazy_import('pulumi_thoth.browser')
26
+ config = _utilities.lazy_import('pulumi_thoth.config')
27
+ governance = _utilities.lazy_import('pulumi_thoth.governance')
28
+ mdm = _utilities.lazy_import('pulumi_thoth.mdm')
29
+
30
+ _utilities.register(
31
+ resource_modules="""
32
+ [
33
+ {
34
+ "pkg": "thoth",
35
+ "mod": "access/apiKey",
36
+ "fqn": "pulumi_thoth.access",
37
+ "classes": {
38
+ "thoth:access/apiKey:ApiKey": "ApiKey"
39
+ }
40
+ },
41
+ {
42
+ "pkg": "thoth",
43
+ "mod": "browser/enrollment",
44
+ "fqn": "pulumi_thoth.browser",
45
+ "classes": {
46
+ "thoth:browser/enrollment:Enrollment": "Enrollment"
47
+ }
48
+ },
49
+ {
50
+ "pkg": "thoth",
51
+ "mod": "browser/policy",
52
+ "fqn": "pulumi_thoth.browser",
53
+ "classes": {
54
+ "thoth:browser/policy:Policy": "Policy"
55
+ }
56
+ },
57
+ {
58
+ "pkg": "thoth",
59
+ "mod": "browser/provider",
60
+ "fqn": "pulumi_thoth.browser",
61
+ "classes": {
62
+ "thoth:browser/provider:Provider": "Provider"
63
+ }
64
+ },
65
+ {
66
+ "pkg": "thoth",
67
+ "mod": "governance/approvalDecision",
68
+ "fqn": "pulumi_thoth.governance",
69
+ "classes": {
70
+ "thoth:governance/approvalDecision:ApprovalDecision": "ApprovalDecision"
71
+ }
72
+ },
73
+ {
74
+ "pkg": "thoth",
75
+ "mod": "governance/packAssignment",
76
+ "fqn": "pulumi_thoth.governance",
77
+ "classes": {
78
+ "thoth:governance/packAssignment:PackAssignment": "PackAssignment"
79
+ }
80
+ },
81
+ {
82
+ "pkg": "thoth",
83
+ "mod": "governance/policySync",
84
+ "fqn": "pulumi_thoth.governance",
85
+ "classes": {
86
+ "thoth:governance/policySync:PolicySync": "PolicySync"
87
+ }
88
+ },
89
+ {
90
+ "pkg": "thoth",
91
+ "mod": "governance/tenantSettings",
92
+ "fqn": "pulumi_thoth.governance",
93
+ "classes": {
94
+ "thoth:governance/tenantSettings:TenantSettings": "TenantSettings"
95
+ }
96
+ },
97
+ {
98
+ "pkg": "thoth",
99
+ "mod": "governance/webhookTest",
100
+ "fqn": "pulumi_thoth.governance",
101
+ "classes": {
102
+ "thoth:governance/webhookTest:WebhookTest": "WebhookTest"
103
+ }
104
+ },
105
+ {
106
+ "pkg": "thoth",
107
+ "mod": "mdm/provider",
108
+ "fqn": "pulumi_thoth.mdm",
109
+ "classes": {
110
+ "thoth:mdm/provider:Provider": "Provider"
111
+ }
112
+ },
113
+ {
114
+ "pkg": "thoth",
115
+ "mod": "mdm/sync",
116
+ "fqn": "pulumi_thoth.mdm",
117
+ "classes": {
118
+ "thoth:mdm/sync:Sync": "Sync"
119
+ }
120
+ }
121
+ ]
122
+ """,
123
+ resource_packages="""
124
+ [
125
+ {
126
+ "pkg": "thoth",
127
+ "token": "pulumi:providers:thoth",
128
+ "fqn": "pulumi_thoth",
129
+ "class": "Provider"
130
+ }
131
+ ]
132
+ """
133
+ )
@@ -0,0 +1,328 @@
1
+ # coding=utf-8
2
+ # *** WARNING: this file was generated by pulumi-language-python. ***
3
+ # *** Do not edit by hand unless you're certain you know what you are doing! ***
4
+
5
+
6
+ import asyncio
7
+ import functools
8
+ import importlib.metadata
9
+ import importlib.util
10
+ import inspect
11
+ import json
12
+ import os
13
+ import sys
14
+ import typing
15
+ import warnings
16
+ import base64
17
+
18
+ import pulumi
19
+ import pulumi.runtime
20
+ from pulumi.runtime.sync_await import _sync_await
21
+ from pulumi.runtime.proto import resource_pb2
22
+
23
+ from semver import VersionInfo as SemverVersion
24
+ from parver import Version as PEP440Version
25
+
26
+ C = typing.TypeVar("C", bound=typing.Callable)
27
+
28
+
29
+ def get_env(*args):
30
+ for v in args:
31
+ value = os.getenv(v)
32
+ if value is not None:
33
+ return value
34
+ return None
35
+
36
+
37
+ def get_env_bool(*args):
38
+ str = get_env(*args)
39
+ if str is not None:
40
+ # NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
41
+ # Terraform uses internally when parsing boolean values.
42
+ if str in ["1", "t", "T", "true", "TRUE", "True"]:
43
+ return True
44
+ if str in ["0", "f", "F", "false", "FALSE", "False"]:
45
+ return False
46
+ return None
47
+
48
+
49
+ def get_env_int(*args):
50
+ str = get_env(*args)
51
+ if str is not None:
52
+ try:
53
+ return int(str)
54
+ except:
55
+ return None
56
+ return None
57
+
58
+
59
+ def get_env_float(*args):
60
+ str = get_env(*args)
61
+ if str is not None:
62
+ try:
63
+ return float(str)
64
+ except:
65
+ return None
66
+ return None
67
+
68
+
69
+ def _get_semver_version():
70
+ # __name__ is set to the fully-qualified name of the current module, In our case, it will be
71
+ # <some module>._utilities. <some module> is the module we want to query the version for.
72
+ root_package, *rest = __name__.split('.')
73
+
74
+ # Unfortunately, PEP440 and semver differ slightly in incompatible ways. The Pulumi engine expects
75
+ # to receive a valid semver string when receiving requests from the language host, so it's our
76
+ # responsibility as the library to convert our own PEP440 version into a valid semver string.
77
+
78
+ pep440_version_string = importlib.metadata.version(root_package)
79
+ pep440_version = PEP440Version.parse(pep440_version_string)
80
+ (major, minor, patch) = pep440_version.release
81
+ prerelease = None
82
+ if pep440_version.pre_tag == 'a':
83
+ prerelease = f"alpha.{pep440_version.pre}"
84
+ elif pep440_version.pre_tag == 'b':
85
+ prerelease = f"beta.{pep440_version.pre}"
86
+ elif pep440_version.pre_tag == 'rc':
87
+ prerelease = f"rc.{pep440_version.pre}"
88
+ elif pep440_version.dev is not None:
89
+ # PEP440 has explicit support for dev builds, while semver encodes them as "prerelease" versions. To bridge
90
+ # between the two, we convert our dev build version into a prerelease tag. This matches what all of our other
91
+ # packages do when constructing their own semver string.
92
+ prerelease = f"dev.{pep440_version.dev}"
93
+ elif pep440_version.local is not None:
94
+ # PEP440 only allows a small set of prerelease tags, so when converting an arbitrary prerelease,
95
+ # PypiVersion in /pkg/codegen/python/utilities.go converts it to a local version. Therefore, we need to
96
+ # do the reverse conversion here and set the local version as the prerelease tag.
97
+ prerelease = pep440_version.local
98
+
99
+ return SemverVersion(major=major, minor=minor, patch=patch, prerelease=prerelease)
100
+
101
+
102
+ # Determine the version once and cache the value, which measurably improves program performance.
103
+ _version = _get_semver_version()
104
+ _version_str = str(_version)
105
+
106
+ def get_resource_opts_defaults() -> pulumi.ResourceOptions:
107
+ return pulumi.ResourceOptions(
108
+ version=get_version(),
109
+ plugin_download_url=get_plugin_download_url(),
110
+ )
111
+
112
+ def get_invoke_opts_defaults() -> pulumi.InvokeOptions:
113
+ return pulumi.InvokeOptions(
114
+ version=get_version(),
115
+ plugin_download_url=get_plugin_download_url(),
116
+ )
117
+
118
+ def get_resource_args_opts(resource_args_type, resource_options_type, *args, **kwargs):
119
+ """
120
+ Return the resource args and options given the *args and **kwargs of a resource's
121
+ __init__ method.
122
+ """
123
+
124
+ resource_args, opts = None, None
125
+
126
+ # If the first item is the resource args type, save it and remove it from the args list.
127
+ if args and isinstance(args[0], resource_args_type):
128
+ resource_args, args = args[0], args[1:]
129
+
130
+ # Now look at the first item in the args list again.
131
+ # If the first item is the resource options class, save it.
132
+ if args and isinstance(args[0], resource_options_type):
133
+ opts = args[0]
134
+
135
+ # If resource_args is None, see if "args" is in kwargs, and, if so, if it's typed as the
136
+ # the resource args type.
137
+ if resource_args is None:
138
+ a = kwargs.get("args")
139
+ if isinstance(a, resource_args_type):
140
+ resource_args = a
141
+
142
+ # If opts is None, look it up in kwargs.
143
+ if opts is None:
144
+ opts = kwargs.get("opts")
145
+
146
+ return resource_args, opts
147
+
148
+
149
+ # Temporary: just use pulumi._utils.lazy_import once everyone upgrades.
150
+ def lazy_import(fullname):
151
+
152
+ import pulumi._utils as u
153
+ f = getattr(u, 'lazy_import', None)
154
+ if f is None:
155
+ f = _lazy_import_temp
156
+
157
+ return f(fullname)
158
+
159
+
160
+ # Copied from pulumi._utils.lazy_import, see comments there.
161
+ def _lazy_import_temp(fullname):
162
+ m = sys.modules.get(fullname, None)
163
+ if m is not None:
164
+ return m
165
+
166
+ spec = importlib.util.find_spec(fullname)
167
+
168
+ m = sys.modules.get(fullname, None)
169
+ if m is not None:
170
+ return m
171
+
172
+ loader = importlib.util.LazyLoader(spec.loader)
173
+ spec.loader = loader
174
+ module = importlib.util.module_from_spec(spec)
175
+
176
+ m = sys.modules.get(fullname, None)
177
+ if m is not None:
178
+ return m
179
+
180
+ sys.modules[fullname] = module
181
+ loader.exec_module(module)
182
+ return module
183
+
184
+
185
+ class Package(pulumi.runtime.ResourcePackage):
186
+ def __init__(self, pkg_info):
187
+ super().__init__()
188
+ self.pkg_info = pkg_info
189
+
190
+ def version(self):
191
+ return _version
192
+
193
+ def construct_provider(self, name: str, typ: str, urn: str) -> pulumi.ProviderResource:
194
+ if typ != self.pkg_info['token']:
195
+ raise Exception(f"unknown provider type {typ}")
196
+ Provider = getattr(lazy_import(self.pkg_info['fqn']), self.pkg_info['class'])
197
+ return Provider(name, pulumi.ResourceOptions(urn=urn))
198
+
199
+
200
+ class Module(pulumi.runtime.ResourceModule):
201
+ def __init__(self, mod_info):
202
+ super().__init__()
203
+ self.mod_info = mod_info
204
+
205
+ def version(self):
206
+ return _version
207
+
208
+ def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource:
209
+ class_name = self.mod_info['classes'].get(typ, None)
210
+
211
+ if class_name is None:
212
+ raise Exception(f"unknown resource type {typ}")
213
+
214
+ TheClass = getattr(lazy_import(self.mod_info['fqn']), class_name)
215
+ return TheClass(name, pulumi.ResourceOptions(urn=urn))
216
+
217
+
218
+ def register(resource_modules, resource_packages):
219
+ resource_modules = json.loads(resource_modules)
220
+ resource_packages = json.loads(resource_packages)
221
+
222
+ for pkg_info in resource_packages:
223
+ pulumi.runtime.register_resource_package(pkg_info['pkg'], Package(pkg_info))
224
+
225
+ for mod_info in resource_modules:
226
+ pulumi.runtime.register_resource_module(
227
+ mod_info['pkg'],
228
+ mod_info['mod'],
229
+ Module(mod_info))
230
+
231
+
232
+ _F = typing.TypeVar('_F', bound=typing.Callable[..., typing.Any])
233
+
234
+
235
+ def lift_output_func(func: typing.Any) -> typing.Callable[[_F], _F]:
236
+ """Decorator internally used on {fn}_output lifted function versions
237
+ to implement them automatically from the un-lifted function."""
238
+
239
+ func_sig = inspect.signature(func)
240
+
241
+ def lifted_func(*args, opts=None, **kwargs):
242
+ bound_args = func_sig.bind(*args, **kwargs)
243
+ # Convert tuple to list, see pulumi/pulumi#8172
244
+ args_list = list(bound_args.args)
245
+ return pulumi.Output.from_input({
246
+ 'args': args_list,
247
+ 'kwargs': bound_args.kwargs
248
+ }).apply(lambda resolved_args: func(*resolved_args['args'],
249
+ opts=opts,
250
+ **resolved_args['kwargs']))
251
+
252
+ return (lambda _: lifted_func)
253
+
254
+
255
+ def call_plain(
256
+ tok: str,
257
+ props: pulumi.Inputs,
258
+ res: typing.Optional[pulumi.Resource] = None,
259
+ typ: typing.Optional[type] = None,
260
+ ) -> typing.Any:
261
+ """
262
+ Wraps pulumi.runtime.plain to force the output and return it plainly.
263
+ """
264
+
265
+ output = pulumi.runtime.call(tok, props, res, typ)
266
+
267
+ # Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency.
268
+ result, known, secret, _ = _sync_await(asyncio.create_task(_await_output(output)))
269
+
270
+ problem = None
271
+ if not known:
272
+ problem = ' an unknown value'
273
+ elif secret:
274
+ problem = ' a secret value'
275
+
276
+ if problem:
277
+ raise AssertionError(
278
+ f"Plain resource method '{tok}' incorrectly returned {problem}. "
279
+ + "This is an error in the provider, please report this to the provider developer."
280
+ )
281
+
282
+ return result
283
+
284
+
285
+ async def _await_output(o: pulumi.Output[typing.Any]) -> typing.Tuple[object, bool, bool, set]:
286
+ return (
287
+ await o._future,
288
+ await o._is_known,
289
+ await o._is_secret,
290
+ await o._resources,
291
+ )
292
+
293
+
294
+ # This is included to provide an upgrade path for users who are using a version
295
+ # of the Pulumi SDK (<3.121.0) that does not include the `deprecated` decorator.
296
+ def deprecated(message: str) -> typing.Callable[[C], C]:
297
+ """
298
+ Decorator to indicate a function is deprecated.
299
+
300
+ As well as inserting appropriate statements to indicate that the function is
301
+ deprecated, this decorator also tags the function with a special attribute
302
+ so that Pulumi code can detect that it is deprecated and react appropriately
303
+ in certain situations.
304
+
305
+ message is the deprecation message that should be printed if the function is called.
306
+ """
307
+
308
+ def decorator(fn: C) -> C:
309
+ if not callable(fn):
310
+ raise TypeError("Expected fn to be callable")
311
+
312
+ @functools.wraps(fn)
313
+ def deprecated_fn(*args, **kwargs):
314
+ warnings.warn(message)
315
+ pulumi.warn(f"{fn.__name__} is deprecated: {message}")
316
+
317
+ return fn(*args, **kwargs)
318
+
319
+ deprecated_fn.__dict__["_pulumi_deprecated_callable"] = fn
320
+ return typing.cast(C, deprecated_fn)
321
+
322
+ return decorator
323
+
324
+ def get_plugin_download_url():
325
+ return None
326
+
327
+ def get_version():
328
+ return _version_str
@@ -0,0 +1,10 @@
1
+ # coding=utf-8
2
+ # *** WARNING: this file was generated by pulumi-language-python. ***
3
+ # *** Do not edit by hand unless you're certain you know what you are doing! ***
4
+
5
+ import builtins as _builtins
6
+ from .. import _utilities
7
+ import typing
8
+ # Export this package's modules as members:
9
+ from .api_key import *
10
+ from .get_api_key_metrics import *