api

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MPL-2.0 Imports: 13 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")
	ErrorClustersSameName = NewMultipleClustersSameNameError()
)

Functions

func NewMultipleClustersSameNameError added in v0.3.0

func NewMultipleClustersSameNameError() error

Types

type API

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

func BuildAPI

func BuildAPI(meta any) *API

func NewAPI

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

func (*API) CSPTagClient added in v1.1.0

func (api *API) CSPTagClient() *CSPTagClient

func (*API) CloudProviderClient added in v0.4.0

func (api *API) CloudProviderClient() *CloudProviderClient

func (*API) ClusterClient

func (api *API) ClusterClient() *ClusterClient

func (*API) PGDClient added in v0.5.0

func (api *API) PGDClient() *PGDClient

func (*API) ProjectClient added in v0.3.0

func (api *API) ProjectClient() *ProjectClient

func (*API) RegionClient

func (api *API) RegionClient() *RegionClient

func (*API) TagClient added in v1.1.0

func (api *API) TagClient() *TagClient

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 CSPTagClient added in v1.1.0

type CSPTagClient struct {
	API
}

func NewCSPTagClient added in v1.1.0

func NewCSPTagClient(api API) *CSPTagClient

func (CSPTagClient) Delete added in v1.1.0

func (tc CSPTagClient) Delete(ctx context.Context, tagId string) error

func (CSPTagClient) Get added in v1.1.0

func (c CSPTagClient) Get(ctx context.Context, projectID, cloudProviderID string) (*api.CSPTagResponse, error)

func (CSPTagClient) Put added in v1.1.0

func (c CSPTagClient) Put(ctx context.Context, projectID, cloudProviderID string, cspTagReq api.CSPTagRequest) (bool, error)

type CloudProviderClient added in v0.4.0

type CloudProviderClient struct{ API }

func NewCloudProviderClient added in v0.4.0

func NewCloudProviderClient(api API) *CloudProviderClient

func (CloudProviderClient) CreateAWSConnection added in v0.4.0

func (c CloudProviderClient) CreateAWSConnection(ctx context.Context, projectID string, conn models.AWSConnection) error

func (CloudProviderClient) CreateAzureConnection added in v0.4.0

func (c CloudProviderClient) CreateAzureConnection(ctx context.Context, projectID string, conn models.AzureConnection) error

func (CloudProviderClient) GetAWSConnection added in v0.4.0

func (c CloudProviderClient) GetAWSConnection(ctx context.Context, projectID string) (*models.AWSConnection, error)

type ClusterClient

type ClusterClient struct {
	API
	CommonCluster
}

func NewClusterClient

func NewClusterClient(api API) *ClusterClient

func (ClusterClient) ConnectionString

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

func (ClusterClient) Create

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

func (ClusterClient) Delete

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

func (ClusterClient) GetPeAllowedPrincipalIds added in v0.6.1

func (c ClusterClient) GetPeAllowedPrincipalIds(ctx context.Context, projectID string, cspID string, regionID string) (*models.PeAllowedPrincipalIds, error)

func (ClusterClient) GetServiceAccountIds added in v0.6.1

func (c ClusterClient) GetServiceAccountIds(ctx context.Context, projectID string, cspID string, regionID string) (*models.ServiceAccountIds, error)

func (ClusterClient) Read

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

func (ClusterClient) ReadByName

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

func (ClusterClient) Update

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

type ClusterResponse

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

type CommonCluster added in v0.9.0

type CommonCluster struct {
	API
}

func (CommonCluster) ClusterPause added in v0.9.0

func (c CommonCluster) ClusterPause(ctx context.Context, projectId, clusterId string) (string, error)

func (CommonCluster) ClusterResume added in v0.9.0

func (c CommonCluster) ClusterResume(ctx context.Context, projectId, clusterId string) (string, error)

type ErrorMessage added in v0.1.1

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

type PGDClient added in v0.5.0

type PGDClient struct {
	API
	CommonCluster
}

func NewPGDClient added in v0.5.0

func NewPGDClient(api API) *PGDClient

func (PGDClient) CalculateWitnessGroupParams added in v0.5.0

func (c PGDClient) CalculateWitnessGroupParams(ctx context.Context, projectId string, WitnessGroupParamsBody pgdApi.WitnessGroupParamsBody) (*pgdApi.WitnessGroupParamsData, error)

func (PGDClient) Create added in v0.5.0

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

func (PGDClient) Delete added in v0.5.0

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

func (PGDClient) GetPeAllowedPrincipalIds added in v0.6.1

func (c PGDClient) GetPeAllowedPrincipalIds(ctx context.Context, projectID string, cspID string, regionID string) (*models.PeAllowedPrincipalIds, error)

func (PGDClient) GetServiceAccountIds added in v0.6.1

func (c PGDClient) GetServiceAccountIds(ctx context.Context, projectID string, cspID string, regionID string) (*models.ServiceAccountIds, error)

func (PGDClient) Read added in v0.5.0

func (c PGDClient) Read(ctx context.Context, projectId, clusterId string) (*models.Cluster, error)

func (PGDClient) ReadByName added in v0.5.0

func (c PGDClient) ReadByName(ctx context.Context, projectId, name string, most_recent bool) (*models.Cluster, error)

func (PGDClient) Update added in v0.5.0

func (c PGDClient) Update(ctx context.Context, projectId, clusterId string, model models.Cluster) (string, error)

type ProjectClient added in v0.3.0

type ProjectClient struct{ API }

func NewProjectClient added in v0.3.0

func NewProjectClient(api API) *ProjectClient

func (ProjectClient) Create added in v0.3.0

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

func (ProjectClient) Delete added in v0.3.0

func (c ProjectClient) Delete(ctx context.Context, projectId string) error

func (ProjectClient) List added in v0.3.0

func (c ProjectClient) List(ctx context.Context, query string) ([]*models.Project, error)

func (ProjectClient) Read added in v0.3.0

func (c ProjectClient) Read(ctx context.Context, id string) (*models.Project, error)

func (ProjectClient) Update added in v0.3.0

func (c ProjectClient) Update(ctx context.Context, projectId, model any) (string, error)

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, project_id, csp_id, query string) ([]*models.Region, error)

func (RegionClient) Read

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

func (RegionClient) Update

func (c RegionClient) Update(ctx context.Context, action, project_id, csp_id, region_id string, tags []commonApi.Tag) error

type TagClient added in v1.1.0

type TagClient struct {
	API
}

func NewTagClient added in v1.1.0

func NewTagClient(api API) *TagClient

func (TagClient) Create added in v1.1.0

func (tc TagClient) Create(ctx context.Context, tagReq api.TagRequest) (*string, error)

func (TagClient) Delete added in v1.1.0

func (tc TagClient) Delete(ctx context.Context, tagId string) error

func (TagClient) Get added in v1.1.0

func (tc TagClient) Get(ctx context.Context, tagId string) (api.TagResponse, error)

func (TagClient) List added in v1.1.0

func (tc TagClient) List(ctx context.Context) ([]api.TagResponse, error)

func (TagClient) Update added in v1.1.0

func (tc TagClient) Update(ctx context.Context, tagId string, tagReq api.TagRequest) (*string, error)

Jump to

Keyboard shortcuts

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