Skip to content

Commit

Permalink
Allow supplying ssh private key for tunnels (#164)
Browse files Browse the repository at this point in the history
Allow supplying ssh private key for tunnels. This supports
https://github.com/meroxa/acceptance/issues/31.
  • Loading branch information
owenthereal authored Jul 8, 2021
1 parent 600ea69 commit 1a9852c
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 43 deletions.
18 changes: 10 additions & 8 deletions cmd/meroxa/root/resources/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ type Create struct {
Metadata string `long:"metadata" short:"m" usage:"resource metadata"`

// credentials
Username string `long:"username" short:"" usage:"username"`
Password string `long:"password" short:"" usage:"password"`
CaCert string `long:"ca-cert" short:"" usage:"trusted certificates for verifying resource"`
ClientCert string `long:"client-cert" short:"" usage:"client certificate for authenticating to the resource"`
ClientKey string `long:"client-key" short:"" usage:"client private key for authenticating to the resource"`
SSL bool `long:"ssl" short:"" usage:"use SSL"`
SSHURL string `long:"ssh-url" short:"" usage:"SSH tunneling address"`
Username string `long:"username" short:"" usage:"username"`
Password string `long:"password" short:"" usage:"password"`
CaCert string `long:"ca-cert" short:"" usage:"trusted certificates for verifying resource"`
ClientCert string `long:"client-cert" short:"" usage:"client certificate for authenticating to the resource"`
ClientKey string `long:"client-key" short:"" usage:"client private key for authenticating to the resource"`
SSL bool `long:"ssl" short:"" usage:"use SSL"`
SSHURL string `long:"ssh-url" short:"" usage:"SSH tunneling address"`
SSHPrivateKey string `long:"ssh-private-key" short:"" usage:"SSH tunneling private key"`
}
}

Expand Down Expand Up @@ -133,7 +134,8 @@ func (c *Create) Execute(ctx context.Context) error {

if sshURL := c.flags.SSHURL; sshURL != "" {
input.SSHTunnel = &meroxa.ResourceSSHTunnelInput{
Address: sshURL,
Address: sshURL,
PrivateKey: c.flags.SSHPrivateKey,
}
}

Expand Down
23 changes: 12 additions & 11 deletions docs/cmd/md/meroxa_resources_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ meroxa resources create slack --type url -u $WEBHOOK_URL
### Options

```
--ca-cert string trusted certificates for verifying resource
--client-cert string client certificate for authenticating to the resource
--client-key string client private key for authenticating to the resource
-h, --help help for create
-m, --metadata string resource metadata
--password string password
--ssh-url string SSH tunneling address
--ssl use SSL
--type string resource type
-u, --url string resource url
--username string username
--ca-cert string trusted certificates for verifying resource
--client-cert string client certificate for authenticating to the resource
--client-key string client private key for authenticating to the resource
-h, --help help for create
-m, --metadata string resource metadata
--password string password
--ssh-private-key string SSH tunneling private key
--ssh-url string SSH tunneling address
--ssl use SSL
--type string resource type
-u, --url string resource url
--username string username
```

### Options inherited from parent commands
Expand Down
23 changes: 12 additions & 11 deletions docs/cmd/www/meroxa-resources-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ meroxa resources create slack --type url -u $WEBHOOK_URL
### Options

```
--ca-cert string trusted certificates for verifying resource
--client-cert string client certificate for authenticating to the resource
--client-key string client private key for authenticating to the resource
-h, --help help for create
-m, --metadata string resource metadata
--password string password
--ssh-url string SSH tunneling address
--ssl use SSL
--type string resource type
-u, --url string resource url
--username string username
--ca-cert string trusted certificates for verifying resource
--client-cert string client certificate for authenticating to the resource
--client-key string client private key for authenticating to the resource
-h, --help help for create
-m, --metadata string resource metadata
--password string password
--ssh-private-key string SSH tunneling private key
--ssh-url string SSH tunneling address
--ssl use SSL
--type string resource type
-u, --url string resource url
--username string username
```

### Options inherited from parent commands
Expand Down
2 changes: 2 additions & 0 deletions etc/completion/meroxa.completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,8 @@ _meroxa_resources_create()
two_word_flags+=("-m")
flags+=("--password=")
two_word_flags+=("--password")
flags+=("--ssh-private-key=")
two_word_flags+=("--ssh-private-key")
flags+=("--ssh-url=")
two_word_flags+=("--ssh-url")
flags+=("--ssl")
Expand Down
4 changes: 4 additions & 0 deletions etc/man/man1/meroxa-resources-create.1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Use the create command to add resources to your Meroxa resource catalog.
\fB\-\-password\fP=""
password

.PP
\fB\-\-ssh\-private\-key\fP=""
SSH tunneling private key

.PP
\fB\-\-ssh\-url\fP=""
SSH tunneling address
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/gorilla/mux v1.7.3
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-runewidth v0.0.10 // indirect
github.com/meroxa/meroxa-go v0.0.0-20210616141510-06325fbc5f3f
github.com/meroxa/meroxa-go v0.0.0-20210708212340-5754168ecaae
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4
github.com/rivo/uniseg v0.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/meroxa/meroxa-go v0.0.0-20210616141510-06325fbc5f3f h1:w8woonEn1TjROam18LvhS6IYmjaT7cW/TSdPsNmPz/o=
github.com/meroxa/meroxa-go v0.0.0-20210616141510-06325fbc5f3f/go.mod h1:kU+28Y6AfKRPbZ8kt1zYtpTXzpuTqFZg2PjyO7c+cHU=
github.com/meroxa/meroxa-go v0.0.0-20210708212340-5754168ecaae h1:gfX4c4Hh1bf1ORp5N3ibFGyEo7zZzXj4TOVeO3x1aJ8=
github.com/meroxa/meroxa-go v0.0.0-20210708212340-5754168ecaae/go.mod h1:kU+28Y6AfKRPbZ8kt1zYtpTXzpuTqFZg2PjyO7c+cHU=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/meroxa/meroxa-go/meroxa.go

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

2 changes: 1 addition & 1 deletion vendor/github.com/meroxa/meroxa-go/options.go

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

18 changes: 11 additions & 7 deletions vendor/github.com/meroxa/meroxa-go/resource.go

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ github.com/mattn/go-isatty
# github.com/mattn/go-runewidth v0.0.10
## explicit
github.com/mattn/go-runewidth
# github.com/meroxa/meroxa-go v0.0.0-20210616141510-06325fbc5f3f
# github.com/meroxa/meroxa-go v0.0.0-20210708212340-5754168ecaae
## explicit
github.com/meroxa/meroxa-go
# github.com/mitchellh/mapstructure v1.4.1
Expand Down

0 comments on commit 1a9852c

Please sign in to comment.