Documentation
¶
Overview ¶
Package profile stores non-secret Jira Cloud connection metadata.
Profile selection is deliberately explicit for every invocation. This package has no active or default profile state.
Index ¶
- Variables
- func RequireName(name string) error
- func ValidateName(name string) error
- func WasCommitted(err error) bool
- type CommitError
- type Profile
- type Registry
- func (r *Registry) Add(ctx context.Context, p Profile) error
- func (r *Registry) Get(ctx context.Context, name string) (Profile, error)
- func (r *Registry) List(ctx context.Context) ([]Profile, error)
- func (r *Registry) Path() string
- func (r *Registry) Put(ctx context.Context, p Profile) error
- func (r *Registry) Remove(ctx context.Context, name string) error
- func (r *Registry) WithProfileLock(ctx context.Context, name string, fn func() error) error
- type TokenKind
Constants ¶
This section is empty.
Variables ¶
var ( // ErrProfileRequired means a caller did not explicitly select a profile. ErrProfileRequired = errors.New("a profile is required for every invocation") // ErrInvalidProfile means profile metadata failed validation. ErrInvalidProfile = errors.New("invalid profile") // ErrNotFound means the requested profile is not registered. ErrNotFound = errors.New("profile not found") // ErrAlreadyExists means Add would overwrite an existing profile. ErrAlreadyExists = errors.New("profile already exists") // ErrCorruptRegistry means the registry cannot be decoded or validated. ErrCorruptRegistry = errors.New("profile registry is corrupt") // ErrInsecurePermissions means registry metadata is accessible too broadly. ErrInsecurePermissions = errors.New("profile registry has insecure permissions") )
Functions ¶
func RequireName ¶
RequireName validates the mandatory per-invocation profile selection.
func ValidateName ¶
ValidateName validates a profile name for exact use as a Keychain account.
func WasCommitted ¶
WasCommitted identifies a post-rename registry failure.
Types ¶
type CommitError ¶
type CommitError struct {
Err error
}
CommitError reports that a registry mutation reached its atomic rename but a subsequent durability step failed. Callers must treat the requested metadata state as committed and must not compensate it as a pre-commit failure.
func (*CommitError) Error ¶
func (e *CommitError) Error() string
func (*CommitError) Unwrap ¶
func (e *CommitError) Unwrap() error
type Profile ¶
type Profile struct {
Name string `json:"name"`
Site string `json:"site"`
Email string `json:"email"`
TokenKind TokenKind `json:"token_kind"`
CloudID string `json:"cloud_id,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
Profile contains only non-secret Jira Cloud connection metadata.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry persists profiles in a strict, non-secret JSON file.
func NewDefaultRegistry ¶
NewDefaultRegistry creates the default user-scoped registry.
func NewRegistry ¶
NewRegistry creates a registry at an explicit path.
func (*Registry) WithProfileLock ¶
WithProfileLock serializes a complete credential+metadata transaction for one profile across jira-cli processes. The lock is distinct from the registry file's short read-modify-write lock.