backend

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBackendEnv = "testing"

DefaultBackendEnv is the default backend environment when not specified

Variables

View Source
var BackendURLs = map[string]string{
	"testing":    "https://lychaz5ra6.execute-api.us-east-1.amazonaws.com/testing",
	"staging":    "https://2gjp7z6bxi.execute-api.us-east-1.amazonaws.com/staging",
	"production": "",
}

BackendURLs maps environment names to backend URLs

Functions

func IsConfigured

func IsConfigured() bool

IsConfigured returns true if a backend API key is available

func IsValidEnvironment

func IsValidEnvironment(env string) bool

IsValidEnvironment checks if the given environment name is valid

func ResolveAPIKey

func ResolveAPIKey(flagValue string) string

ResolveAPIKey returns the backend API key from flag, config, or environment Priority: flag > config > env

func ResolveBackendEnv

func ResolveBackendEnv() string

ResolveBackendEnv returns the backend environment name

func ResolveBackendURL

func ResolveBackendURL() string

ResolveBackendURL returns the backend URL based on configuration Priority: explicit URL > env URL > env name > config env > default (testing)

func ValidEnvironments

func ValidEnvironments() []string

ValidEnvironments returns the list of valid backend environments

Types

type APIResponse

type APIResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
	Error   string `json:"error,omitempty"`
}

APIResponse represents a generic API response

type AWSCredentials

type AWSCredentials struct {
	AccessKeyID     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
	Region          string `json:"region,omitempty"`
	SessionToken    string `json:"session_token,omitempty"`
}

AWSCredentials represents AWS credentials stored in the backend

type AzureCredentials

type AzureCredentials struct {
	SubscriptionID string `json:"subscription_id"`
	TenantID       string `json:"tenant_id,omitempty"`
	ClientID       string `json:"client_id,omitempty"`
	ClientSecret   string `json:"client_secret,omitempty"`
}

AzureCredentials represents Azure credentials stored in the backend

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the HTTP client for the clanker backend API

func NewClient

func NewClient(apiKey string, debug bool) *Client

NewClient creates a new backend client

func NewClientWithURL

func NewClientWithURL(apiKey, baseURL string, debug bool) *Client

NewClientWithURL creates a new backend client with a specific URL

func (*Client) DeleteCredential

func (c *Client) DeleteCredential(ctx context.Context, provider CredentialProvider) error

DeleteCredential deletes credentials for a provider from the backend

func (*Client) GetAWSCredentials

func (c *Client) GetAWSCredentials(ctx context.Context) (*AWSCredentials, error)

GetAWSCredentials retrieves AWS credentials from the backend

func (*Client) GetAzureCredentials

func (c *Client) GetAzureCredentials(ctx context.Context) (*AzureCredentials, error)

GetAzureCredentials retrieves Azure credentials from the backend

func (*Client) GetCloudflareCredentials

func (c *Client) GetCloudflareCredentials(ctx context.Context) (*CloudflareCredentials, error)

GetCloudflareCredentials retrieves Cloudflare credentials from the backend

func (*Client) GetGCPCredentials

func (c *Client) GetGCPCredentials(ctx context.Context) (*GCPCredentials, error)

GetGCPCredentials retrieves GCP credentials from the backend

func (*Client) GetKubernetesCredentials

func (c *Client) GetKubernetesCredentials(ctx context.Context) (*KubernetesCredentials, error)

GetKubernetesCredentials retrieves Kubernetes credentials from the backend

func (*Client) ListCredentials

func (c *Client) ListCredentials(ctx context.Context) ([]CredentialEntry, error)

ListCredentials lists all credentials stored in the backend

func (*Client) StoreAWSCredentials

func (c *Client) StoreAWSCredentials(ctx context.Context, creds *AWSCredentials) error

StoreAWSCredentials stores AWS credentials in the backend

func (*Client) StoreAzureCredentials

func (c *Client) StoreAzureCredentials(ctx context.Context, creds *AzureCredentials) error

StoreAzureCredentials stores Azure credentials in the backend

func (*Client) StoreCloudflareCredentials

func (c *Client) StoreCloudflareCredentials(ctx context.Context, creds *CloudflareCredentials) error

StoreCloudflareCredentials stores Cloudflare credentials in the backend

func (*Client) StoreGCPCredentials

func (c *Client) StoreGCPCredentials(ctx context.Context, creds *GCPCredentials) error

StoreGCPCredentials stores GCP credentials in the backend

func (*Client) StoreKubernetesCredentials

func (c *Client) StoreKubernetesCredentials(ctx context.Context, creds *KubernetesCredentials) error

StoreKubernetesCredentials stores Kubernetes credentials in the backend Note: kubernetes provider must be added to the backend for this to work

type CloudflareCredentials

type CloudflareCredentials struct {
	APIToken  string `json:"api_token"`
	AccountID string `json:"account_id,omitempty"`
	ZoneID    string `json:"zone_id,omitempty"`
}

CloudflareCredentials represents Cloudflare credentials stored in the backend

type CredentialEntry

type CredentialEntry struct {
	Provider  CredentialProvider `json:"provider"`
	CreatedAt time.Time          `json:"created_at"`
	UpdatedAt time.Time          `json:"updated_at"`
	Masked    map[string]string  `json:"masked,omitempty"`
}

CredentialEntry represents a stored credential in the backend

type CredentialListResponse

type CredentialListResponse struct {
	Success bool              `json:"success"`
	Data    []CredentialEntry `json:"data"`
}

CredentialListResponse represents the response from listing credentials

type CredentialProvider

type CredentialProvider string

CredentialProvider represents supported credential providers

const (
	ProviderAWS        CredentialProvider = "aws"
	ProviderGCP        CredentialProvider = "gcp"
	ProviderAzure      CredentialProvider = "azure"
	ProviderCloudflare CredentialProvider = "cloudflare"
	ProviderKubernetes CredentialProvider = "kubernetes"
)

type CredentialRawResponse

type CredentialRawResponse struct {
	Success bool            `json:"success"`
	Data    CredentialEntry `json:"data"`
}

CredentialRawResponse represents the response from getting raw credentials

type GCPCredentials

type GCPCredentials struct {
	ProjectID          string `json:"project_id"`
	ServiceAccountJSON string `json:"service_account_json,omitempty"`
}

GCPCredentials represents GCP credentials stored in the backend

type KubernetesCredentials

type KubernetesCredentials struct {
	KubeconfigContent string `json:"kubeconfig_content"`
	ContextName       string `json:"context_name,omitempty"`
}

KubernetesCredentials represents Kubernetes credentials stored in the backend

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL