Documentation
      ¶
    
    
  
    
      Index ¶
- Constants
 - Variables
 - func DecodeJSON(res *http.Response, obj interface{}) error
 - func IsDecodeTypeError(err error) bool
 - func IsHTTP(err error) (*http.Response, bool)
 - func MarshalToRequest(req *http.Request, obj interface{}) error
 - func NewStatusCodeError(res *http.Response) error
 - func Retries(req *http.Request) (int, bool)
 - func WithRetries(req *http.Request, n int) *http.Request
 - type Access
 - type AskPassCredentialHelper
 - type Client
 - func (c *Client) Close() error
 - func (c *Client) CurrentUser() (string, string)
 - func (c *Client) Do(req *http.Request) (*http.Response, error)
 - func (c *Client) DoWithAuth(remote string, req *http.Request) (*http.Response, error)
 - func (c *Client) GitEnv() Env
 - func (c *Client) LogHTTPStats(w io.WriteCloser)
 - func (c *Client) LogRequest(r *http.Request, reqKey string) *http.Request
 - func (c *Client) LogResponse(key string, res *http.Response)
 - func (c *Client) LogStats(out io.Writer)
 - func (c *Client) NewRequest(method string, e Endpoint, suffix string, body interface{}) (*http.Request, error)
 - func (c *Client) OSEnv() Env
 
- type ClientError
 - type CredentialHelper
 - type CredentialHelpers
 - type Creds
 - type Endpoint
 - type EndpointFinder
 - type Env
 - type NetrcFinder
 - type ReadSeekCloser
 - type SSHResolver
 - type TestEnv
 - type UniqTestEnv
 
Constants ¶
const MediaType = "application/vnd.git-lfs+json; charset=utf-8"
    const UrlUnknown = "<unknown>"
    Variables ¶
var (
	UserAgent = "git-lfs"
)
    Functions ¶
func DecodeJSON ¶
func IsDecodeTypeError ¶
func MarshalToRequest ¶
func NewStatusCodeError ¶
Types ¶
type AskPassCredentialHelper ¶
type AskPassCredentialHelper struct {
	// Program is the executable program's absolute or relative name.
	Program string
}
    AskPassCredentialHelper implements the CredentialHelper type for GIT_ASKPASS and 'core.askpass' configuration values.
func (*AskPassCredentialHelper) Approve ¶
func (a *AskPassCredentialHelper) Approve(_ Creds) error
Approve implements CredentialHelper.Approve, and returns nil. The ASKPASS credential helper does not implement credential approval.
func (*AskPassCredentialHelper) Fill ¶
func (a *AskPassCredentialHelper) Fill(what Creds) (Creds, error)
Fill implements fill by running the ASKPASS program and returning its output as a password encoded in the Creds type given the key "password".
It accepts the password as coming from the program's stdout, as when invoked with the given arguments (see (*AskPassCredentialHelper).args() below)./
If there was an error running the command, it is returned instead of a set of filled credentials.
func (*AskPassCredentialHelper) Reject ¶
func (a *AskPassCredentialHelper) Reject(_ Creds) error
Reject implements CredentialHelper.Reject, and returns nil. The ASKPASS credential helper does not implement credential rejection.
type Client ¶
type Client struct {
	Endpoints   EndpointFinder
	Credentials CredentialHelper
	SSH         SSHResolver
	Netrc       NetrcFinder
	DialTimeout         int
	KeepaliveTimeout    int
	TLSTimeout          int
	ConcurrentTransfers int
	HTTPSProxy          string
	HTTPProxy           string
	NoProxy             string
	SkipSSLVerify       bool
	Verbose          bool
	DebuggingVerbose bool
	VerboseOut       io.Writer
	LoggingStats bool // DEPRECATED
	// contains filtered or unexported fields
}
    func (*Client) CurrentUser ¶
