Documentation ¶
Index ¶
- Constants
- type KeyFlow
- func (c *KeyFlow) Clone() interface{}
- func (c *KeyFlow) Do(req *http.Request) (*http.Response, error)
- func (c *KeyFlow) GetAccessToken() (string, error)
- func (c *KeyFlow) GetConfig() KeyFlowConfig
- func (c *KeyFlow) GetServiceAccountEmail() string
- func (c *KeyFlow) Init(ctx context.Context, cfg ...KeyFlowConfig) error
- type KeyFlowConfig
- type RetryConfig
- type ServiceAccountKeyPrivateResponse
- type TokenFlow
- type TokenFlowConfig
- type TokenResponseBody
Constants ¶
View Source
const ( // Known error messages ClientTimeoutErr = "Client.Timeout exceeded while awaiting headers" ClientContextDeadlineErr = "context deadline exceeded" ClientConnectionRefusedErr = "connection refused" ClientEOFError = "unexpected EOF" )
View Source
const ( DefaultClientTimeout = time.Minute DefaultRetryMaxRetries = 3 DefaultRetryWaitBetweenCalls = 30 * time.Second DefaultRetryTimeout = 2 * time.Minute DefaultTraceparent = false )
View Source
const ( // Key Flow optional env variable (1) ServiceAccountKey = "STACKIT_SERVICE_ACCOUNT_KEY" PrivateKey = "STACKIT_PRIVATE_KEY" // Key Flow optional env variable (2) using file paths ServiceAccountKeyPath = "STACKIT_SERVICE_ACCOUNT_KEY_PATH" PrivateKeyPath = "STACKIT_PRIVATE_KEY_PATH" )
View Source
const ( // Service Account Token Flow // Auth flow env variables ServiceAccountEmail = "STACKIT_SERVICE_ACCOUNT_EMAIL" ServiceAccountToken = "STACKIT_SERVICE_ACCOUNT_TOKEN" )
View Source
const (
PrivateKeyBlockType = "PRIVATE KEY"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyFlow ¶
type KeyFlow struct {
// contains filtered or unexported fields
}
KeyFlow handles auth with SA key
func (*KeyFlow) GetAccessToken ¶
GetAccessToken returns short-lived access token
func (*KeyFlow) GetConfig ¶
func (c *KeyFlow) GetConfig() KeyFlowConfig
GetConfig returns the flow configuration
func (*KeyFlow) GetServiceAccountEmail ¶
GetServiceAccountEmail returns the service account email
type KeyFlowConfig ¶
type KeyFlowConfig struct { ServiceAccountKeyPath string PrivateKeyPath string ServiceAccountKey []byte PrivateKey []byte ClientRetry *RetryConfig EnableTraceparent bool }
KeyFlowConfig is the flow config
type RetryConfig ¶
type RetryConfig struct { MaxRetries int // Max retries WaitBetweenCalls time.Duration // Time to wait between requests RetryTimeout time.Duration // Max time to re-try ClientTimeout time.Duration // HTTP Client timeout Traceparent *bool // Add traceparent header? }
func NewRetryConfig ¶
func NewRetryConfig() *RetryConfig
type ServiceAccountKeyPrivateResponse ¶
type ServiceAccountKeyPrivateResponse struct { Active bool `json:"active"` CreatedAt time.Time `json:"createdAt"` Credentials struct { Aud string `json:"aud"` Iss string `json:"iss"` Kid string `json:"kid"` PrivateKey *string `json:"privateKey,omitempty"` Sub uuid.UUID `json:"sub"` } `json:"credentials"` ID uuid.UUID `json:"id"` KeyAlgorithm string `json:"keyAlgorithm"` KeyOrigin string `json:"keyOrigin"` KeyType string `json:"keyType"` PublicKey string `json:"publicKey"` ValidUntil *time.Time `json:"validUntil,omitempty"` }
ServiceAccountKeyPrivateResponse is the API response when creating a new SA key
type TokenFlow ¶
type TokenFlow struct {
// contains filtered or unexported fields
}
TokenFlow handles auth with SA static token
func (*TokenFlow) Clone ¶
func (c *TokenFlow) Clone() interface{}
Clone creates a clone of the client
func (*TokenFlow) GetConfig ¶
func (c *TokenFlow) GetConfig() TokenFlowConfig
GetConfig returns the flow configuration
func (*TokenFlow) GetServiceAccountEmail ¶
GetServiceAccountEmail returns the service account email
type TokenFlowConfig ¶
type TokenFlowConfig struct { ServiceAccountEmail string ServiceAccountToken string ClientRetry *RetryConfig EnableTraceparent bool }
TokenFlowConfig is the flow config
type TokenResponseBody ¶
type TokenResponseBody struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` Scope string `json:"scope"` TokenType string `json:"token_type"` }
TokenResponseBody is the API response when requesting a new token
Click to show internal directories.
Click to hide internal directories.