Documentation
¶
Overview ¶
Package netconfig is roughly analogous to netrc but with json or yaml configuration and more validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalLogin ¶
type ExternalLogin struct {
Token string `json:"token,omitempty" yaml:"token,omitempty"`
}
ExternalLogin represents a credentials configuration in json or yaml.
type ExternalRemote ¶
type ExternalRemote struct {
Address string `json:"address,omitempty" yaml:"address,omitempty"`
Login ExternalLogin `json:"login,omitempty" yaml:"login,omitempty"`
}
ExternalRemote represents a remote configuration in json or yaml.
type Login ¶
type Login interface {
Token() string
// contains filtered or unexported methods
}
Login represents user credentials.
type Remote ¶
type Remote interface {
Address() string
Login() (Login, bool)
// contains filtered or unexported methods
}
Remote represents the configuration required for a given address.
type RemoteProvider ¶
type RemoteProvider interface {
// GetRemote gets the Remote for the address.
//
// Returns false if no such remote exists.
GetRemote(address string) (Remote, bool)
// WithUpdatedRemote returns a new RemoteProvider with the Remote updated at the given address.
//
// If this Remote already existed, this overwrites the existing remote.
// If this Remote did not exist, this adds a new Remote.
WithUpdatedRemote(address string, updatedToken string) (RemoteProvider, error)
// WithoutRemote returns a new RemoteProvider with the Remove deleted.
//
// Returns false if the remote did not exist.
WithoutRemote(address string) (RemoteProvider, bool)
// ToExternalRemotes converts the RemoteProvider into sorted ExternalRemotes.
//
// Sorted by address.
ToExternalRemotes() []ExternalRemote
}
RemoteProvider provides Remotes.
func NewRemoteProvider ¶
func NewRemoteProvider(externalRemotes []ExternalRemote) (RemoteProvider, error)
NewRemoteProvider returns a new RemoteProvider for the ExternalRemotes.
Click to show internal directories.
Click to hide internal directories.