func (*Client) DoWithAuth ¶
func (*Client) LogHTTPStats ¶
func (c *Client) LogHTTPStats(w io.WriteCloser)
func (*Client) LogRequest ¶
LogRequest tells the client to log the request's stats to the http log after the response body has been read.
func (*Client) LogResponse ¶
LogResponse sends the current response stats to the http log.
DEPRECATED: Use LogRequest() instead.
func (*Client) LogStats ¶
LogStats is intended to be called after all HTTP operations for the commmand have finished. It dumps k/v logs, one line per httpTransfer into a log file with the current timestamp.
DEPRECATED: Call LogHTTPStats() before the first HTTP request.
func (*Client) NewRequest ¶
type ClientError ¶
type ClientError struct {
	Message          string `json:"message"`
	DocumentationUrl string `json:"documentation_url,omitempty"`
	RequestId        string `json:"request_id,omitempty"`
	// contains filtered or unexported fields
}
    func (*ClientError) Error ¶
func (e *ClientError) Error() string
func (*ClientError) HTTPResponse ¶
func (e *ClientError) HTTPResponse() *http.Response
type CredentialHelper ¶
type CredentialHelpers ¶
type CredentialHelpers []CredentialHelper
CredentialHelpers is a []CredentialHelper that iterates through each credential helper to fill, reject, or approve credentials.
func (CredentialHelpers) Approve ¶
func (h CredentialHelpers) Approve(what Creds) error
Approve implements CredentialHelper.Approve and approves the given Creds "what" amongst all known CredentialHelpers. If any `CredentialHelper`s returned a non-nil error, no further `CredentialHelper`s are notified, so as to prevent inconsistent state.
func (CredentialHelpers) Fill ¶
func (h CredentialHelpers) Fill(what Creds) (Creds, error)
Fill implements CredentialHelper.Fill by asking each CredentialHelper in order to fill the credentials.
If a fill was successful, it is returned immediately, and no other `CredentialHelper`s are consulted. If any CredentialHelper returns an error, it is returned immediately.
func (CredentialHelpers) Reject ¶
func (h CredentialHelpers) Reject(what Creds) error
Reject implements CredentialHelper.Reject and rejects the given Creds "what" amongst all knonw CredentialHelpers. If any `CredentialHelper`s returned a non-nil error, no further `CredentialHelper`s are notified, so as to prevent inconsistent state.
type Endpoint ¶
type Endpoint struct {
	Url            string
	SshUserAndHost string
	SshPath        string
	SshPort        string
	Operation      string
}
    An Endpoint describes how to access a Git LFS server.
type EndpointFinder ¶
type EndpointFinder interface {
	NewEndpointFromCloneURL(rawurl string) Endpoint
	NewEndpoint(rawurl string) Endpoint
	Endpoint(operation, remote string) Endpoint
	RemoteEndpoint(operation, remote string) Endpoint
	GitRemoteURL(remote string, forpush bool) string
	AccessFor(rawurl string) Access
	SetAccess(rawurl string, access Access)
	GitProtocol() string
}
    func NewEndpointFinder ¶
func NewEndpointFinder(git Env) EndpointFinder
type Env ¶
type Env interface {
	Get(string) (string, bool)
	GetAll(string) []string
	Int(string, int) int
	Bool(string, bool) bool
	All() map[string][]string
}
    Env is an interface for the config.Environment methods that this package relies on.
type NetrcFinder ¶
func ParseNetrc ¶
func ParseNetrc(osEnv Env) (NetrcFinder, string, error)
type ReadSeekCloser ¶
type ReadSeekCloser interface {
	io.Seeker
	io.ReadCloser
}
    func NewByteBody ¶
func NewByteBody(by []byte) ReadSeekCloser
type SSHResolver ¶
type TestEnv ¶
TestEnv is a basic config.Environment implementation. Only used in tests, or as a zero value to NewClient().
type UniqTestEnv ¶
func (UniqTestEnv) All ¶
func (e UniqTestEnv) All() map[string][]string
func (UniqTestEnv) GetAll ¶
func (e UniqTestEnv) GetAll(key string) []string