pulumi-taba 0.3.18__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.
- pulumi_taba-0.3.18/PKG-INFO +71 -0
- pulumi_taba-0.3.18/README.md +56 -0
- pulumi_taba-0.3.18/pulumi_taba/__init__.py +65 -0
- pulumi_taba-0.3.18/pulumi_taba/_utilities.py +328 -0
- pulumi_taba-0.3.18/pulumi_taba/config/__init__.py +9 -0
- pulumi_taba-0.3.18/pulumi_taba/config/__init__.pyi +51 -0
- pulumi_taba-0.3.18/pulumi_taba/config/vars.py +71 -0
- pulumi_taba-0.3.18/pulumi_taba/distributor.py +392 -0
- pulumi_taba-0.3.18/pulumi_taba/get_token.py +172 -0
- pulumi_taba-0.3.18/pulumi_taba/get_tokens.py +131 -0
- pulumi_taba-0.3.18/pulumi_taba/get_topic.py +328 -0
- pulumi_taba-0.3.18/pulumi_taba/get_topics.py +199 -0
- pulumi_taba-0.3.18/pulumi_taba/outputs.py +288 -0
- pulumi_taba-0.3.18/pulumi_taba/provider.py +297 -0
- pulumi_taba-0.3.18/pulumi_taba/pulumi-plugin.json +5 -0
- pulumi_taba-0.3.18/pulumi_taba/py.typed +0 -0
- pulumi_taba-0.3.18/pulumi_taba/queue.py +847 -0
- pulumi_taba-0.3.18/pulumi_taba/token.py +487 -0
- pulumi_taba-0.3.18/pulumi_taba.egg-info/PKG-INFO +71 -0
- pulumi_taba-0.3.18/pulumi_taba.egg-info/SOURCES.txt +23 -0
- pulumi_taba-0.3.18/pulumi_taba.egg-info/dependency_links.txt +1 -0
- pulumi_taba-0.3.18/pulumi_taba.egg-info/requires.txt +6 -0
- pulumi_taba-0.3.18/pulumi_taba.egg-info/top_level.txt +1 -0
- pulumi_taba-0.3.18/pyproject.toml +22 -0
- pulumi_taba-0.3.18/setup.cfg +4 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pulumi_taba
|
|
3
|
+
Version: 0.3.18
|
|
4
|
+
Summary: Queues, distributors and access tokens of the Taba messaging system.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://github.com/rafaelpontani/taba
|
|
7
|
+
Project-URL: Repository, https://github.com/rafaelpontani/pulumi-taba
|
|
8
|
+
Keywords: pulumi,taba,messaging,queue,category/infrastructure
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: packaging>=24.0
|
|
12
|
+
Requires-Dist: pulumi<4.0.0,>=3.269.0
|
|
13
|
+
Requires-Dist: semver>=2.8.1
|
|
14
|
+
Requires-Dist: typing-extensions<5,>=4.11; python_version < "3.11"
|
|
15
|
+
|
|
16
|
+
# Pulumi provider for Taba
|
|
17
|
+
|
|
18
|
+
Manages the queues, distributors and access tokens of a [Taba](https://github.com/rafaelpontani/taba) cluster as code, through its client API: `preview`, drift detection with `refresh`, `import`, a guard against removing a queue that still holds messages, and an optional `createOrUpdate` that takes over what already exists. Available for **TypeScript/JavaScript, Python, .NET and Go**. It is the [Terraform and OpenTofu provider](https://github.com/rafaelpontani/taba/blob/main/doc/en-US/40-terraform.md) bridged to Pulumi, so both behave the same way.
|
|
19
|
+
|
|
20
|
+
> Other languages: [Português (Brasil)](https://github.com/rafaelpontani/taba/blob/main/doc/pt-BR/41-pulumi.md) · [all languages](https://github.com/rafaelpontani/taba/blob/main/doc/README.md)
|
|
21
|
+
|
|
22
|
+
The full guide (installation by language, configuration, every resource, `createOrUpdate` and its risks, tokens, replacement, tests, publication): [41-pulumi.md](https://github.com/rafaelpontani/taba/blob/main/doc/en-US/41-pulumi.md).
|
|
23
|
+
|
|
24
|
+
| Language | Package | Install |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| TypeScript / JavaScript | [`pulumi-taba`](https://www.npmjs.com/package/pulumi-taba) | `npm install pulumi-taba` |
|
|
27
|
+
| Python | [`pulumi-taba`](https://pypi.org/project/pulumi-taba/) | `pip install pulumi-taba` |
|
|
28
|
+
| .NET | [`Taba.Pulumi`](https://www.nuget.org/packages/Taba.Pulumi) | `dotnet add package Taba.Pulumi` |
|
|
29
|
+
| Go | `github.com/rafaelpontani/pulumi-taba/sdk/go/taba` | `go get github.com/rafaelpontani/pulumi-taba/sdk` |
|
|
30
|
+
|
|
31
|
+
The Pulumi CLI also needs the **plugin** of the provider, which is not in those packages. It is installed from the GitHub Release of the mirror repository (use the version of the package, which is the version of Taba):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pulumi plugin install resource taba 0.3.9 --server github://api.github.com/rafaelpontani/pulumi-taba
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The provider reads the address and the token of the cluster from the stack configuration (or from `TABA_URL` and `TABA_TOKEN`):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pulumi config set taba:endpoint https://taba.example.com:8080
|
|
41
|
+
pulumi config set --secret taba:token "$ROOT_TOKEN"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
A queue, a distributor that copies each publication to the queues starting with `orders` or `billing`, and a token that publishes and consumes only the topics whose name starts with `orders`:
|
|
45
|
+
|
|
46
|
+
**Python**
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import pulumi
|
|
50
|
+
import pulumi_taba as taba
|
|
51
|
+
|
|
52
|
+
orders = taba.Queue("orders", name="orders", ttl=86400, max_deliveries=5)
|
|
53
|
+
|
|
54
|
+
events = taba.Distributor("events", name="events", prefixes=["orders", "billing"])
|
|
55
|
+
|
|
56
|
+
token = taba.Token("orders-app",
|
|
57
|
+
name="orders-app",
|
|
58
|
+
permissions=["publish", "consume"],
|
|
59
|
+
topic_prefixes=[orders.name])
|
|
60
|
+
|
|
61
|
+
pulumi.export("secret", token.secret) # a Pulumi secret
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- **Resources:** `Queue`, `Distributor`, `Token`. **Functions:** `getTopic`, `getTopics`, `getToken`, `getTokens`.
|
|
65
|
+
- **`name` is required** in the three resources: nothing generates it (no autonaming), because the name of a queue is a contract with the applications and is how `createOrUpdate` finds what exists.
|
|
66
|
+
- **The provider version is the Taba version** and targets the node of the same version.
|
|
67
|
+
- **The token secret** is in the Pulumi state, as a secret: keep the state in a backend that encrypts it. The property is called `secret` in every language (a C# class cannot have a property with its own name).
|
|
68
|
+
- **A queue with messages is not removed** (nor replaced) unless `forceDestroy: true` was applied first.
|
|
69
|
+
- **`createOrUpdate` is off by default**: turn it on (provider or resource, or `TABA_CREATE_OR_UPDATE=true`) only for programs meant to take over what was created by hand, by `taba-cli` or by an application.
|
|
70
|
+
|
|
71
|
+
License: [Apache-2.0](https://github.com/rafaelpontani/taba/blob/main/connectors/LICENSE).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Pulumi provider for Taba
|
|
2
|
+
|
|
3
|
+
Manages the queues, distributors and access tokens of a [Taba](https://github.com/rafaelpontani/taba) cluster as code, through its client API: `preview`, drift detection with `refresh`, `import`, a guard against removing a queue that still holds messages, and an optional `createOrUpdate` that takes over what already exists. Available for **TypeScript/JavaScript, Python, .NET and Go**. It is the [Terraform and OpenTofu provider](https://github.com/rafaelpontani/taba/blob/main/doc/en-US/40-terraform.md) bridged to Pulumi, so both behave the same way.
|
|
4
|
+
|
|
5
|
+
> Other languages: [Português (Brasil)](https://github.com/rafaelpontani/taba/blob/main/doc/pt-BR/41-pulumi.md) · [all languages](https://github.com/rafaelpontani/taba/blob/main/doc/README.md)
|
|
6
|
+
|
|
7
|
+
The full guide (installation by language, configuration, every resource, `createOrUpdate` and its risks, tokens, replacement, tests, publication): [41-pulumi.md](https://github.com/rafaelpontani/taba/blob/main/doc/en-US/41-pulumi.md).
|
|
8
|
+
|
|
9
|
+
| Language | Package | Install |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| TypeScript / JavaScript | [`pulumi-taba`](https://www.npmjs.com/package/pulumi-taba) | `npm install pulumi-taba` |
|
|
12
|
+
| Python | [`pulumi-taba`](https://pypi.org/project/pulumi-taba/) | `pip install pulumi-taba` |
|
|
13
|
+
| .NET | [`Taba.Pulumi`](https://www.nuget.org/packages/Taba.Pulumi) | `dotnet add package Taba.Pulumi` |
|
|
14
|
+
| Go | `github.com/rafaelpontani/pulumi-taba/sdk/go/taba` | `go get github.com/rafaelpontani/pulumi-taba/sdk` |
|
|
15
|
+
|
|
16
|
+
The Pulumi CLI also needs the **plugin** of the provider, which is not in those packages. It is installed from the GitHub Release of the mirror repository (use the version of the package, which is the version of Taba):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pulumi plugin install resource taba 0.3.9 --server github://api.github.com/rafaelpontani/pulumi-taba
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The provider reads the address and the token of the cluster from the stack configuration (or from `TABA_URL` and `TABA_TOKEN`):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pulumi config set taba:endpoint https://taba.example.com:8080
|
|
26
|
+
pulumi config set --secret taba:token "$ROOT_TOKEN"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
A queue, a distributor that copies each publication to the queues starting with `orders` or `billing`, and a token that publishes and consumes only the topics whose name starts with `orders`:
|
|
30
|
+
|
|
31
|
+
**Python**
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import pulumi
|
|
35
|
+
import pulumi_taba as taba
|
|
36
|
+
|
|
37
|
+
orders = taba.Queue("orders", name="orders", ttl=86400, max_deliveries=5)
|
|
38
|
+
|
|
39
|
+
events = taba.Distributor("events", name="events", prefixes=["orders", "billing"])
|
|
40
|
+
|
|
41
|
+
token = taba.Token("orders-app",
|
|
42
|
+
name="orders-app",
|
|
43
|
+
permissions=["publish", "consume"],
|
|
44
|
+
topic_prefixes=[orders.name])
|
|
45
|
+
|
|
46
|
+
pulumi.export("secret", token.secret) # a Pulumi secret
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **Resources:** `Queue`, `Distributor`, `Token`. **Functions:** `getTopic`, `getTopics`, `getToken`, `getTokens`.
|
|
50
|
+
- **`name` is required** in the three resources: nothing generates it (no autonaming), because the name of a queue is a contract with the applications and is how `createOrUpdate` finds what exists.
|
|
51
|
+
- **The provider version is the Taba version** and targets the node of the same version.
|
|
52
|
+
- **The token secret** is in the Pulumi state, as a secret: keep the state in a backend that encrypts it. The property is called `secret` in every language (a C# class cannot have a property with its own name).
|
|
53
|
+
- **A queue with messages is not removed** (nor replaced) unless `forceDestroy: true` was applied first.
|
|
54
|
+
- **`createOrUpdate` is off by default**: turn it on (provider or resource, or `TABA_CREATE_OR_UPDATE=true`) only for programs meant to take over what was created by hand, by `taba-cli` or by an application.
|
|
55
|
+
|
|
56
|
+
License: [Apache-2.0](https://github.com/rafaelpontani/taba/blob/main/connectors/LICENSE).
|
|
@@ -0,0 +1,65 @@
|
|
|
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 .distributor import *
|
|
10
|
+
from .get_token import *
|
|
11
|
+
from .get_tokens import *
|
|
12
|
+
from .get_topic import *
|
|
13
|
+
from .get_topics import *
|
|
14
|
+
from .provider import *
|
|
15
|
+
from .queue import *
|
|
16
|
+
from .token import *
|
|
17
|
+
from . import outputs
|
|
18
|
+
|
|
19
|
+
# Make subpackages available:
|
|
20
|
+
if typing.TYPE_CHECKING:
|
|
21
|
+
import pulumi_taba.config as __config
|
|
22
|
+
config = __config
|
|
23
|
+
else:
|
|
24
|
+
config = _utilities.lazy_import('pulumi_taba.config')
|
|
25
|
+
|
|
26
|
+
_utilities.register(
|
|
27
|
+
resource_modules="""
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
"pkg": "taba",
|
|
31
|
+
"mod": "index/distributor",
|
|
32
|
+
"fqn": "pulumi_taba",
|
|
33
|
+
"classes": {
|
|
34
|
+
"taba:index/distributor:Distributor": "Distributor"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"pkg": "taba",
|
|
39
|
+
"mod": "index/queue",
|
|
40
|
+
"fqn": "pulumi_taba",
|
|
41
|
+
"classes": {
|
|
42
|
+
"taba:index/queue:Queue": "Queue"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"pkg": "taba",
|
|
47
|
+
"mod": "index/token",
|
|
48
|
+
"fqn": "pulumi_taba",
|
|
49
|
+
"classes": {
|
|
50
|
+
"taba:index/token:Token": "Token"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
""",
|
|
55
|
+
resource_packages="""
|
|
56
|
+
[
|
|
57
|
+
{
|
|
58
|
+
"pkg": "taba",
|
|
59
|
+
"token": "pulumi:providers:taba",
|
|
60
|
+
"fqn": "pulumi_taba",
|
|
61
|
+
"class": "Provider"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
"""
|
|
65
|
+
)
|
|
@@ -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
|
+
|
|
17
|
+
import pulumi
|
|
18
|
+
import pulumi.runtime
|
|
19
|
+
from pulumi.runtime.sync_await import _sync_await
|
|
20
|
+
|
|
21
|
+
from packaging.version import Version as PEP440Version
|
|
22
|
+
from semver import VersionInfo as SemverVersion
|
|
23
|
+
|
|
24
|
+
C = typing.TypeVar("C", bound=typing.Callable)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_env(*args):
|
|
28
|
+
for v in args:
|
|
29
|
+
value = os.getenv(v)
|
|
30
|
+
if value is not None:
|
|
31
|
+
return value
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_env_bool(*args):
|
|
36
|
+
str = get_env(*args)
|
|
37
|
+
if str is not None:
|
|
38
|
+
# NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
|
|
39
|
+
# Terraform uses internally when parsing boolean values.
|
|
40
|
+
if str in ["1", "t", "T", "true", "TRUE", "True"]:
|
|
41
|
+
return True
|
|
42
|
+
if str in ["0", "f", "F", "false", "FALSE", "False"]:
|
|
43
|
+
return False
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get_env_int(*args):
|
|
48
|
+
str = get_env(*args)
|
|
49
|
+
if str is not None:
|
|
50
|
+
try:
|
|
51
|
+
return int(str)
|
|
52
|
+
except:
|
|
53
|
+
return None
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_env_float(*args):
|
|
58
|
+
str = get_env(*args)
|
|
59
|
+
if str is not None:
|
|
60
|
+
try:
|
|
61
|
+
return float(str)
|
|
62
|
+
except:
|
|
63
|
+
return None
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _get_semver_version():
|
|
68
|
+
# __name__ is set to the fully-qualified name of the current module, In our case, it will be
|
|
69
|
+
# <some module>._utilities. <some module> is the module we want to query the version for.
|
|
70
|
+
root_package, *rest = __name__.split('.')
|
|
71
|
+
|
|
72
|
+
# Unfortunately, PEP440 and semver differ slightly in incompatible ways. The Pulumi engine expects
|
|
73
|
+
# to receive a valid semver string when receiving requests from the language host, so it's our
|
|
74
|
+
# responsibility as the library to convert our own PEP440 version into a valid semver string.
|
|
75
|
+
|
|
76
|
+
pep440_version_string = importlib.metadata.version(root_package)
|
|
77
|
+
pep440_version = PEP440Version(pep440_version_string)
|
|
78
|
+
(major, minor, patch) = pep440_version.release
|
|
79
|
+
prerelease = None
|
|
80
|
+
if pep440_version.pre is not None:
|
|
81
|
+
pre_tag, pre_number = pep440_version.pre
|
|
82
|
+
if pre_tag == 'a':
|
|
83
|
+
prerelease = f"alpha.{pre_number}"
|
|
84
|
+
elif pre_tag == 'b':
|
|
85
|
+
prerelease = f"beta.{pre_number}"
|
|
86
|
+
elif pre_tag == 'rc':
|
|
87
|
+
prerelease = f"rc.{pre_number}"
|
|
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 "github://api.github.com/rafaelpontani/pulumi-taba"
|
|
326
|
+
|
|
327
|
+
def get_version():
|
|
328
|
+
return _version_str
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
import sys
|
|
7
|
+
from .vars import _ExportableConfig
|
|
8
|
+
|
|
9
|
+
sys.modules[__name__].__class__ = _ExportableConfig
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
import warnings
|
|
7
|
+
import sys
|
|
8
|
+
import pulumi
|
|
9
|
+
import pulumi.runtime
|
|
10
|
+
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
|
11
|
+
if sys.version_info >= (3, 11):
|
|
12
|
+
from typing import NotRequired, TypedDict, TypeAlias
|
|
13
|
+
else:
|
|
14
|
+
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
|
15
|
+
from .. import _utilities
|
|
16
|
+
|
|
17
|
+
caCertFile: Optional[str]
|
|
18
|
+
"""
|
|
19
|
+
Path of a PEM file with a private certificate authority. Conflicts with `ca_cert_pem`.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
caCertPem: Optional[str]
|
|
23
|
+
"""
|
|
24
|
+
PEM of a private certificate authority that signs the API certificate. Conflicts with `ca_cert_file`. Default: the `TABA_CA_CERT` environment variable (a PEM or a file path).
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
createOrUpdate: Optional[bool]
|
|
28
|
+
"""
|
|
29
|
+
Default of the `create_or_update` attribute of every resource: when creating a queue, distributor or token that already exists in the cluster, take it over (and bring it to the declared configuration) instead of failing. Off by default, because it takes over in silence what may belong to another configuration. Default: the `TABA_CREATE_OR_UPDATE` environment variable (`true` or `false`), or `false`.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
endpoint: Optional[str]
|
|
33
|
+
"""
|
|
34
|
+
URL of the client API (the cluster load balancer), such as `https://taba.example.com:8080`. Default: the `TABA_URL` environment variable.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
requestTimeout: Optional[str]
|
|
38
|
+
"""
|
|
39
|
+
Timeout of each call, as a Go duration (`30s`, `1m`). Default: `30s`.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
retryMaxWait: Optional[str]
|
|
43
|
+
"""
|
|
44
|
+
Total wait, as a Go duration (`3m`, `90s`), between the attempts of a call that gets `429` or `503`: each one waits for the `Retry-After` (5 s from a node of the cluster) or 1, 2, 4… up to 64 seconds, and no attempt is made whose wait would pass this total. A node that crashed answers for the definitions it owns until the others vote it out (about a minute). It also bounds the creations of a token that get `503 cluster.quorum-unavailable`, each one after revoking what the previous one may have created. `0s`: no new attempt. Default: `3m`.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
token: Optional[str]
|
|
48
|
+
"""
|
|
49
|
+
Access token (`Authorization: Bearer`). Queues and distributors need `create` and `manage` within their prefixes; tokens need the root token (or an `admin` one for tokens that are not `admin`). Default: the `TABA_TOKEN` environment variable. Without it, the calls go without authentication.
|
|
50
|
+
"""
|
|
51
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
import warnings
|
|
7
|
+
import sys
|
|
8
|
+
import pulumi
|
|
9
|
+
import pulumi.runtime
|
|
10
|
+
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
|
11
|
+
if sys.version_info >= (3, 11):
|
|
12
|
+
from typing import NotRequired, TypedDict, TypeAlias
|
|
13
|
+
else:
|
|
14
|
+
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
|
15
|
+
from .. import _utilities
|
|
16
|
+
|
|
17
|
+
import types
|
|
18
|
+
|
|
19
|
+
__config__ = pulumi.Config('taba')
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class _ExportableConfig(types.ModuleType):
|
|
23
|
+
@_builtins.property
|
|
24
|
+
def ca_cert_file(self) -> Optional[str]:
|
|
25
|
+
"""
|
|
26
|
+
Path of a PEM file with a private certificate authority. Conflicts with `ca_cert_pem`.
|
|
27
|
+
"""
|
|
28
|
+
return __config__.get('caCertFile')
|
|
29
|
+
|
|
30
|
+
@_builtins.property
|
|
31
|
+
def ca_cert_pem(self) -> Optional[str]:
|
|
32
|
+
"""
|
|
33
|
+
PEM of a private certificate authority that signs the API certificate. Conflicts with `ca_cert_file`. Default: the `TABA_CA_CERT` environment variable (a PEM or a file path).
|
|
34
|
+
"""
|
|
35
|
+
return __config__.get('caCertPem')
|
|
36
|
+
|
|
37
|
+
@_builtins.property
|
|
38
|
+
def create_or_update(self) -> Optional[bool]:
|
|
39
|
+
"""
|
|
40
|
+
Default of the `create_or_update` attribute of every resource: when creating a queue, distributor or token that already exists in the cluster, take it over (and bring it to the declared configuration) instead of failing. Off by default, because it takes over in silence what may belong to another configuration. Default: the `TABA_CREATE_OR_UPDATE` environment variable (`true` or `false`), or `false`.
|
|
41
|
+
"""
|
|
42
|
+
return __config__.get_bool('createOrUpdate')
|
|
43
|
+
|
|
44
|
+
@_builtins.property
|
|
45
|
+
def endpoint(self) -> Optional[str]:
|
|
46
|
+
"""
|
|
47
|
+
URL of the client API (the cluster load balancer), such as `https://taba.example.com:8080`. Default: the `TABA_URL` environment variable.
|
|
48
|
+
"""
|
|
49
|
+
return __config__.get('endpoint')
|
|
50
|
+
|
|
51
|
+
@_builtins.property
|
|
52
|
+
def request_timeout(self) -> Optional[str]:
|
|
53
|
+
"""
|
|
54
|
+
Timeout of each call, as a Go duration (`30s`, `1m`). Default: `30s`.
|
|
55
|
+
"""
|
|
56
|
+
return __config__.get('requestTimeout')
|
|
57
|
+
|
|
58
|
+
@_builtins.property
|
|
59
|
+
def retry_max_wait(self) -> Optional[str]:
|
|
60
|
+
"""
|
|
61
|
+
Total wait, as a Go duration (`3m`, `90s`), between the attempts of a call that gets `429` or `503`: each one waits for the `Retry-After` (5 s from a node of the cluster) or 1, 2, 4… up to 64 seconds, and no attempt is made whose wait would pass this total. A node that crashed answers for the definitions it owns until the others vote it out (about a minute). It also bounds the creations of a token that get `503 cluster.quorum-unavailable`, each one after revoking what the previous one may have created. `0s`: no new attempt. Default: `3m`.
|
|
62
|
+
"""
|
|
63
|
+
return __config__.get('retryMaxWait')
|
|
64
|
+
|
|
65
|
+
@_builtins.property
|
|
66
|
+
def token(self) -> Optional[str]:
|
|
67
|
+
"""
|
|
68
|
+
Access token (`Authorization: Bearer`). Queues and distributors need `create` and `manage` within their prefixes; tokens need the root token (or an `admin` one for tokens that are not `admin`). Default: the `TABA_TOKEN` environment variable. Without it, the calls go without authentication.
|
|
69
|
+
"""
|
|
70
|
+
return __config__.get('token')
|
|
71
|
+
|