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
- func (c *FronteggClient) GetEmail() string
- func (c *FronteggClient) GetEndpoint() string
- func (c *FronteggClient) GetPassword() string
- func (c *FronteggClient) GetToken() string
- func (c *FronteggClient) GetTokenExpiry() time.Time
- func (c *FronteggClient) NeedsTokenRefresh() error
- func (c *FronteggClient) RefreshToken() error
- type Region
- type RegionInfo
- type Role
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 ¶
type CloudAPIClient struct { HTTPClient *http.Client FronteggClient *FronteggClient Endpoint string BaseEndpoint string }
CloudAPIClient is a client for interacting with the Materialize Cloud API
func NewCloudAPIClient ¶
func NewCloudAPIClient(fronteggClient *FronteggClient, cloudAPIEndpoint, baseEndpoint string) *CloudAPIClient
NewCloudAPIClient creates a new Cloud API client
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 Token string Email string Endpoint string TokenExpiry time.Time Password string }
FronteggClient struct to encapsulate the http.Client with additional properties
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) GetEmail ¶
func (c *FronteggClient) GetEmail() string
Get the email from the FronteggClient
func (*FronteggClient) GetEndpoint ¶
func (c *FronteggClient) GetEndpoint() string
Get the endpoint from the FronteggClient
func (*FronteggClient) GetPassword ¶
func (c *FronteggClient) GetPassword() string
Get the password from the FronteggClient
func (*FronteggClient) GetToken ¶
func (c *FronteggClient) GetToken() string
Get the token from the FronteggClient
func (*FronteggClient) GetTokenExpiry ¶
func (c *FronteggClient) GetTokenExpiry() time.Time
Get the token expiry from the FronteggClient
func (*FronteggClient) NeedsTokenRefresh ¶
func (c *FronteggClient) NeedsTokenRefresh() error
func (*FronteggClient) RefreshToken ¶
func (c *FronteggClient) RefreshToken() error
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.