client

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrResourceNotFound = errors.New("could not find any matching resource")

ErrResourceNotFound is what GetFromResource returns when the server has no resource of that name.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Title string `json:"title"`
	Msg   string `json:"msg"`
	Cause string `json:"cause"`
}

func (*APIError) String

func (e *APIError) String() string

type APIParameter

type APIParameter struct {
	APIKey      string
	BaseURL     string
	Debug       bool
	Key         string
	Cert        string
	Cacert      string
	CdkUser     string
	CdkPassword string
	AuthMode    string
	Insecure    bool
}

type AuthMethod

type AuthMethod interface {
	AuthorizationHeader() string
}

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func (BasicAuth) AuthorizationHeader

func (t BasicAuth) AuthorizationHeader() string

type BearerToken

type BearerToken struct {
	Token string
}

func (BearerToken) AuthorizationHeader

func (t BearerToken) AuthorizationHeader() string

type Client

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

func Make

func Make(apiParameter APIParameter) (*Client, error)

func MakeFromEnv

func MakeFromEnv() (*Client, error)

func (*Client) ActivateDebug

func (client *Client) ActivateDebug()

func (*Client) Apply

func (client *Client) Apply(resource *resource.Resource, dryMode bool, diffMode bool) (Result, error)

func (*Client) CreateAdminToken

func (client *Client) CreateAdminToken(name string) (CreatedToken, error)

func (*Client) CreateApplicationInstanceToken

func (client *Client) CreateApplicationInstanceToken(applicationInstanceName, name string) (CreatedToken, error)

func (*Client) Delete

func (client *Client) Delete(kind *schema.Kind, parentPathValue []string, parentQueryValue []string, name string, ignoreMissing bool) error

func (*Client) DeleteResource

func (client *Client) DeleteResource(resource *resource.Resource, ignoreMissing bool) error

func (*Client) DeleteToken

func (client *Client) DeleteToken(uuid string) error

func (*Client) Describe

func (client *Client) Describe(kind *schema.Kind, parentPathValue []string, parentQueryValue []string, name string) (resource.Resource, error)

func (*Client) ExecuteSQL

func (client *Client) ExecuteSQL(maxLine int, sql string) (SQLResult, error)

func (*Client) Get

func (client *Client) Get(kind *schema.Kind, parentPathValue []string, parentQueryValue []string, queryParams map[string]string) ([]resource.Resource, error)

func (*Client) GetCatalog

func (client *Client) GetCatalog() *schema.Catalog

func (*Client) GetFromResource

func (client *Client) GetFromResource(res *resource.Resource) (resource.Resource, error)

GetFromResource fetches the current version of a resource from the server by name and kind. It builds the appropriate URL and query parameters based on the resource's kind configuration.

func (*Client) GetKinds

func (client *Client) GetKinds() schema.KindCatalog

func (*Client) GetOpenAPI

func (client *Client) GetOpenAPI() ([]byte, error)

func (*Client) GetTemplate added in v0.8.0

func (client *Client) GetTemplate(kindKebabCase, templateName string) (resource.Resource, error)

GetTemplate fetches an admin-curated resource template by name from the new Console template API. The endpoint is /public/console/v2/{kebab-kind}-template/{name} (e.g. /public/console/v2/topic-template/high-partition-topic).

Returns 404 when the server doesn't support resource templates yet, which the caller surfaces as a clear error — older Console versions stay supported because the offline template fallback (without a name arg) doesn't go through this path.

func (*Client) IgnoreUntrustedCertificate

func (client *Client) IgnoreUntrustedCertificate()

func (*Client) ListAdminToken

func (client *Client) ListAdminToken() ([]Token, error)

func (*Client) ListApplicationInstanceToken

func (client *Client) ListApplicationInstanceToken(applicationInstanceName string) ([]Token, error)

func (*Client) ListTemplates added in v0.8.0

func (client *Client) ListTemplates(kindKebabCase string) ([]resource.Resource, error)

