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) (*CreateResourceResponse, error)
- func (c *Client) CreateSession(ctx context.Context, ...) (*CreateSessionResponse, error)
- func (c *Client) DeleteAuthorization(ctx context.Context, authID string) (bool, error)
- func (c *Client) DeleteResource(resourceID, resourceName string) (bool, error)
- func (c *Client) DeleteSession(sessionID string) (bool, 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, authID, newName, newDescription string) (*UpdateAuthorizationResponse, error)
- func (c *Client) UpdateResource(resourceID string, rType string, yamlRConfig []byte) (*UpdateResourceResponse, error)
- func (c *Client) UpdateSession(...) (*UpdateSessionResponse, error)
- type CreateAuthorizationRequest
- type CreateAuthorizationResponse
- type CreateResourceRequest
- type CreateResourceResponse
- type CreateSessionRequest
- type CreateSessionResponse
- 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 = 5 DefaultFunctionMaxTimeout = time.Duration(time.Minute * 1) )
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) (*CreateResourceResponse, error)
Resources / Integrations
func (*Client) CreateSession ¶
func (c *Client) CreateSession(ctx context.Context, sessionName, resourceName, authorizationName, clusterName, ttl, sessionType string, users []string) (*CreateSessionResponse, error)
Sessions
func (*Client) DeleteAuthorization ¶ added in v0.0.3
func (*Client) DeleteResource ¶
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) UpdateSession ¶
func (c *Client) UpdateSession(sessionID, sessionName, resourceName, authorizationName, clusterName, ttl, sessionType string, users []string) (*UpdateSessionResponse, error)
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"` AuthorizationName string `json:"authorizationName"` SessionTTL string `json:"sessionTTL"` SessionType string `json:"sessionType"` // List of user emails to add to the endpoint SessionUsers []string `json:"sessionUsers"` }
sessions
type CreateSessionResponse ¶
type CreateSessionResponse struct {
ID string `json:"id"`
}
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.