api

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REGION_ACTIVE    = "ACTIVE"
	REGION_INACTIVE  = "INACTIVE"
	REGION_SUSPENDED = "SUSPENDED"
)

Variables

View Source
var (
	Error404     = errors.New("resource not found")
	ErrorUnknown = errors.New("unknown API error")
)

Functions

This section is empty.

Types

type API

type API struct {
	BaseURL    string
	Token      string
	UserAgent  string
	HTTPClient http.Client
}

func BuildAPI

func BuildAPI(meta any) *API

func NewAPI

func NewAPI(ba_bearer_token, ba_api_uri, userAgent string) *API

func (*API) ClusterClient

func (api *API) ClusterClient() *ClusterClient

func (*API) RegionClient

func (api *API) RegionClient() *RegionClient

type APIError added in v0.1.1

type APIError struct {
	Error struct {
		Status    int            `json:"status"`
		Message   string         `json:"message"`
		Errors    []ErrorMessage `json:"errors"`
		Reference string         `json:"reference"`
		Source    string         `json:"source"`
	} `json:"error"`
}

type BigAnimalError added in v0.1.1

type BigAnimalError struct {
	APIError APIError
}

func (*BigAnimalError) Error added in v0.1.1

func (baerr *BigAnimalError) Error() string

func (*BigAnimalError) GetDetails added in v0.1.1

func (baerr *BigAnimalError) GetDetails() string

type ClusterClient

type ClusterClient struct{ API }

func NewClusterClient

func NewClusterClient(api API) *ClusterClient

func (ClusterClient) ConnectionString

func (c ClusterClient) ConnectionString(ctx context.Context, id string) (*models.ClusterConnection, error)

func (ClusterClient) Create

func (c ClusterClient) Create(ctx context.Context, model any) (string, error)

func (ClusterClient) Delete

func (c ClusterClient) Delete(ctx context.Context, id string) error

func (ClusterClient) Read

func (c ClusterClient) Read(ctx context.Context, id string) (*models.Cluster, error)

func (ClusterClient) ReadByName

func (c ClusterClient) ReadByName(ctx context.Context, name string) (*models.Cluster, error)

func (ClusterClient) Update

func (c ClusterClient) Update(ctx context.Context, cluster *models.Cluster, id string) (*models.Cluster, error)

type ClusterResponse

type ClusterResponse struct {
	Data struct {
		ClusterId string `json:"clusterId"`
	} `json:"data"`
}

type ErrorMessage added in v0.1.1

type ErrorMessage struct {
	Message string `json:"message"`
}

type RegionClient

type RegionClient struct{ API }

func NewRegionClient

func NewRegionClient(api API) *RegionClient

func (RegionClient) Create

func (c RegionClient) Create(ctx context.Context, model any) (string, error)

func (RegionClient) List

func (c RegionClient) List(ctx context.Context, csp_id, query string) ([]*models.Region, error)

func (RegionClient) Read

func (c RegionClient) Read(ctx context.Context, csp_id, id string) (*models.Region, error)

func (RegionClient) Update

func (c RegionClient) Update(ctx context.Context, action, csp_id, region_id string) error

Jump to

Keyboard shortcuts

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