tillclient

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

this file is adapted from by go-github package https://github.com/google/go-github/blob/master/github/timestamp.go

Index

Constants

This section is empty.

Variables

View Source
var BaseURL string
View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Client

type Client struct {
	*resty.Client
	Token string

	Instances     *InstancesService
	InstanceStats *InstanceStatsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(token string) (c *Client, err error)

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, urlStr string, body interface{}) (*resty.Request, error)

type CustomError

type CustomError struct {
	StatusCode int

	Err error
}

func (*CustomError) Error

func (r *CustomError) Error() string

type Instance

type Instance struct {
	ID                  *int64              `json:"id,omitempty"`
	Name                *string             `json:"name,omitempty"`
	Description         *string             `json:"description,omitempty"`
	Requests            *int64              `json:"requests,omitempty"`
	InterceptedRequests *int64              `json:"intercepted_requests,omitempty"`
	SuccessfulRequests  *int64              `json:"successful_requests,omitempty"`
	FailedRequests      *int64              `json:"failed_requests,omitempty"`
	CacheHits           *int64              `json:"cache_hits,omitempty"`
	CacheSets           *int64              `json:"cache_sets,omitempty"`
	Features            *[]features.Feature `json:"features,omitempty"`

	CreatedAt *Timestamp `json:"created_at,omitempty"`
	UpdatedAt *Timestamp `json:"updated_at,omitempty"`
}

func (*Instance) GetCacheHits added in v0.5.0

func (i *Instance) GetCacheHits() int64

GetCacheHits returns the CacheHits field if it's non-nil, zero value otherwise.

func (*Instance) GetCacheSets added in v0.5.0

func (i *Instance) GetCacheSets() int64

GetCacheSets returns the CacheSets field if it's non-nil, zero value otherwise.

func (*Instance) GetCreatedAt

func (i *Instance) GetCreatedAt() Timestamp

GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.

func (*Instance) GetDescription

func (i *Instance) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*Instance) GetFailedRequests added in v0.5.0

func (i *Instance) GetFailedRequests() int64

GetFailedRequests returns the FailedRequests field if it's non-nil, zero value otherwise.

func (*Instance) GetFeatures added in v0.2.0

func (i *Instance) GetFeatures() []features.Feature

GetFeatures returns the Features field if it's non-nil, zero value otherwise.

func (*Instance) GetID

func (i *Instance) GetID() int64

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Instance) GetInterceptedRequests added in v0.5.0

func (i *Instance) GetInterceptedRequests() int64

GetInterceptedRequests returns the InterceptedRequests field if it's non-nil, zero value otherwise.

func (*Instance) GetName

func (i *Instance) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Instance) GetRequests added in v0.1.4

func (i *Instance) GetRequests() int64

GetRequests returns the Requests field if it's non-nil, zero value otherwise.

func (*Instance) GetSuccessfulRequests added in v0.7.7

func (i *Instance) GetSuccessfulRequests() int64

GetSuccessfulRequests returns the SuccessfulRequests field if it's non-nil, zero value otherwise.

func (*Instance) GetUpdatedAt

func (i *Instance) GetUpdatedAt() Timestamp

GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.

type InstanceStat added in v0.1.4

type InstanceStat struct {
	Name                *string `json:"name,omitempty"`
	Requests            *uint64 `json:"requests,omitempty"`
	InterceptedRequests *uint64 `json:"intercepted_requests,omitempty"`
	SuccessfulRequests  *uint64 `json:"successful_requests,omitempty"`
	FailedRequests      *uint64 `json:"failed_requests,omitempty"`
	CacheHits           *uint64 `json:"cache_hits,omitempty"`
	CacheSets           *uint64 `json:"cache_sets,omitempty"`
}

func (*InstanceStat) DeepCopy added in v0.1.4

func (is *InstanceStat) DeepCopy() (nis InstanceStat)

DeepCopy goes through the fields and copy them, so that all values are copied, and all pointer don't point to the same address

func (*InstanceStat) GetCacheHits added in v0.4.0

func (is *InstanceStat) GetCacheHits() uint64

GetCacheHits returns the CacheHits field if it's non-nil, zero value otherwise.

func (*InstanceStat) GetCacheSets added in v0.4.0

func (is *InstanceStat) GetCacheSets() uint64

GetCacheSets returns the CacheSets field if it's non-nil, zero value otherwise.

func (*InstanceStat) GetFailedRequests added in v0.4.0

func (is *InstanceStat) GetFailedRequests() uint64

GetFailedRequests returns the FailedRequests field if it's non-nil, zero value otherwise.

func (*InstanceStat) GetInterceptedRequests added in v0.4.0

func (is *InstanceStat) GetInterceptedRequests() uint64

GetInterceptedRequests returns the InterceptedRequests field if it's non-nil, zero value otherwise.

func (*InstanceStat) GetName added in v0.1.4

func (is *InstanceStat) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*InstanceStat) GetRequests added in v0.1.4

func (is *InstanceStat) GetRequests() uint64

GetRequests returns the Requests field if it's non-nil, zero value otherwise.

func (*InstanceStat) GetSuccessfulRequests added in v0.7.7

func (is *InstanceStat) GetSuccessfulRequests() uint64

GetSuccessfulRequests returns the SuccessfulRequests field if it's non-nil, zero value otherwise.

func (*InstanceStat) IsZero added in v0.1.4

func (is *InstanceStat) IsZero() bool

IsZero checks if it is zero value

type InstanceStatMutex added in v0.1.4

type InstanceStatMutex struct {
	InstanceStat
	Mutex *sync.Mutex
}

InstanceStatMutex is used for struct to for atomic incr and decr of counters

type InstanceStatsService added in v0.1.4

type InstanceStatsService service

func (*InstanceStatsService) Update added in v0.1.4

func (s *InstanceStatsService) Update(ctx context.Context, is InstanceStat) (*Instance, *resty.Response, error)

type InstancesService

type InstancesService service

func (*InstancesService) Get

func (s *InstancesService) Get(ctx context.Context, name string) (*Instance, *resty.Response, error)

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. This is necessary for some fields since the GitHub API is inconsistent in how it represents times. All exported methods of time.Time can be called on Timestamp.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL