Skip to content

Commit

Permalink
Update C# YAML GetResource implementation to compile with .NET v6 (#2122
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lblackstone committed Aug 9, 2022
1 parent 1d341e5 commit fd362bc
Show file tree
Hide file tree
Showing 3 changed files with 673 additions and 224 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

- Add a descriptive message for an invalid Patch delete (https://github.com/pulumi/pulumi-kubernetes/pull/2111)
- Fix erroneous resourceVersion diff for CRDs managed with SSA (https://github.com/pulumi/pulumi-kubernetes/pull/2121)
- Update C# YAML GetResource implementation to compile with .NET v6 (https://github.com/pulumi/pulumi-kubernetes/pull/2122)

## 3.20.2 (July 25, 2022)

Expand Down
12 changes: 9 additions & 3 deletions provider/pkg/gen/dotnet-templates/yaml/yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ namespace Pulumi.Kubernetes.Yaml
where T : KubernetesResource
{
var type = typeof(T);
var groupVersionKind =
string groupVersionKind;
switch(type)
{
{{- range .Resources}}
type == typeof({{.Package}}.{{.Name}}) ? "{{.GVK}}" :
case var t when t == typeof({{.Package}}.{{.Name}}):
groupVersionKind = "{{.GVK}}";
break;
{{- end}}
throw new ArgumentException($"Unknown resource type {typeof(T).FullName}");
default:
throw new ArgumentException($"Unknown resource type {typeof(T).FullName}");
}
var id = namespaceName != null ? $"{namespaceName}/{name}" : name;
return Resources.Apply(r =>
{
Expand Down
Loading

0 comments on commit fd362bc

Please sign in to comment.