Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jyecusch committed Aug 7, 2024
1 parent 3996998 commit 108099b
Show file tree
Hide file tree
Showing 20 changed files with 113 additions and 30 deletions.
14 changes: 8 additions & 6 deletions examples/go/main.go
Original file line number Diff line number Diff line change
@@ -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
})
}
15 changes: 10 additions & 5 deletions provider/aws/tagresources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down
6 changes: 6 additions & 0 deletions sdk/dotnet/Aws/Inputs/TagArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ namespace Pulumi.Awstags.Aws.Inputs

public sealed class TagArgs : global::Pulumi.ResourceArgs
{
[Input("key", required: true)]
public Input<string> Key { get; set; } = null!;

[Input("value", required: true)]
public Input<string> Value { get; set; } = null!;

public TagArgs()
{
}
Expand Down
10 changes: 9 additions & 1 deletion sdk/dotnet/Aws/Outputs/Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion sdk/dotnet/Aws/ResourceTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/pulumi-plugin.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion sdk/dotnet/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1-alpha.1723003944+4bcb4a8b.dirty
0.0.1-alpha.1723004377+3996998c.dirty
12 changes: 12 additions & 0 deletions sdk/go/awstags/aws/pulumiTypes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/awstags/internal/pulumiUtilities.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/go/awstags/pulumi-plugin.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion sdk/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 2 additions & 0 deletions sdk/nodejs/types/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ import * as outputs from "../types/output";

export namespace aws {
export interface TagArgs {
key: pulumi.Input<string>;
value: pulumi.Input<string>;
}
}
2 changes: 2 additions & 0 deletions sdk/nodejs/types/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as outputs from "../types/output";

export namespace aws {
export interface Tag {
key: string;
value: string;
}

}
2 changes: 1 addition & 1 deletion sdk/nodejs/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/pulumi_awstags/_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
33 changes: 30 additions & 3 deletions sdk/python/pulumi_awstags/aws/_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


25 changes: 22 additions & 3 deletions sdk/python/pulumi_awstags/aws/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


2 changes: 1 addition & 1 deletion sdk/python/pulumi_awstags/pulumi-plugin.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 108099b

Please sign in to comment.