client

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

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

APIClient provides HTTP client for OpenChoreo API server

func NewAPIClient

func NewAPIClient() (*APIClient, error)

NewAPIClient creates a new API client with control plane auto-detection

func (*APIClient) Apply

func (c *APIClient) Apply(ctx context.Context, resource map[string]interface{}) (*ApplyResponse, error)

Apply sends a resource to the /api/v1/apply endpoint

func (*APIClient) Delete

func (c *APIClient) Delete(ctx context.Context, resource map[string]interface{}) (*DeleteResponse, error)

func (*APIClient) HealthCheck

func (c *APIClient) HealthCheck(ctx context.Context) error

HealthCheck verifies API server connectivity

func (*APIClient) ListComponents

func (c *APIClient) ListComponents(ctx context.Context, orgName, projectName string) ([]ComponentResponse, error)

ListComponents retrieves all components for an organization and project from the API

func (*APIClient) ListOrganizations

func (c *APIClient) ListOrganizations(ctx context.Context) ([]OrganizationResponse, error)

ListOrganizations retrieves all organizations from the API

func (*APIClient) ListProjects

func (c *APIClient) ListProjects(ctx context.Context, orgName string) ([]ProjectResponse, error)

ListProjects retrieves all projects for an organization from the API

type ApplyResponse

type ApplyResponse struct {
	Success bool `json:"success"`
	Data    struct {
		APIVersion string `json:"apiVersion"`
		Kind       string `json:"kind"`
		Name       string `json:"name"`
		Namespace  string `json:"namespace,omitempty"`
		Operation  string `json:"operation"` // "created" or "updated"
	} `json:"data"`
	Error string `json:"error,omitempty"`
	Code  string `json:"code,omitempty"`
}

ApplyResponse represents the response from /api/v1/apply

type ComponentResponse

type ComponentResponse struct {
	Name        string `json:"name"`
	OrgName     string `json:"orgName"`
	ProjectName string `json:"projectName"`
	DisplayName string `json:"displayName,omitempty"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type"`
	CreatedAt   string `json:"createdAt"`
	Status      string `json:"status,omitempty"`
}

ComponentResponse represents a component from the API

type DeleteResponse

type DeleteResponse struct {
	Success bool `json:"success"`
	Data    struct {
		APIVersion string `json:"apiVersion"`
		Kind       string `json:"kind"`
		Name       string `json:"name"`
		Namespace  string `json:"namespace,omitempty"`
		Operation  string `json:"operation"` // "deleted" or "not_found"
	} `json:"data"`
	Error string `json:"error,omitempty"`
	Code  string `json:"code,omitempty"`
}

type ListComponentsResponse

type ListComponentsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Items      []ComponentResponse `json:"items"`
		TotalCount int                 `json:"totalCount"`
		Page       int                 `json:"page"`
		PageSize   int                 `json:"pageSize"`
	} `json:"data"`
	Error string `json:"error,omitempty"`
	Code  string `json:"code,omitempty"`
}

ListComponentsResponse represents the response from listing components

type ListOrganizationsResponse

type ListOrganizationsResponse struct {
	Success bool         `json:"success"`
	Data    ListResponse `json:"data"`
	Error   string       `json:"error,omitempty"`
	Code    string       `json:"code,omitempty"`
}

ListOrganizationsResponse represents the response from listing organizations

type ListProjectsResponse

type ListProjectsResponse struct {
	Success bool `json:"success"`
	Data    struct {
		Items      []ProjectResponse `json:"items"`
		TotalCount int               `json:"totalCount"`
		Page       int               `json:"page"`
		PageSize   int               `json:"pageSize"`
	} `json:"data"`
	Error string `json:"error,omitempty"`
	Code  string `json:"code,omitempty"`
}

ListProjectsResponse represents the response from listing projects

type ListResponse

type ListResponse struct {
	Items      []OrganizationResponse `json:"items"`
	TotalCount int                    `json:"totalCount"`
	Page       int                    `json:"page"`
	PageSize   int                    `json:"pageSize"`
}

ListResponse represents a paginated list response

type OrganizationResponse

type OrganizationResponse struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName,omitempty"`
	Description string `json:"description,omitempty"`
	Status      string `json:"status"`
	CreatedAt   string `json:"createdAt"`
}

OrganizationResponse represents an organization from the API

type ProjectResponse

type ProjectResponse struct {
	Name               string `json:"name"`
	OrgName            string `json:"orgName"`
	DisplayName        string `json:"displayName,omitempty"`
	Description        string `json:"description,omitempty"`
	DeploymentPipeline string `json:"deploymentPipeline,omitempty"`
	CreatedAt          string `json:"createdAt"`
	Status             string `json:"status,omitempty"`
}

ProjectResponse represents a project from the API

Jump to

Keyboard shortcuts

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