Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .get() to Python SDK #435

Merged
merged 5 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- v1.14.x
- v1.13.x

### Improvements

- Add .get() to Python SDK. (https://github.com/pulumi/pulumi-kubernetes/pull/435).

### Bug fixes

- Align YAML parsing with core Kubernetes supported YAML subset. (https://github.com/pulumi/pulumi-kubernetes/pull/690).
Expand Down
12 changes: 11 additions & 1 deletion pkg/gen/python-templates/kind.py.mustache
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version


class {{Kind}}(pulumi.CustomResource):
{{{Comment}}}

def __init__(self, resource_name, opts=None{{#Properties}}, {{LanguageName}}=None{{/Properties}}, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -48,6 +53,11 @@ class {{Kind}}(pulumi.CustomResource):
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return {{Kind}}(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -13,6 +17,7 @@ class MutatingWebhookConfiguration(pulumi.CustomResource):
MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or
reject and may change the object.
"""

def __init__(self, resource_name, opts=None, metadata=None, webhooks=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -45,6 +50,11 @@ def __init__(self, resource_name, opts=None, metadata=None, webhooks=None, __nam
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return MutatingWebhookConfiguration(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -12,6 +16,7 @@ class MutatingWebhookConfigurationList(pulumi.CustomResource):
"""
MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration.
"""

def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -46,6 +51,11 @@ def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return MutatingWebhookConfigurationList(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -13,6 +17,7 @@ class ValidatingWebhookConfiguration(pulumi.CustomResource):
ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept
or reject and object without changing it.
"""

def __init__(self, resource_name, opts=None, metadata=None, webhooks=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -45,6 +50,11 @@ def __init__(self, resource_name, opts=None, metadata=None, webhooks=None, __nam
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return ValidatingWebhookConfiguration(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -12,6 +16,7 @@ class ValidatingWebhookConfigurationList(pulumi.CustomResource):
"""
ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration.
"""

def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -46,6 +51,11 @@ def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return ValidatingWebhookConfigurationList(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -13,6 +17,7 @@ class CustomResourceDefinition(pulumi.CustomResource):
CustomResourceDefinition represents a resource that should be exposed on the API server. Its
name MUST be in the format <.spec.name>.<.spec.group>.
"""

def __init__(self, resource_name, opts=None, metadata=None, spec=None, status=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -48,6 +53,11 @@ def __init__(self, resource_name, opts=None, metadata=None, spec=None, status=No
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return CustomResourceDefinition(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -12,6 +16,7 @@ class CustomResourceDefinitionList(pulumi.CustomResource):
"""
CustomResourceDefinitionList is a list of CustomResourceDefinition objects.
"""

def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -46,6 +51,11 @@ def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return CustomResourceDefinitionList(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
12 changes: 11 additions & 1 deletion sdk/python/pulumi_kubernetes/apiregistration/v1/APIService.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -12,6 +16,7 @@ class APIService(pulumi.CustomResource):
"""
APIService represents a server for a particular GroupVersion. Name must be "version.group".
"""

def __init__(self, resource_name, opts=None, metadata=None, spec=None, status=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -45,6 +50,11 @@ def __init__(self, resource_name, opts=None, metadata=None, spec=None, status=No
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return APIService(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -12,6 +16,7 @@ class APIServiceList(pulumi.CustomResource):
"""
APIServiceList is a list of APIService objects.
"""

def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -46,6 +51,11 @@ def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return APIServiceList(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -12,6 +16,7 @@ class APIService(pulumi.CustomResource):
"""
APIService represents a server for a particular GroupVersion. Name must be "version.group".
"""

def __init__(self, resource_name, opts=None, metadata=None, spec=None, status=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -45,6 +50,11 @@ def __init__(self, resource_name, opts=None, metadata=None, spec=None, status=No
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return APIService(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# *** WARNING: this file was generated by the Pulumi Kubernetes codegen tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
from copy import copy
from typing import Optional

import pulumi
import pulumi.runtime
import warnings
from pulumi import Input, ResourceOptions

from ... import tables, version

Expand All @@ -12,6 +16,7 @@ class APIServiceList(pulumi.CustomResource):
"""
APIServiceList is a list of APIService objects.
"""

def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__=None, __opts__=None):
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
Expand Down Expand Up @@ -46,6 +51,11 @@ def __init__(self, resource_name, opts=None, items=None, metadata=None, __name__
__props__,
opts)

@staticmethod
def get(name: str, id: Input[str], opts: Optional[ResourceOptions] = None):
opts = ResourceOptions(id=id) if opts is None else opts.merge(ResourceOptions(id=id))
return APIServiceList(name, opts)

def translate_output_property(self, prop: str) -> str:
return tables._CASING_FORWARD_TABLE.get(prop) or prop

Expand Down
Loading