pulumi-docker-build 0.0.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 pulumi-docker-build might be problematic. Click here for more details.

@@ -0,0 +1,291 @@
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 importlib.metadata
8
+ import importlib.util
9
+ import inspect
10
+ import json
11
+ import os
12
+ import sys
13
+ import typing
14
+
15
+ import pulumi
16
+ import pulumi.runtime
17
+ from pulumi.runtime.sync_await import _sync_await
18
+
19
+ from semver import VersionInfo as SemverVersion
20
+ from parver import Version as PEP440Version
21
+
22
+
23
+ def get_env(*args):
24
+ for v in args:
25
+ value = os.getenv(v)
26
+ if value is not None:
27
+ return value
28
+ return None
29
+
30
+
31
+ def get_env_bool(*args):
32
+ str = get_env(*args)
33
+ if str is not None:
34
+ # NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
35
+ # Terraform uses internally when parsing boolean values.
36
+ if str in ["1", "t", "T", "true", "TRUE", "True"]:
37
+ return True
38
+ if str in ["0", "f", "F", "false", "FALSE", "False"]:
39
+ return False
40
+ return None
41
+
42
+
43
+ def get_env_int(*args):
44
+ str = get_env(*args)
45
+ if str is not None:
46
+ try:
47
+ return int(str)
48
+ except:
49
+ return None
50
+ return None
51
+
52
+
53
+ def get_env_float(*args):
54
+ str = get_env(*args)
55
+ if str is not None:
56
+ try:
57
+ return float(str)
58
+ except:
59
+ return None
60
+ return None
61
+
62
+
63
+ def _get_semver_version():
64
+ # __name__ is set to the fully-qualified name of the current module, In our case, it will be
65
+ # <some module>._utilities. <some module> is the module we want to query the version for.
66
+ root_package, *rest = __name__.split('.')
67
+
68
+ # pkg_resources uses setuptools to inspect the set of installed packages. We use it here to ask
69
+ # for the currently installed version of the root package (i.e. us) and get its version.
70
+
71
+ # Unfortunately, PEP440 and semver differ slightly in incompatible ways. The Pulumi engine expects
72
+ # to receive a valid semver string when receiving requests from the language host, so it's our
73
+ # responsibility as the library to convert our own PEP440 version into a valid semver string.
74
+
75
+ pep440_version_string = importlib.metadata.version(root_package)
76
+ pep440_version = PEP440Version.parse(pep440_version_string)
77
+ (major, minor, patch) = pep440_version.release
78
+ prerelease = None
79
+ if pep440_version.pre_tag == 'a':
80
+ prerelease = f"alpha.{pep440_version.pre}"
81
+ elif pep440_version.pre_tag == 'b':
82
+ prerelease = f"beta.{pep440_version.pre}"
83
+ elif pep440_version.pre_tag == 'rc':
84
+ prerelease = f"rc.{pep440_version.pre}"
85
+ elif pep440_version.dev is not None:
86
+ prerelease = f"dev.{pep440_version.dev}"
87
+
88
+ # The only significant difference between PEP440 and semver as it pertains to us is that PEP440 has explicit support
89
+ # for dev builds, while semver encodes them as "prerelease" versions. In order to bridge between the two, we convert
90
+ # our dev build version into a prerelease tag. This matches what all of our other packages do when constructing
91
+ # their own semver string.
92
+ return SemverVersion(major=major, minor=minor, patch=patch, prerelease=prerelease)
93
+
94
+
95
+ # Determine the version once and cache the value, which measurably improves program performance.
96
+ _version = _get_semver_version()
97
+ _version_str = str(_version)
98
+
99
+
100
+ def get_version():
101
+ return _version_str
102
+
103
+ def get_resource_opts_defaults() -> pulumi.ResourceOptions:
104
+ return pulumi.ResourceOptions(
105
+ version=get_version(),
106
+ plugin_download_url=get_plugin_download_url(),
107
+ )
108
+
109
+ def get_invoke_opts_defaults() -> pulumi.InvokeOptions:
110
+ return pulumi.InvokeOptions(
111
+ version=get_version(),
112
+ plugin_download_url=get_plugin_download_url(),
113
+ )
114
+
115
+ def get_resource_args_opts(resource_args_type, resource_options_type, *args, **kwargs):
116
+ """
117
+ Return the resource args and options given the *args and **kwargs of a resource's
118
+ __init__ method.
119
+ """
120
+
121
+ resource_args, opts = None, None
122
+
123
+ # If the first item is the resource args type, save it and remove it from the args list.
124
+ if args and isinstance(args[0], resource_args_type):
125
+ resource_args, args = args[0], args[1:]
126
+
127
+ # Now look at the first item in the args list again.
128
+ # If the first item is the resource options class, save it.
129
+ if args and isinstance(args[0], resource_options_type):
130
+ opts = args[0]
131
+
132
+ # If resource_args is None, see if "args" is in kwargs, and, if so, if it's typed as the
133
+ # the resource args type.
134
+ if resource_args is None:
135
+ a = kwargs.get("args")
136
+ if isinstance(a, resource_args_type):
137
+ resource_args = a
138
+
139
+ # If opts is None, look it up in kwargs.
140
+ if opts is None:
141
+ opts = kwargs.get("opts")
142
+
143
+ return resource_args, opts
144
+
145
+
146
+ # Temporary: just use pulumi._utils.lazy_import once everyone upgrades.
147
+ def lazy_import(fullname):
148
+
149
+ import pulumi._utils as u
150
+ f = getattr(u, 'lazy_import', None)
151
+ if f is None:
152
+ f = _lazy_import_temp
153
+
154
+ return f(fullname)
155
+
156
+
157
+ # Copied from pulumi._utils.lazy_import, see comments there.
158
+ def _lazy_import_temp(fullname):
159
+ m = sys.modules.get(fullname, None)
160
+ if m is not None:
161
+ return m
162
+
163
+ spec = importlib.util.find_spec(fullname)
164
+
165
+ m = sys.modules.get(fullname, None)
166
+ if m is not None:
167
+ return m
168
+
169
+ loader = importlib.util.LazyLoader(spec.loader)
170
+ spec.loader = loader
171
+ module = importlib.util.module_from_spec(spec)
172
+
173
+ m = sys.modules.get(fullname, None)
174
+ if m is not None:
175
+ return m
176
+
177
+ sys.modules[fullname] = module
178
+ loader.exec_module(module)
179
+ return module
180
+
181
+
182
+ class Package(pulumi.runtime.ResourcePackage):
183
+ def __init__(self, pkg_info):
184
+ super().__init__()
185
+ self.pkg_info = pkg_info
186
+
187
+ def version(self):
188
+ return _version
189
+
190
+ def construct_provider(self, name: str, typ: str, urn: str) -> pulumi.ProviderResource:
191
+ if typ != self.pkg_info['token']:
192
+ raise Exception(f"unknown provider type {typ}")
193
+ Provider = getattr(lazy_import(self.pkg_info['fqn']), self.pkg_info['class'])
194
+ return Provider(name, pulumi.ResourceOptions(urn=urn))
195
+
196
+
197
+ class Module(pulumi.runtime.ResourceModule):
198
+ def __init__(self, mod_info):
199
+ super().__init__()
200
+ self.mod_info = mod_info
201
+
202
+ def version(self):
203
+ return _version
204
+
205
+ def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource:
206
+ class_name = self.mod_info['classes'].get(typ, None)
207
+
208
+ if class_name is None:
209
+ raise Exception(f"unknown resource type {typ}")
210
+
211
+ TheClass = getattr(lazy_import(self.mod_info['fqn']), class_name)
212
+ return TheClass(name, pulumi.ResourceOptions(urn=urn))
213
+
214
+
215
+ def register(resource_modules, resource_packages):
216
+ resource_modules = json.loads(resource_modules)
217
+ resource_packages = json.loads(resource_packages)
218
+
219
+ for pkg_info in resource_packages:
220
+ pulumi.runtime.register_resource_package(pkg_info['pkg'], Package(pkg_info))
221
+
222
+ for mod_info in resource_modules:
223
+ pulumi.runtime.register_resource_module(
224
+ mod_info['pkg'],
225
+ mod_info['mod'],
226
+ Module(mod_info))
227
+
228
+
229
+ _F = typing.TypeVar('_F', bound=typing.Callable[..., typing.Any])
230
+
231
+
232
+ def lift_output_func(func: typing.Any) -> typing.Callable[[_F], _F]:
233
+ """Decorator internally used on {fn}_output lifted function versions
234
+ to implement them automatically from the un-lifted function."""
235
+
236
+ func_sig = inspect.signature(func)
237
+
238
+ def lifted_func(*args, opts=None, **kwargs):
239
+ bound_args = func_sig.bind(*args, **kwargs)
240
+ # Convert tuple to list, see pulumi/pulumi#8172
241
+ args_list = list(bound_args.args)
242
+ return pulumi.Output.from_input({
243
+ 'args': args_list,
244
+ 'kwargs': bound_args.kwargs
245
+ }).apply(lambda resolved_args: func(*resolved_args['args'],
246
+ opts=opts,
247
+ **resolved_args['kwargs']))
248
+
249
+ return (lambda _: lifted_func)
250
+
251
+
252
+ def call_plain(
253
+ tok: str,
254
+ props: pulumi.Inputs,
255
+ res: typing.Optional[pulumi.Resource] = None,
256
+ typ: typing.Optional[type] = None,
257
+ ) -> typing.Any:
258
+ """
259
+ Wraps pulumi.runtime.plain to force the output and return it plainly.
260
+ """
261
+
262
+ output = pulumi.runtime.call(tok, props, res, typ)
263
+
264
+ # Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency.
265
+ result, known, secret, _ = _sync_await(asyncio.ensure_future(_await_output(output)))
266
+
267
+ problem = None
268
+ if not known:
269
+ problem = ' an unknown value'
270
+ elif secret:
271
+ problem = ' a secret value'
272
+
273
+ if problem:
274
+ raise AssertionError(
275
+ f"Plain resource method '{tok}' incorrectly returned {problem}. "
276
+ + "This is an error in the provider, please report this to the provider developer."
277
+ )
278
+
279
+ return result
280
+
281
+
282
+ async def _await_output(o: pulumi.Output[typing.Any]) -> typing.Tuple[object, bool, bool, set]:
283
+ return (
284
+ await o._future,
285
+ await o._is_known,
286
+ await o._is_secret,
287
+ await o._resources,
288
+ )
289
+
290
+ def get_plugin_download_url():
291
+ return None
@@ -0,0 +1,8 @@
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 sys
6
+ from .vars import _ExportableConfig
7
+
8
+ sys.modules[__name__].__class__ = _ExportableConfig
@@ -0,0 +1,19 @@
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 copy
6
+ import warnings
7
+ import pulumi
8
+ import pulumi.runtime
9
+ from typing import Any, Mapping, Optional, Sequence, Union, overload
10
+ from .. import _utilities
11
+ from .. import outputs as _root_outputs
12
+
13
+ host: str
14
+ """
15
+ The build daemon's address.
16
+ """
17
+
18
+ registries: Optional[str]
19
+
@@ -0,0 +1,29 @@
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 copy
6
+ import warnings
7
+ import pulumi
8
+ import pulumi.runtime
9
+ from typing import Any, Mapping, Optional, Sequence, Union, overload
10
+ from .. import _utilities
11
+ from .. import outputs as _root_outputs
12
+
13
+ import types
14
+
15
+ __config__ = pulumi.Config('docker-build')
16
+
17
+
18
+ class _ExportableConfig(types.ModuleType):
19
+ @property
20
+ def host(self) -> str:
21
+ """
22
+ The build daemon's address.
23
+ """
24
+ return __config__.get('host') or (_utilities.get_env('DOCKER_HOST') or '')
25
+
26
+ @property
27
+ def registries(self) -> Optional[str]:
28
+ return __config__.get('registries')
29
+