diff --git a/provider/cmd/pulumi-resource-kubernetes/schema.json b/provider/cmd/pulumi-resource-kubernetes/schema.json index 139552edde..1d2bb343da 100644 --- a/provider/cmd/pulumi-resource-kubernetes/schema.json +++ b/provider/cmd/pulumi-resource-kubernetes/schema.json @@ -95186,7 +95186,7 @@ ] }, "kubernetes:yaml/v2:ConfigGroup": { - "description": "ConfigGroup creates a set of Kubernetes resources from Kubernetes YAML text. The YAML text\nmay be supplied using any of the following methods:\n\n1. Using a filename or a list of filenames:\n2. Using a file pattern or a list of file patterns:\n3. Using a literal string containing YAML, or a list of such strings:\n4. Any combination of files, patterns, or YAML strings:\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Local File\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: \"foo.yaml\",\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"foo.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"foo.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"foo.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Multiple Local Files\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: [\"foo.yaml\", \"bar.yaml\"],\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"foo.yaml\", \"bar.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"foo.yaml\", \"bar.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"foo.yaml\", \"bar.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Local File Pattern\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: \"yaml/*.yaml\",\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"yaml/*.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"yaml/*.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"yaml/*.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Multiple Local File Patterns\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: [\"foo/*.yaml\", \"bar/*.yaml\"],\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"foo/*.yaml\", \"bar/*.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"foo/*.yaml\", \"bar/*.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"yaml/*.yaml\", \"bar/*.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Literal YAML String\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n yaml: `\napiVersion: v1\nkind: Namespace\nmetadata:\n name: foo\n`,\n})\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n yaml=['''\napiVersion: v1\nkind: Namespace\nmetadata:\n name: foo\n''']\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Yaml = @\"\n apiVersion: v1\n kind: Namespace\n metadata:\n name: foo\n \",\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tYAML: []string{\n\t\t\t\t\t`\napiVersion: v1\nkind: Namespace\nmetadata:\n name: foo\n`,\n\t\t\t\t},\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### YAML with Transformations\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: \"foo.yaml\",\n transformations: [\n // Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer.\n (obj: any, opts: pulumi.CustomResourceOptions) => {\n if (obj.kind === \"Service\" && obj.apiVersion === \"v1\") {\n if (obj.spec && obj.spec.type && obj.spec.type === \"LoadBalancer\") {\n obj.spec.type = \"ClusterIP\";\n }\n }\n },\n\n // Set a resource alias for a previous name.\n (obj: any, opts: pulumi.CustomResourceOptions) => {\n if (obj.kind === \"Deployment\") {\n opts.aliases = [{ name: \"oldName\" }]\n }\n },\n\n // Omit a resource from the Chart by transforming the specified resource definition to an empty List.\n (obj: any, opts: pulumi.CustomResourceOptions) => {\n if (obj.kind === \"Pod\" && obj.metadata.name === \"test\") {\n obj.apiVersion = \"v1\"\n obj.kind = \"List\"\n }\n },\n ],\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\n# Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer.\ndef make_service_private(obj, opts):\n if obj[\"kind\"] == \"Service\" and obj[\"apiVersion\"] == \"v1\":\n try:\n t = obj[\"spec\"][\"type\"]\n if t == \"LoadBalancer\":\n obj[\"spec\"][\"type\"] = \"ClusterIP\"\n except KeyError:\n pass\n\n\n# Set a resource alias for a previous name.\ndef alias(obj, opts):\n if obj[\"kind\"] == \"Deployment\":\n opts.aliases = [\"oldName\"]\n\n\n# Omit a resource from the Chart by transforming the specified resource definition to an empty List.\ndef omit_resource(obj, opts):\n if obj[\"kind\"] == \"Pod\" and obj[\"metadata\"][\"name\"] == \"test\":\n obj[\"apiVersion\"] = \"v1\"\n obj[\"kind\"] = \"List\"\n\n\nexample = ConfigGroup(\n \"example\",\n files=[\"foo.yaml\"],\n transformations=[make_service_private, alias, omit_resource],\n)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"foo.yaml\" },\n Transformations =\n {\n LoadBalancerToClusterIP,\n ResourceAlias,\n OmitTestPod,\n }\n });\n\n // Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer.\n ImmutableDictionary LoadBalancerToClusterIP(ImmutableDictionary obj, CustomResourceOptions opts)\n {\n if ((string)obj[\"kind\"] == \"Service\" && (string)obj[\"apiVersion\"] == \"v1\")\n {\n var spec = (ImmutableDictionary)obj[\"spec\"];\n if (spec != null && (string)spec[\"type\"] == \"LoadBalancer\")\n {\n return obj.SetItem(\"spec\", spec.SetItem(\"type\", \"ClusterIP\"));\n }\n }\n\n return obj;\n }\n\n // Set a resource alias for a previous name.\n ImmutableDictionary ResourceAlias(ImmutableDictionary obj, CustomResourceOptions opts)\n {\n if ((string)obj[\"kind\"] == \"Deployment\")\n {\n opts.Aliases.Add(new Alias { Name = \"oldName\" });\n }\n\n return obj;\n }\n\n // Omit a resource from the Chart by transforming the specified resource definition to an empty List.\n ImmutableDictionary OmitTestPod(ImmutableDictionary obj, CustomResourceOptions opts)\n {\n var metadata = (ImmutableDictionary)obj[\"metadata\"];\n if ((string)obj[\"kind\"] == \"Pod\" && (string)metadata[\"name\"] == \"test\")\n {\n return new Dictionary\n {\n [\"apiVersion\"] = \"v1\",\n [\"kind\"] = \"List\",\n [\"items\"] = new Dictionary(),\n }.ToImmutableDictionary();\n }\n\n return obj;\n }\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"foo.yaml\"},\n\t\t\t\tTransformations: []yaml.Transformation{\n\t\t\t\t\t// Make every service private to the cluster, i.e., turn all services into ClusterIP\n\t\t\t\t\t// instead of LoadBalancer.\n\t\t\t\t\tfunc(state map[string]interface{}, opts ...pulumi.ResourceOption) {\n\t\t\t\t\t\tif state[\"kind\"] == \"Service\" {\n\t\t\t\t\t\t\tspec := state[\"spec\"].(map[string]interface{})\n\t\t\t\t\t\t\tspec[\"type\"] = \"ClusterIP\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// Set a resource alias for a previous name.\n\t\t\t\t\tfunc(state map[string]interface{}, opts ...pulumi.ResourceOption) {\n\t\t\t\t\t\tif state[\"kind\"] == \"Deployment\" {\n\t\t\t\t\t\t\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tName: pulumi.String(\"oldName\"),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\topts = append(opts, aliases)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// Omit a resource from the Chart by transforming the specified resource definition\n\t\t\t\t\t// to an empty List.\n\t\t\t\t\tfunc(state map[string]interface{}, opts ...pulumi.ResourceOption) {\n\t\t\t\t\t\tname := state[\"metadata\"].(map[string]interface{})[\"name\"]\n\t\t\t\t\t\tif state[\"kind\"] == \"Pod\" && name == \"test\" {\n\t\t\t\t\t\t\tstate[\"apiVersion\"] = \"core/v1\"\n\t\t\t\t\t\t\tstate[\"kind\"] = \"List\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{% /examples %}}\n", + "description": "ConfigGroup creates a set of Kubernetes resources from Kubernetes YAML text. The YAML text\nmay be supplied using any of the following methods:\n\n1. Using a filename or a list of filenames:\n2. Using a file pattern or a list of file patterns:\n3. Using a literal string containing YAML, or a list of such strings:\n4. Any combination of files, patterns, or YAML strings:\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Local File\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: \"foo.yaml\",\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"foo.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"foo.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"foo.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Multiple Local Files\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: [\"foo.yaml\", \"bar.yaml\"],\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"foo.yaml\", \"bar.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"foo.yaml\", \"bar.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"foo.yaml\", \"bar.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Local File Pattern\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: \"yaml/*.yaml\",\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"yaml/*.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"yaml/*.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"yaml/*.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Multiple Local File Patterns\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n files: [\"foo/*.yaml\", \"bar/*.yaml\"],\n});\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n files=[\"foo/*.yaml\", \"bar/*.yaml\"],\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Files = new[] { \"foo/*.yaml\", \"bar/*.yaml\" }\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tFiles: []string{\"yaml/*.yaml\", \"bar/*.yaml\"},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{{% example %}}\n### Literal YAML String\n\n```typescript\nimport * as k8s from \"@pulumi/kubernetes\";\n\nconst example = new k8s.yaml.v2.ConfigGroup(\"example\", {\n yaml: `\napiVersion: v1\nkind: Namespace\nmetadata:\n name: foo\n`,\n})\n```\n```python\nfrom pulumi_kubernetes.yaml.v2 import ConfigGroup\n\nexample = ConfigGroup(\n \"example\",\n yaml=['''\napiVersion: v1\nkind: Namespace\nmetadata:\n name: foo\n''']\n)\n```\n```csharp\nusing System.Threading.Tasks;\nusing Pulumi;\nusing Pulumi.Kubernetes.Yaml.V2;\n\nclass YamlStack : Stack\n{\n public YamlStack()\n {\n var helloWorld = new ConfigGroup(\"example\", new ConfigGroupArgs\n {\n Yaml = @\"\n apiVersion: v1\n kind: Namespace\n metadata:\n name: foo\n \",\n });\n }\n}\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := yaml.NewConfigGroup(ctx, \"example\",\n\t\t\t&yaml.ConfigGroupArgs{\n\t\t\t\tYAML: []string{\n\t\t\t\t\t`\napiVersion: v1\nkind: Namespace\nmetadata:\n name: foo\n`,\n\t\t\t\t},\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n}\n```\n{{% /example %}}\n{% /examples %}}\n", "properties": { "resources": { "type": "array", @@ -95199,32 +95199,18 @@ "type": "object", "inputProperties": { "files": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "Set of paths or a URLs that uniquely identify files." + "type": "array", + "items": { + "type": "string" + }, + "description": "Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns." }, "objs": { - "oneOf": [ - { - "$ref": "pulumi.json#/Any" - }, - { - "type": "array", - "items": { - "$ref": "pulumi.json#/Any" - } - } - ], - "description": "Objects representing Kubernetes resources." + "type": "array", + "items": { + "$ref": "pulumi.json#/Any" + }, + "description": "Objects representing Kubernetes resource configurations." }, "resourcePrefix": { "type": "string", @@ -95235,18 +95221,8 @@ "description": "Indicates that child resources should skip the await logic." }, "yaml": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "YAML text containing Kubernetes manifest(s)." + "type": "string", + "description": "A Kubernetes YAML manifest containing Kubernetes resource configuration(s)." } }, "isComponent": true diff --git a/provider/pkg/gen/overlays.go b/provider/pkg/gen/overlays.go index f703246009..db40834507 100644 --- a/provider/pkg/gen/overlays.go +++ b/provider/pkg/gen/overlays.go @@ -1170,35 +1170,21 @@ var yamlConfigGroupV2Resource = pschema.ResourceSpec{ InputProperties: map[string]pschema.PropertySpec{ "files": { TypeSpec: pschema.TypeSpec{ - OneOf: []pschema.TypeSpec{ - { - Type: "string", - }, - { - Type: "array", - Items: &pschema.TypeSpec{ - Type: "string", - }, - }, + Type: "array", + Items: &pschema.TypeSpec{ + Type: "string", }, }, - Description: "Set of paths or a URLs that uniquely identify files.", + Description: "Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns.", }, "objs": { TypeSpec: pschema.TypeSpec{ - OneOf: []pschema.TypeSpec{ - { - Ref: "pulumi.json#/Any", - }, - { - Type: "array", - Items: &pschema.TypeSpec{ - Ref: "pulumi.json#/Any", - }, - }, + Type: "array", + Items: &pschema.TypeSpec{ + Ref: "pulumi.json#/Any", }, }, - Description: "Objects representing Kubernetes resources.", + Description: "Objects representing Kubernetes resource configurations.", }, "resourcePrefix": { TypeSpec: pschema.TypeSpec{ @@ -1214,19 +1200,9 @@ var yamlConfigGroupV2Resource = pschema.ResourceSpec{ }, "yaml": { TypeSpec: pschema.TypeSpec{ - OneOf: []pschema.TypeSpec{ - { - Type: "string", - }, - { - Type: "array", - Items: &pschema.TypeSpec{ - Type: "string", - }, - }, - }, + Type: "string", }, - Description: "YAML text containing Kubernetes manifest(s).", + Description: "A Kubernetes YAML manifest containing Kubernetes resource configuration(s).", }, }, } diff --git a/provider/pkg/provider/yaml/v2/configgroup.go b/provider/pkg/provider/yaml/v2/configgroup.go index 5525fc6698..6179d84301 100644 --- a/provider/pkg/provider/yaml/v2/configgroup.go +++ b/provider/pkg/provider/yaml/v2/configgroup.go @@ -32,7 +32,7 @@ type ConfigGroupProvider struct { type ConfigGroupArgs struct { Files pulumi.StringArrayInput `pulumi:"files"` - YAML pulumi.StringArrayInput `pulumi:"yaml,optional"` + YAML pulumi.StringInput `pulumi:"yaml,optional"` Objects pulumi.MapArrayInput `pulumi:"objs,optional"` ResourcePrefix pulumi.StringInput `pulumi:"resourcePrefix,optional"` SkipAwait pulumi.BoolInput `pulumi:"skipAwait,optional"` @@ -80,7 +80,7 @@ func (k *ConfigGroupProvider) Construct(ctx *pulumi.Context, typ, name string, i // make type assertions to get each value (or the zero value) // note: "objects" contains unwrapped values at this point files, _ := args[0].([]string) - yaml, _ := args[1].([]string) + yaml, _ := args[1].(string) objects, _ := args[2].([]map[string]any) resourcePrefix, hasResourcePrefix := args[3].(string) skipAwait, _ := args[4].(bool) diff --git a/provider/pkg/provider/yaml/v2/configgroup_test.go b/provider/pkg/provider/yaml/v2/configgroup_test.go index 54b02691ae..396b870cef 100644 --- a/provider/pkg/provider/yaml/v2/configgroup_test.go +++ b/provider/pkg/provider/yaml/v2/configgroup_test.go @@ -123,7 +123,7 @@ var _ = Describe("Construct", func() { Describe("yamls", func() { Context("when the input is a valid YAML", func() { BeforeEach(func() { - inputs["yaml"] = resource.NewArrayProperty([]resource.PropertyValue{resource.NewStringProperty(manifest)}) + inputs["yaml"] = resource.NewStringProperty(manifest) }) commonAssertions() }) @@ -161,7 +161,7 @@ var _ = Describe("Construct", func() { Context("when the input value(s) are unknown", func() { BeforeEach(func() { req.DryRun = true - inputs["yaml"] = resource.MakeComputed(resource.NewArrayProperty([]resource.PropertyValue{resource.NewStringProperty("")})) + inputs["yaml"] = resource.MakeComputed(resource.NewStringProperty("")) }) It("should emit a warning", func(ctx context.Context) { diff --git a/provider/pkg/provider/yaml/v2/yaml.go b/provider/pkg/provider/yaml/v2/yaml.go index 68ef12ecf0..b3f649d5a7 100644 --- a/provider/pkg/provider/yaml/v2/yaml.go +++ b/provider/pkg/provider/yaml/v2/yaml.go @@ -38,7 +38,7 @@ import ( type ParseArgs struct { Files []string - YAML []string + YAML string Objects []unstructured.Unstructured ResourcePrefix string SkipAwait bool @@ -52,7 +52,7 @@ func ParseDecodeYamlFiles(ctx *pulumi.Context, args *ParseArgs, glob bool, clien objs = append(objs, args.Objects...) // Continue by gathering any other YAML from files provided. - yamls := args.YAML + yamls := []string{args.YAML} for _, file := range args.Files { // Read the raw YAML file(s) specified in the input file parameter. It might be a URL or a file path. var yaml []byte diff --git a/provider/pkg/provider/yaml/v2/yaml_test.go b/provider/pkg/provider/yaml/v2/yaml_test.go index 472fb6173c..d6275afe11 100644 --- a/provider/pkg/provider/yaml/v2/yaml_test.go +++ b/provider/pkg/provider/yaml/v2/yaml_test.go @@ -167,14 +167,14 @@ var _ = Describe("ParseDecodeYamlFiles", func() { Describe("yamls", func() { Context("when the input is a valid YAML string", func() { BeforeEach(func() { - args.YAML = []string{manifest} + args.YAML = manifest }) commonAssertions() }) Context("when the manifest is empty", func() { BeforeEach(func() { - args.YAML = []string{`---`} + args.YAML = "---" }) It("should do nothing", func(ctx context.Context) { _, err := parse(ctx) diff --git a/sdk/dotnet/Yaml/V2/ConfigGroup.cs b/sdk/dotnet/Yaml/V2/ConfigGroup.cs index 3c4612858a..b948ffe377 100644 --- a/sdk/dotnet/Yaml/V2/ConfigGroup.cs +++ b/sdk/dotnet/Yaml/V2/ConfigGroup.cs @@ -109,74 +109,6 @@ namespace Pulumi.Kubernetes.Yaml.V2 /// } /// } /// ``` - /// ### YAML with Transformations - /// ```csharp - /// using System.Collections.Generic; - /// using System.Collections.Immutable; - /// using System.Threading.Tasks; - /// using Pulumi; - /// using Pulumi.Kubernetes.Yaml.V2; - /// - /// class YamlStack : Stack - /// { - /// public YamlStack() - /// { - /// var helloWorld = new ConfigGroup("example", new ConfigGroupArgs - /// { - /// Files = new[] { "foo.yaml" }, - /// Transformations = - /// { - /// LoadBalancerToClusterIP, - /// ResourceAlias, - /// OmitTestPod, - /// } - /// }); - /// - /// // Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer. - /// ImmutableDictionary<string, object> LoadBalancerToClusterIP(ImmutableDictionary<string, object> obj, CustomResourceOptions opts) - /// { - /// if ((string)obj["kind"] == "Service" && (string)obj["apiVersion"] == "v1") - /// { - /// var spec = (ImmutableDictionary<string, object>)obj["spec"]; - /// if (spec != null && (string)spec["type"] == "LoadBalancer") - /// { - /// return obj.SetItem("spec", spec.SetItem("type", "ClusterIP")); - /// } - /// } - /// - /// return obj; - /// } - /// - /// // Set a resource alias for a previous name. - /// ImmutableDictionary<string, object> ResourceAlias(ImmutableDictionary<string, object> obj, CustomResourceOptions opts) - /// { - /// if ((string)obj["kind"] == "Deployment") - /// { - /// opts.Aliases.Add(new Alias { Name = "oldName" }); - /// } - /// - /// return obj; - /// } - /// - /// // Omit a resource from the Chart by transforming the specified resource definition to an empty List. - /// ImmutableDictionary<string, object> OmitTestPod(ImmutableDictionary<string, object> obj, CustomResourceOptions opts) - /// { - /// var metadata = (ImmutableDictionary<string, object>)obj["metadata"]; - /// if ((string)obj["kind"] == "Pod" && (string)metadata["name"] == "test") - /// { - /// return new Dictionary<string, object> - /// { - /// ["apiVersion"] = "v1", - /// ["kind"] = "List", - /// ["items"] = new Dictionary<string, object>(), - /// }.ToImmutableDictionary(); - /// } - /// - /// return obj; - /// } - /// } - /// } - /// ``` /// {% /examples %}} /// [KubernetesResourceType("kubernetes:yaml/v2:ConfigGroup")] @@ -219,17 +151,29 @@ namespace Pulumi.Kubernetes.Types.Inputs.Yaml.V2 public class ConfigGroupArgs : global::Pulumi.ResourceArgs { - /// - /// Set of paths or a URLs that uniquely identify files. - /// [Input("files")] - public InputUnion>? Files { get; set; } + private InputList? _files; /// - /// Objects representing Kubernetes resources. + /// Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. /// + public InputList Files + { + get => _files ?? (_files = new InputList()); + set => _files = value; + } + [Input("objs")] - public InputUnion>? Objs { get; set; } + private InputList? _objs; + + /// + /// Objects representing Kubernetes resource configurations. + /// + public InputList Objs + { + get => _objs ?? (_objs = new InputList()); + set => _objs = value; + } /// /// A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". @@ -244,10 +188,10 @@ public class ConfigGroupArgs : global::Pulumi.ResourceArgs public Input? SkipAwait { get; set; } /// - /// YAML text containing Kubernetes manifest(s). + /// A Kubernetes YAML manifest containing Kubernetes resource configuration(s). /// [Input("yaml")] - public InputUnion>? Yaml { get; set; } + public Input? Yaml { get; set; } public ConfigGroupArgs() { diff --git a/sdk/go/kubernetes/yaml/v2/configGroup.go b/sdk/go/kubernetes/yaml/v2/configGroup.go index ff5d23e8c1..8e2cdf777d 100644 --- a/sdk/go/kubernetes/yaml/v2/configGroup.go +++ b/sdk/go/kubernetes/yaml/v2/configGroup.go @@ -165,65 +165,6 @@ import ( // } // // ``` -// ### YAML with Transformations -// ```go -// package main -// -// import ( -// -// "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2" -// "github.com/pulumi/pulumi/sdk/v3/go/pulumi" -// -// ) -// -// func main() { -// pulumi.Run(func(ctx *pulumi.Context) error { -// _, err := yaml.NewConfigGroup(ctx, "example", -// &yaml.ConfigGroupArgs{ -// Files: []string{"foo.yaml"}, -// Transformations: []yaml.Transformation{ -// // Make every service private to the cluster, i.e., turn all services into ClusterIP -// // instead of LoadBalancer. -// func(state map[string]interface{}, opts ...pulumi.ResourceOption) { -// if state["kind"] == "Service" { -// spec := state["spec"].(map[string]interface{}) -// spec["type"] = "ClusterIP" -// } -// }, -// -// // Set a resource alias for a previous name. -// func(state map[string]interface{}, opts ...pulumi.ResourceOption) { -// if state["kind"] == "Deployment" { -// aliases := pulumi.Aliases([]pulumi.Alias{ -// { -// Name: pulumi.String("oldName"), -// }, -// }) -// opts = append(opts, aliases) -// } -// }, -// -// // Omit a resource from the Chart by transforming the specified resource definition -// // to an empty List. -// func(state map[string]interface{}, opts ...pulumi.ResourceOption) { -// name := state["metadata"].(map[string]interface{})["name"] -// if state["kind"] == "Pod" && name == "test" { -// state["apiVersion"] = "core/v1" -// state["kind"] = "List" -// } -// }, -// }, -// }, -// ) -// if err != nil { -// return err -// } -// -// return nil -// }) -// } -// -// ``` // {% /examples %}} type ConfigGroup struct { pulumi.ResourceState @@ -249,30 +190,30 @@ func NewConfigGroup(ctx *pulumi.Context, } type configGroupArgs struct { - // Set of paths or a URLs that uniquely identify files. - Files interface{} `pulumi:"files"` - // Objects representing Kubernetes resources. - Objs interface{} `pulumi:"objs"` + // Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. + Files []string `pulumi:"files"` + // Objects representing Kubernetes resource configurations. + Objs []interface{} `pulumi:"objs"` // A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". ResourcePrefix *string `pulumi:"resourcePrefix"` // Indicates that child resources should skip the await logic. SkipAwait *bool `pulumi:"skipAwait"` - // YAML text containing Kubernetes manifest(s). - Yaml interface{} `pulumi:"yaml"` + // A Kubernetes YAML manifest containing Kubernetes resource configuration(s). + Yaml *string `pulumi:"yaml"` } // The set of arguments for constructing a ConfigGroup resource. type ConfigGroupArgs struct { - // Set of paths or a URLs that uniquely identify files. - Files pulumi.Input - // Objects representing Kubernetes resources. - Objs pulumi.Input + // Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. + Files pulumi.StringArrayInput + // Objects representing Kubernetes resource configurations. + Objs pulumi.ArrayInput // A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". ResourcePrefix pulumi.StringPtrInput // Indicates that child resources should skip the await logic. SkipAwait pulumi.BoolPtrInput - // YAML text containing Kubernetes manifest(s). - Yaml pulumi.Input + // A Kubernetes YAML manifest containing Kubernetes resource configuration(s). + Yaml pulumi.StringPtrInput } func (ConfigGroupArgs) ElementType() reflect.Type { diff --git a/sdk/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java b/sdk/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java index 57cf877f70..c66dc02273 100644 --- a/sdk/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java +++ b/sdk/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java @@ -3,7 +3,6 @@ package com.pulumi.kubernetes.yaml_v2; -import com.pulumi.core.Either; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.Boolean; @@ -20,32 +19,32 @@ public final class ConfigGroupArgs extends com.pulumi.resources.ResourceArgs { public static final ConfigGroupArgs Empty = new ConfigGroupArgs(); /** - * Set of paths or a URLs that uniquely identify files. + * Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. * */ @Import(name="files") - private @Nullable Output>> files; + private @Nullable Output> files; /** - * @return Set of paths or a URLs that uniquely identify files. + * @return Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. * */ - public Optional>>> files() { + public Optional>> files() { return Optional.ofNullable(this.files); } /** - * Objects representing Kubernetes resources. + * Objects representing Kubernetes resource configurations. * */ @Import(name="objs") - private @Nullable Output>> objs; + private @Nullable Output> objs; /** - * @return Objects representing Kubernetes resources. + * @return Objects representing Kubernetes resource configurations. * */ - public Optional>>> objs() { + public Optional>> objs() { return Optional.ofNullable(this.objs); } @@ -80,17 +79,17 @@ public Optional> skipAwait() { } /** - * YAML text containing Kubernetes manifest(s). + * A Kubernetes YAML manifest containing Kubernetes resource configuration(s). * */ @Import(name="yaml") - private @Nullable Output>> yaml; + private @Nullable Output yaml; /** - * @return YAML text containing Kubernetes manifest(s). + * @return A Kubernetes YAML manifest containing Kubernetes resource configuration(s). * */ - public Optional>>> yaml() { + public Optional> yaml() { return Optional.ofNullable(this.yaml); } @@ -123,85 +122,65 @@ public Builder(ConfigGroupArgs defaults) { } /** - * @param files Set of paths or a URLs that uniquely identify files. + * @param files Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. * * @return builder * */ - public Builder files(@Nullable Output>> files) { + public Builder files(@Nullable Output> files) { $.files = files; return this; } /** - * @param files Set of paths or a URLs that uniquely identify files. + * @param files Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. * * @return builder * */ - public Builder files(Either> files) { + public Builder files(List files) { return files(Output.of(files)); } /** - * @param files Set of paths or a URLs that uniquely identify files. + * @param files Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. * * @return builder * */ - public Builder files(String files) { - return files(Either.ofLeft(files)); - } - - /** - * @param files Set of paths or a URLs that uniquely identify files. - * - * @return builder - * - */ - public Builder files(List files) { - return files(Either.ofRight(files)); + public Builder files(String... files) { + return files(List.of(files)); } /** - * @param objs Objects representing Kubernetes resources. + * @param objs Objects representing Kubernetes resource configurations. * * @return builder * */ - public Builder objs(@Nullable Output>> objs) { + public Builder objs(@Nullable Output> objs) { $.objs = objs; return this; } /** - * @param objs Objects representing Kubernetes resources. + * @param objs Objects representing Kubernetes resource configurations. * * @return builder * */ - public Builder objs(Either> objs) { + public Builder objs(List objs) { return objs(Output.of(objs)); } /** - * @param objs Objects representing Kubernetes resources. - * - * @return builder - * - */ - public Builder objs(Object objs) { - return objs(Either.ofLeft(objs)); - } - - /** - * @param objs Objects representing Kubernetes resources. + * @param objs Objects representing Kubernetes resource configurations. * * @return builder * */ - public Builder objs(List objs) { - return objs(Either.ofRight(objs)); + public Builder objs(Object... objs) { + return objs(List.of(objs)); } /** @@ -247,44 +226,24 @@ public Builder skipAwait(Boolean skipAwait) { } /** - * @param yaml YAML text containing Kubernetes manifest(s). + * @param yaml A Kubernetes YAML manifest containing Kubernetes resource configuration(s). * * @return builder * */ - public Builder yaml(@Nullable Output>> yaml) { + public Builder yaml(@Nullable Output yaml) { $.yaml = yaml; return this; } /** - * @param yaml YAML text containing Kubernetes manifest(s). - * - * @return builder - * - */ - public Builder yaml(Either> yaml) { - return yaml(Output.of(yaml)); - } - - /** - * @param yaml YAML text containing Kubernetes manifest(s). + * @param yaml A Kubernetes YAML manifest containing Kubernetes resource configuration(s). * * @return builder * */ public Builder yaml(String yaml) { - return yaml(Either.ofLeft(yaml)); - } - - /** - * @param yaml YAML text containing Kubernetes manifest(s). - * - * @return builder - * - */ - public Builder yaml(List yaml) { - return yaml(Either.ofRight(yaml)); + return yaml(Output.of(yaml)); } public ConfigGroupArgs build() { diff --git a/sdk/nodejs/yaml/v2/configGroup.ts b/sdk/nodejs/yaml/v2/configGroup.ts index 85d06fdc42..be25598b8e 100644 --- a/sdk/nodejs/yaml/v2/configGroup.ts +++ b/sdk/nodejs/yaml/v2/configGroup.ts @@ -64,40 +64,6 @@ import * as utilities from "../../utilities"; * `, * }) * ``` - * ### YAML with Transformations - * - * ```typescript - * import * as k8s from "@pulumi/kubernetes"; - * - * const example = new k8s.yaml.v2.ConfigGroup("example", { - * files: "foo.yaml", - * transformations: [ - * // Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer. - * (obj: any, opts: pulumi.CustomResourceOptions) => { - * if (obj.kind === "Service" && obj.apiVersion === "v1") { - * if (obj.spec && obj.spec.type && obj.spec.type === "LoadBalancer") { - * obj.spec.type = "ClusterIP"; - * } - * } - * }, - * - * // Set a resource alias for a previous name. - * (obj: any, opts: pulumi.CustomResourceOptions) => { - * if (obj.kind === "Deployment") { - * opts.aliases = [{ name: "oldName" }] - * } - * }, - * - * // Omit a resource from the Chart by transforming the specified resource definition to an empty List. - * (obj: any, opts: pulumi.CustomResourceOptions) => { - * if (obj.kind === "Pod" && obj.metadata.name === "test") { - * obj.apiVersion = "v1" - * obj.kind = "List" - * } - * }, - * ], - * }); - * ``` * {% /examples %}} */ export class ConfigGroup extends pulumi.ComponentResource { @@ -150,13 +116,13 @@ export class ConfigGroup extends pulumi.ComponentResource { */ export interface ConfigGroupArgs { /** - * Set of paths or a URLs that uniquely identify files. + * Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. */ - files?: pulumi.Input[]>; + files?: pulumi.Input[]>; /** - * Objects representing Kubernetes resources. + * Objects representing Kubernetes resource configurations. */ - objs?: pulumi.Input; + objs?: pulumi.Input; /** * A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". */ @@ -166,7 +132,7 @@ export interface ConfigGroupArgs { */ skipAwait?: pulumi.Input; /** - * YAML text containing Kubernetes manifest(s). + * A Kubernetes YAML manifest containing Kubernetes resource configuration(s). */ - yaml?: pulumi.Input[]>; + yaml?: pulumi.Input; } diff --git a/sdk/python/pulumi_kubernetes/yaml/v2/ConfigGroup.py b/sdk/python/pulumi_kubernetes/yaml/v2/ConfigGroup.py index b2216ea68d..3fd02d979a 100644 --- a/sdk/python/pulumi_kubernetes/yaml/v2/ConfigGroup.py +++ b/sdk/python/pulumi_kubernetes/yaml/v2/ConfigGroup.py @@ -14,18 +14,18 @@ @pulumi.input_type class ConfigGroupArgs: def __init__(__self__, *, - files: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]] = None, - objs: Optional[pulumi.Input[Union[Any, Sequence[Any]]]] = None, + files: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + objs: Optional[pulumi.Input[Sequence[Any]]] = None, resource_prefix: Optional[pulumi.Input[str]] = None, skip_await: Optional[pulumi.Input[bool]] = None, - yaml: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]] = None): + yaml: Optional[pulumi.Input[str]] = None): """ The set of arguments for constructing a ConfigGroup resource. - :param pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]] files: Set of paths or a URLs that uniquely identify files. - :param pulumi.Input[Union[Any, Sequence[Any]]] objs: Objects representing Kubernetes resources. + :param pulumi.Input[Sequence[pulumi.Input[str]]] files: Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. + :param pulumi.Input[Sequence[Any]] objs: Objects representing Kubernetes resource configurations. :param pulumi.Input[str] resource_prefix: A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". :param pulumi.Input[bool] skip_await: Indicates that child resources should skip the await logic. - :param pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]] yaml: YAML text containing Kubernetes manifest(s). + :param pulumi.Input[str] yaml: A Kubernetes YAML manifest containing Kubernetes resource configuration(s). """ if files is not None: pulumi.set(__self__, "files", files) @@ -40,26 +40,26 @@ def __init__(__self__, *, @property @pulumi.getter - def files(self) -> Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]]: + def files(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: """ - Set of paths or a URLs that uniquely identify files. + Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. """ return pulumi.get(self, "files") @files.setter - def files(self, value: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]]): + def files(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): pulumi.set(self, "files", value) @property @pulumi.getter - def objs(self) -> Optional[pulumi.Input[Union[Any, Sequence[Any]]]]: + def objs(self) -> Optional[pulumi.Input[Sequence[Any]]]: """ - Objects representing Kubernetes resources. + Objects representing Kubernetes resource configurations. """ return pulumi.get(self, "objs") @objs.setter - def objs(self, value: Optional[pulumi.Input[Union[Any, Sequence[Any]]]]): + def objs(self, value: Optional[pulumi.Input[Sequence[Any]]]): pulumi.set(self, "objs", value) @property @@ -88,14 +88,14 @@ def skip_await(self, value: Optional[pulumi.Input[bool]]): @property @pulumi.getter - def yaml(self) -> Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]]: + def yaml(self) -> Optional[pulumi.Input[str]]: """ - YAML text containing Kubernetes manifest(s). + A Kubernetes YAML manifest containing Kubernetes resource configuration(s). """ return pulumi.get(self, "yaml") @yaml.setter - def yaml(self, value: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]]): + def yaml(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "yaml", value) @@ -104,11 +104,11 @@ class ConfigGroup(pulumi.ComponentResource): def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, - files: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]] = None, - objs: Optional[pulumi.Input[Union[Any, Sequence[Any]]]] = None, + files: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + objs: Optional[pulumi.Input[Sequence[Any]]] = None, resource_prefix: Optional[pulumi.Input[str]] = None, skip_await: Optional[pulumi.Input[bool]] = None, - yaml: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]] = None, + yaml: Optional[pulumi.Input[str]] = None, __props__=None): """ ConfigGroup creates a set of Kubernetes resources from Kubernetes YAML text. The YAML text @@ -170,49 +170,15 @@ def __init__(__self__, '''] ) ``` - ### YAML with Transformations - ```python - from pulumi_kubernetes.yaml.v2 import ConfigGroup - - # Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer. - def make_service_private(obj, opts): - if obj["kind"] == "Service" and obj["apiVersion"] == "v1": - try: - t = obj["spec"]["type"] - if t == "LoadBalancer": - obj["spec"]["type"] = "ClusterIP" - except KeyError: - pass - - - # Set a resource alias for a previous name. - def alias(obj, opts): - if obj["kind"] == "Deployment": - opts.aliases = ["oldName"] - - - # Omit a resource from the Chart by transforming the specified resource definition to an empty List. - def omit_resource(obj, opts): - if obj["kind"] == "Pod" and obj["metadata"]["name"] == "test": - obj["apiVersion"] = "v1" - obj["kind"] = "List" - - - example = ConfigGroup( - "example", - files=["foo.yaml"], - transformations=[make_service_private, alias, omit_resource], - ) - ``` {% /examples %}} :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. - :param pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]] files: Set of paths or a URLs that uniquely identify files. - :param pulumi.Input[Union[Any, Sequence[Any]]] objs: Objects representing Kubernetes resources. + :param pulumi.Input[Sequence[pulumi.Input[str]]] files: Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns. + :param pulumi.Input[Sequence[Any]] objs: Objects representing Kubernetes resource configurations. :param pulumi.Input[str] resource_prefix: A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". :param pulumi.Input[bool] skip_await: Indicates that child resources should skip the await logic. - :param pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]] yaml: YAML text containing Kubernetes manifest(s). + :param pulumi.Input[str] yaml: A Kubernetes YAML manifest containing Kubernetes resource configuration(s). """ ... @overload @@ -280,40 +246,6 @@ def __init__(__self__, '''] ) ``` - ### YAML with Transformations - ```python - from pulumi_kubernetes.yaml.v2 import ConfigGroup - - # Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer. - def make_service_private(obj, opts): - if obj["kind"] == "Service" and obj["apiVersion"] == "v1": - try: - t = obj["spec"]["type"] - if t == "LoadBalancer": - obj["spec"]["type"] = "ClusterIP" - except KeyError: - pass - - - # Set a resource alias for a previous name. - def alias(obj, opts): - if obj["kind"] == "Deployment": - opts.aliases = ["oldName"] - - - # Omit a resource from the Chart by transforming the specified resource definition to an empty List. - def omit_resource(obj, opts): - if obj["kind"] == "Pod" and obj["metadata"]["name"] == "test": - obj["apiVersion"] = "v1" - obj["kind"] = "List" - - - example = ConfigGroup( - "example", - files=["foo.yaml"], - transformations=[make_service_private, alias, omit_resource], - ) - ``` {% /examples %}} :param str resource_name: The name of the resource. @@ -331,11 +263,11 @@ def __init__(__self__, resource_name: str, *args, **kwargs): def _internal_init(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, - files: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]] = None, - objs: Optional[pulumi.Input[Union[Any, Sequence[Any]]]] = None, + files: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + objs: Optional[pulumi.Input[Sequence[Any]]] = None, resource_prefix: Optional[pulumi.Input[str]] = None, skip_await: Optional[pulumi.Input[bool]] = None, - yaml: Optional[pulumi.Input[Union[str, Sequence[pulumi.Input[str]]]]] = None, + yaml: Optional[pulumi.Input[str]] = None, __props__=None): opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts) if not isinstance(opts, pulumi.ResourceOptions):