Documentation ¶
Index ¶
- Constants
- Variables
- func Do[T any](op func() (T, error), retryOptions ...RetryOption) (T, error)
- func IsMaxRetriesReached(err error) bool
- func IsTimeout(err error) bool
- type Client
- func (c *Client) CreateAuthorization(ctx context.Context, aName, description, permissions, resourceName string) (*CreateAuthorizationResponse, error)
- func (c *Client) CreateResource(ctx context.Context, name, rType string, yamlRConfig []byte, tags []string) (*CreateResourceResponse, error)
- func (c *Client) CreateScript(ctx context.Context, name, command, endpoint string) (*CreateResourceResponse, error)
- func (c *Client) CreateSession(ctx context.Context, ...) (*CreateSessionResponse, error)
- func (c *Client) CreateTeam(ctx context.Context, name *string, members, endpoints *[]string) (*CreateResourceResponse, error)
- func (c *Client) DeleteAuthorization(ctx context.Context, authID string) (bool, error)
- func (c *Client) DeleteResource(resourceID, resourceName string) (bool, error)
- func (c *Client) DeleteScript(ctx context.Context, id, name string) (bool, error)
- func (c *Client) DeleteSession(sessionID string) (bool, error)
- func (c *Client) DeleteTeam(ctx context.Context, id, name string) (bool, error)
- func (c *Client) GetTeam(ctx context.Context, id string) (*CreateResourceResponse, error)
- func (c *Client) ReadAuthorization(authID string, waitForStatus bool) (any, error)
- func (c *Client) ReadSession(sessionID string, waitForStatus bool) (map[string]interface{}, error)
- func (c *Client) UpdateAuthorization(ctx context.Context, ...) (*UpdateAuthorizationResponse, error)
- func (c *Client) UpdateResource(resourceID string, rType string, yamlRConfig []byte, tags []string) (*UpdateResourceResponse, error)
- func (c *Client) UpdateScript(ctx context.Context, id, name, command, endpoint *string) (any, error)
- func (c *Client) UpdateSession(...) (*UpdateSessionResponse, error)
- func (c *Client) UpdateTeam(ctx context.Context, id, name *string, members, endpoints *[]string) (any, error)
- type CreateAuthorizationRequest
- type CreateAuthorizationResponse
- type CreateResourceRequest
- type CreateResourceResponse
- type CreateSessionRequest
- type CreateSessionResponse
- type DefaultResponse
- type ErrorResponse
- type RetryOption
- func AfterRetryLimit(afterRetryLimit func(err error)) RetryOption
- func RetryChecker(checker func(result any, err error) bool) RetryOption
- func RetryLimit(tries int) RetryOption
- func RetryResultChecker(resultChecker func(result any) bool) RetryOption
- func Sleep(d time.Duration) RetryOption
- func Timeout(d time.Duration) RetryOption
- type UpdateAuthorizationRequest
- type UpdateAuthorizationResponse
- type UpdateResourceRequest
- type UpdateResourceResponse
- type UpdateSessionRequest
- type UpdateSessionResponse
Constants ¶
View Source
const ( DefaultFunctionMaxRetry = 10 DefaultFunctionMaxTimeout = time.Duration(time.Minute * 5) )
View Source
const (
PostgresIntegrationType = "postgres"
)
Variables ¶
View Source
var ( // ErrTimeout = errgo.New("Operation aborted. Timeout occured") // ErrMaxRetriesReached = errgo.New("Operation aborted. Too many errors.") ErrTimeout = errors.New("timeout occured") ErrMaxRetriesReached = errors.New("too many errors") )
Functions ¶
func Do ¶ added in v0.0.3
func Do[T any](op func() (T, error), retryOptions ...RetryOption) (T, error)
func IsMaxRetriesReached ¶ added in v0.0.3
IsMaxRetriesReached returns true if the cause of the given error is a MaxRetriesReachedError.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateAuthorization ¶ added in v0.0.3
func (c *Client) CreateAuthorization(ctx context.Context, aName, description, permissions, resourceName string) (*CreateAuthorizationResponse, error)
Authorizations
func (*Client) CreateResource ¶
func (c *Client) CreateResource( ctx context.Context, name, rType string, yamlRConfig []byte, tags []string, ) (*CreateResourceResponse, error)
Resources / Integrations
func (*Client) CreateScript ¶ added in v0.0.12
func (*Client) CreateSession ¶
func (c *Client) CreateSession( ctx context.Context, sessionName, resourceName, authorizationName, clusterName, ttl, sessionType string, isJITEnabled bool, accessApprovers []string, pauseTimeout string, users []string, memory, cpu string, tags []string, ) (*CreateSessionResponse, error)
Sessions
func (*Client) CreateTeam ¶ added in v0.0.12
func (*Client) DeleteAuthorization ¶ added in v0.0.3
func (*Client) DeleteResource ¶
func (*Client) DeleteScript ¶ added in v0.0.12
func (*Client) DeleteTeam ¶ added in v0.0.12
func (*Client) ReadAuthorization ¶ added in v0.0.3
func (*Client) ReadSession ¶
waitForStatus: if true, will wait for session to be active/fail before returning
func (*Client) UpdateAuthorization ¶ added in v0.0.3
func (*Client) UpdateResource ¶
func (*Client) UpdateScript ¶ added in v0.0.12
func (*Client) UpdateSession ¶
type CreateAuthorizationRequest ¶ added in v0.0.3
type CreateAuthorizationRequest struct { AuthorizationName string `json:"name"` Resource string `json:"resource"` Description string `json:"description"` Permissions string `json:"permissions"` }
Authorizations
type CreateAuthorizationResponse ¶ added in v0.0.3
type CreateAuthorizationResponse struct {
ID string `json:"id"`
}
type CreateResourceRequest ¶
type CreateResourceResponse ¶
type CreateResourceResponse struct {
ID string `json:"id"`
}
type CreateSessionRequest ¶
type CreateSessionRequest struct { SessionName string `json:"sessionName"` ResourceName string `json:"resourceName"` ClusterName string `json:"clusterName,omitempty"` AuthorizationName string `json:"authorizationName,omitempty"` SessionTTL string `json:"sessionTTL,omitempty"` SessionType string `json:"sessionType"` // List of user emails to add to the endpoint SessionUsers []string `json:"sessionUsers,omitempty"` // endpoint JIT access mode IsJITEnabled bool `json:"is_jit_enabled"` AccessApprovers []string `json:"access_approvers"` Memory string `json:"memory"` CPU string `json:"cpu"` UsersTags []string `json:"usertags"` // pause endpoint timeout Timeout string `json:"timeout"` }
sessions
type CreateSessionResponse ¶
type CreateSessionResponse struct {
ID string `json:"id"`
}
type DefaultResponse ¶ added in v0.0.12
type DefaultResponse struct {
Status string
}
type ErrorResponse ¶ added in v0.0.12
type RetryOption ¶ added in v0.0.3
type RetryOption func(options *retryOptions)
Option to dictate behaviour of retry validator
func AfterRetryLimit ¶ added in v0.0.3
func AfterRetryLimit(afterRetryLimit func(err error)) RetryOption
AfterRetryLimit is called after a retry limit is reached and can be used e.g. to emit events.
func RetryChecker ¶ added in v0.0.3
func RetryChecker(checker func(result any, err error) bool) RetryOption
RetryChecker defines whether the given error is an error that can be retried.
func RetryLimit ¶ added in v0.0.3
func RetryLimit(tries int) RetryOption
RetryLimit specifies the maximum number of times op will be called by Do().
func RetryResultChecker ¶ added in v0.0.3
func RetryResultChecker(resultChecker func(result any) bool) RetryOption
func Sleep ¶ added in v0.0.3
func Sleep(d time.Duration) RetryOption
func Timeout ¶ added in v0.0.3
func Timeout(d time.Duration) RetryOption
Timeout specifies the maximum time that should be used before aborting the retry loop. Note that this does not abort the operation in progress.
type UpdateAuthorizationRequest ¶ added in v0.0.3
type UpdateAuthorizationResponse ¶ added in v0.0.3
type UpdateAuthorizationResponse struct {
ID string `json:"id"`
}
type UpdateResourceRequest ¶
type UpdateResourceResponse ¶
type UpdateResourceResponse struct {
ID string `json:"id"`
}
type UpdateSessionRequest ¶
type UpdateSessionRequest = CreateSessionRequest
type UpdateSessionResponse ¶
type UpdateSessionResponse struct {
ID string `json:"id"`
}
Click to show internal directories.
Click to hide internal directories.