Documentation
¶
Index ¶
- Variables
- type GCPClient
- type GCPClientFactory
- type GCPClientImpl
- func (c *GCPClientImpl) CreateGCPHttpRequest(ctx context.Context, method string, url string, body io.Reader) (*http.Request, error)
- func (pi *GCPClientImpl) Digest() string
- func (c *GCPClientImpl) GetAnthosAWSClusterNames(ctx context.Context, projectId string) ([]string, error)
- func (c *GCPClientImpl) GetAnthosAzureClusterNames(ctx context.Context, projectId string) ([]string, error)
- func (c *GCPClientImpl) GetAnthosOnBaremetalClusterNames(ctx context.Context, projectId string) ([]string, error)
- func (c *GCPClientImpl) GetAnthosOnVMWareClusterNames(ctx context.Context, projectId string) ([]string, error)
- func (c *GCPClientImpl) GetClusterNames(ctx context.Context, projectId string) ([]string, error)
- func (c *GCPClientImpl) GetComposerEnvironmentNames(ctx context.Context, projectId string, location string) ([]string, error)
- func (c *GCPClientImpl) GetFleetMembershipNames(ctx context.Context, projectId string) ([]string, error)
- func (c *GCPClientImpl) ListLogEntries(ctx context.Context, projectId string, filter string, logSink chan any) error
- type PageClient
- type RefreshableToken
- type RequestGenerator
Constants ¶
This section is empty.
Variables ¶
var ErrorInternalServerError = errors.New("internal server error")
var ErrorRateLimitExceeds = errors.New("ratelimit exceeds. retry it later")
var MaxRetryCount = 10
var MaxWaitTimeOnRetriableError = 60
var MinWaitTimeOnRetriableError = 5
var RetriableHttpResponseCodes = []int{
429, 500, 501, 502, 503,
}
var RetriableWithRefreshingTokenHttpResponseCodes = []int{
401, 403,
}
Functions ¶
This section is empty.
Types ¶
type GCPClient ¶
type GCPClient interface { GetClusterNames(ctx context.Context, projectId string) ([]string, error) GetAnthosAWSClusterNames(ctx context.Context, projectId string) ([]string, error) GetAnthosAzureClusterNames(ctx context.Context, projectId string) ([]string, error) GetAnthosOnBaremetalClusterNames(ctx context.Context, projectId string) ([]string, error) GetAnthosOnVMWareClusterNames(ctx context.Context, projectId string) ([]string, error) GetComposerEnvironmentNames(ctx context.Context, projectId string, location string) ([]string, error) ListLogEntries(ctx context.Context, projectId string, filter string, logSink chan any) error }
func NewGCPClient ¶
func NewGCPClient(refresher token.TokenRefresher, headerProviders []httpclient.HTTPHeaderProvider) (GCPClient, error)
type GCPClientFactory ¶
type GCPClientFactory struct { HeaderProviders []httpclient.HTTPHeaderProvider TokenStores []token.TokenStore }
var DefaultGCPClientFactory *GCPClientFactory = NewGCPClientFactory()
func NewGCPClientFactory ¶
func NewGCPClientFactory() *GCPClientFactory
func (*GCPClientFactory) NewClient ¶
func (f *GCPClientFactory) NewClient() (GCPClient, error)
NewClient instanciate a new GCPClient from current factory config.
func (*GCPClientFactory) RegisterHeaderProvider ¶
func (f *GCPClientFactory) RegisterHeaderProvider(provider httpclient.HTTPHeaderProvider)
RegisterHeaderProvider adds a new HeaderProvider on factory config.
func (*GCPClientFactory) RegisterRefreshableTokenStore ¶
func (f *GCPClientFactory) RegisterRefreshableTokenStore(store token.TokenStore)
RegisterRefreshableTokenStore adds a refreshable token store. The token will be refreshed when permission related error happens.
type GCPClientImpl ¶
type GCPClientImpl struct { BaseClient httpclient.HTTPClient[*http.Response] // This is a parameter for limiting the result length of List log entries api call for testing purpose. MaxLogEntries int }
func (*GCPClientImpl) CreateGCPHttpRequest ¶
func (*GCPClientImpl) Digest ¶
func (pi *GCPClientImpl) Digest() string
Digest implements task.CachableDependency.
func (*GCPClientImpl) GetAnthosAWSClusterNames ¶
func (c *GCPClientImpl) GetAnthosAWSClusterNames(ctx context.Context, projectId string) ([]string, error)
GetAnthosAWSClusterNames retrieves the list of Anthos on AWS cluster names.
func (*GCPClientImpl) GetAnthosAzureClusterNames ¶
func (c *GCPClientImpl) GetAnthosAzureClusterNames(ctx context.Context, projectId string) ([]string, error)
GetAnthosAzureClusterNames retrieves the list of Anthos on Azure cluster names.
func (*GCPClientImpl) GetAnthosOnBaremetalClusterNames ¶
func (*GCPClientImpl) GetAnthosOnVMWareClusterNames ¶
func (*GCPClientImpl) GetComposerEnvironmentNames ¶
func (c *GCPClientImpl) GetComposerEnvironmentNames(ctx context.Context, projectId string, location string) ([]string, error)
Get all composer environment names from composer.googleapis.com in a region refs: https://cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments/list
func (*GCPClientImpl) GetFleetMembershipNames ¶
func (*GCPClientImpl) ListLogEntries ¶
func (c *GCPClientImpl) ListLogEntries(ctx context.Context, projectId string, filter string, logSink chan any) error
*
- Query logs with specified filter
type PageClient ¶
type PageClient[T any] struct { // contains filtered or unexported fields }
PageClient is utility to obtain all the resource from API returning page token.
func NewPageClient ¶
func NewPageClient[T any](client httpclient.HTTPClient[*http.Response]) *PageClient[T]
func (*PageClient[T]) GetAll ¶
func (p *PageClient[T]) GetAll(ctx context.Context, requestGenerator RequestGenerator, nextPageTokenMapper func(response *T) string) ([]*T, error)