generated from pulumi/pulumi-provider-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add mkdir and mktemp * Get tests working * Regen SDKs
- Loading branch information
1 parent
82cb8f0
commit 887e995
Showing
29 changed files
with
2,388 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,4 +69,6 @@ enum Bin { | |
BIN_WGET = 3; | ||
BIN_MV = 4; | ||
BIN_TAR = 5; | ||
BIN_MKDIR = 6; | ||
BIN_MKTEMP = 7; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/pulumi/pulumi-go-provider/infer" | ||
pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1" | ||
) | ||
|
||
type MkdirArgs struct { | ||
DefaultFileManipulator | ||
Directory []string `pulumi:"directory"` | ||
Mode string `pulumi:"mode,optional"` | ||
Parents bool `pulumi:"parents,optional"` | ||
Verbose bool `pulumi:"verbose,optional"` | ||
Help bool `pulumi:"help,optional"` | ||
Version bool `pulumi:"version,optional"` | ||
} | ||
|
||
// Cmd implements CommandArgs. | ||
func (m MkdirArgs) Cmd() *pb.Command { | ||
b := builder{m.Directory} | ||
b.opv(m.Mode, "--mode") | ||
b.op(m.Parents, "--parents") | ||
b.op(m.Verbose, "--verbose") | ||
b.op(m.Help, "--help") | ||
b.op(m.Version, "--version") | ||
|
||
return &pb.Command{ | ||
Bin: pb.Bin_BIN_MKDIR, | ||
Args: b.args, | ||
} | ||
} | ||
|
||
var _ CommandArgs = MkdirArgs{} | ||
|
||
type Mkdir struct{} | ||
|
||
type MkdirState = CommandState[MkdirArgs] | ||
|
||
// Create implements infer.CustomCreate. | ||
func (Mkdir) Create(ctx context.Context, name string, inputs MkdirArgs, preview bool) (id string, output MkdirState, err error) { | ||
state := MkdirState{} | ||
if err := state.Create(ctx, inputs, preview); err != nil { | ||
return name, state, fmt.Errorf("mkdir: %w", err) | ||
} | ||
|
||
return name, state, nil | ||
} | ||
|
||
// Update implements infer.CustomUpdate. | ||
func (Mkdir) Update(ctx context.Context, id string, olds MkdirState, news MkdirArgs, preview bool) (MkdirState, error) { | ||
state, err := olds.Update(ctx, news, preview) | ||
if err != nil { | ||
return olds, fmt.Errorf("mkdir: %w", err) | ||
} | ||
|
||
return state, nil | ||
} | ||
|
||
// Delete implements infer.CustomDelete. | ||
func (Mkdir) Delete(ctx context.Context, id string, props MkdirState) error { | ||
if err := props.Delete(ctx); err != nil { | ||
return fmt.Errorf("mkdir: %w", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
var _ = (infer.CustomCreate[MkdirArgs, MkdirState])((*Mkdir)(nil)) | ||
var _ = (infer.CustomUpdate[MkdirArgs, MkdirState])((*Mkdir)(nil)) | ||
var _ = (infer.CustomDelete[MkdirState])((*Mkdir)(nil)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/pulumi/pulumi-go-provider/infer" | ||
pb "github.com/unmango/pulumi-baremetal/gen/go/unmango/baremetal/v1alpha1" | ||
) | ||
|
||
type MktempArgs struct { | ||
DefaultFileManipulator | ||
Template string `pulumi:"template,optional"` | ||
Directory bool `pulumi:"directory,optional"` | ||
DryRun bool `pulumi:"dryRun,optional"` | ||
Quiet bool `pulumi:"quiet,optional"` | ||
Suffix string `pulumi:"suffix,optional"` | ||
P string `pulumi:"p,optional"` | ||
TmpDir bool `pulumi:"tmpdir,optional"` | ||
T bool `pulumi:"t,optional"` | ||
Help bool `pulumi:"help,optional"` | ||
Version bool `pulumi:"version,optional"` | ||
} | ||
|
||
// Cmd implements CommandArgs. | ||
func (m MktempArgs) Cmd() *pb.Command { | ||
b := builder{} | ||
b.op(m.Directory, "--directory") | ||
b.op(m.DryRun, "--dry-run") | ||
b.op(m.Quiet, "--quiet") | ||
b.opv(m.Suffix, "--suffix") | ||
b.opv(m.P, "-p") | ||
b.op(m.TmpDir, "--tmpdir") | ||
b.op(m.T, "-t") | ||
b.op(m.Help, "--help") | ||
b.op(m.Version, "--version") | ||
|
||
if m.Template != "" { | ||
b.arg(m.Template) | ||
} | ||
|
||
return &pb.Command{ | ||
Bin: pb.Bin_BIN_MKTEMP, | ||
Args: b.args, | ||
} | ||
} | ||
|
||
var _ CommandArgs = MktempArgs{} | ||
|
||
type Mktemp struct{} | ||
|
||
type MktempState = CommandState[MktempArgs] | ||
|
||
// Create implements infer.CustomCreate. | ||
func (Mktemp) Create(ctx context.Context, name string, inputs MktempArgs, preview bool) (id string, output MktempState, err error) { | ||
state := MktempState{} | ||
if err := state.Create(ctx, inputs, preview); err != nil { | ||
return name, state, fmt.Errorf("mktemp: %w", err) | ||
} | ||
|
||
return name, state, nil | ||
} | ||
|
||
// Update implements infer.CustomUpdate. | ||
func (Mktemp) Update(ctx context.Context, id string, olds MktempState, news MktempArgs, preview bool) (MktempState, error) { | ||
state, err := olds.Update(ctx, news, preview) | ||
if err != nil { | ||
return olds, fmt.Errorf("mktemp: %w", err) | ||
} | ||
|
||
return state, nil | ||
} | ||
|
||
// Delete implements infer.CustomDelete. | ||
func (Mktemp) Delete(ctx context.Context, id string, props MktempState) error { | ||
if err := props.Delete(ctx); err != nil { | ||
return fmt.Errorf("mktemp: %w", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
var _ = (infer.CustomCreate[MktempArgs, MktempState])((*Mktemp)(nil)) | ||
var _ = (infer.CustomUpdate[MktempArgs, MktempState])((*Mktemp)(nil)) | ||
var _ = (infer.CustomDelete[MktempState])((*Mktemp)(nil)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.