Add credential and libraries to session recording resource (#3374)
This commit is contained in:
20 files changed
+2055
-150
No files matched your search
@@ -35,8 +35,8 @@ func AttributesMapToVaultCredentialLibraryAttributes(in map[string]interface{})
|
||||
}
|
||||
|
||||
func (pt *CredentialLibrary) GetVaultCredentialLibraryAttributes() (*VaultCredentialLibraryAttributes, error) {
|
||||
if pt.Type != "vault" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-library is of type %s", "vault", pt.Type)
|
||||
if pt.Type != "vault-generic" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-library is of type %s", "vault-generic", pt.Type)
|
||||
}
|
||||
return AttributesMapToVaultCredentialLibraryAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -40,8 +40,8 @@ func AttributesMapToVaultSSHCertificateCredentialLibraryAttributes(in map[string
|
||||
}
|
||||
|
||||
func (pt *CredentialLibrary) GetVaultSSHCertificateCredentialLibraryAttributes() (*VaultSSHCertificateCredentialLibraryAttributes, error) {
|
||||
if pt.Type != "vaultsshcertificate" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-library is of type %s", "vaultsshcertificate", pt.Type)
|
||||
if pt.Type != "vault-ssh-certificate" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-library is of type %s", "vault-ssh-certificate", pt.Type)
|
||||
}
|
||||
return AttributesMapToVaultSSHCertificateCredentialLibraryAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -37,8 +37,8 @@ func AttributesMapToSshPrivateKeyAttributes(in map[string]interface{}) (*SshPriv
|
||||
}
|
||||
|
||||
func (pt *Credential) GetSshPrivateKeyAttributes() (*SshPrivateKeyAttributes, error) {
|
||||
if pt.Type != "sshprivatekey" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "sshprivatekey", pt.Type)
|
||||
if pt.Type != "ssh_private_key" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "ssh_private_key", pt.Type)
|
||||
}
|
||||
return AttributesMapToSshPrivateKeyAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -35,8 +35,8 @@ func AttributesMapToUsernamePasswordAttributes(in map[string]interface{}) (*User
|
||||
}
|
||||
|
||||
func (pt *Credential) GetUsernamePasswordAttributes() (*UsernamePasswordAttributes, error) {
|
||||
if pt.Type != "usernamepassword" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "usernamepassword", pt.Type)
|
||||
if pt.Type != "username_password" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "username_password", pt.Type)
|
||||
}
|
||||
return AttributesMapToUsernamePasswordAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
type Credential struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
CredentialStore *CredentialStore `json:"credential_store,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Purposes []string `json:"purposes,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Attributes map[string]interface{} `json:"attributes,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
type CredentialLibrary struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
CredentialStore *CredentialStore `json:"credential_store,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Purposes []string `json:"purposes,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Attributes map[string]interface{} `json:"attributes,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
type CredentialStore struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
ScopeId string `json:"scope_id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Attributes map[string]interface{} `json:"attributes,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type JsonCredentialAttributes struct {
|
||||
ObjectHmac string `json:"object_hmac,omitempty"`
|
||||
}
|
||||
|
||||
func AttributesMapToJsonCredentialAttributes(in map[string]interface{}) (*JsonCredentialAttributes, error) {
|
||||
if in == nil {
|
||||
return nil, fmt.Errorf("nil input map")
|
||||
}
|
||||
var out JsonCredentialAttributes
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
Result: &out,
|
||||
TagName: "json",
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
|
||||
}
|
||||
if err := dec.Decode(in); err != nil {
|
||||
return nil, fmt.Errorf("error decoding: %w", err)
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (pt *Credential) GetJsonCredentialAttributes() (*JsonCredentialAttributes, error) {
|
||||
if pt.Type != "json" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "json", pt.Type)
|
||||
}
|
||||
return AttributesMapToJsonCredentialAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type SshPrivateKeyCredentialAttributes struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
PrivateKeyHmac string `json:"private_key_hmac,omitempty"`
|
||||
PrivateKeyPassphraseHmac string `json:"private_key_passphrase_hmac,omitempty"`
|
||||
}
|
||||
|
||||
func AttributesMapToSshPrivateKeyCredentialAttributes(in map[string]interface{}) (*SshPrivateKeyCredentialAttributes, error) {
|
||||
if in == nil {
|
||||
return nil, fmt.Errorf("nil input map")
|
||||
}
|
||||
var out SshPrivateKeyCredentialAttributes
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
Result: &out,
|
||||
TagName: "json",
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
|
||||
}
|
||||
if err := dec.Decode(in); err != nil {
|
||||
return nil, fmt.Errorf("error decoding: %w", err)
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (pt *Credential) GetSshPrivateKeyCredentialAttributes() (*SshPrivateKeyCredentialAttributes, error) {
|
||||
if pt.Type != "ssh_private_key" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "ssh_private_key", pt.Type)
|
||||
}
|
||||
return AttributesMapToSshPrivateKeyCredentialAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type UsernamePasswordCredentialAttributes struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
PasswordHmac string `json:"password_hmac,omitempty"`
|
||||
}
|
||||
|
||||
func AttributesMapToUsernamePasswordCredentialAttributes(in map[string]interface{}) (*UsernamePasswordCredentialAttributes, error) {
|
||||
if in == nil {
|
||||
return nil, fmt.Errorf("nil input map")
|
||||
}
|
||||
var out UsernamePasswordCredentialAttributes
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
Result: &out,
|
||||
TagName: "json",
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
|
||||
}
|
||||
if err := dec.Decode(in); err != nil {
|
||||
return nil, fmt.Errorf("error decoding: %w", err)
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (pt *Credential) GetUsernamePasswordCredentialAttributes() (*UsernamePasswordCredentialAttributes, error) {
|
||||
if pt.Type != "username_password" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential is of type %s", "username_password", pt.Type)
|
||||
}
|
||||
return AttributesMapToUsernamePasswordCredentialAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -5,7 +5,9 @@
|
||||
package sessionrecordings
|
||||
|
||||
type ValuesAtTime struct {
|
||||
User *User `json:"user,omitempty"`
|
||||
Target *Target `json:"target,omitempty"`
|
||||
Host *Host `json:"host,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
Target *Target `json:"target,omitempty"`
|
||||
Host *Host `json:"host,omitempty"`
|
||||
Credentials []*Credential `json:"credentials,omitempty"`
|
||||
CredentialLibraries []*CredentialLibrary `json:"credential_libraries,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type VaultCredentialLibraryAttributes struct {
|
||||
Path string `json:"path,omitempty"`
|
||||
HttpMethod string `json:"http_method,omitempty"`
|
||||
HttpRequestBody string `json:"http_request_body,omitempty"`
|
||||
}
|
||||
|
||||
func AttributesMapToVaultCredentialLibraryAttributes(in map[string]interface{}) (*VaultCredentialLibraryAttributes, error) {
|
||||
if in == nil {
|
||||
return nil, fmt.Errorf("nil input map")
|
||||
}
|
||||
var out VaultCredentialLibraryAttributes
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
Result: &out,
|
||||
TagName: "json",
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
|
||||
}
|
||||
if err := dec.Decode(in); err != nil {
|
||||
return nil, fmt.Errorf("error decoding: %w", err)
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (pt *CredentialLibrary) GetVaultCredentialLibraryAttributes() (*VaultCredentialLibraryAttributes, error) {
|
||||
if pt.Type != "vault-generic" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-library is of type %s", "vault-generic", pt.Type)
|
||||
}
|
||||
return AttributesMapToVaultCredentialLibraryAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type VaultCredentialStoreAttributes struct {
|
||||
Address string `json:"address,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
TlsServerName string `json:"tls_server_name,omitempty"`
|
||||
TlsSkipVerify bool `json:"tls_skip_verify,omitempty"`
|
||||
WorkerFilter string `json:"worker_filter,omitempty"`
|
||||
}
|
||||
|
||||
func AttributesMapToVaultCredentialStoreAttributes(in map[string]interface{}) (*VaultCredentialStoreAttributes, error) {
|
||||
if in == nil {
|
||||
return nil, fmt.Errorf("nil input map")
|
||||
}
|
||||
var out VaultCredentialStoreAttributes
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
Result: &out,
|
||||
TagName: "json",
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
|
||||
}
|
||||
if err := dec.Decode(in); err != nil {
|
||||
return nil, fmt.Errorf("error decoding: %w", err)
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (pt *CredentialStore) GetVaultCredentialStoreAttributes() (*VaultCredentialStoreAttributes, error) {
|
||||
if pt.Type != "vault" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-store is of type %s", "vault", pt.Type)
|
||||
}
|
||||
return AttributesMapToVaultCredentialStoreAttributes(pt.Attributes)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Code generated by "make api"; DO NOT EDIT.
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
package sessionrecordings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type VaultSSHCertificateCredentialLibraryAttributes struct {
|
||||
Path string `json:"path,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
KeyType string `json:"key_type,omitempty"`
|
||||
KeyBits uint32 `json:"key_bits,omitempty"`
|
||||
Ttl string `json:"ttl,omitempty"`
|
||||
CriticalOptions map[string]string `json:"critical_options,omitempty"`
|
||||
Extensions map[string]string `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
func AttributesMapToVaultSSHCertificateCredentialLibraryAttributes(in map[string]interface{}) (*VaultSSHCertificateCredentialLibraryAttributes, error) {
|
||||
if in == nil {
|
||||
return nil, fmt.Errorf("nil input map")
|
||||
}
|
||||
var out VaultSSHCertificateCredentialLibraryAttributes
|
||||
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
Result: &out,
|
||||
TagName: "json",
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating mapstructure decoder: %w", err)
|
||||
}
|
||||
if err := dec.Decode(in); err != nil {
|
||||
return nil, fmt.Errorf("error decoding: %w", err)
|
||||
}
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (pt *CredentialLibrary) GetVaultSSHCertificateCredentialLibraryAttributes() (*VaultSSHCertificateCredentialLibraryAttributes, error) {
|
||||
if pt.Type != "vault-ssh-certificate" {
|
||||
return nil, fmt.Errorf("asked to fetch %s-type attributes but credential-library is of type %s", "vault-ssh-certificate", pt.Type)
|
||||
}
|
||||
return AttributesMapToVaultSSHCertificateCredentialLibraryAttributes(pt.Attributes)
|
||||
}
|
||||
Reference in new issue
Block a user