ListTemplates fetches all admin-curated resource templates of a given kind from the Console template API. Endpoint: /public/console/v2/{kebab-kind}-template.

func (*Client) Login

func (client *Client) Login(username, password string) (LoginResult, error)

func (*Client) Run

func (client *Client) Run(run schema.Run, pathValue []string, queryParams map[string]string, body interface{}) ([]byte, error)

func (*Client) SetAPIKey

func (client *Client) SetAPIKey(apiKey string)

type CreatedToken

type CreatedToken struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	CreatedAt string `json:"createdAt"`
	Token     string `json:"token"`
}

type DeleteInterceptorPayload

type DeleteInterceptorPayload struct {
	VCluster *string `json:"vCluster"`
	Group    *string `json:"group"`
	Username *string `json:"username"`
}

type GatewayAPIParameter

type GatewayAPIParameter struct {
	BaseURL            string
	Debug              bool
	CdkGatewayUser     string
	CdkGatewayPassword string
}

type GatewayClient

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

func MakeGateway

func MakeGateway(apiParameter GatewayAPIParameter) (*GatewayClient, error)

func MakeGatewayClientFromEnv

func MakeGatewayClientFromEnv() (*GatewayClient, error)

func (*GatewayClient) ActivateDebug

func (client *GatewayClient) ActivateDebug()

func (*GatewayClient) Apply

func (client *GatewayClient) Apply(resource *resource.Resource, dryMode bool, diffMode bool) (Result, error)

func (*GatewayClient) Delete

func (client *GatewayClient) Delete(kind *schema.Kind, parentPathValue []string, parentQueryValue []string, name string) error

func (*GatewayClient) DeleteInterceptor

func (client *GatewayClient) DeleteInterceptor(kind *schema.Kind, name string, param map[string]string, ignoreMissing bool) error

func (*GatewayClient) DeleteKindByNameAndVCluster

func (client *GatewayClient) DeleteKindByNameAndVCluster(kind *schema.Kind, param map[string]string, ignoreMissing bool) error

func (*GatewayClient) DeleteResourceByName

func (client *GatewayClient) DeleteResourceByName(resource *resource.Resource, ignoreMissing bool) error

func (*GatewayClient) DeleteResourceByNameAndVCluster

func (client *GatewayClient) DeleteResourceByNameAndVCluster(resource *resource.Resource, ignoreMissing bool) error

func (*GatewayClient) DeleteResourceInterceptors

func (client *GatewayClient) DeleteResourceInterceptors(resource *resource.Resource, ignoreMissing bool) error

func (*GatewayClient) Describe

func (client *GatewayClient) Describe(kind *schema.Kind, parentPathValue []string, parentQueryValue []string, name string) (resource.Resource, error)

func (*GatewayClient) Get

func (client *GatewayClient) Get(kind *schema.Kind, parentPathValue []string, parentQueryValue []string, queryParams map[string]string) ([]resource.Resource, error)

func (*GatewayClient) GetCatalog

func (client *GatewayClient) GetCatalog() *schema.Catalog

func (*GatewayClient) GetFromResource

func (client *GatewayClient) GetFromResource(res *resource.Resource) (resource.Resource, error)

func (*GatewayClient) GetKinds

func (client *GatewayClient) GetKinds() schema.KindCatalog

func (*GatewayClient) GetOpenAPI

func (client *GatewayClient) GetOpenAPI() ([]byte, error)

func (*GatewayClient) Run

func (client *GatewayClient) Run(run schema.Run, pathValue []string, queryParams map[string]string, body interface{}) ([]byte, error)

type LoginResult

type LoginResult struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
}

type Result

type Result struct {
	UpsertResult string
	Diff         string
}

type SQLResult

type SQLResult struct {
	Header []string        `json:"header"`
	Row    [][]interface{} `json:"row"`
}

type Token

type Token struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	CreatedAt    string `json:"createdAt"`
	LastTimeUsed string `json:"lastTimeUsed"`
}

Jump to

Keyboard shortcuts

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