From 108099b889781ffe845ef99ae60705930fdf60f9 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Wed, 7 Aug 2024 14:33:00 +1000 Subject: [PATCH] minor fixes --- examples/go/main.go | 14 +++++---- provider/aws/tagresources.go | 15 ++++++--- sdk/dotnet/Aws/Inputs/TagArgs.cs | 6 ++++ sdk/dotnet/Aws/Outputs/Tag.cs | 10 +++++- sdk/dotnet/Aws/ResourceTag.cs | 2 +- sdk/dotnet/Provider.cs | 2 +- sdk/dotnet/Utilities.cs | 2 +- sdk/dotnet/pulumi-plugin.json | 2 +- sdk/dotnet/version.txt | 2 +- sdk/go/awstags/aws/pulumiTypes.go | 12 +++++++ sdk/go/awstags/internal/pulumiUtilities.go | 4 +-- sdk/go/awstags/pulumi-plugin.json | 2 +- sdk/nodejs/package.json | 2 +- sdk/nodejs/types/input.ts | 2 ++ sdk/nodejs/types/output.ts | 2 ++ sdk/nodejs/utilities.ts | 2 +- sdk/python/pulumi_awstags/_utilities.py | 2 +- sdk/python/pulumi_awstags/aws/_inputs.py | 33 ++++++++++++++++++-- sdk/python/pulumi_awstags/aws/outputs.py | 25 +++++++++++++-- sdk/python/pulumi_awstags/pulumi-plugin.json | 2 +- 20 files changed, 113 insertions(+), 30 deletions(-) diff --git a/examples/go/main.go b/examples/go/main.go index 2bff2d7..f2f680f 100644 --- a/examples/go/main.go +++ b/examples/go/main.go @@ -1,21 +1,23 @@ package main import ( - "github.com/nitrictech/pulumi-awstags-native/sdk/v3/go/awstags" + "github.com/nitrictech/pulumi-awstags-native/sdk/v3/go/awstags/aws" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { - myRandomResource, err := awstags.NewRandom(ctx, "myRandomResource", &awstags.RandomArgs{ - Length: pulumi.Int(24), + _, err := aws.NewResourceTag(ctx, "myResourceTag", &aws.ResourceTagArgs{ + ResourceARN: pulumi.String("arn:aws:s3:::myBucket"), + Tag: &aws.TagArgs{ + Key: pulumi.String("myTagKey"), + Value: pulumi.String("myTagValue"), + }, }) + if err != nil { return err } - ctx.Export("output", map[string]interface{}{ - "value": myRandomResource.Result, - }) return nil }) } diff --git a/provider/aws/tagresources.go b/provider/aws/tagresources.go index 5151c0f..3cfc86d 100644 --- a/provider/aws/tagresources.go +++ b/provider/aws/tagresources.go @@ -30,14 +30,14 @@ var limiter = rate.NewLimiter(rate.Every(time.Second/5), 1) // - WireDependencies: Control how outputs and secrets flows through values. type ResourceTag struct{} -type tag struct { - Key string - Value string +type Tag struct { + Key string `pulumi:"key"` + Value string `pulumi:"value"` } type ResourceTagArgs struct { ResourceARN string `pulumi:"resourceARN"` - Tag tag `pulumi:"tag"` + Tag Tag `pulumi:"tag"` } type ResourceTagState struct { @@ -137,7 +137,7 @@ func removeTag(arn string, tagKey string) error { return nil } -func addTag(arn string, tag tag) error { +func addTag(arn string, tag Tag) error { // Group ARNs by region so we can make a single call to each region. region, err := getRegion(arn) if err != nil { @@ -171,6 +171,11 @@ func getRegion(arnString string) (string, error) { return "", err } + // S3 bucket ARNs are regionless, so we default to us-east-1. + if arn.Service == "s3" { + return "us-east-1", nil + } + return arn.Region, nil } diff --git a/sdk/dotnet/Aws/Inputs/TagArgs.cs b/sdk/dotnet/Aws/Inputs/TagArgs.cs index 286fe9a..5a151fb 100644 --- a/sdk/dotnet/Aws/Inputs/TagArgs.cs +++ b/sdk/dotnet/Aws/Inputs/TagArgs.cs @@ -12,6 +12,12 @@ namespace Pulumi.Awstags.Aws.Inputs public sealed class TagArgs : global::Pulumi.ResourceArgs { + [Input("key", required: true)] + public Input Key { get; set; } = null!; + + [Input("value", required: true)] + public Input Value { get; set; } = null!; + public TagArgs() { } diff --git a/sdk/dotnet/Aws/Outputs/Tag.cs b/sdk/dotnet/Aws/Outputs/Tag.cs index 6fb0a24..940581f 100644 --- a/sdk/dotnet/Aws/Outputs/Tag.cs +++ b/sdk/dotnet/Aws/Outputs/Tag.cs @@ -13,9 +13,17 @@ namespace Pulumi.Awstags.Aws.Outputs [OutputType] public sealed class Tag { + public readonly string Key; + public readonly string Value; + [OutputConstructor] - private Tag() + private Tag( + string key, + + string value) { + Key = key; + Value = value; } } } diff --git a/sdk/dotnet/Aws/ResourceTag.cs b/sdk/dotnet/Aws/ResourceTag.cs index 4325001..ff86349 100644 --- a/sdk/dotnet/Aws/ResourceTag.cs +++ b/sdk/dotnet/Aws/ResourceTag.cs @@ -41,7 +41,7 @@ private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, - PluginDownloadURL = "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz", + PluginDownloadURL = "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz", }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. diff --git a/sdk/dotnet/Provider.cs b/sdk/dotnet/Provider.cs index e4d7b14..3dece8f 100644 --- a/sdk/dotnet/Provider.cs +++ b/sdk/dotnet/Provider.cs @@ -29,7 +29,7 @@ private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, - PluginDownloadURL = "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz", + PluginDownloadURL = "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz", }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. diff --git a/sdk/dotnet/Utilities.cs b/sdk/dotnet/Utilities.cs index f0aa375..cd3c62b 100644 --- a/sdk/dotnet/Utilities.cs +++ b/sdk/dotnet/Utilities.cs @@ -53,7 +53,7 @@ static class Utilities { var dst = src ?? new global::Pulumi.InvokeOptions{}; dst.Version = src?.Version ?? Version; - dst.PluginDownloadURL = src?.PluginDownloadURL ?? "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz"; + dst.PluginDownloadURL = src?.PluginDownloadURL ?? "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz"; return dst; } diff --git a/sdk/dotnet/pulumi-plugin.json b/sdk/dotnet/pulumi-plugin.json index 8cfc59b..c045750 100644 --- a/sdk/dotnet/pulumi-plugin.json +++ b/sdk/dotnet/pulumi-plugin.json @@ -1,5 +1,5 @@ { "resource": true, "name": "awstags", - "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz" + "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz" } diff --git a/sdk/dotnet/version.txt b/sdk/dotnet/version.txt index 6927e8d..e5728d3 100644 --- a/sdk/dotnet/version.txt +++ b/sdk/dotnet/version.txt @@ -1 +1 @@ -0.0.1-alpha.1723003944+4bcb4a8b.dirty +0.0.1-alpha.1723004377+3996998c.dirty diff --git a/sdk/go/awstags/aws/pulumiTypes.go b/sdk/go/awstags/aws/pulumiTypes.go index dddb1f1..03a6a98 100644 --- a/sdk/go/awstags/aws/pulumiTypes.go +++ b/sdk/go/awstags/aws/pulumiTypes.go @@ -15,6 +15,8 @@ import ( var _ = internal.GetEnvOrDefault type Tag struct { + Key string `pulumi:"key"` + Value string `pulumi:"value"` } // TagInput is an input type that accepts TagArgs and TagOutput values. @@ -29,6 +31,8 @@ type TagInput interface { } type TagArgs struct { + Key pulumi.StringInput `pulumi:"key"` + Value pulumi.StringInput `pulumi:"value"` } func (TagArgs) ElementType() reflect.Type { @@ -69,6 +73,14 @@ func (o TagOutput) ToOutput(ctx context.Context) pulumix.Output[Tag] { } } +func (o TagOutput) Key() pulumi.StringOutput { + return o.ApplyT(func(v Tag) string { return v.Key }).(pulumi.StringOutput) +} + +func (o TagOutput) Value() pulumi.StringOutput { + return o.ApplyT(func(v Tag) string { return v.Value }).(pulumi.StringOutput) +} + func init() { pulumi.RegisterInputType(reflect.TypeOf((*TagInput)(nil)).Elem(), TagArgs{}) pulumi.RegisterOutputType(TagOutput{}) diff --git a/sdk/go/awstags/internal/pulumiUtilities.go b/sdk/go/awstags/internal/pulumiUtilities.go index 0ed96a9..6685657 100644 --- a/sdk/go/awstags/internal/pulumiUtilities.go +++ b/sdk/go/awstags/internal/pulumiUtilities.go @@ -93,7 +93,7 @@ func IsZero(v interface{}) bool { // PkgResourceDefaultOpts provides package level defaults to pulumi.OptionResource. func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOption { defaults := []pulumi.ResourceOption{} - defaults = append(defaults, pulumi.PluginDownloadURL("https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz")) + defaults = append(defaults, pulumi.PluginDownloadURL("https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz")) version := SdkVersion if !version.Equals(semver.Version{}) { defaults = append(defaults, pulumi.Version(version.String())) @@ -104,7 +104,7 @@ func PkgResourceDefaultOpts(opts []pulumi.ResourceOption) []pulumi.ResourceOptio // PkgInvokeDefaultOpts provides package level defaults to pulumi.OptionInvoke. func PkgInvokeDefaultOpts(opts []pulumi.InvokeOption) []pulumi.InvokeOption { defaults := []pulumi.InvokeOption{} - defaults = append(defaults, pulumi.PluginDownloadURL("https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz")) + defaults = append(defaults, pulumi.PluginDownloadURL("https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz")) version := SdkVersion if !version.Equals(semver.Version{}) { defaults = append(defaults, pulumi.Version(version.String())) diff --git a/sdk/go/awstags/pulumi-plugin.json b/sdk/go/awstags/pulumi-plugin.json index 8cfc59b..c045750 100644 --- a/sdk/go/awstags/pulumi-plugin.json +++ b/sdk/go/awstags/pulumi-plugin.json @@ -1,5 +1,5 @@ { "resource": true, "name": "awstags", - "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz" + "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz" } diff --git a/sdk/nodejs/package.json b/sdk/nodejs/package.json index 6d18327..29e8488 100644 --- a/sdk/nodejs/package.json +++ b/sdk/nodejs/package.json @@ -23,6 +23,6 @@ "pulumi": { "resource": true, "name": "awstags", - "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz" + "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz" } } diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index c5010aa..83940c6 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -7,5 +7,7 @@ import * as outputs from "../types/output"; export namespace aws { export interface TagArgs { + key: pulumi.Input; + value: pulumi.Input; } } diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index a7092e1..2f0508b 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -7,6 +7,8 @@ import * as outputs from "../types/output"; export namespace aws { export interface Tag { + key: string; + value: string; } } diff --git a/sdk/nodejs/utilities.ts b/sdk/nodejs/utilities.ts index 9b4aec4..589e4be 100644 --- a/sdk/nodejs/utilities.ts +++ b/sdk/nodejs/utilities.ts @@ -50,7 +50,7 @@ export function getVersion(): string { /** @internal */ export function resourceOptsDefaults(): any { - return { version: getVersion(), pluginDownloadURL: "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz" }; + return { version: getVersion(), pluginDownloadURL: "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz" }; } /** @internal */ diff --git a/sdk/python/pulumi_awstags/_utilities.py b/sdk/python/pulumi_awstags/_utilities.py index bd5f8db..cf972e8 100644 --- a/sdk/python/pulumi_awstags/_utilities.py +++ b/sdk/python/pulumi_awstags/_utilities.py @@ -247,4 +247,4 @@ def lifted_func(*args, opts=None, **kwargs): return (lambda _: lifted_func) def get_plugin_download_url(): - return "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz" + return "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz" diff --git a/sdk/python/pulumi_awstags/aws/_inputs.py b/sdk/python/pulumi_awstags/aws/_inputs.py index 9a86309..d697bc9 100644 --- a/sdk/python/pulumi_awstags/aws/_inputs.py +++ b/sdk/python/pulumi_awstags/aws/_inputs.py @@ -15,12 +15,39 @@ @pulumi.input_type class TagArgs: - def __init__(__self__): - pass + def __init__(__self__, *, + key: pulumi.Input[str], + value: pulumi.Input[str]): + TagArgs._configure( + lambda key, value: pulumi.set(__self__, key, value), + key=key, + value=value, + ) @staticmethod def _configure( _setter: Callable[[Any, Any], None], + key: pulumi.Input[str], + value: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None): - pass + _setter("key", key) + _setter("value", value) + + @property + @pulumi.getter + def key(self) -> pulumi.Input[str]: + return pulumi.get(self, "key") + + @key.setter + def key(self, value: pulumi.Input[str]): + pulumi.set(self, "key", value) + + @property + @pulumi.getter + def value(self) -> pulumi.Input[str]: + return pulumi.get(self, "value") + + @value.setter + def value(self, value: pulumi.Input[str]): + pulumi.set(self, "value", value) diff --git a/sdk/python/pulumi_awstags/aws/outputs.py b/sdk/python/pulumi_awstags/aws/outputs.py index 9c8fd71..1547054 100644 --- a/sdk/python/pulumi_awstags/aws/outputs.py +++ b/sdk/python/pulumi_awstags/aws/outputs.py @@ -15,12 +15,31 @@ @pulumi.output_type class Tag(dict): - def __init__(__self__): - pass + def __init__(__self__, *, + key: str, + value: str): + Tag._configure( + lambda key, value: pulumi.set(__self__, key, value), + key=key, + value=value, + ) @staticmethod def _configure( _setter: Callable[[Any, Any], None], + key: str, + value: str, opts: Optional[pulumi.ResourceOptions]=None): - pass + _setter("key", key) + _setter("value", value) + + @property + @pulumi.getter + def key(self) -> str: + return pulumi.get(self, "key") + + @property + @pulumi.getter + def value(self) -> str: + return pulumi.get(self, "value") diff --git a/sdk/python/pulumi_awstags/pulumi-plugin.json b/sdk/python/pulumi_awstags/pulumi-plugin.json index 8cfc59b..c045750 100644 --- a/sdk/python/pulumi_awstags/pulumi-plugin.json +++ b/sdk/python/pulumi_awstags/pulumi-plugin.json @@ -1,5 +1,5 @@ { "resource": true, "name": "awstags", - "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723003944+4bcb4a8b.dirty/pulumi-awstags-v0.0.1-alpha.1723003944+4bcb4a8b.dirty.tgz" + "server": "https://github.com/nitrictech/pulumi-awstags-native/releases/download/v0.0.1-alpha.1723004377+3996998c.dirty/pulumi-awstags-v0.0.1-alpha.1723004377+3996998c.dirty.tgz" }