registration

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair() (privateKey string, publicKey string, err error)

GenerateKeyPair generates a new ED25519 key pair for registration

func SaveRegistration

func SaveRegistration(dir string, reg *StoredRegistration) error

SaveRegistration saves the registration data to the specified directory

Types

type Client

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

Client handles the cluster registration flow

func NewClient

func NewClient(managementURL string, config Config) *Client

NewClient creates a new registration client

func (*Client) PollForApproval

func (c *Client) PollForApproval(ctx context.Context, pollURL string, pollInterval time.Duration, progressCallback func()) (*Status, error)

PollForApproval polls the registration status with optional progress callback

func (*Client) StartRegistration

func (c *Client) StartRegistration(ctx context.Context) (*Result, error)

StartRegistration initiates the registration process

type Config

type Config struct {
	ClusterName    string            `json:"cluster_name"`
	OrganizationID string            `json:"organization_id,omitempty"` // Optional - user will select in UI
	Tags           map[string]string `json:"tags,omitempty"`
	PublicKey      string            `json:"public_key,omitempty"` // PEM encoded public key
}

Config contains the configuration for cluster registration

type Result

type Result struct {
	RegistrationID string    `json:"registration_id"`
	AuthURL        string    `json:"auth_url"`
	PollURL        string    `json:"poll_url"`
	ExpiresAt      time.Time `json:"expires_at"`
}

Result contains the result of registration initiation

type Status

type Status struct {
	Status           string `json:"status"`
	ClusterID        string `json:"cluster_id,omitempty"`
	OrganizationID   string `json:"organization_id,omitempty"`
	ServiceAccountID string `json:"service_account_id,omitempty"`
	DNSHostname      string `json:"dns_hostname,omitempty"`
}

Status represents the status of a registration during polling

type StoredRegistration

type StoredRegistration struct {
	ClusterID        string            `json:"cluster_id"`
	ClusterName      string            `json:"cluster_name"`
	OrganizationID   string            `json:"organization_id"`
	ServiceAccountID string            `json:"service_account_id"`
	DNSHostname      string            `json:"dns_hostname,omitempty"` // Auto-provisioned DNS hostname from cloud
	PrivateKey       string            `json:"private_key"`            // PEM encoded private key
	CloudURL         string            `json:"cloud_url"`
	RegisteredAt     time.Time         `json:"registered_at"`
	Tags             map[string]string `json:"tags,omitempty"`

	// Pending registration fields
	Status         string    `json:"status,omitempty"` // "pending" or "approved"
	RegistrationID string    `json:"registration_id,omitempty"`
	PollURL        string    `json:"poll_url,omitempty"`
	ExpiresAt      time.Time `json:"expires_at,omitempty"`
}

StoredRegistration contains the registration data stored on disk

func LoadRegistration

func LoadRegistration(dir string) (*StoredRegistration, error)

LoadRegistration loads the registration data from the specified directory

Jump to

Keyboard shortcuts

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