initial commit
This commit is contained in:
0
sdk/python/Pulumi.yaml
generated
Normal file
0
sdk/python/Pulumi.yaml
generated
Normal file
63
sdk/python/README.md
generated
Normal file
63
sdk/python/README.md
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
# Terraform Bridge Provider Boilerplate
|
||||
|
||||
This repository is the template for authoring a Pulumi package from an existing Terraform provider as part of the guide for [authoring and publishing Pulumi packages](https://www.pulumi.com/docs/iac/packages-and-automation/pulumi-packages/authoring/).
|
||||
|
||||
This repository is initially set up as a fictitious provider named "xyz" to demonstrate a resource, a data source and configuration derived from the [github.com/pulumi/terraform-provider-xyz provider](https://github.com/pulumi/terraform-provider-xyz).
|
||||
|
||||
Read the [setup instructions](SETUP.md) for step-by-step instructions on how to bridge a new provider and refer to our complete docs [guide for authoring and publishing a Pulumi Package](https://www.pulumi.com/docs/iac/packages-and-automation/pulumi-packages/authoring/).
|
||||
|
||||
# Xyz Resource Provider
|
||||
|
||||
The Xyz Resource Provider lets you manage [Xyz](http://example.com) resources.
|
||||
|
||||
## Installing
|
||||
|
||||
This package is available for several languages/platforms:
|
||||
|
||||
### Node.js (JavaScript/TypeScript)
|
||||
|
||||
To use from JavaScript or TypeScript in Node.js, install using either `npm`:
|
||||
|
||||
```bash
|
||||
npm install @pulumi/xyz
|
||||
```
|
||||
|
||||
or `yarn`:
|
||||
|
||||
```bash
|
||||
yarn add @pulumi/xyz
|
||||
```
|
||||
|
||||
### Python
|
||||
|
||||
To use from Python, install using `pip`:
|
||||
|
||||
```bash
|
||||
pip install pulumi_xyz
|
||||
```
|
||||
|
||||
### Go
|
||||
|
||||
To use from Go, use `go get` to grab the latest version of the library:
|
||||
|
||||
```bash
|
||||
go get github.com/pulumi/pulumi-xyz/sdk/go/...
|
||||
```
|
||||
|
||||
### .NET
|
||||
|
||||
To use from .NET, install using `dotnet add package`:
|
||||
|
||||
```bash
|
||||
dotnet add package Pulumi.Xyz
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The following configuration points are available for the `xyz` provider:
|
||||
|
||||
- `xyz:region` (environment: `XYZ_REGION`) - the region in which to deploy resources
|
||||
|
||||
## Reference
|
||||
|
||||
For detailed reference documentation, please visit [the Pulumi registry](https://www.pulumi.com/registry/packages/xyz/api-docs/).
|
||||
3
sdk/python/go.mod
generated
Normal file
3
sdk/python/go.mod
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
module fake_python_module // Exclude this directory from Go tools
|
||||
|
||||
go 1.17
|
||||
4
sdk/python/pulumi_xyz/README.md
generated
Normal file
4
sdk/python/pulumi_xyz/README.md
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
> This provider is a derived work of the [Terraform Provider](https://github.com/terraform-providers/terraform-provider-xyz)
|
||||
> distributed under [MPL 2.0](https://www.mozilla.org/en-US/MPL/2.0/). If you encounter a bug or missing feature,
|
||||
> first check the [`pulumi-xyz` repo](https://github.com/pulumi/pulumi-xyz/issues); however, if that doesn't turn up anything,
|
||||
> please consult the source [`terraform-provider-xyz` repo](https://github.com/terraform-providers/terraform-provider-xyz/issues).
|
||||
46
sdk/python/pulumi_xyz/__init__.py
generated
Normal file
46
sdk/python/pulumi_xyz/__init__.py
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
from . import _utilities
|
||||
import typing
|
||||
# Export this package's modules as members:
|
||||
from .get_data_source import *
|
||||
from .provider import *
|
||||
from .resource import *
|
||||
|
||||
# Make subpackages available:
|
||||
if typing.TYPE_CHECKING:
|
||||
import pulumi_xyz.config as __config
|
||||
config = __config
|
||||
import pulumi_xyz.region as __region
|
||||
region = __region
|
||||
else:
|
||||
config = _utilities.lazy_import('pulumi_xyz.config')
|
||||
region = _utilities.lazy_import('pulumi_xyz.region')
|
||||
|
||||
_utilities.register(
|
||||
resource_modules="""
|
||||
[
|
||||
{
|
||||
"pkg": "xyz",
|
||||
"mod": "index/resource",
|
||||
"fqn": "pulumi_xyz",
|
||||
"classes": {
|
||||
"xyz:index/resource:Resource": "Resource"
|
||||
}
|
||||
}
|
||||
]
|
||||
""",
|
||||
resource_packages="""
|
||||
[
|
||||
{
|
||||
"pkg": "xyz",
|
||||
"token": "pulumi:providers:xyz",
|
||||
"fqn": "pulumi_xyz",
|
||||
"class": "Provider"
|
||||
}
|
||||
]
|
||||
"""
|
||||
)
|
||||
331
sdk/python/pulumi_xyz/_utilities.py
generated
Normal file
331
sdk/python/pulumi_xyz/_utilities.py
generated
Normal file
@@ -0,0 +1,331 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
|
||||
import asyncio
|
||||
import functools
|
||||
import importlib.metadata
|
||||
import importlib.util
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import typing
|
||||
import warnings
|
||||
import base64
|
||||
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from pulumi.runtime.sync_await import _sync_await
|
||||
from pulumi.runtime.proto import resource_pb2
|
||||
|
||||
from semver import VersionInfo as SemverVersion
|
||||
from parver import Version as PEP440Version
|
||||
|
||||
C = typing.TypeVar("C", bound=typing.Callable)
|
||||
|
||||
|
||||
def get_env(*args):
|
||||
for v in args:
|
||||
value = os.getenv(v)
|
||||
if value is not None:
|
||||
return value
|
||||
return None
|
||||
|
||||
|
||||
def get_env_bool(*args):
|
||||
str = get_env(*args)
|
||||
if str is not None:
|
||||
# NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
|
||||
# Terraform uses internally when parsing boolean values.
|
||||
if str in ["1", "t", "T", "true", "TRUE", "True"]:
|
||||
return True
|
||||
if str in ["0", "f", "F", "false", "FALSE", "False"]:
|
||||
return False
|
||||
return None
|
||||
|
||||
|
||||
def get_env_int(*args):
|
||||
str = get_env(*args)
|
||||
if str is not None:
|
||||
try:
|
||||
return int(str)
|
||||
except:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def get_env_float(*args):
|
||||
str = get_env(*args)
|
||||
if str is not None:
|
||||
try:
|
||||
return float(str)
|
||||
except:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def _get_semver_version():
|
||||
# __name__ is set to the fully-qualified name of the current module, In our case, it will be
|
||||
# <some module>._utilities. <some module> is the module we want to query the version for.
|
||||
root_package, *rest = __name__.split('.')
|
||||
|
||||
# pkg_resources uses setuptools to inspect the set of installed packages. We use it here to ask
|
||||
# for the currently installed version of the root package (i.e. us) and get its version.
|
||||
|
||||
# Unfortunately, PEP440 and semver differ slightly in incompatible ways. The Pulumi engine expects
|
||||
# to receive a valid semver string when receiving requests from the language host, so it's our
|
||||
# responsibility as the library to convert our own PEP440 version into a valid semver string.
|
||||
|
||||
pep440_version_string = importlib.metadata.version(root_package)
|
||||
pep440_version = PEP440Version.parse(pep440_version_string)
|
||||
(major, minor, patch) = pep440_version.release
|
||||
prerelease = None
|
||||
if pep440_version.pre_tag == 'a':
|
||||
prerelease = f"alpha.{pep440_version.pre}"
|
||||
elif pep440_version.pre_tag == 'b':
|
||||
prerelease = f"beta.{pep440_version.pre}"
|
||||
elif pep440_version.pre_tag == 'rc':
|
||||
prerelease = f"rc.{pep440_version.pre}"
|
||||
elif pep440_version.dev is not None:
|
||||
# PEP440 has explicit support for dev builds, while semver encodes them as "prerelease" versions. To bridge
|
||||
# between the two, we convert our dev build version into a prerelease tag. This matches what all of our other
|
||||
# packages do when constructing their own semver string.
|
||||
prerelease = f"dev.{pep440_version.dev}"
|
||||
elif pep440_version.local is not None:
|
||||
# PEP440 only allows a small set of prerelease tags, so when converting an arbitrary prerelease,
|
||||
# PypiVersion in /pkg/codegen/python/utilities.go converts it to a local version. Therefore, we need to
|
||||
# do the reverse conversion here and set the local version as the prerelease tag.
|
||||
prerelease = pep440_version.local
|
||||
|
||||
return SemverVersion(major=major, minor=minor, patch=patch, prerelease=prerelease)
|
||||
|
||||
|
||||
# Determine the version once and cache the value, which measurably improves program performance.
|
||||
_version = _get_semver_version()
|
||||
_version_str = str(_version)
|
||||
|
||||
def get_resource_opts_defaults() -> pulumi.ResourceOptions:
|
||||
return pulumi.ResourceOptions(
|
||||
version=get_version(),
|
||||
plugin_download_url=get_plugin_download_url(),
|
||||
)
|
||||
|
||||
def get_invoke_opts_defaults() -> pulumi.InvokeOptions:
|
||||
return pulumi.InvokeOptions(
|
||||
version=get_version(),
|
||||
plugin_download_url=get_plugin_download_url(),
|
||||
)
|
||||
|
||||
def get_resource_args_opts(resource_args_type, resource_options_type, *args, **kwargs):
|
||||
"""
|
||||
Return the resource args and options given the *args and **kwargs of a resource's
|
||||
__init__ method.
|
||||
"""
|
||||
|
||||
resource_args, opts = None, None
|
||||
|
||||
# If the first item is the resource args type, save it and remove it from the args list.
|
||||
if args and isinstance(args[0], resource_args_type):
|
||||
resource_args, args = args[0], args[1:]
|
||||
|
||||
# Now look at the first item in the args list again.
|
||||
# If the first item is the resource options class, save it.
|
||||
if args and isinstance(args[0], resource_options_type):
|
||||
opts = args[0]
|
||||
|
||||
# If resource_args is None, see if "args" is in kwargs, and, if so, if it's typed as the
|
||||
# the resource args type.
|
||||
if resource_args is None:
|
||||
a = kwargs.get("args")
|
||||
if isinstance(a, resource_args_type):
|
||||
resource_args = a
|
||||
|
||||
# If opts is None, look it up in kwargs.
|
||||
if opts is None:
|
||||
opts = kwargs.get("opts")
|
||||
|
||||
return resource_args, opts
|
||||
|
||||
|
||||
# Temporary: just use pulumi._utils.lazy_import once everyone upgrades.
|
||||
def lazy_import(fullname):
|
||||
|
||||
import pulumi._utils as u
|
||||
f = getattr(u, 'lazy_import', None)
|
||||
if f is None:
|
||||
f = _lazy_import_temp
|
||||
|
||||
return f(fullname)
|
||||
|
||||
|
||||
# Copied from pulumi._utils.lazy_import, see comments there.
|
||||
def _lazy_import_temp(fullname):
|
||||
m = sys.modules.get(fullname, None)
|
||||
if m is not None:
|
||||
return m
|
||||
|
||||
spec = importlib.util.find_spec(fullname)
|
||||
|
||||
m = sys.modules.get(fullname, None)
|
||||
if m is not None:
|
||||
return m
|
||||
|
||||
loader = importlib.util.LazyLoader(spec.loader)
|
||||
spec.loader = loader
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
|
||||
m = sys.modules.get(fullname, None)
|
||||
if m is not None:
|
||||
return m
|
||||
|
||||
sys.modules[fullname] = module
|
||||
loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
class Package(pulumi.runtime.ResourcePackage):
|
||||
def __init__(self, pkg_info):
|
||||
super().__init__()
|
||||
self.pkg_info = pkg_info
|
||||
|
||||
def version(self):
|
||||
return _version
|
||||
|
||||
def construct_provider(self, name: str, typ: str, urn: str) -> pulumi.ProviderResource:
|
||||
if typ != self.pkg_info['token']:
|
||||
raise Exception(f"unknown provider type {typ}")
|
||||
Provider = getattr(lazy_import(self.pkg_info['fqn']), self.pkg_info['class'])
|
||||
return Provider(name, pulumi.ResourceOptions(urn=urn))
|
||||
|
||||
|
||||
class Module(pulumi.runtime.ResourceModule):
|
||||
def __init__(self, mod_info):
|
||||
super().__init__()
|
||||
self.mod_info = mod_info
|
||||
|
||||
def version(self):
|
||||
return _version
|
||||
|
||||
def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource:
|
||||
class_name = self.mod_info['classes'].get(typ, None)
|
||||
|
||||
if class_name is None:
|
||||
raise Exception(f"unknown resource type {typ}")
|
||||
|
||||
TheClass = getattr(lazy_import(self.mod_info['fqn']), class_name)
|
||||
return TheClass(name, pulumi.ResourceOptions(urn=urn))
|
||||
|
||||
|
||||
def register(resource_modules, resource_packages):
|
||||
resource_modules = json.loads(resource_modules)
|
||||
resource_packages = json.loads(resource_packages)
|
||||
|
||||
for pkg_info in resource_packages:
|
||||
pulumi.runtime.register_resource_package(pkg_info['pkg'], Package(pkg_info))
|
||||
|
||||
for mod_info in resource_modules:
|
||||
pulumi.runtime.register_resource_module(
|
||||
mod_info['pkg'],
|
||||
mod_info['mod'],
|
||||
Module(mod_info))
|
||||
|
||||
|
||||
_F = typing.TypeVar('_F', bound=typing.Callable[..., typing.Any])
|
||||
|
||||
|
||||
def lift_output_func(func: typing.Any) -> typing.Callable[[_F], _F]:
|
||||
"""Decorator internally used on {fn}_output lifted function versions
|
||||
to implement them automatically from the un-lifted function."""
|
||||
|
||||
func_sig = inspect.signature(func)
|
||||
|
||||
def lifted_func(*args, opts=None, **kwargs):
|
||||
bound_args = func_sig.bind(*args, **kwargs)
|
||||
# Convert tuple to list, see pulumi/pulumi#8172
|
||||
args_list = list(bound_args.args)
|
||||
return pulumi.Output.from_input({
|
||||
'args': args_list,
|
||||
'kwargs': bound_args.kwargs
|
||||
}).apply(lambda resolved_args: func(*resolved_args['args'],
|
||||
opts=opts,
|
||||
**resolved_args['kwargs']))
|
||||
|
||||
return (lambda _: lifted_func)
|
||||
|
||||
|
||||
def call_plain(
|
||||
tok: str,
|
||||
props: pulumi.Inputs,
|
||||
res: typing.Optional[pulumi.Resource] = None,
|
||||
typ: typing.Optional[type] = None,
|
||||
) -> typing.Any:
|
||||
"""
|
||||
Wraps pulumi.runtime.plain to force the output and return it plainly.
|
||||
"""
|
||||
|
||||
output = pulumi.runtime.call(tok, props, res, typ)
|
||||
|
||||
# Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency.
|
||||
result, known, secret, _ = _sync_await(asyncio.create_task(_await_output(output)))
|
||||
|
||||
problem = None
|
||||
if not known:
|
||||
problem = ' an unknown value'
|
||||
elif secret:
|
||||
problem = ' a secret value'
|
||||
|
||||
if problem:
|
||||
raise AssertionError(
|
||||
f"Plain resource method '{tok}' incorrectly returned {problem}. "
|
||||
+ "This is an error in the provider, please report this to the provider developer."
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
async def _await_output(o: pulumi.Output[typing.Any]) -> typing.Tuple[object, bool, bool, set]:
|
||||
return (
|
||||
await o._future,
|
||||
await o._is_known,
|
||||
await o._is_secret,
|
||||
await o._resources,
|
||||
)
|
||||
|
||||
|
||||
# This is included to provide an upgrade path for users who are using a version
|
||||
# of the Pulumi SDK (<3.121.0) that does not include the `deprecated` decorator.
|
||||
def deprecated(message: str) -> typing.Callable[[C], C]:
|
||||
"""
|
||||
Decorator to indicate a function is deprecated.
|
||||
|
||||
As well as inserting appropriate statements to indicate that the function is
|
||||
deprecated, this decorator also tags the function with a special attribute
|
||||
so that Pulumi code can detect that it is deprecated and react appropriately
|
||||
in certain situations.
|
||||
|
||||
message is the deprecation message that should be printed if the function is called.
|
||||
"""
|
||||
|
||||
def decorator(fn: C) -> C:
|
||||
if not callable(fn):
|
||||
raise TypeError("Expected fn to be callable")
|
||||
|
||||
@functools.wraps(fn)
|
||||
def deprecated_fn(*args, **kwargs):
|
||||
warnings.warn(message)
|
||||
pulumi.warn(f"{fn.__name__} is deprecated: {message}")
|
||||
|
||||
return fn(*args, **kwargs)
|
||||
|
||||
deprecated_fn.__dict__["_pulumi_deprecated_callable"] = fn
|
||||
return typing.cast(C, deprecated_fn)
|
||||
|
||||
return decorator
|
||||
|
||||
def get_plugin_download_url():
|
||||
return None
|
||||
|
||||
def get_version():
|
||||
return _version_str
|
||||
9
sdk/python/pulumi_xyz/config/__init__.py
generated
Normal file
9
sdk/python/pulumi_xyz/config/__init__.py
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
import sys
|
||||
from .vars import _ExportableConfig
|
||||
|
||||
sys.modules[__name__].__class__ = _ExportableConfig
|
||||
23
sdk/python/pulumi_xyz/config/__init__.pyi
generated
Normal file
23
sdk/python/pulumi_xyz/config/__init__.pyi
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
import copy
|
||||
import warnings
|
||||
import sys
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired, TypedDict, TypeAlias
|
||||
else:
|
||||
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
||||
from .. import _utilities
|
||||
from .. import region
|
||||
|
||||
region: Optional[str]
|
||||
"""
|
||||
A region which should be used.
|
||||
"""
|
||||
|
||||
31
sdk/python/pulumi_xyz/config/vars.py
generated
Normal file
31
sdk/python/pulumi_xyz/config/vars.py
generated
Normal file
@@ -0,0 +1,31 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
import copy
|
||||
import warnings
|
||||
import sys
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired, TypedDict, TypeAlias
|
||||
else:
|
||||
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
||||
from .. import _utilities
|
||||
from .. import region
|
||||
|
||||
import types
|
||||
|
||||
__config__ = pulumi.Config('xyz')
|
||||
|
||||
|
||||
class _ExportableConfig(types.ModuleType):
|
||||
@property
|
||||
def region(self) -> Optional[str]:
|
||||
"""
|
||||
A region which should be used.
|
||||
"""
|
||||
return __config__.get('region')
|
||||
|
||||
86
sdk/python/pulumi_xyz/get_data_source.py
generated
Normal file
86
sdk/python/pulumi_xyz/get_data_source.py
generated
Normal file
@@ -0,0 +1,86 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
import copy
|
||||
import warnings
|
||||
import sys
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired, TypedDict, TypeAlias
|
||||
else:
|
||||
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
||||
from . import _utilities
|
||||
|
||||
__all__ = [
|
||||
'GetDataSourceResult',
|
||||
'AwaitableGetDataSourceResult',
|
||||
'get_data_source',
|
||||
'get_data_source_output',
|
||||
]
|
||||
|
||||
@pulumi.output_type
|
||||
class GetDataSourceResult:
|
||||
"""
|
||||
A collection of values returned by getDataSource.
|
||||
"""
|
||||
def __init__(__self__, id=None, sample_attribute=None):
|
||||
if id and not isinstance(id, str):
|
||||
raise TypeError("Expected argument 'id' to be a str")
|
||||
pulumi.set(__self__, "id", id)
|
||||
if sample_attribute and not isinstance(sample_attribute, str):
|
||||
raise TypeError("Expected argument 'sample_attribute' to be a str")
|
||||
pulumi.set(__self__, "sample_attribute", sample_attribute)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def id(self) -> builtins.str:
|
||||
"""
|
||||
The provider-assigned unique ID for this managed resource.
|
||||
"""
|
||||
return pulumi.get(self, "id")
|
||||
|
||||
@property
|
||||
@pulumi.getter(name="sampleAttribute")
|
||||
def sample_attribute(self) -> builtins.str:
|
||||
return pulumi.get(self, "sample_attribute")
|
||||
|
||||
|
||||
class AwaitableGetDataSourceResult(GetDataSourceResult):
|
||||
# pylint: disable=using-constant-test
|
||||
def __await__(self):
|
||||
if False:
|
||||
yield self
|
||||
return GetDataSourceResult(
|
||||
id=self.id,
|
||||
sample_attribute=self.sample_attribute)
|
||||
|
||||
|
||||
def get_data_source(sample_attribute: Optional[builtins.str] = None,
|
||||
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDataSourceResult:
|
||||
"""
|
||||
Use this data source to access information about an existing resource.
|
||||
"""
|
||||
__args__ = dict()
|
||||
__args__['sampleAttribute'] = sample_attribute
|
||||
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
|
||||
__ret__ = pulumi.runtime.invoke('xyz:index/getDataSource:getDataSource', __args__, opts=opts, typ=GetDataSourceResult).value
|
||||
|
||||
return AwaitableGetDataSourceResult(
|
||||
id=pulumi.get(__ret__, 'id'),
|
||||
sample_attribute=pulumi.get(__ret__, 'sample_attribute'))
|
||||
def get_data_source_output(sample_attribute: Optional[pulumi.Input[builtins.str]] = None,
|
||||
opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDataSourceResult]:
|
||||
"""
|
||||
Use this data source to access information about an existing resource.
|
||||
"""
|
||||
__args__ = dict()
|
||||
__args__['sampleAttribute'] = sample_attribute
|
||||
opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
|
||||
__ret__ = pulumi.runtime.invoke_output('xyz:index/getDataSource:getDataSource', __args__, opts=opts, typ=GetDataSourceResult)
|
||||
return __ret__.apply(lambda __response__: GetDataSourceResult(
|
||||
id=pulumi.get(__response__, 'id'),
|
||||
sample_attribute=pulumi.get(__response__, 'sample_attribute')))
|
||||
105
sdk/python/pulumi_xyz/provider.py
generated
Normal file
105
sdk/python/pulumi_xyz/provider.py
generated
Normal file
@@ -0,0 +1,105 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
import copy
|
||||
import warnings
|
||||
import sys
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired, TypedDict, TypeAlias
|
||||
else:
|
||||
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
||||
from . import _utilities
|
||||
from . import region
|
||||
|
||||
__all__ = ['ProviderArgs', 'Provider']
|
||||
|
||||
@pulumi.input_type
|
||||
class ProviderArgs:
|
||||
def __init__(__self__, *,
|
||||
region: Optional[pulumi.Input['region.Region']] = None):
|
||||
"""
|
||||
The set of arguments for constructing a Provider resource.
|
||||
:param pulumi.Input['region.Region'] region: A region which should be used.
|
||||
"""
|
||||
if region is not None:
|
||||
pulumi.set(__self__, "region", region)
|
||||
|
||||
@property
|
||||
@pulumi.getter
|
||||
def region(self) -> Optional[pulumi.Input['region.Region']]:
|
||||
"""
|
||||
A region which should be used.
|
||||
"""
|
||||
return pulumi.get(self, "region")
|
||||
|
||||
@region.setter
|
||||
def region(self, value: Optional[pulumi.Input['region.Region']]):
|
||||
pulumi.set(self, "region", value)
|
||||
|
||||
|
||||
class Provider(pulumi.ProviderResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
region: Optional[pulumi.Input['region.Region']] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
The provider type for the xyz package. By default, resources use package-wide configuration
|
||||
settings, however an explicit `Provider` instance may be created and passed during resource
|
||||
construction to achieve fine-grained programmatic control over provider settings. See the
|
||||
[documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.
|
||||
|
||||
:param str resource_name: The name of the resource.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
:param pulumi.Input['region.Region'] region: A region which should be used.
|
||||
"""
|
||||
...
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
args: Optional[ProviderArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
The provider type for the xyz package. By default, resources use package-wide configuration
|
||||
settings, however an explicit `Provider` instance may be created and passed during resource
|
||||
construction to achieve fine-grained programmatic control over provider settings. See the
|
||||
[documentation](https://www.pulumi.com/docs/reference/programming-model/#providers) for more information.
|
||||
|
||||
:param str resource_name: The name of the resource.
|
||||
:param ProviderArgs args: The arguments to use to populate this resource's properties.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
def __init__(__self__, resource_name: str, *args, **kwargs):
|
||||
resource_args, opts = _utilities.get_resource_args_opts(ProviderArgs, pulumi.ResourceOptions, *args, **kwargs)
|
||||
if resource_args is not None:
|
||||
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
||||
else:
|
||||
__self__._internal_init(resource_name, *args, **kwargs)
|
||||
|
||||
def _internal_init(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
region: Optional[pulumi.Input['region.Region']] = None,
|
||||
__props__=None):
|
||||
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
|
||||
if not isinstance(opts, pulumi.ResourceOptions):
|
||||
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
||||
if opts.id is None:
|
||||
if __props__ is not None:
|
||||
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
||||
__props__ = ProviderArgs.__new__(ProviderArgs)
|
||||
|
||||
__props__.__dict__["region"] = pulumi.Output.from_input(region).apply(pulumi.runtime.to_json) if region is not None else None
|
||||
super(Provider, __self__).__init__(
|
||||
'xyz',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
||||
5
sdk/python/pulumi_xyz/pulumi-plugin.json
generated
Normal file
5
sdk/python/pulumi_xyz/pulumi-plugin.json
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"resource": true,
|
||||
"name": "xyz",
|
||||
"version": "1.0.0-alpha.0+dev"
|
||||
}
|
||||
0
sdk/python/pulumi_xyz/py.typed
generated
Normal file
0
sdk/python/pulumi_xyz/py.typed
generated
Normal file
9
sdk/python/pulumi_xyz/region/__init__.py
generated
Normal file
9
sdk/python/pulumi_xyz/region/__init__.py
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
from .. import _utilities
|
||||
import typing
|
||||
# Export this package's modules as members:
|
||||
from ._enums import *
|
||||
16
sdk/python/pulumi_xyz/region/_enums.py
generated
Normal file
16
sdk/python/pulumi_xyz/region/_enums.py
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
import builtins
|
||||
from enum import Enum
|
||||
|
||||
__all__ = [
|
||||
'Region',
|
||||
]
|
||||
|
||||
|
||||
class Region(builtins.str, Enum):
|
||||
HERE = "HERE"
|
||||
OVER_THERE = "OVER_THERE"
|
||||
149
sdk/python/pulumi_xyz/resource.py
generated
Normal file
149
sdk/python/pulumi_xyz/resource.py
generated
Normal file
@@ -0,0 +1,149 @@
|
||||
# coding=utf-8
|
||||
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
||||
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
||||
|
||||
import builtins
|
||||
import copy
|
||||
import warnings
|
||||
import sys
|
||||
import pulumi
|
||||
import pulumi.runtime
|
||||
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import NotRequired, TypedDict, TypeAlias
|
||||
else:
|
||||
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
||||
from . import _utilities
|
||||
|
||||
__all__ = ['ResourceArgs', 'Resource']
|
||||
|
||||
@pulumi.input_type
|
||||
class ResourceArgs:
|
||||
def __init__(__self__, *,
|
||||
sample_attribute: Optional[pulumi.Input[builtins.str]] = None):
|
||||
"""
|
||||
The set of arguments for constructing a Resource resource.
|
||||
:param pulumi.Input[builtins.str] sample_attribute: Sample attribute.
|
||||
"""
|
||||
if sample_attribute is not None:
|
||||
pulumi.set(__self__, "sample_attribute", sample_attribute)
|
||||
|
||||
@property
|
||||
@pulumi.getter(name="sampleAttribute")
|
||||
def sample_attribute(self) -> Optional[pulumi.Input[builtins.str]]:
|
||||
"""
|
||||
Sample attribute.
|
||||
"""
|
||||
return pulumi.get(self, "sample_attribute")
|
||||
|
||||
@sample_attribute.setter
|
||||
def sample_attribute(self, value: Optional[pulumi.Input[builtins.str]]):
|
||||
pulumi.set(self, "sample_attribute", value)
|
||||
|
||||
|
||||
@pulumi.input_type
|
||||
class _ResourceState:
|
||||
def __init__(__self__, *,
|
||||
sample_attribute: Optional[pulumi.Input[builtins.str]] = None):
|
||||
"""
|
||||
Input properties used for looking up and filtering Resource resources.
|
||||
:param pulumi.Input[builtins.str] sample_attribute: Sample attribute.
|
||||
"""
|
||||
if sample_attribute is not None:
|
||||
pulumi.set(__self__, "sample_attribute", sample_attribute)
|
||||
|
||||
@property
|
||||
@pulumi.getter(name="sampleAttribute")
|
||||
def sample_attribute(self) -> Optional[pulumi.Input[builtins.str]]:
|
||||
"""
|
||||
Sample attribute.
|
||||
"""
|
||||
return pulumi.get(self, "sample_attribute")
|
||||
|
||||
@sample_attribute.setter
|
||||
def sample_attribute(self, value: Optional[pulumi.Input[builtins.str]]):
|
||||
pulumi.set(self, "sample_attribute", value)
|
||||
|
||||
|
||||
class Resource(pulumi.CustomResource):
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
sample_attribute: Optional[pulumi.Input[builtins.str]] = None,
|
||||
__props__=None):
|
||||
"""
|
||||
Create a Resource resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
:param pulumi.Input[builtins.str] sample_attribute: Sample attribute.
|
||||
"""
|
||||
...
|
||||
@overload
|
||||
def __init__(__self__,
|
||||
resource_name: str,
|
||||
args: Optional[ResourceArgs] = None,
|
||||
opts: Optional[pulumi.ResourceOptions] = None):
|
||||
"""
|
||||
Create a Resource resource with the given unique name, props, and options.
|
||||
:param str resource_name: The name of the resource.
|
||||
:param ResourceArgs args: The arguments to use to populate this resource's properties.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
"""
|
||||
...
|
||||
def __init__(__self__, resource_name: str, *args, **kwargs):
|
||||
resource_args, opts = _utilities.get_resource_args_opts(ResourceArgs, pulumi.ResourceOptions, *args, **kwargs)
|
||||
if resource_args is not None:
|
||||
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
||||
else:
|
||||
__self__._internal_init(resource_name, *args, **kwargs)
|
||||
|
||||
def _internal_init(__self__,
|
||||
resource_name: str,
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
sample_attribute: Optional[pulumi.Input[builtins.str]] = None,
|
||||
__props__=None):
|
||||
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
|
||||
if not isinstance(opts, pulumi.ResourceOptions):
|
||||
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
||||
if opts.id is None:
|
||||
if __props__ is not None:
|
||||
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
||||
__props__ = ResourceArgs.__new__(ResourceArgs)
|
||||
|
||||
__props__.__dict__["sample_attribute"] = sample_attribute
|
||||
super(Resource, __self__).__init__(
|
||||
'xyz:index/resource:Resource',
|
||||
resource_name,
|
||||
__props__,
|
||||
opts)
|
||||
|
||||
@staticmethod
|
||||
def get(resource_name: str,
|
||||
id: pulumi.Input[str],
|
||||
opts: Optional[pulumi.ResourceOptions] = None,
|
||||
sample_attribute: Optional[pulumi.Input[builtins.str]] = None) -> 'Resource':
|
||||
"""
|
||||
Get an existing Resource resource's state with the given name, id, and optional extra
|
||||
properties used to qualify the lookup.
|
||||
|
||||
:param str resource_name: The unique name of the resulting resource.
|
||||
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
|
||||
:param pulumi.ResourceOptions opts: Options for the resource.
|
||||
:param pulumi.Input[builtins.str] sample_attribute: Sample attribute.
|
||||
"""
|
||||
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
|
||||
|
||||
__props__ = _ResourceState.__new__(_ResourceState)
|
||||
|
||||
__props__.__dict__["sample_attribute"] = sample_attribute
|
||||
return Resource(resource_name, opts=opts, __props__=__props__)
|
||||
|
||||
@property
|
||||
@pulumi.getter(name="sampleAttribute")
|
||||
def sample_attribute(self) -> pulumi.Output[Optional[builtins.str]]:
|
||||
"""
|
||||
Sample attribute.
|
||||
"""
|
||||
return pulumi.get(self, "sample_attribute")
|
||||
|
||||
22
sdk/python/pyproject.toml
generated
Normal file
22
sdk/python/pyproject.toml
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
[project]
|
||||
name = "pulumi_xyz"
|
||||
description = "A Pulumi package for creating and managing xyz cloud resources."
|
||||
dependencies = ["parver>=0.2.1", "pulumi>=3.142.0,<4.0.0", "semver>=2.8.1", "typing-extensions>=4.11; python_version < \"3.11\""]
|
||||
keywords = ["xyz", "category/cloud"]
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9"
|
||||
version = "1.0.0a0+dev"
|
||||
[project.license]
|
||||
text = "Apache-2.0"
|
||||
[project.urls]
|
||||
Homepage = "https://www.pulumi.com"
|
||||
Repository = "https://github.com/pulumi/pulumi-xyz"
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=61.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool]
|
||||
[tool.setuptools]
|
||||
[tool.setuptools.package-data]
|
||||
pulumi_xyz = ["py.typed", "pulumi-plugin.json"]
|
||||
Reference in New Issue
Block a user