Documentation
¶
Index ¶
- Constants
- func IsCredentialsNotFoundError(err error) bool
- func ParseCredentialOverrides(overrides []string) (map[string]map[string]string, error)
- type Credential
- type CredentialStore
- type CredentialType
- type NoopStore
- func (s NoopStore) Add(context.Context, Credential) error
- func (s NoopStore) Get(context.Context, string) (*Credential, bool, error)
- func (s NoopStore) List(context.Context) ([]Credential, error)
- func (s NoopStore) RecreateAll(context.Context) error
- func (s NoopStore) Refresh(context.Context, Credential) error
- func (s NoopStore) Remove(context.Context, string) error
- type ProgramLoaderRunner
- type Store
- func (s *Store) Add(_ context.Context, cred Credential) error
- func (s *Store) Get(_ context.Context, toolName string) (*Credential, bool, error)
- func (s *Store) List(_ context.Context) ([]Credential, error)
- func (s *Store) RecreateAll(_ context.Context) error
- func (s *Store) Refresh(_ context.Context, cred Credential) error
- func (s *Store) Remove(_ context.Context, toolName string) error
- type StoreFactory
Constants ¶
View Source
const ( CredentialTypeTool CredentialType = "tool" CredentialTypeModelProvider CredentialType = "modelProvider" ExistingCredential = "GPTSCRIPT_EXISTING_CREDENTIAL" CredentialExpiration = "GPTSCRIPT_CREDENTIAL_EXPIRATION" )
View Source
const ( DefaultCredentialContext = "default" AllCredentialContexts = "*" )
Variables ¶
This section is empty.
Functions ¶
func IsCredentialsNotFoundError ¶ added in v0.9.6
func ParseCredentialOverrides ¶ added in v0.9.6
ParseCredentialOverrides parses a string of credential overrides that the user provided as a command line arg. The format of credential overrides can be one of two things: cred1:ENV1,ENV2 (direct mapping of environment variables) cred1:ENV1=VALUE1,ENV2=VALUE2 (key-value pairs)
This function turns it into a map[string]map[string]string like this:
{
"cred1": {
"ENV1": "VALUE1",
"ENV2": "VALUE2",
}
}
Types ¶
type Credential ¶
type Credential struct {
Context string `json:"context"`
ToolName string `json:"toolName"`
Type CredentialType `json:"type"`
Env map[string]string `json:"env"`
// If the CheckParam that is stored is different from the param on the tool,
// then the credential will be re-authed as if it does not exist.
CheckParam string `json:"checkParam"`
Ephemeral bool `json:"ephemeral,omitempty"`
ExpiresAt *time.Time `json:"expiresAt"`
RefreshToken string `json:"refreshToken"`
}
func (Credential) IsExpired ¶ added in v0.8.4
func (c Credential) IsExpired() bool
type CredentialStore ¶ added in v0.8.2
type CredentialStore interface {
Get(ctx context.Context, toolName string) (*Credential, bool, error)
Add(ctx context.Context, cred Credential) error
Refresh(ctx context.Context, cred Credential) error
Remove(ctx context.Context, toolName string) error
List(ctx context.Context) ([]Credential, error)
RecreateAll(ctx context.Context) error
}
type CredentialType ¶ added in v0.8.0
type CredentialType string
type NoopStore ¶ added in v0.8.2
type NoopStore struct{}
func (NoopStore) List ¶ added in v0.8.2
func (s NoopStore) List(context.Context) ([]Credential, error)
func (NoopStore) RecreateAll ¶ added in v0.9.6
type ProgramLoaderRunner ¶ added in v0.9.6
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Add ¶
func (s *Store) Add(_ context.Context, cred Credential) error
Add adds a new credential to the credential store. Any context set on the credential object will be overwritten with the first context of the credential store.
type StoreFactory ¶ added in v0.9.6
type StoreFactory struct {
// contains filtered or unexported fields
}
func NewFactory ¶ added in v0.9.6
func NewFactory(ctx context.Context, cfg *config.CLIConfig, overrides []string, plr ProgramLoaderRunner) (StoreFactory, error)
func (*StoreFactory) NewStore ¶ added in v0.9.6
func (s *StoreFactory) NewStore(credCtxs []string) (CredentialStore, error)
Click to show internal directories.
Click to hide internal directories.