diff --git a/provider/go.mod b/provider/go.mod index 5d4eec6f..bfd4f73d 100644 --- a/provider/go.mod +++ b/provider/go.mod @@ -44,7 +44,6 @@ require ( github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-git/go-git/v5 v5.12.0 // indirect github.com/go-logr/logr v1.4.2 // indirect - github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect diff --git a/provider/go.sum b/provider/go.sum index 0fe6c1d6..e200ea73 100644 --- a/provider/go.sum +++ b/provider/go.sum @@ -74,12 +74,8 @@ github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMj github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= @@ -91,12 +87,8 @@ github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20230406165453-00490a63f317 h1:hFhpt7CTmR3DX+b4R19ydQFtofxT0Sv3QsKNMVQYTMQ= -github.com/google/pprof v0.0.0-20230406165453-00490a63f317/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -152,14 +144,8 @@ github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A= github.com/natefinch/atomic v1.0.1/go.mod h1:N/D/ELrljoqDyT3rZrsUmtsuzvHkeB/wWjHV22AZRbM= -github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= -github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0= github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA= -github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= -github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= -github.com/onsi/gomega v1.34.0 h1:eSSPsPNp6ZpsG8X1OVmOTxig+CblTc4AxpPBykhe2Os= -github.com/onsi/gomega v1.34.0/go.mod h1:MIKI8c+f+QLWk+hxbePD4i0LMJSExPaZOVfkoex4cAo= github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= github.com/opentracing/basictracer-go v1.1.0 h1:Oa1fTSBvAl8pa3U+IJYqrKm0NALwH9OsgwOqDv4xJW0= diff --git a/provider/pkg/provider/cmd/command.go b/provider/pkg/provider/cmd/command.go index 52c964e1..fe64e107 100644 --- a/provider/pkg/provider/cmd/command.go +++ b/provider/pkg/provider/cmd/command.go @@ -2,7 +2,6 @@ package cmd import ( "context" - "encoding/json" "fmt" pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1" @@ -37,13 +36,6 @@ func (s *CommandState[T]) Create(ctx context.Context, inputs T, preview bool) er return fmt.Errorf("creating provisioner: %w", err) } - temp, err := json.Marshal(inputs.ExpectedFiles()) - if err != nil { - return fmt.Errorf("failed marshalling json: %w", err) - } - - log.Info(string(temp)) - log.Debug("sending create request") res, err := p.Create(ctx, &pb.CreateRequest{ Command: inputs.Cmd(), @@ -53,6 +45,11 @@ func (s *CommandState[T]) Create(ctx context.Context, inputs T, preview bool) er return fmt.Errorf("sending create request: %w", err) } + if res.Files == nil { + log.Debug("files was empty, this is probably a bug somewhere else") + res.Files = []string{} + } + s.Args = inputs s.ExitCode = int(res.Result.ExitCode) s.Stdout = res.Result.Stdout diff --git a/provider/pkg/provider/cmd/rm.go b/provider/pkg/provider/cmd/rm.go new file mode 100644 index 00000000..bb98c290 --- /dev/null +++ b/provider/pkg/provider/cmd/rm.go @@ -0,0 +1,78 @@ +package cmd + +import ( + "context" + "fmt" + + "github.com/pulumi/pulumi-go-provider/infer" + pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1" +) + +type RmArgs struct { + Dir bool `pulumi:"dir,optional"` + Files []string `pulumi:"files"` + Force bool `pulumi:"force,optional"` + Help bool `pulumi:"help,optional"` + OneFileSystem bool `pulumi:"oneFileSystem,optional"` + Recursive bool `pulumi:"recursive,optional"` + Verbose bool `pulumi:"verbose,optional"` +} + +// Cmd implements CommandArgs. +func (r RmArgs) Cmd() *pb.Command { + b := builder{r.Files} + b.op(r.Dir, "--dir") + b.op(r.Force, "--force") + b.op(r.Help, "--help") + b.op(r.OneFileSystem, "--one-file-system") + b.op(r.Verbose, "--verbose") + + return &pb.Command{ + Bin: pb.Bin_BIN_RM, + Args: b.args, + } +} + +// ExpectedFiles implements CommandArgs. +func (r RmArgs) ExpectedFiles() []string { + return []string{} +} + +var _ CommandArgs = RmArgs{} + +type Rm struct{} + +type RmState = CommandState[RmArgs] + +// Create implements infer.CustomCreate. +func (Rm) Create(ctx context.Context, name string, inputs RmArgs, preview bool) (id string, output RmState, err error) { + state := RmState{} + if err := state.Create(ctx, inputs, preview); err != nil { + return name, state, fmt.Errorf("wget: %w", err) + } + + return name, state, nil +} + +// Update implements infer.CustomUpdate. +func (Rm) Update(ctx context.Context, id string, olds RmState, news RmArgs, preview bool) (RmState, error) { + state, err := olds.Update(ctx, news, preview) + if err != nil { + return olds, fmt.Errorf("wget: %w", err) + } + + return state, nil +} + +// Delete implements infer.CustomDelete. +func (Rm) Delete(ctx context.Context, id string, props RmState) error { + if err := props.Delete(ctx); err != nil { + return fmt.Errorf("wget: %w", err) + } + + return nil +} + +var _ = (infer.CustomCreate[RmArgs, RmState])((*Rm)(nil)) +var _ = (infer.CustomUpdate[RmArgs, RmState])((*Rm)(nil)) +var _ = (infer.CustomDelete[RmState])((*Rm)(nil)) diff --git a/provider/provider.go b/provider/provider.go index 51367bb7..7d1a0cdf 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -46,6 +46,7 @@ func Provider() p.Provider { }, Config: infer.Config[provider.Config](), Resources: []infer.InferredResource{ + infer.Resource[cmd.Rm](), infer.Resource[cmd.Tee](), infer.Resource[cmd.Wget](), }, diff --git a/sdk/dotnet/Cmd/Outputs/RmArgs.cs b/sdk/dotnet/Cmd/Outputs/RmArgs.cs new file mode 100644 index 00000000..43ee08a3 --- /dev/null +++ b/sdk/dotnet/Cmd/Outputs/RmArgs.cs @@ -0,0 +1,50 @@ +// *** WARNING: this file was generated by pulumi. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; +using Pulumi; + +namespace UnMango.Baremetal.Cmd.Outputs +{ + + [OutputType] + public sealed class RmArgs + { + public readonly bool? Dir; + public readonly ImmutableArray Files; + public readonly bool? Force; + public readonly bool? Help; + public readonly bool? OneFileSystem; + public readonly bool? Recursive; + public readonly bool? Verbose; + + [OutputConstructor] + private RmArgs( + bool? dir, + + ImmutableArray files, + + bool? force, + + bool? help, + + bool? oneFileSystem, + + bool? recursive, + + bool? verbose) + { + Dir = dir; + Files = files; + Force = force; + Help = help; + OneFileSystem = oneFileSystem; + Recursive = recursive; + Verbose = verbose; + } + } +} diff --git a/sdk/dotnet/Cmd/Rm.cs b/sdk/dotnet/Cmd/Rm.cs new file mode 100644 index 00000000..083ea955 --- /dev/null +++ b/sdk/dotnet/Cmd/Rm.cs @@ -0,0 +1,108 @@ +// *** WARNING: this file was generated by pulumi. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; +using Pulumi; + +namespace UnMango.Baremetal.Cmd +{ + [BaremetalResourceType("baremetal:cmd:Rm")] + public partial class Rm : global::Pulumi.CustomResource + { + [Output("args")] + public Output Args { get; private set; } = null!; + + [Output("createdFiles")] + public Output> CreatedFiles { get; private set; } = null!; + + [Output("exitCode")] + public Output ExitCode { get; private set; } = null!; + + [Output("stderr")] + public Output Stderr { get; private set; } = null!; + + [Output("stdout")] + public Output Stdout { get; private set; } = null!; + + + /// + /// Create a Rm resource with the given unique name, arguments, and options. + /// + /// + /// The unique name of the resource + /// The arguments used to populate this resource's properties + /// A bag of options that control this resource's behavior + public Rm(string name, RmArgs args, CustomResourceOptions? options = null) + : base("baremetal:cmd:Rm", name, args ?? new RmArgs(), MakeResourceOptions(options, "")) + { + } + + private Rm(string name, Input id, CustomResourceOptions? options = null) + : base("baremetal:cmd:Rm", name, null, MakeResourceOptions(options, id)) + { + } + + private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input? id) + { + var defaultOptions = new CustomResourceOptions + { + Version = Utilities.Version, + PluginDownloadURL = "github://api.github.com/unmango", + }; + var merged = CustomResourceOptions.Merge(defaultOptions, options); + // Override the ID if one was specified for consistency with other language SDKs. + merged.Id = id ?? merged.Id; + return merged; + } + /// + /// Get an existing Rm resource's state with the given name, ID, and optional extra + /// properties used to qualify the lookup. + /// + /// + /// The unique name of the resulting resource. + /// The unique provider ID of the resource to lookup. + /// A bag of options that control this resource's behavior + public static Rm Get(string name, Input id, CustomResourceOptions? options = null) + { + return new Rm(name, id, options); + } + } + + public sealed class RmArgs : global::Pulumi.ResourceArgs + { + [Input("dir")] + public Input? Dir { get; set; } + + [Input("files", required: true)] + private InputList? _files; + public InputList Files + { + get => _files ?? (_files = new InputList()); + set => _files = value; + } + + [Input("force")] + public Input? Force { get; set; } + + [Input("help")] + public Input? Help { get; set; } + + [Input("oneFileSystem")] + public Input? OneFileSystem { get; set; } + + [Input("recursive")] + public Input? Recursive { get; set; } + + [Input("verbose")] + public Input? Verbose { get; set; } + + public RmArgs() + { + } + public static new RmArgs Empty => new RmArgs(); + } +} diff --git a/sdk/go/baremetal/cmd/init.go b/sdk/go/baremetal/cmd/init.go index b62596a0..e25b86c1 100644 --- a/sdk/go/baremetal/cmd/init.go +++ b/sdk/go/baremetal/cmd/init.go @@ -21,6 +21,8 @@ func (m *module) Version() semver.Version { func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) { switch typ { + case "baremetal:cmd:Rm": + r = &Rm{} case "baremetal:cmd:Tee": r = &Tee{} case "baremetal:cmd:Wget": diff --git a/sdk/go/baremetal/cmd/pulumiTypes.go b/sdk/go/baremetal/cmd/pulumiTypes.go index 87d4c49f..ab9302ff 100644 --- a/sdk/go/baremetal/cmd/pulumiTypes.go +++ b/sdk/go/baremetal/cmd/pulumiTypes.go @@ -14,6 +14,64 @@ import ( var _ = internal.GetEnvOrDefault +type RmArgsType struct { + Dir *bool `pulumi:"dir"` + Files []string `pulumi:"files"` + Force *bool `pulumi:"force"` + Help *bool `pulumi:"help"` + OneFileSystem *bool `pulumi:"oneFileSystem"` + Recursive *bool `pulumi:"recursive"` + Verbose *bool `pulumi:"verbose"` +} + +type RmArgsTypeOutput struct{ *pulumi.OutputState } + +func (RmArgsTypeOutput) ElementType() reflect.Type { + return reflect.TypeOf((*RmArgsType)(nil)).Elem() +} + +func (o RmArgsTypeOutput) ToRmArgsTypeOutput() RmArgsTypeOutput { + return o +} + +func (o RmArgsTypeOutput) ToRmArgsTypeOutputWithContext(ctx context.Context) RmArgsTypeOutput { + return o +} + +func (o RmArgsTypeOutput) ToOutput(ctx context.Context) pulumix.Output[RmArgsType] { + return pulumix.Output[RmArgsType]{ + OutputState: o.OutputState, + } +} + +func (o RmArgsTypeOutput) Dir() pulumi.BoolPtrOutput { + return o.ApplyT(func(v RmArgsType) *bool { return v.Dir }).(pulumi.BoolPtrOutput) +} + +func (o RmArgsTypeOutput) Files() pulumi.StringArrayOutput { + return o.ApplyT(func(v RmArgsType) []string { return v.Files }).(pulumi.StringArrayOutput) +} + +func (o RmArgsTypeOutput) Force() pulumi.BoolPtrOutput { + return o.ApplyT(func(v RmArgsType) *bool { return v.Force }).(pulumi.BoolPtrOutput) +} + +func (o RmArgsTypeOutput) Help() pulumi.BoolPtrOutput { + return o.ApplyT(func(v RmArgsType) *bool { return v.Help }).(pulumi.BoolPtrOutput) +} + +func (o RmArgsTypeOutput) OneFileSystem() pulumi.BoolPtrOutput { + return o.ApplyT(func(v RmArgsType) *bool { return v.OneFileSystem }).(pulumi.BoolPtrOutput) +} + +func (o RmArgsTypeOutput) Recursive() pulumi.BoolPtrOutput { + return o.ApplyT(func(v RmArgsType) *bool { return v.Recursive }).(pulumi.BoolPtrOutput) +} + +func (o RmArgsTypeOutput) Verbose() pulumi.BoolPtrOutput { + return o.ApplyT(func(v RmArgsType) *bool { return v.Verbose }).(pulumi.BoolPtrOutput) +} + type TeeArgsType struct { Append *bool `pulumi:"append"` Content string `pulumi:"content"` @@ -306,6 +364,7 @@ func (o WgetArgsTypeOutput) Wait() pulumi.StringPtrOutput { } func init() { + pulumi.RegisterOutputType(RmArgsTypeOutput{}) pulumi.RegisterOutputType(TeeArgsTypeOutput{}) pulumi.RegisterOutputType(WgetArgsTypeOutput{}) } diff --git a/sdk/go/baremetal/cmd/rm.go b/sdk/go/baremetal/cmd/rm.go new file mode 100644 index 00000000..cb21b3c9 --- /dev/null +++ b/sdk/go/baremetal/cmd/rm.go @@ -0,0 +1,161 @@ +// Code generated by pulumi-language-go DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package cmd + +import ( + "context" + "reflect" + + "errors" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "github.com/pulumi/pulumi/sdk/v3/go/pulumix" + "github.com/unmango/pulumi-baremetal/sdk/go/baremetal/internal" +) + +type Rm struct { + pulumi.CustomResourceState + + Args RmArgsTypeOutput `pulumi:"args"` + CreatedFiles pulumi.StringArrayOutput `pulumi:"createdFiles"` + ExitCode pulumi.IntOutput `pulumi:"exitCode"` + Stderr pulumi.StringOutput `pulumi:"stderr"` + Stdout pulumi.StringOutput `pulumi:"stdout"` +} + +// NewRm registers a new resource with the given unique name, arguments, and options. +func NewRm(ctx *pulumi.Context, + name string, args *RmArgs, opts ...pulumi.ResourceOption) (*Rm, error) { + if args == nil { + return nil, errors.New("missing one or more required arguments") + } + + if args.Files == nil { + return nil, errors.New("invalid value for required argument 'Files'") + } + opts = internal.PkgResourceDefaultOpts(opts) + var resource Rm + err := ctx.RegisterResource("baremetal:cmd:Rm", name, args, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// GetRm gets an existing Rm resource's state with the given name, ID, and optional +// state properties that are used to uniquely qualify the lookup (nil if not required). +func GetRm(ctx *pulumi.Context, + name string, id pulumi.IDInput, state *RmState, opts ...pulumi.ResourceOption) (*Rm, error) { + var resource Rm + err := ctx.ReadResource("baremetal:cmd:Rm", name, id, state, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// Input properties used for looking up and filtering Rm resources. +type rmState struct { +} + +type RmState struct { +} + +func (RmState) ElementType() reflect.Type { + return reflect.TypeOf((*rmState)(nil)).Elem() +} + +type rmArgs struct { + Dir *bool `pulumi:"dir"` + Files []string `pulumi:"files"` + Force *bool `pulumi:"force"` + Help *bool `pulumi:"help"` + OneFileSystem *bool `pulumi:"oneFileSystem"` + Recursive *bool `pulumi:"recursive"` + Verbose *bool `pulumi:"verbose"` +} + +// The set of arguments for constructing a Rm resource. +type RmArgs struct { + Dir pulumi.BoolPtrInput + Files pulumi.StringArrayInput + Force pulumi.BoolPtrInput + Help pulumi.BoolPtrInput + OneFileSystem pulumi.BoolPtrInput + Recursive pulumi.BoolPtrInput + Verbose pulumi.BoolPtrInput +} + +func (RmArgs) ElementType() reflect.Type { + return reflect.TypeOf((*rmArgs)(nil)).Elem() +} + +type RmInput interface { + pulumi.Input + + ToRmOutput() RmOutput + ToRmOutputWithContext(ctx context.Context) RmOutput +} + +func (*Rm) ElementType() reflect.Type { + return reflect.TypeOf((**Rm)(nil)).Elem() +} + +func (i *Rm) ToRmOutput() RmOutput { + return i.ToRmOutputWithContext(context.Background()) +} + +func (i *Rm) ToRmOutputWithContext(ctx context.Context) RmOutput { + return pulumi.ToOutputWithContext(ctx, i).(RmOutput) +} + +func (i *Rm) ToOutput(ctx context.Context) pulumix.Output[*Rm] { + return pulumix.Output[*Rm]{ + OutputState: i.ToRmOutputWithContext(ctx).OutputState, + } +} + +type RmOutput struct{ *pulumi.OutputState } + +func (RmOutput) ElementType() reflect.Type { + return reflect.TypeOf((**Rm)(nil)).Elem() +} + +func (o RmOutput) ToRmOutput() RmOutput { + return o +} + +func (o RmOutput) ToRmOutputWithContext(ctx context.Context) RmOutput { + return o +} + +func (o RmOutput) ToOutput(ctx context.Context) pulumix.Output[*Rm] { + return pulumix.Output[*Rm]{ + OutputState: o.OutputState, + } +} + +func (o RmOutput) Args() RmArgsTypeOutput { + return o.ApplyT(func(v *Rm) RmArgsTypeOutput { return v.Args }).(RmArgsTypeOutput) +} + +func (o RmOutput) CreatedFiles() pulumi.StringArrayOutput { + return o.ApplyT(func(v *Rm) pulumi.StringArrayOutput { return v.CreatedFiles }).(pulumi.StringArrayOutput) +} + +func (o RmOutput) ExitCode() pulumi.IntOutput { + return o.ApplyT(func(v *Rm) pulumi.IntOutput { return v.ExitCode }).(pulumi.IntOutput) +} + +func (o RmOutput) Stderr() pulumi.StringOutput { + return o.ApplyT(func(v *Rm) pulumi.StringOutput { return v.Stderr }).(pulumi.StringOutput) +} + +func (o RmOutput) Stdout() pulumi.StringOutput { + return o.ApplyT(func(v *Rm) pulumi.StringOutput { return v.Stdout }).(pulumi.StringOutput) +} + +func init() { + pulumi.RegisterInputType(reflect.TypeOf((*RmInput)(nil)).Elem(), &Rm{}) + pulumi.RegisterOutputType(RmOutput{}) +} diff --git a/sdk/go/baremetal/x/cmd/init.go b/sdk/go/baremetal/x/cmd/init.go index b62596a0..e25b86c1 100644 --- a/sdk/go/baremetal/x/cmd/init.go +++ b/sdk/go/baremetal/x/cmd/init.go @@ -21,6 +21,8 @@ func (m *module) Version() semver.Version { func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) { switch typ { + case "baremetal:cmd:Rm": + r = &Rm{} case "baremetal:cmd:Tee": r = &Tee{} case "baremetal:cmd:Wget": diff --git a/sdk/go/baremetal/x/cmd/pulumiTypes.go b/sdk/go/baremetal/x/cmd/pulumiTypes.go index 3fad6957..0007d397 100644 --- a/sdk/go/baremetal/x/cmd/pulumiTypes.go +++ b/sdk/go/baremetal/x/cmd/pulumiTypes.go @@ -14,6 +14,65 @@ import ( var _ = internal.GetEnvOrDefault +type RmArgsType struct { + Dir *bool `pulumi:"dir"` + Files []string `pulumi:"files"` + Force *bool `pulumi:"force"` + Help *bool `pulumi:"help"` + OneFileSystem *bool `pulumi:"oneFileSystem"` + Recursive *bool `pulumi:"recursive"` + Verbose *bool `pulumi:"verbose"` +} + +type RmArgsTypeOutput struct{ *pulumi.OutputState } + +func (RmArgsTypeOutput) ElementType() reflect.Type { + return reflect.TypeOf((*RmArgsType)(nil)).Elem() +} + +func (o RmArgsTypeOutput) ToRmArgsTypeOutput() RmArgsTypeOutput { + return o +} + +func (o RmArgsTypeOutput) ToRmArgsTypeOutputWithContext(ctx context.Context) RmArgsTypeOutput { + return o +} + +func (o RmArgsTypeOutput) ToOutput(ctx context.Context) pulumix.Output[RmArgsType] { + return pulumix.Output[RmArgsType]{ + OutputState: o.OutputState, + } +} + +func (o RmArgsTypeOutput) Dir() pulumix.Output[*bool] { + return pulumix.Apply[RmArgsType](o, func(v RmArgsType) *bool { return v.Dir }) +} + +func (o RmArgsTypeOutput) Files() pulumix.ArrayOutput[string] { + value := pulumix.Apply[RmArgsType](o, func(v RmArgsType) []string { return v.Files }) + return pulumix.ArrayOutput[string]{OutputState: value.OutputState} +} + +func (o RmArgsTypeOutput) Force() pulumix.Output[*bool] { + return pulumix.Apply[RmArgsType](o, func(v RmArgsType) *bool { return v.Force }) +} + +func (o RmArgsTypeOutput) Help() pulumix.Output[*bool] { + return pulumix.Apply[RmArgsType](o, func(v RmArgsType) *bool { return v.Help }) +} + +func (o RmArgsTypeOutput) OneFileSystem() pulumix.Output[*bool] { + return pulumix.Apply[RmArgsType](o, func(v RmArgsType) *bool { return v.OneFileSystem }) +} + +func (o RmArgsTypeOutput) Recursive() pulumix.Output[*bool] { + return pulumix.Apply[RmArgsType](o, func(v RmArgsType) *bool { return v.Recursive }) +} + +func (o RmArgsTypeOutput) Verbose() pulumix.Output[*bool] { + return pulumix.Apply[RmArgsType](o, func(v RmArgsType) *bool { return v.Verbose }) +} + type TeeArgsType struct { Append *bool `pulumi:"append"` Content string `pulumi:"content"` @@ -309,6 +368,7 @@ func (o WgetArgsTypeOutput) Wait() pulumix.Output[*string] { } func init() { + pulumi.RegisterOutputType(RmArgsTypeOutput{}) pulumi.RegisterOutputType(TeeArgsTypeOutput{}) pulumi.RegisterOutputType(WgetArgsTypeOutput{}) } diff --git a/sdk/go/baremetal/x/cmd/rm.go b/sdk/go/baremetal/x/cmd/rm.go new file mode 100644 index 00000000..01375336 --- /dev/null +++ b/sdk/go/baremetal/x/cmd/rm.go @@ -0,0 +1,142 @@ +// Code generated by pulumi-language-go DO NOT EDIT. +// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** + +package cmd + +import ( + "context" + "reflect" + + "errors" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "github.com/pulumi/pulumi/sdk/v3/go/pulumix" + "github.com/unmango/pulumi-baremetal/sdk/go/baremetal/internal" +) + +type Rm struct { + pulumi.CustomResourceState + + Args pulumix.GPtrOutput[RmArgsType, RmArgsTypeOutput] `pulumi:"args"` + CreatedFiles pulumix.ArrayOutput[string] `pulumi:"createdFiles"` + ExitCode pulumix.Output[int] `pulumi:"exitCode"` + Stderr pulumix.Output[string] `pulumi:"stderr"` + Stdout pulumix.Output[string] `pulumi:"stdout"` +} + +// NewRm registers a new resource with the given unique name, arguments, and options. +func NewRm(ctx *pulumi.Context, + name string, args *RmArgs, opts ...pulumi.ResourceOption) (*Rm, error) { + if args == nil { + return nil, errors.New("missing one or more required arguments") + } + + if args.Files == nil { + return nil, errors.New("invalid value for required argument 'Files'") + } + opts = internal.PkgResourceDefaultOpts(opts) + var resource Rm + err := ctx.RegisterResource("baremetal:cmd:Rm", name, args, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// GetRm gets an existing Rm resource's state with the given name, ID, and optional +// state properties that are used to uniquely qualify the lookup (nil if not required). +func GetRm(ctx *pulumi.Context, + name string, id pulumi.IDInput, state *RmState, opts ...pulumi.ResourceOption) (*Rm, error) { + var resource Rm + err := ctx.ReadResource("baremetal:cmd:Rm", name, id, state, &resource, opts...) + if err != nil { + return nil, err + } + return &resource, nil +} + +// Input properties used for looking up and filtering Rm resources. +type rmState struct { +} + +type RmState struct { +} + +func (RmState) ElementType() reflect.Type { + return reflect.TypeOf((*rmState)(nil)).Elem() +} + +type rmArgs struct { + Dir *bool `pulumi:"dir"` + Files []string `pulumi:"files"` + Force *bool `pulumi:"force"` + Help *bool `pulumi:"help"` + OneFileSystem *bool `pulumi:"oneFileSystem"` + Recursive *bool `pulumi:"recursive"` + Verbose *bool `pulumi:"verbose"` +} + +// The set of arguments for constructing a Rm resource. +type RmArgs struct { + Dir pulumix.Input[*bool] + Files pulumix.Input[[]string] + Force pulumix.Input[*bool] + Help pulumix.Input[*bool] + OneFileSystem pulumix.Input[*bool] + Recursive pulumix.Input[*bool] + Verbose pulumix.Input[*bool] +} + +func (RmArgs) ElementType() reflect.Type { + return reflect.TypeOf((*rmArgs)(nil)).Elem() +} + +type RmOutput struct{ *pulumi.OutputState } + +func (RmOutput) ElementType() reflect.Type { + return reflect.TypeOf((*Rm)(nil)).Elem() +} + +func (o RmOutput) ToRmOutput() RmOutput { + return o +} + +func (o RmOutput) ToRmOutputWithContext(ctx context.Context) RmOutput { + return o +} + +func (o RmOutput) ToOutput(ctx context.Context) pulumix.Output[Rm] { + return pulumix.Output[Rm]{ + OutputState: o.OutputState, + } +} + +func (o RmOutput) Args() pulumix.GPtrOutput[RmArgsType, RmArgsTypeOutput] { + value := pulumix.Apply[Rm](o, func(v Rm) pulumix.GPtrOutput[RmArgsType, RmArgsTypeOutput] { return v.Args }) + unwrapped := pulumix.Flatten[*RmArgsType, pulumix.GPtrOutput[RmArgsType, RmArgsTypeOutput]](value) + return pulumix.GPtrOutput[RmArgsType, RmArgsTypeOutput]{OutputState: unwrapped.OutputState} +} + +func (o RmOutput) CreatedFiles() pulumix.ArrayOutput[string] { + value := pulumix.Apply[Rm](o, func(v Rm) pulumix.ArrayOutput[string] { return v.CreatedFiles }) + unwrapped := pulumix.Flatten[[]string, pulumix.ArrayOutput[string]](value) + return pulumix.ArrayOutput[string]{OutputState: unwrapped.OutputState} +} + +func (o RmOutput) ExitCode() pulumix.Output[int] { + value := pulumix.Apply[Rm](o, func(v Rm) pulumix.Output[int] { return v.ExitCode }) + return pulumix.Flatten[int, pulumix.Output[int]](value) +} + +func (o RmOutput) Stderr() pulumix.Output[string] { + value := pulumix.Apply[Rm](o, func(v Rm) pulumix.Output[string] { return v.Stderr }) + return pulumix.Flatten[string, pulumix.Output[string]](value) +} + +func (o RmOutput) Stdout() pulumix.Output[string] { + value := pulumix.Apply[Rm](o, func(v Rm) pulumix.Output[string] { return v.Stdout }) + return pulumix.Flatten[string, pulumix.Output[string]](value) +} + +func init() { + pulumi.RegisterOutputType(RmOutput{}) +} diff --git a/sdk/nodejs/cmd/index.ts b/sdk/nodejs/cmd/index.ts index 6e39e827..d72ff02d 100644 --- a/sdk/nodejs/cmd/index.ts +++ b/sdk/nodejs/cmd/index.ts @@ -5,6 +5,11 @@ import * as pulumi from "@pulumi/pulumi"; import * as utilities from "../utilities"; // Export members: +export { RmArgs } from "./rm"; +export type Rm = import("./rm").Rm; +export const Rm: typeof import("./rm").Rm = null as any; +utilities.lazyLoad(exports, ["Rm"], () => require("./rm")); + export { TeeArgs } from "./tee"; export type Tee = import("./tee").Tee; export const Tee: typeof import("./tee").Tee = null as any; @@ -20,6 +25,8 @@ const _module = { version: utilities.getVersion(), construct: (name: string, type: string, urn: string): pulumi.Resource => { switch (type) { + case "baremetal:cmd:Rm": + return new Rm(name, undefined, { urn }) case "baremetal:cmd:Tee": return new Tee(name, undefined, { urn }) case "baremetal:cmd:Wget": diff --git a/sdk/nodejs/cmd/rm.ts b/sdk/nodejs/cmd/rm.ts new file mode 100644 index 00000000..55be2a1d --- /dev/null +++ b/sdk/nodejs/cmd/rm.ts @@ -0,0 +1,91 @@ +// *** WARNING: this file was generated by pulumi-language-nodejs. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +import * as pulumi from "@pulumi/pulumi"; +import * as inputs from "../types/input"; +import * as outputs from "../types/output"; +import * as utilities from "../utilities"; + +export class Rm extends pulumi.CustomResource { + /** + * Get an existing Rm resource's state with the given name, ID, and optional extra + * properties used to qualify the lookup. + * + * @param name The _unique_ name of the resulting resource. + * @param id The _unique_ provider ID of the resource to lookup. + * @param opts Optional settings to control the behavior of the CustomResource. + */ + public static get(name: string, id: pulumi.Input, opts?: pulumi.CustomResourceOptions): Rm { + return new Rm(name, undefined as any, { ...opts, id: id }); + } + + /** @internal */ + public static readonly __pulumiType = 'baremetal:cmd:Rm'; + + /** + * Returns true if the given object is an instance of Rm. This is designed to work even + * when multiple copies of the Pulumi SDK have been loaded into the same process. + */ + public static isInstance(obj: any): obj is Rm { + if (obj === undefined || obj === null) { + return false; + } + return obj['__pulumiType'] === Rm.__pulumiType; + } + + public /*out*/ readonly args!: pulumi.Output; + public /*out*/ readonly createdFiles!: pulumi.Output; + public /*out*/ readonly exitCode!: pulumi.Output; + public /*out*/ readonly stderr!: pulumi.Output; + public /*out*/ readonly stdout!: pulumi.Output; + + /** + * Create a Rm resource with the given unique name, arguments, and options. + * + * @param name The _unique_ name of the resource. + * @param args The arguments to use to populate this resource's properties. + * @param opts A bag of options that control this resource's behavior. + */ + constructor(name: string, args: RmArgs, opts?: pulumi.CustomResourceOptions) { + let resourceInputs: pulumi.Inputs = {}; + opts = opts || {}; + if (!opts.id) { + if ((!args || args.files === undefined) && !opts.urn) { + throw new Error("Missing required property 'files'"); + } + resourceInputs["dir"] = args ? args.dir : undefined; + resourceInputs["files"] = args ? args.files : undefined; + resourceInputs["force"] = args ? args.force : undefined; + resourceInputs["help"] = args ? args.help : undefined; + resourceInputs["oneFileSystem"] = args ? args.oneFileSystem : undefined; + resourceInputs["recursive"] = args ? args.recursive : undefined; + resourceInputs["verbose"] = args ? args.verbose : undefined; + resourceInputs["args"] = undefined /*out*/; + resourceInputs["createdFiles"] = undefined /*out*/; + resourceInputs["exitCode"] = undefined /*out*/; + resourceInputs["stderr"] = undefined /*out*/; + resourceInputs["stdout"] = undefined /*out*/; + } else { + resourceInputs["args"] = undefined /*out*/; + resourceInputs["createdFiles"] = undefined /*out*/; + resourceInputs["exitCode"] = undefined /*out*/; + resourceInputs["stderr"] = undefined /*out*/; + resourceInputs["stdout"] = undefined /*out*/; + } + opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); + super(Rm.__pulumiType, name, resourceInputs, opts); + } +} + +/** + * The set of arguments for constructing a Rm resource. + */ +export interface RmArgs { + dir?: pulumi.Input; + files: pulumi.Input[]>; + force?: pulumi.Input; + help?: pulumi.Input; + oneFileSystem?: pulumi.Input; + recursive?: pulumi.Input; + verbose?: pulumi.Input; +} diff --git a/sdk/nodejs/tsconfig.json b/sdk/nodejs/tsconfig.json index a341fdc1..83266f17 100644 --- a/sdk/nodejs/tsconfig.json +++ b/sdk/nodejs/tsconfig.json @@ -14,6 +14,7 @@ }, "files": [ "cmd/index.ts", + "cmd/rm.ts", "cmd/tee.ts", "cmd/wget.ts", "config/index.ts", diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index e48c563b..1e057234 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -6,6 +6,16 @@ import * as inputs from "../types/input"; import * as outputs from "../types/output"; export namespace cmd { + export interface RmArgs { + dir?: boolean; + files: string[]; + force?: boolean; + help?: boolean; + oneFileSystem?: boolean; + recursive?: boolean; + verbose?: boolean; + } + export interface TeeArgs { append?: boolean; content: string; diff --git a/sdk/python/unmango_baremetal/__init__.py b/sdk/python/unmango_baremetal/__init__.py index 26da8cd5..28de72ac 100644 --- a/sdk/python/unmango_baremetal/__init__.py +++ b/sdk/python/unmango_baremetal/__init__.py @@ -25,6 +25,7 @@ "mod": "cmd", "fqn": "unmango_baremetal.cmd", "classes": { + "baremetal:cmd:Rm": "Rm", "baremetal:cmd:Tee": "Tee", "baremetal:cmd:Wget": "Wget" } diff --git a/sdk/python/unmango_baremetal/cmd/__init__.py b/sdk/python/unmango_baremetal/cmd/__init__.py index f0207029..6b8cb98a 100644 --- a/sdk/python/unmango_baremetal/cmd/__init__.py +++ b/sdk/python/unmango_baremetal/cmd/__init__.py @@ -5,6 +5,7 @@ from .. import _utilities import typing # Export this package's modules as members: +from .rm import * from .tee import * from .wget import * from . import outputs diff --git a/sdk/python/unmango_baremetal/cmd/outputs.py b/sdk/python/unmango_baremetal/cmd/outputs.py index 2ade7b2f..2d0a8ce5 100644 --- a/sdk/python/unmango_baremetal/cmd/outputs.py +++ b/sdk/python/unmango_baremetal/cmd/outputs.py @@ -10,10 +10,88 @@ from .. import _utilities __all__ = [ + 'RmArgs', 'TeeArgs', 'WgetArgs', ] +@pulumi.output_type +class RmArgs(dict): + @staticmethod + def __key_warning(key: str): + suggest = None + if key == "oneFileSystem": + suggest = "one_file_system" + + if suggest: + pulumi.log.warn(f"Key '{key}' not found in RmArgs. Access the value via the '{suggest}' property getter instead.") + + def __getitem__(self, key: str) -> Any: + RmArgs.__key_warning(key) + return super().__getitem__(key) + + def get(self, key: str, default = None) -> Any: + RmArgs.__key_warning(key) + return super().get(key, default) + + def __init__(__self__, *, + files: Sequence[str], + dir: Optional[bool] = None, + force: Optional[bool] = None, + help: Optional[bool] = None, + one_file_system: Optional[bool] = None, + recursive: Optional[bool] = None, + verbose: Optional[bool] = None): + pulumi.set(__self__, "files", files) + if dir is not None: + pulumi.set(__self__, "dir", dir) + if force is not None: + pulumi.set(__self__, "force", force) + if help is not None: + pulumi.set(__self__, "help", help) + if one_file_system is not None: + pulumi.set(__self__, "one_file_system", one_file_system) + if recursive is not None: + pulumi.set(__self__, "recursive", recursive) + if verbose is not None: + pulumi.set(__self__, "verbose", verbose) + + @property + @pulumi.getter + def files(self) -> Sequence[str]: + return pulumi.get(self, "files") + + @property + @pulumi.getter + def dir(self) -> Optional[bool]: + return pulumi.get(self, "dir") + + @property + @pulumi.getter + def force(self) -> Optional[bool]: + return pulumi.get(self, "force") + + @property + @pulumi.getter + def help(self) -> Optional[bool]: + return pulumi.get(self, "help") + + @property + @pulumi.getter(name="oneFileSystem") + def one_file_system(self) -> Optional[bool]: + return pulumi.get(self, "one_file_system") + + @property + @pulumi.getter + def recursive(self) -> Optional[bool]: + return pulumi.get(self, "recursive") + + @property + @pulumi.getter + def verbose(self) -> Optional[bool]: + return pulumi.get(self, "verbose") + + @pulumi.output_type class TeeArgs(dict): def __init__(__self__, *, diff --git a/sdk/python/unmango_baremetal/cmd/rm.py b/sdk/python/unmango_baremetal/cmd/rm.py new file mode 100644 index 00000000..6288895f --- /dev/null +++ b/sdk/python/unmango_baremetal/cmd/rm.py @@ -0,0 +1,230 @@ +# coding=utf-8 +# *** WARNING: this file was generated by pulumi-language-python. *** +# *** Do not edit by hand unless you're certain you know what you are doing! *** + +import copy +import warnings +import pulumi +import pulumi.runtime +from typing import Any, Mapping, Optional, Sequence, Union, overload +from .. import _utilities +from . import outputs + +__all__ = ['RmArgs', 'Rm'] + +@pulumi.input_type +class RmArgs: + def __init__(__self__, *, + files: pulumi.Input[Sequence[pulumi.Input[str]]], + dir: Optional[pulumi.Input[bool]] = None, + force: Optional[pulumi.Input[bool]] = None, + help: Optional[pulumi.Input[bool]] = None, + one_file_system: Optional[pulumi.Input[bool]] = None, + recursive: Optional[pulumi.Input[bool]] = None, + verbose: Optional[pulumi.Input[bool]] = None): + """ + The set of arguments for constructing a Rm resource. + """ + pulumi.set(__self__, "files", files) + if dir is not None: + pulumi.set(__self__, "dir", dir) + if force is not None: + pulumi.set(__self__, "force", force) + if help is not None: + pulumi.set(__self__, "help", help) + if one_file_system is not None: + pulumi.set(__self__, "one_file_system", one_file_system) + if recursive is not None: + pulumi.set(__self__, "recursive", recursive) + if verbose is not None: + pulumi.set(__self__, "verbose", verbose) + + @property + @pulumi.getter + def files(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]: + return pulumi.get(self, "files") + + @files.setter + def files(self, value: pulumi.Input[Sequence[pulumi.Input[str]]]): + pulumi.set(self, "files", value) + + @property + @pulumi.getter + def dir(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "dir") + + @dir.setter + def dir(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "dir", value) + + @property + @pulumi.getter + def force(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "force") + + @force.setter + def force(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "force", value) + + @property + @pulumi.getter + def help(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "help") + + @help.setter + def help(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "help", value) + + @property + @pulumi.getter(name="oneFileSystem") + def one_file_system(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "one_file_system") + + @one_file_system.setter + def one_file_system(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "one_file_system", value) + + @property + @pulumi.getter + def recursive(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "recursive") + + @recursive.setter + def recursive(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "recursive", value) + + @property + @pulumi.getter + def verbose(self) -> Optional[pulumi.Input[bool]]: + return pulumi.get(self, "verbose") + + @verbose.setter + def verbose(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "verbose", value) + + +class Rm(pulumi.CustomResource): + @overload + def __init__(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + dir: Optional[pulumi.Input[bool]] = None, + files: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + force: Optional[pulumi.Input[bool]] = None, + help: Optional[pulumi.Input[bool]] = None, + one_file_system: Optional[pulumi.Input[bool]] = None, + recursive: Optional[pulumi.Input[bool]] = None, + verbose: Optional[pulumi.Input[bool]] = None, + __props__=None): + """ + Create a Rm resource with the given unique name, props, and options. + :param str resource_name: The name of the resource. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + ... + @overload + def __init__(__self__, + resource_name: str, + args: RmArgs, + opts: Optional[pulumi.ResourceOptions] = None): + """ + Create a Rm resource with the given unique name, props, and options. + :param str resource_name: The name of the resource. + :param RmArgs args: The arguments to use to populate this resource's properties. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + ... + def __init__(__self__, resource_name: str, *args, **kwargs): + resource_args, opts = _utilities.get_resource_args_opts(RmArgs, pulumi.ResourceOptions, *args, **kwargs) + if resource_args is not None: + __self__._internal_init(resource_name, opts, **resource_args.__dict__) + else: + __self__._internal_init(resource_name, *args, **kwargs) + + def _internal_init(__self__, + resource_name: str, + opts: Optional[pulumi.ResourceOptions] = None, + dir: Optional[pulumi.Input[bool]] = None, + files: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + force: Optional[pulumi.Input[bool]] = None, + help: Optional[pulumi.Input[bool]] = None, + one_file_system: Optional[pulumi.Input[bool]] = None, + recursive: Optional[pulumi.Input[bool]] = None, + verbose: Optional[pulumi.Input[bool]] = None, + __props__=None): + opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts) + if not isinstance(opts, pulumi.ResourceOptions): + raise TypeError('Expected resource options to be a ResourceOptions instance') + if opts.id is None: + if __props__ is not None: + raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') + __props__ = RmArgs.__new__(RmArgs) + + __props__.__dict__["dir"] = dir + if files is None and not opts.urn: + raise TypeError("Missing required property 'files'") + __props__.__dict__["files"] = files + __props__.__dict__["force"] = force + __props__.__dict__["help"] = help + __props__.__dict__["one_file_system"] = one_file_system + __props__.__dict__["recursive"] = recursive + __props__.__dict__["verbose"] = verbose + __props__.__dict__["args"] = None + __props__.__dict__["created_files"] = None + __props__.__dict__["exit_code"] = None + __props__.__dict__["stderr"] = None + __props__.__dict__["stdout"] = None + super(Rm, __self__).__init__( + 'baremetal:cmd:Rm', + resource_name, + __props__, + opts) + + @staticmethod + def get(resource_name: str, + id: pulumi.Input[str], + opts: Optional[pulumi.ResourceOptions] = None) -> 'Rm': + """ + Get an existing Rm resource's state with the given name, id, and optional extra + properties used to qualify the lookup. + + :param str resource_name: The unique name of the resulting resource. + :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. + :param pulumi.ResourceOptions opts: Options for the resource. + """ + opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) + + __props__ = RmArgs.__new__(RmArgs) + + __props__.__dict__["args"] = None + __props__.__dict__["created_files"] = None + __props__.__dict__["exit_code"] = None + __props__.__dict__["stderr"] = None + __props__.__dict__["stdout"] = None + return Rm(resource_name, opts=opts, __props__=__props__) + + @property + @pulumi.getter + def args(self) -> pulumi.Output['outputs.RmArgs']: + return pulumi.get(self, "args") + + @property + @pulumi.getter(name="createdFiles") + def created_files(self) -> pulumi.Output[Sequence[str]]: + return pulumi.get(self, "created_files") + + @property + @pulumi.getter(name="exitCode") + def exit_code(self) -> pulumi.Output[int]: + return pulumi.get(self, "exit_code") + + @property + @pulumi.getter + def stderr(self) -> pulumi.Output[str]: + return pulumi.get(self, "stderr") + + @property + @pulumi.getter + def stdout(self) -> pulumi.Output[str]: + return pulumi.get(self, "stdout") + diff --git a/tests/lifecycle_test.go b/tests/lifecycle_test.go index eb4367c2..d84f37a7 100644 --- a/tests/lifecycle_test.go +++ b/tests/lifecycle_test.go @@ -45,6 +45,51 @@ var _ = Describe("Command Resources", func() { Expect(err).NotTo(HaveOccurred()) }) + Describe("Rm", Ordered, func() { + file := containerPath("rm.txt") + + test := integration.LifeCycleTest{ + Resource: "baremetal:cmd:Rm", + Create: integration.Operation{ + Inputs: resource.NewPropertyMapFromMap(map[string]interface{}{ + "files": []string{file}, + }), + ExpectedOutput: resource.NewPropertyMapFromMap(map[string]interface{}{ + "exitCode": 0, + "stdout": "", + "stderr": "", + "createdFiles": []string{}, + "args": map[string]interface{}{ + "files": []string{file}, + + // Defaults + "force": false, + "help": false, + "oneFileSystem": false, + "recursive": false, + "verbose": false, + "dir": false, + }, + }), + Hook: func(inputs, output resource.PropertyMap) { + Expect(provisioner).NotTo(ContainFile(context.Background(), file)) + }, + }, + } + + BeforeAll(func(ctx context.Context) { + By("creating a file to be removed") + err := provisioner.WriteFile(ctx, file, []byte("some text")) + Expect(err).NotTo(HaveOccurred()) + }) + + It("should complete a full lifecycle", func(ctx context.Context) { + run(server, test) + + Expect(provisioner).NotTo(ContainFile(ctx, file)) + }) + }) + Describe("Tee", Ordered, func() { stdin := "Test lifecycle stdin" newStdin := "Updated stdin"