Documentation
¶
Index ¶
- Variables
- func AddFlags(opts *Opts, flags *pflag.FlagSet)
- type ApiClient
- func (c *ApiClient) ArtifactExists(hash string) (*http.Response, error)
- func (c *ApiClient) FetchArtifact(hash string) (*http.Response, error)
- func (c *ApiClient) GetCachingStatus() (util.CachingStatus, error)
- func (c *ApiClient) GetTeam(teamID string) (*Team, error)
- func (c *ApiClient) GetTeamID() string
- func (c *ApiClient) GetTeams() (*TeamsResponse, error)
- func (c *ApiClient) GetUser() (*UserResponse, error)
- func (c *ApiClient) HasUser() bool
- func (c *ApiClient) IsLinked() bool
- func (c *ApiClient) PutArtifact(hash string, artifactBody []byte, duration int, tag string) error
- func (c *ApiClient) RecordAnalyticsEvents(events []map[string]interface{}) error
- func (c *ApiClient) SetTeamID(teamID string)
- func (c *ApiClient) SetToken(token string)
- func (c *ApiClient) UserAgent() string
- func (c *ApiClient) VerifySSOToken(token string, tokenName string) (*VerifiedSSOUser, error)
- type Membership
- type Opts
- type Pagination
- type RemoteConfig
- type Team
- type TeamsResponse
- type User
- type UserResponse
- type VerifiedSSOUser
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyFailures = errors.New("skipping HTTP Request, too many failures have occurred")
ErrTooManyFailures is returned from remote cache API methods after `maxRemoteFailCount` errors have occurred
Functions ¶
Types ¶
type ApiClient ¶
type ApiClient struct { // An http client HttpClient *retryablehttp.Client // contains filtered or unexported fields }
func NewClient ¶
func NewClient(remoteConfig RemoteConfig, logger hclog.Logger, titanVersion string, opts Opts) *ApiClient
New creates a new ApiClient
func (*ApiClient) ArtifactExists ¶
ArtifactExists attempts to determine if the build artifact with the given hash exists in the Remote Caching server
func (*ApiClient) FetchArtifact ¶
FetchArtifact attempts to retrieve the build artifact with the given hash from the Remote Caching server
func (*ApiClient) GetCachingStatus ¶
func (c *ApiClient) GetCachingStatus() (util.CachingStatus, error)
GetCachingStatus returns the server's perspective on whether or not remote caching requests will be allowed.
func (*ApiClient) GetTeam ¶
GetTeam gets a particular Khulnasoft Team. It returns nil if it's not found
func (*ApiClient) GetTeams ¶
func (c *ApiClient) GetTeams() (*TeamsResponse, error)
GetTeams returns a list of Khulnasoft teams
func (*ApiClient) GetUser ¶
func (c *ApiClient) GetUser() (*UserResponse, error)
GetUser returns the current user
func (*ApiClient) PutArtifact ¶
func (*ApiClient) RecordAnalyticsEvents ¶
func (*ApiClient) VerifySSOToken ¶
func (c *ApiClient) VerifySSOToken(token string, tokenName string) (*VerifiedSSOUser, error)
type Membership ¶
type Membership struct {
Role string `json:"role"`
}
Membership is the relationship between the logged-in user and a particular team
type Opts ¶
type Opts struct {
UsePreflight bool
}
Opts holds values for configuring the behavior of the API client
type Pagination ¶
type Pagination struct { Count int `json:"count,omitempty"` Next int `json:"next,omitempty"` Prev int `json:"prev,omitempty"` }
Pagination is a Khulnasoft pagination object
type RemoteConfig ¶
RemoteConfig holds the authentication and endpoint details for the API client
type Team ¶
type Team struct { ID string `json:"id,omitempty"` Slug string `json:"slug,omitempty"` Name string `json:"name,omitempty"` CreatedAt int `json:"createdAt,omitempty"` Created string `json:"created,omitempty"` Membership Membership `json:"membership"` }
Team is a Khulnasoft Team object
type TeamsResponse ¶
type TeamsResponse struct { Teams []Team `json:"teams,omitempty"` Pagination Pagination `json:"pagination,omitempty"` }
TeamsResponse is a Khulnasoft object containing a list of teams and pagination info
type UserResponse ¶
type UserResponse struct {
User User `json:"user,omitempty"`
}
type VerifiedSSOUser ¶
VerifiedSSOUser contains data returned from the SSO token verification endpoint