cmd

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() error

Execute runs the root command.

func SetVersion

func SetVersion(v string)

SetVersion sets the CLI version from build flags.

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string
	Message    string
}

APIError represents an error from the admin API.

func (*APIError) Error

func (e *APIError) Error() string

type AdminCreateResponse

type AdminCreateResponse struct {
	Admin  AdminResponse `json:"admin"`
	APIKey string        `json:"api_key"`
}

type AdminListResponse

type AdminListResponse struct {
	Data       []AdminResponse `json:"data"`
	Total      int64           `json:"total"`
	Page       int             `json:"page"`
	PerPage    int             `json:"per_page"`
	TotalPages int             `json:"total_pages"`
}

type AdminResponse

type AdminResponse struct {
	ID         string  `json:"id"`
	Email      string  `json:"email"`
	Name       string  `json:"name"`
	Role       string  `json:"role"`
	IsActive   bool    `json:"is_active"`
	LastUsedAt *string `json:"last_used_at,omitempty"`
	LastUsedIP string  `json:"last_used_ip,omitempty"`
	CreatedAt  string  `json:"created_at"`
	UpdatedAt  string  `json:"updated_at"`
}

type AdminRotateKeyResponse

type AdminRotateKeyResponse struct {
	APIKey string `json:"api_key"`
}

type AuditLogListResponse

type AuditLogListResponse struct {
	Data       []AuditLogResponse `json:"data"`
	Total      int64              `json:"total"`
	Page       int                `json:"page"`
	PerPage    int                `json:"per_page"`
	TotalPages int                `json:"total_pages"`
}

type AuditLogResponse

type AuditLogResponse struct {
	ID             string         `json:"id"`
	AdminID        *string        `json:"admin_id,omitempty"`
	AdminEmail     string         `json:"admin_email"`
	Action         string         `json:"action"`
	ResourceType   string         `json:"resource_type,omitempty"`
	ResourceID     *string        `json:"resource_id,omitempty"`
	ResourceName   string         `json:"resource_name,omitempty"`
	RequestMethod  string         `json:"request_method,omitempty"`
	RequestPath    string         `json:"request_path,omitempty"`
	ResponseStatus int            `json:"response_status,omitempty"`
	RequestBody    map[string]any `json:"request_body,omitempty"`
	IPAddress      string         `json:"ip_address,omitempty"`
	UserAgent      string         `json:"user_agent,omitempty"`
	Success        bool           `json:"success"`
	ErrorMessage   string         `json:"error_message,omitempty"`
	CreatedAt      string         `json:"created_at"`
}

type AuditStatsResponse

type AuditStatsResponse struct {
	Total         int64              `json:"total"`
	Failed24h     int64              `json:"failed_24h"`
	RecentActions []AuditLogResponse `json:"recent_actions"`
}

type Client

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

Client is the admin API HTTP client.

func NewClient

func NewClient(baseURL, apiKey string, verbose bool) *Client

NewClient creates a new admin API client.

func (*Client) Delete

func (c *Client) Delete(path string) error

Delete performs a DELETE request.

func (*Client) Do

func (c *Client) Do(method, path string, body any) ([]byte, int, error)

Do performs an HTTP request and returns the response body.

func (*Client) Get

func (c *Client) Get(path string) ([]byte, error)

Get performs a GET request.

func (*Client) Patch

func (c *Client) Patch(path string, body any) ([]byte, error)

Patch performs a PATCH request.

func (*Client) Post

func (c *Client) Post(path string, body any) ([]byte, error)

Post performs a POST request.

type Config

type Config struct {
	APIVersion     string         `yaml:"apiVersion"`
	Kind           string         `yaml:"kind"`
	CurrentContext string         `yaml:"current-context"`
	Contexts       []NamedContext `yaml:"contexts"`
}

func (*Config) GetContext

func (c *Config) GetContext(name string) *NamedContext

func (*Config) SetContext

func (c *Config) SetContext(name string, ctx ContextDetail)

type ContextDetail

type ContextDetail struct {
	APIURL     string `yaml:"api-url"`
	APIKey     string `yaml:"api-key,omitempty"`
	APIKeyFile string `yaml:"api-key-file,omitempty"`
}

type NamedContext

type NamedContext struct {
	Name    string        `yaml:"name"`
	Context ContextDetail `yaml:"context"`
}

type TargetMappingListResponse

type TargetMappingListResponse struct {
	Data       []TargetMappingResponse `json:"data"`
	Total      int64                   `json:"total"`
	Page       int                     `json:"page"`
	PerPage    int                     `json:"per_page"`
	TotalPages int                     `json:"total_pages"`
}

type TargetMappingResponse

type TargetMappingResponse struct {
	ID          string  `json:"id"`
	TargetType  string  `json:"target_type"`
	AssetType   string  `json:"asset_type"`
	Priority    int     `json:"priority"`
	IsActive    bool    `json:"is_active"`
	IsPrimary   bool    `json:"is_primary"`
	Description *string `json:"description,omitempty"`
	CreatedBy   *string `json:"created_by,omitempty"`
	CreatedAt   string  `json:"created_at"`
	UpdatedAt   string  `json:"updated_at"`
}

type ValidateResponse

type ValidateResponse struct {
	ID    string `json:"id"`
	Email string `json:"email"`
	Name  string `json:"name"`
	Role  string `json:"role"`
}

Jump to

Keyboard shortcuts

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