-
Notifications
You must be signed in to change notification settings - Fork 6
/
ssh.go
41 lines (30 loc) · 1.01 KB
/
ssh.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package infisical
import (
api "github.com/infisical/go-sdk/packages/api/ssh"
)
type SignSshPublicKeyOptions = api.SignSshPublicKeyV1Request
type IssueSshCredsOptions = api.IssueSshCredsV1Request
type SshInterface interface {
SignKey(options SignSshPublicKeyOptions) (api.SignSshPublicKeyV1Response, error)
IssueCredentials(options IssueSshCredsOptions) (api.IssueSshCredsV1Response, error)
}
type Ssh struct {
client *InfisicalClient
}
func (f *Ssh) SignKey(options SignSshPublicKeyOptions) (api.SignSshPublicKeyV1Response, error) {
res, err := api.CallSignSshPublicKeyV1(f.client.httpClient, options)
if err != nil {
return api.SignSshPublicKeyV1Response{}, err
}
return res, nil
}
func (f *Ssh) IssueCredentials(options IssueSshCredsOptions) (api.IssueSshCredsV1Response, error) {
res, err := api.CallIssueSshCredsV1(f.client.httpClient, options)
if err != nil {
return api.IssueSshCredsV1Response{}, err
}
return res, nil
}
func NewSsh(client *InfisicalClient) SshInterface {
return &Ssh{client: client}
}