Documentation
¶
Index ¶
- func ConstructAppPassword(clientID, secret string) string
- func FronteggRequest(ctx context.Context, client *FronteggClient, method, url string, body []byte) (*http.Response, error)
- func HandleAPIError(resp *http.Response) error
- func HandleApiError(resp *http.Response) error
- func IsNotFoundError(err error) bool
- func SplitHostPort(hostPortStr string) (host string, port int, err error)
- type AppPassword
- type CloudAPIClient
- func (c *CloudAPIClient) EnableRegion(ctx context.Context, provider CloudProvider) (*CloudRegion, error)
- func (c *CloudAPIClient) GetHost(ctx context.Context, regionID string) (string, error)
- func (c *CloudAPIClient) GetRegionDetails(ctx context.Context, provider CloudProvider) (*CloudRegion, error)
- func (c *CloudAPIClient) ListCloudProviders(ctx context.Context) ([]CloudProvider, error)
- type CloudProvider
- type CloudProviderResponse
- type CloudRegion
- type DBClient
- type FronteggAPIError
- type FronteggClient
- type Region
- type RegionInfo
- type Role
- type TokenSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConstructAppPassword ¶
Helper function to construct app password from clientId and secret.
func FronteggRequest ¶ added in v0.6.6
func FronteggRequest(ctx context.Context, client *FronteggClient, method, url string, body []byte) (*http.Response, error)
Helper function to perform HTTP requests
func HandleAPIError ¶ added in v0.8.9
HandleAPIError processes an HTTP response and returns a FronteggAPIError if applicable
func HandleApiError ¶ added in v0.6.6
Helper function to handle API errors
func IsNotFoundError ¶ added in v0.8.9
IsNotFoundError checks if the error is a 404 Not Found error
Types ¶
type AppPassword ¶
type CloudAPIClient ¶
CloudAPIClient is a client for interacting with the Materialize Cloud API
func NewCloudAPIClient ¶
func NewCloudAPIClient(tokens TokenSource, cloudAPIEndpoint, baseEndpoint string) *CloudAPIClient
NewCloudAPIClient creates a new Cloud API client that authorizes its requests from the given token source.
func (*CloudAPIClient) EnableRegion ¶ added in v0.6.10
func (c *CloudAPIClient) EnableRegion(ctx context.Context, provider CloudProvider) (*CloudRegion, error)
EnableRegion sends a PATCH request to enable a cloud region
func (*CloudAPIClient) GetRegionDetails ¶
func (c *CloudAPIClient) GetRegionDetails(ctx context.Context, provider CloudProvider) (*CloudRegion, error)
GetRegionDetails fetches the details for a given region
func (*CloudAPIClient) ListCloudProviders ¶
func (c *CloudAPIClient) ListCloudProviders(ctx context.Context) ([]CloudProvider, error)
ListCloudProviders fetches the list of cloud providers and their regions
type CloudProvider ¶
type CloudProvider struct {
ID string `json:"id"`
Name string `json:"name"`
Url string `json:"url"`
CloudProvider string `json:"cloudProvider"`
}
CloudProvider contains the information about a cloud provider and its region
type CloudProviderResponse ¶
type CloudProviderResponse struct {
Data []CloudProvider `json:"data"`
NextCursor string `json:"nextCursor,omitempty"`
}
CloudProviderResponse represents the response for listing cloud providers
type CloudRegion ¶
type CloudRegion struct {
RegionInfo *RegionInfo `json:"regionInfo"`
}
Region holds the connection details for an active region
type DBClient ¶
func NewDBClient ¶
type FronteggAPIError ¶ added in v0.8.9
FronteggAPIError represents a standardized error structure for Frontegg API calls
func NewFronteggAPIError ¶ added in v0.8.9
func NewFronteggAPIError(resp *http.Response, message string) *FronteggAPIError
NewFronteggAPIError creates a new FronteggAPIError instance
func (*FronteggAPIError) Error ¶ added in v0.8.9
func (e *FronteggAPIError) Error() string
type FronteggClient ¶
type FronteggClient struct {
HTTPClient *http.Client
Endpoint string
// Email identifies the authenticated principal and is also used as the
// database user. It is derived from the credentials, so it never changes for
// the lifetime of the client.
Email string
// contains filtered or unexported fields
}
FronteggClient talks to the Frontegg admin API and doubles as the TokenSource for every other authorized client.
HTTPClient, Endpoint and Email are fixed once the client is built. The token state behind them is mutable and guarded by mu.
func NewFronteggClient ¶
func NewFronteggClient(ctx context.Context, password, endpoint string) (*FronteggClient, error)
NewFronteggClient function for initializing a new Frontegg client with an auth token
func (*FronteggClient) Token ¶
func (c *FronteggClient) Token(ctx context.Context) (string, error)
Token implements TokenSource. It returns the cached token while it is still good and otherwise fetches a new one. The lock is deliberately held across the fetch so that concurrent callers arriving on an expired token produce a single request instead of one each.
type RegionInfo ¶
type RegionInfo struct {
SqlAddress string `json:"sqlAddress"`
HttpAddress string `json:"httpAddress"`
Resolvable bool `json:"resolvable"`
EnabledAt string `json:"enabledAt"`
}
RegionInfo holds the detailed information about a region from the Cloud API
type Role ¶
type Role struct {
ID string `json:"id"`
VendorID string `json:"vendorId"`
TenantID *string `json:"tenantId,omitempty"`
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description"`
IsDefault bool `json:"isDefault"`
FirstUserRole bool `json:"firstUserRole"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Permissions []string `json:"permissions"`
Level int `json:"level"`
}
Role represents the Frontegg role structure.