Documentation
¶
Index ¶
- Constants
- func ValidateIdentifier(kind, name string) error
- type Client
- type CommandBuilder
- type CommandClient
- type FakeClient
- type Item
- type ItemCommandBuilder
- func (i *ItemCommandBuilder) Build() []string
- func (i *ItemCommandBuilder) WithCreate(create *ItemCreateCommandBuilder) *ItemCommandBuilder
- func (i *ItemCommandBuilder) WithGet(get *ItemGetCommandBuilder) *ItemCommandBuilder
- func (i *ItemCommandBuilder) WithList(list *ItemListCommandBuilder) *ItemCommandBuilder
- type ItemCreateCommandBuilder
- func (i *ItemCreateCommandBuilder) Build() []string
- func (i *ItemCreateCommandBuilder) WithCategory(category *string) *ItemCreateCommandBuilder
- func (i *ItemCreateCommandBuilder) WithDryRun(dryRun bool) *ItemCreateCommandBuilder
- func (i *ItemCreateCommandBuilder) WithStdin(stdin bool) *ItemCreateCommandBuilder
- func (i *ItemCreateCommandBuilder) WithTitle(title string) *ItemCreateCommandBuilder
- func (i *ItemCreateCommandBuilder) WithVault(vault string) *ItemCreateCommandBuilder
- type ItemField
- type ItemGetCommandBuilder
- type ItemListCommandBuilder
- type ItemSection
- type Vault
- type VaultCommandBuilder
- type VaultGetCommandBuilder
- type VaultListCommandBuilder
Constants ¶
View Source
const ( ItemIDNotesPlain = "notesPlain" ItemFieldTypeString = "STRING" ItemPurposeNotes = "NOTES" ItemLabelNotesPlain = "notesPlain" )
View Source
const (
VaultItemCategoryAPICredential = "API Credential"
)
Variables ¶
This section is empty.
Functions ¶
func ValidateIdentifier ¶ added in v0.1.3
ValidateIdentifier checks that name is a non-empty identifier that matches the allowlist. kind is included in the error so callers can tell which argument was rejected (e.g. "vault", "item").
Types ¶
type CommandBuilder ¶
type CommandBuilder struct {
Format string
Item *ItemCommandBuilder
Vault *VaultCommandBuilder
}
func NewCommandBuilder ¶
func NewCommandBuilder() *CommandBuilder
func (*CommandBuilder) Build ¶
func (c *CommandBuilder) Build() []string
func (*CommandBuilder) WithItem ¶
func (c *CommandBuilder) WithItem(item *ItemCommandBuilder) *CommandBuilder
func (*CommandBuilder) WithJSONFormat ¶
func (c *CommandBuilder) WithJSONFormat() *CommandBuilder
func (*CommandBuilder) WithVault ¶
func (c *CommandBuilder) WithVault(vault *VaultCommandBuilder) *CommandBuilder
type CommandClient ¶
type CommandClient struct {
// contains filtered or unexported fields
}
func (*CommandClient) GetVaultItem ¶
func (c *CommandClient) GetVaultItem(ctx context.Context, vaultName string, itemName string) (Item, error)
GetVaultItem implements Client. 同一 vault/item への呼び出しは memoize され、op サブプロセスの起動は クライアントの生存期間中 1 回に抑えられる。エラーはキャッシュされず、 次の呼び出しで再試行される。
func (*CommandClient) ListVaultItems ¶
type FakeClient ¶
func NewFakeClient ¶
func NewFakeClient() *FakeClient
func (*FakeClient) GetVaultItem ¶
func (f *FakeClient) GetVaultItem(ctx context.Context, vaultName string, itemName string) (Item, error)
GetVaultItem implements Client.
func (*FakeClient) ListVaultItems ¶
ListVaultItems implements Client.
type Item ¶
type Item struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Version int `json:"version,omitempty"`
Vault Vault `json:"vault,omitempty"`
Category string `json:"category,omitempty"`
LastEditedBy string `json:"last_edited_by,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Sections []ItemSection `json:"sections,omitempty"`
Fields []ItemField `json:"fields,omitempty"`
}
type ItemCommandBuilder ¶
type ItemCommandBuilder struct {
Get *ItemGetCommandBuilder
Create *ItemCreateCommandBuilder
// This method is not used in the provided code, but can be implemented if needed.
List *ItemListCommandBuilder
}
func NewItemCommandBuilder ¶
func NewItemCommandBuilder() *ItemCommandBuilder
func (*ItemCommandBuilder) Build ¶
func (i *ItemCommandBuilder) Build() []string
func (*ItemCommandBuilder) WithCreate ¶
func (i *ItemCommandBuilder) WithCreate(create *ItemCreateCommandBuilder) *ItemCommandBuilder
func (*ItemCommandBuilder) WithGet ¶
func (i *ItemCommandBuilder) WithGet(get *ItemGetCommandBuilder) *ItemCommandBuilder
func (*ItemCommandBuilder) WithList ¶
func (i *ItemCommandBuilder) WithList(list *ItemListCommandBuilder) *ItemCommandBuilder
type ItemCreateCommandBuilder ¶
type ItemCreateCommandBuilder struct {
Title string
Vault *string
DryRun bool
Category *string
Stdin bool
}
func NewItemCreateCommandBuilder ¶
func NewItemCreateCommandBuilder() *ItemCreateCommandBuilder
func (*ItemCreateCommandBuilder) Build ¶
func (i *ItemCreateCommandBuilder) Build() []string
func (*ItemCreateCommandBuilder) WithCategory ¶
func (i *ItemCreateCommandBuilder) WithCategory(category *string) *ItemCreateCommandBuilder
func (*ItemCreateCommandBuilder) WithDryRun ¶
func (i *ItemCreateCommandBuilder) WithDryRun(dryRun bool) *ItemCreateCommandBuilder
func (*ItemCreateCommandBuilder) WithStdin ¶
func (i *ItemCreateCommandBuilder) WithStdin(stdin bool) *ItemCreateCommandBuilder
func (*ItemCreateCommandBuilder) WithTitle ¶
func (i *ItemCreateCommandBuilder) WithTitle(title string) *ItemCreateCommandBuilder
func (*ItemCreateCommandBuilder) WithVault ¶
func (i *ItemCreateCommandBuilder) WithVault(vault string) *ItemCreateCommandBuilder
type ItemField ¶
type ItemField struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Purpose string `json:"purpose,omitempty"`
Label string `json:"label,omitempty"`
Value string `json:"value,omitempty"`
Reference string `json:"reference,omitempty"`
Section *ItemSection `json:"section,omitempty"`
}
type ItemGetCommandBuilder ¶
func NewItemGetCommandBuilder ¶
func NewItemGetCommandBuilder() *ItemGetCommandBuilder
func (*ItemGetCommandBuilder) Build ¶
func (i *ItemGetCommandBuilder) Build() []string
func (*ItemGetCommandBuilder) WithTitle ¶
func (i *ItemGetCommandBuilder) WithTitle(title string) *ItemGetCommandBuilder
func (*ItemGetCommandBuilder) WithVault ¶
func (i *ItemGetCommandBuilder) WithVault(vault string) *ItemGetCommandBuilder
type ItemListCommandBuilder ¶
type ItemListCommandBuilder struct {
Vault *string
}
func NewItemListCommandBuilder ¶
func NewItemListCommandBuilder() *ItemListCommandBuilder
func (*ItemListCommandBuilder) Build ¶
func (i *ItemListCommandBuilder) Build() []string
func (*ItemListCommandBuilder) WithVault ¶
func (i *ItemListCommandBuilder) WithVault(vault string) *ItemListCommandBuilder
type ItemSection ¶
type VaultCommandBuilder ¶
type VaultCommandBuilder struct {
Get *VaultGetCommandBuilder
List *VaultListCommandBuilder
}
func NewVaultCommandBuilder ¶
func NewVaultCommandBuilder() *VaultCommandBuilder
func (*VaultCommandBuilder) Build ¶
func (v *VaultCommandBuilder) Build() []string
func (*VaultCommandBuilder) WithGet ¶
func (v *VaultCommandBuilder) WithGet(get *VaultGetCommandBuilder) *VaultCommandBuilder
func (*VaultCommandBuilder) WithList ¶
func (v *VaultCommandBuilder) WithList(list *VaultListCommandBuilder) *VaultCommandBuilder
type VaultGetCommandBuilder ¶
type VaultGetCommandBuilder struct {
Vault string
}
func NewVaultGetCommandBuilder ¶
func NewVaultGetCommandBuilder() *VaultGetCommandBuilder
func (*VaultGetCommandBuilder) Build ¶
func (v *VaultGetCommandBuilder) Build() []string
func (*VaultGetCommandBuilder) WithVault ¶
func (v *VaultGetCommandBuilder) WithVault(vault string) *VaultGetCommandBuilder
type VaultListCommandBuilder ¶
type VaultListCommandBuilder struct{}
func NewVaultListCommandBuilder ¶
func NewVaultListCommandBuilder() *VaultListCommandBuilder
func (*VaultListCommandBuilder) Build ¶
func (v *VaultListCommandBuilder) Build() []string
Click to show internal directories.
Click to hide internal directories.