api

package
v1.4.1-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package api provides functions to interact with the agents API.

Package api provides functions to interact with the auth API.

Index

Constants

View Source
const (
	ExpansionStatusSuccess  ExpansionStatus = "success"
	ExpansionStatusPossible ExpansionStatus = "possible"
	ExpansionStatusError    ExpansionStatus = "error"

	RecoveryStatusCompleted RecoveryStatus = "completed"
	RecoveryStatusOngoing   RecoveryStatus = "ongoing"
	RecoveryStatusErrored   RecoveryStatus = "errored"
)

Variables

This section is empty.

Functions

func DeleteAgent

func DeleteAgent(urls configuration.URLs, accessToken string, swarmID string, nexusID string, nodeID string, agentID string) error

func ExtractGenericModel

func ExtractGenericModel(response any) request_utils.RequestModifier

func ExtractRefreshCookie

func ExtractRefreshCookie(response *string) request_utils.RequestModifier

func GetDeviceAPIKey

func GetDeviceAPIKey(urls configuration.URLs, deviceID string) (string, error)

func PaginatorHandler

func PaginatorHandler[T any](
	requestFunc request_utils.BoundRequest,
	urlBuilder URLBuilder,
	opts ...PaginatorHandlerOptionsFunc,
) ([]T, error)

func UpdateAgent

func UpdateAgent(urls configuration.URLs, accessToken string, swarmID string, nexusID string, nodeID string, agentID string, nodesBody UpdateNewAgentRequestBody) error

Types

type APIKeyResponse

type APIKeyResponse struct {
	APIKey string `json:"api_key"`
	Status string `json:"status,omitempty"`
}

type Account

type Account struct {
	ID                 string              `json:"id"`
	FirstName          string              `json:"first_name"`
	LastName           string              `json:"last_name"`
	Internal           bool                `json:"internal"`
	Banned             bool                `json:"banned"`
	CreatedAt          time.Time           `json:"created_at"`
	DeletedAt          *time.Time          `json:"deleted_at"`
	MaxAllowedProjects int                 `json:"max_allowed_projects"`
	Emails             []AccountEmail      `json:"emails"`
	TwoFactorEnabled   bool                `json:"two_factor_enabled"`
	EndpointGateway    string              `json:"endpoint_gateway"`
	TenantID           string              `json:"tenant_id"`
	AuthProvider       AccountAuthProvider `json:"auth_provider"`
}

type AccountAuthProvider

type AccountAuthProvider string

type AccountEmail

type AccountEmail struct {
	ID        string    `json:"id"`
	Email     string    `json:"email"`
	Verified  bool      `json:"verified"`
	Default   bool      `json:"default"`
	CreatedAt time.Time `json:"created_at"`
}

type AgentConfig

type AgentConfig struct {
	ID         string `json:"id"`
	MountPoint string `json:"mount_point"`
	Disk       string `json:"disk"`
	Port       int    `json:"port"`
	Secret     string `json:"secret"`
}

type AgentModel

type AgentModel string
const (
	UnknownAgentModel AgentModel = "unknown"
	CellAgentModel    AgentModel = "cell"
	VirtualAgentModel AgentModel = "virtual"
)

type AgentVolume

type AgentVolume struct {
	MountPoint string `json:"mount_point"`
	Disk       string `json:"disk"`
}

type AnsibleConfig

type AnsibleConfig struct {
	Nodes []NodeConfig `json:"nodes"`
}

type AuthAPI

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

func NewAuthAPI

func NewAuthAPI(config *configuration.Config) *AuthAPI

func (*AuthAPI) Activate

func (api *AuthAPI) Activate(
	urlConfig configuration.URLs,
	token string,
) error

func (*AuthAPI) CreateApiKey

func (api *AuthAPI) CreateApiKey(
	urlConfig configuration.URLs,
	operatorID string,
	name string,
	token string,
	forgeApiKeyToken string,
) (string, error)

func (*AuthAPI) ForgeToken

func (api *AuthAPI) ForgeToken(
	urlConfig configuration.URLs,
	operatorID string,
	email string,
	password string,
	tfaCode string,
	tokenType string,
	token string,
	refreshToken string,
) (string, error)

func (*AuthAPI) GenerateChallenge

func (api *AuthAPI) GenerateChallenge(
	urlConfig configuration.URLs,
	email *string,
	username *string,
	organizationName *string,
) (*ChallengeResponseModel, error)

func (*AuthAPI) GenerateOldChallenge

func (api *AuthAPI) GenerateOldChallenge(
	urlConfig configuration.URLs,
	email string,
) (*ChallengeResponseModel, error)

func (*AuthAPI) SignIn

func (api *AuthAPI) SignIn(
	urlConfig configuration.URLs,
	username string,
	organization string,
	password string,
	tfaCode string,
) (*SignInToken, error)

func (*AuthAPI) SignUp

func (api *AuthAPI) SignUp(
	urlConfig configuration.URLs,
	email string,
	username string,
	firstName *string,
	lastName *string,
	authenticationPublicKey *string,
	organizationName string,
	organizationBasePolicy map[string]interface{},
	organizationSettings map[string]interface{},
) error

type AuthAPIInterface

type AuthAPIInterface interface {
	Activate(
		urlConfig configuration.URLs,
		token string,
	) error

	SignUp(
		urlConfig configuration.URLs,
		email string,
		username string,
		firstName *string,
		lastName *string,
		authenticationPublicKey *string,
		organizationName string,
		organizationBasePolicy map[string]interface{},
		organizationSettings map[string]interface{},
	) error
	SignIn(
		urlConfig configuration.URLs,
		username string,
		organization string,
		password string,
		tfaCode string,
	) (*SignInToken, error)
	GenerateChallenge(
		urlConfig configuration.URLs,
		email *string,
		username *string,
		organizationName *string,
	) (*ChallengeResponseModel, error)
	ForgeToken(
		urlConfig configuration.URLs,
		operatorID string,
		email string,
		password string,
		tfaCode string,
		tokenType string,
		token string,
		refreshToken string,
	) (string, error)
	CreateApiKey(
		urlConfig configuration.URLs,
		operatorID string,
		name string,
		token string,
		forgeApiKeyToken string,
	) (string, error)
}

type BulkInsertNewAgentRequestBody

type BulkInsertNewAgentRequestBody struct {
	Agents []CreateNewAgentRequestBody `json:"agents"`
}

type BulkInsertNewNodeRequestBody

type BulkInsertNewNodeRequestBody struct {
	Nodes []CreateNewNodeRequestBody `json:"nodes"`
}

type ChallengeRequestBodyV3

type ChallengeRequestBodyV3 struct {
	Email            *string `json:"email,omitempty"`
	Username         *string `json:"username,omitempty"`
	OrganizationName *string `json:"organization_name,omitempty"`
}

func CreateChallengeRequestBodyV3

func CreateChallengeRequestBodyV3(
	email *string,
	username *string,
	organizationName *string,
) ChallengeRequestBodyV3

type ChallengeResponseModel

type ChallengeResponseModel struct {
	Challenge string `json:"challenge"`
	Salt      string `json:"salt" example:"SGVsbG8gd29ybGQ="`
}

type ChangeOperatorPolicyRequestBody

type ChangeOperatorPolicyRequestBody struct {
	PolicyID string `json:"policy_id"`
}

type CreateGatewayRequestBody

type CreateGatewayRequestBody struct {
	Name          string                 `json:"name"`
	Location      string                 `json:"location"`
	Configuration map[string]interface{} `json:"configuration"`
}

type CreateNewAgentRequestBody

type CreateNewAgentRequestBody struct {
	Port     int                    `json:"port"`
	Features map[string]interface{} `json:"features"`
	Volume   AgentVolume            `json:"volume"`
}

type CreateNewNodeRequestBody

type CreateNewNodeRequestBody struct {
	Name          string                      `json:"name"`
	Label         *string                     `json:"label"`
	Configuration map[string]interface{}      `json:"config" swaggertype:"object,string"`
	PublicIP      string                      `json:"public_ip"`
	PrivateIP     string                      `json:"private_ip"`
	Agents        []CreateNewAgentRequestBody `json:"agents"`
}

type CreateNexusRequestBody

type CreateNexusRequestBody struct {
	Name        string `json:"name" `
	Description string `json:"description,omitempty"`
	Location    string `json:"location"`
	ProviderID  string `json:"provider_id,omitempty"`
}

type CreateNodeBodyRequest

type CreateNodeBodyRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	NexusID     string `json:"nexus_id"`
	SecretID    string `json:"secret_id"`
}

type CreateOperatorRequestBodyV2

type CreateOperatorRequestBodyV2 struct {
	Email                   string  `json:"email"`
	FirstName               *string `json:"first_name"`
	LastName                *string `json:"last_name"`
	Username                string  `json:"username"`
	AuthenticationPublicKey *string `json:"authentication_public_key"`
}

type CreateOrganizationRequestBodyV2

type CreateOrganizationRequestBodyV2 struct {
	Name       string                 `json:"name"`
	BasePolicy map[string]interface{} `json:"base_policy"`
	Settings   map[string]interface{} `json:"settings"`
}

type CreateRedundancyClassRequestBody

type CreateRedundancyClassRequestBody struct {
	Name              string   `json:"name"`
	Description       string   `json:"description"`
	InnerK            int      `json:"inner_k"`
	InnerN            int      `json:"inner_n"`
	OuterK            int      `json:"outer_k"`
	OuterN            int      `json:"outer_n"`
	AntiAffinityGroup int      `json:"anti_affinity_group"`
	Nexuses           []string `json:"nexuses"`
}

type CreateSwarmRequest

type CreateSwarmRequest struct {
	Name          string                 `json:"name"`
	Configuration map[string]interface{} `json:"configuration"`
	Description   *string                `json:"description"`
}

type CreateTenantRequestBody

type CreateTenantRequestBody struct {
	Name        string          `json:"name"`
	Description *string         `json:"description"`
	Settings    *TenantSettings `json:"settings"`
	CouponCode  *string         `json:"coupon_code"`
	Zone        *string         `json:"zone"`
	ZKEnabled   *bool           `json:"zk_enabled"`
}

type DNSChallengeRecord

type DNSChallengeRecord struct {
	Type  string `json:"type"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

type DeviceRegistrationResponse

type DeviceRegistrationResponse struct {
	DeviceCode string `json:"device_code"`
	ClientURL  string `json:"client_url"`
}

func RegisterDevice

func RegisterDevice(urls configuration.URLs, uuid string) (*DeviceRegistrationResponse, error)

type Distributor

type Distributor struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	OwnerID     string    `json:"owner_id"`
	CreatedAt   time.Time `json:"created_at"`
	DeletedAt   time.Time `json:"deleted_at"`
	ImageURL    string    `json:"image_url"`
}

type DistributorCoupon

type DistributorCoupon struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Description    string    `json:"description"`
	Redemptions    int       `json:"redemptions"`
	MaxRedemptions int64     `json:"max_redemptions"`
	Code           string    `json:"code"`
	Zone           string    `json:"zone"`
	CreatedAt      time.Time `json:"created_at"`
	ExternalID     string    `json:"external_id"`
}

func (*DistributorCoupon) ToHumanReadableDistributorCode

func (c *DistributorCoupon) ToHumanReadableDistributorCode() *HumanReadableDistributorCoupon

type DistributorCouponCodeResponseModel

type DistributorCouponCodeResponseModel struct {
	CouponCode string `json:"coupon_code"`
}

type DistributorCouponList

type DistributorCouponList struct {
	Coupons []*DistributorCoupon `json:"coupons"`
}

type DistributorList

type DistributorList struct {
	Distributors []*Distributor `json:"distributors"`
}

type DistributorReportResponseModel

type DistributorReportResponseModel struct {
	Report []TenantReport `json:"report"`
}

type EnabledAuthProvidersConfig

type EnabledAuthProvidersConfig struct {
	GoogleClientID         *string `json:"google_client_id"`
	MicrosoftApplicationID *string `json:"microsoft_application_id"`
	MicrosoftDirectoryID   *string `json:"microsoft_directory_id"`
}

type ErrorResponseModel

type ErrorResponseModel struct {
	Message string `json:"message"`
	Param   string `json:"param"`
}

type EvaluatedStatusType

type EvaluatedStatusType string

type ExpansionStatus

type ExpansionStatus string

type Gateway

type Gateway struct {
	ID             string     `json:"id"`
	Name           string     `json:"name"`
	Location       string     `json:"location"`
	CreatedAt      time.Time  `json:"created_at"`
	DeletedAt      *time.Time `json:"deleted_at"`
	Secret         string     `json:"secret"`
	OrganizationID *string    `json:"organization_id"`
}

type GatewayInstance

type GatewayInstance struct {
	ID              string                 `json:"id"`
	GatewayID       string                 `json:"gateway_id"`
	IP              string                 `json:"ip"`
	Status          map[string]interface{} `json:"status"`
	StatusUpdatedAt *time.Time             `json:"status_updated_at"`
	CreatedAt       time.Time              `json:"created_at"`
	Features        map[string]interface{} `json:"features"`
	EvaluatedStatus GatewayStatus          `json:"evaluated_status"`
}

type GatewayInstanceListResponse

type GatewayInstanceListResponse struct {
	Data []*GatewayInstance `json:"data"`
}

type GatewayStatus

type GatewayStatus string
const (
	UnknownGatewayStatus  GatewayStatus = "unknown"
	InactiveGatewayStatus GatewayStatus = "inactive"
	ActiveGatewayStatus   GatewayStatus = "active"
	OfflineGatewayStatus  GatewayStatus = "offline"
	OnlineGatewayStatus   GatewayStatus = "online"
)

type GatewayTenant

type GatewayTenant struct {
	ID            string                 `json:"id"`
	GatewayID     string                 `json:"gateway_id"`
	TenantID      string                 `json:"tenant_id"`
	CreatedAt     time.Time              `json:"created_at"`
	DeletedAt     *time.Time             `json:"deleted_at"`
	HardDeleteAt  *time.Time             `json:"hard_delete_at"`
	Configuration map[string]interface{} `json:"configuration"`
	Hidden        bool                   `json:"hidden"`
}

type GatewayWithGatewayTenant

type GatewayWithGatewayTenant struct {
	Gateway       *Gateway       `json:"gateway"`
	GatewayTenant *GatewayTenant `json:"gateway_tenant"`
}

type GenericIDResponseModel

type GenericIDResponseModel struct {
	ID string `json:"id"`
}

type GenericPaginatedResponse

type GenericPaginatedResponse[T interface{}] struct {
	Data     []T  `json:"data"`
	NextPage *int `json:"next_page"`
	Count    int  `json:"count"`
}

func GetAgent

func GetAgent(urls configuration.URLs, accessToken string, swarmID, nexusID, nodeID, agentID string) (*GenericPaginatedResponse[*NewAgent], error)

func ListAgents

func ListAgents(urls configuration.URLs, accessToken string, swarmID string, nexusID, nodeID, sort string, filter string) (*GenericPaginatedResponse[*NewAgent], error)

func ListAgentsForRC

func ListAgentsForRC(urls configuration.URLs, accessToken string, swarmID string, rcID, sort string, filter string) (*GenericPaginatedResponse[*NewAgent], error)

type GetAgentEvaluatedStatusResponse

type GetAgentEvaluatedStatusResponse struct {
	Status EvaluatedStatusType `json:"status"`
}

func GetAgentStatus

func GetAgentStatus(urls configuration.URLs, accessToken, swarmID, nexusID, nodeID, agentID string) (*GetAgentEvaluatedStatusResponse, error)

type HumanReadableDistributorCoupon

type HumanReadableDistributorCoupon struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Description    string    `json:"description"`
	Redemptions    int       `json:"redemptions"`
	MaxRedemptions string    `json:"max_redemptions"`
	Code           string    `json:"code"`
	Zone           string    `json:"zone"`
	CreatedAt      time.Time `json:"created_at"`
	ExternalID     string    `json:"external_id"`
}

type HumanReadableStatus

type HumanReadableStatus struct {
	Status            string `json:"status"`
	ChildType         string `json:"child_type"`
	ChildCount        int    `json:"child_count"`
	ChildOnlineCount  int    `json:"child_online_count"`
	ChildOfflineCount int    `json:"child_offline_count"`
	ChildPendingCount int    `json:"child_pending_count"`
	ChildWarningCount int    `json:"child_warning_count"`
	ChildErrorCount   int    `json:"child_error_count"`
}

type IAMUser

type IAMUser struct {
	ID                 string         `json:"id"`
	FirstName          string         `json:"first_name"`
	LastName           string         `json:"last_name"`
	Internal           bool           `json:"internal"`
	Banned             bool           `json:"banned"`
	CreatedAt          time.Time      `json:"created_at"`
	DeletedAt          *time.Time     `json:"deleted_at"`
	MaxAllowedProjects int            `json:"max_allowed_projects"`
	Email              string         `json:"email"`
	Emails             []IAMUserEmail `json:"emails"`
	TwoFactorEnabled   bool           `json:"two_factor_enabled"`
	Status             string         `json:"status"`
	PolicyName         string         `json:"policy_name"`
	OrganizationID     *string        `json:"organization_id"`
}

type IAMUserEmail

type IAMUserEmail struct {
	ID             string    `json:"id"`
	Email          string    `json:"email"`
	Verified       bool      `json:"verified"`
	Default        bool      `json:"default"`
	CreatedAt      time.Time `json:"created_at"`
	OrganizationID *string   `json:"organization_id"`
}

type IAMUserList

type IAMUserList struct {
	Operators []*IAMUser `json:"operators"`
}

type InfraAggregateCluster

type InfraAggregateCluster struct {
	ClusterID string                      `json:"cluster_id"`
	Name      string                      `json:"name"`
	Details   InfraAggregateClusterDetail `json:"details"`
	Type      InfraClusterType            `json:"type"`
}

type InfraAggregateClusterDetail

type InfraAggregateClusterDetail struct {
	LastUpdate   time.Time                         `json:"last_update"`
	NextUpdate   time.Time                         `json:"next_update"`
	IsUpdateOk   bool                              `json:"is_update_ok"`
	Nodes        []InfraAggregateNodeDetail        `json:"nodes"`
	VirtualNodes []InfraAggregateVirtualNodeDetail `json:"virtual_nodes"`
}

type InfraAggregateDiskDetail

type InfraAggregateDiskDetail struct {
	DiskUUID              string               `json:"disk_uuid"`
	Path                  string               `json:"path"`
	Used                  bool                 `json:"used"`
	PVRef                 string               `json:"pv_ref,omitempty"`
	TotalStorageSizeBytes int64                `json:"total_storage_size_bytes"`
	UsedStorageBytes      int64                `json:"used_storage_bytes"`
	Status                InfraAggregateStatus `json:"status"`
}

type InfraAggregateNodeDetail

type InfraAggregateNodeDetail struct {
	NodeID     string                     `json:"node_id"`
	NodeName   string                     `json:"node_name"`
	Status     InfraAggregateStatus       `json:"status"`
	OSName     *string                    `json:"os_name,omitempty"`
	CPU        *InfraNodeCPUInfo          `json:"cpu,omitempty"`
	RAM        *InfraNodeRAMInfo          `json:"ram,omitempty"`
	ExternalIP *string                    `json:"external_ip,omitempty"`
	InternalIP *string                    `json:"internal_ip"`
	Disks      []InfraAggregateDiskDetail `json:"disks"`
}

type InfraAggregateStatus

type InfraAggregateStatus struct {
	Code    InfraAggregateStatusCode `json:"code"`
	Details string                   `json:"details,omitempty"`
}

type InfraAggregateStatusCode

type InfraAggregateStatusCode string
const (
	StatusCodeOk      InfraAggregateStatusCode = "status_ok"
	StatusCodeWarning InfraAggregateStatusCode = "status_warning"
	StatusCodeError   InfraAggregateStatusCode = "status_error"
	StatusCodeInUse   InfraAggregateStatusCode = "status_in_use"
)

type InfraAggregateVirtualNodeDetail

type InfraAggregateVirtualNodeDetail struct {
	NodeID               string                  `json:"node_id"`
	NodeName             string                  `json:"node_name"`
	Status               InfraAggregateStatus    `json:"status"`
	StorageType          InfraVirtualStorageType `json:"storage_type"`
	StorageConfiguration map[string]any          `json:"storage_configuration"`
}

type InfraClusterConnectCmdResponse

type InfraClusterConnectCmdResponse struct {
	// mandatory, the generated command to use to execute a cluster-connect. It will contains the orgranization-id and its api-key
	Command string `` /* 231-byte string literal not displayed */
}

type InfraClusterType

type InfraClusterType string
const (
	ClusterTypePhysical InfraClusterType = "physical"
	ClusterTypeVirtual  InfraClusterType = "virtual"
)

type InfraNodeCPUInfo

type InfraNodeCPUInfo struct {
	Cores int `json:"cores"`
}

type InfraNodeRAMInfo

type InfraNodeRAMInfo struct {
	Available float64 `json:"available"`
}

type InfraVirtualStorageType

type InfraVirtualStorageType string
const (
	VirtualStorageTypeS3 InfraVirtualStorageType = "s3"
)

type InfrastructureCluster

type InfrastructureCluster struct {
	ClusterID string `json:"cluster_id"`
	Name      string `json:"name"`
}

type InviteOperatorRequestBody

type InviteOperatorRequestBody struct {
	Email     string  `json:"email"`
	FirstName *string `json:"first_name"`
	LastName  *string `json:"last_name"`
	PolicyID  string  `json:"policy_id"`
}

type LocationAPI

type LocationAPI struct{}

func NewLocationAPI

func NewLocationAPI() *LocationAPI

func (*LocationAPI) List

func (api *LocationAPI) List(
	urlConfig configuration.URLs,
	apiKey string,
	organizationID string,
) ([]InfrastructureCluster, error)

func (*LocationAPI) ListAggregated

func (api *LocationAPI) ListAggregated(
	urlConfig configuration.URLs,
	apiKey string,
	organizationID string,
) ([]InfraAggregateCluster, error)

type LocationAPIInterface

type LocationAPIInterface interface {
	List(
		urlConfig configuration.URLs,
		apiKey string,
		organizationID string,
	) ([]InfrastructureCluster, error)
	ListAggregated(
		urlConfig configuration.URLs,
		apiKey string,
		organizationID string,
	) ([]InfraAggregateCluster, error)
}

type MonitoredResourceForSeverityNotifications

type MonitoredResourceForSeverityNotifications map[string]SeverityForNotificationType

type NewAgent

type NewAgent struct {
	ID                 string                 `json:"id"`
	NodeID             string                 `json:"node_id"`
	PublicKey          *string                `json:"public_key"`
	Features           map[string]interface{} `json:"features"`
	CreatedAt          time.Time              `json:"created"`
	DeletedAt          *time.Time             `json:"deleted"`
	LastStatusUpdateAt time.Time              `json:"last_status_update_at"`
	Secret             string                 `json:"secret"`
	Online             bool                   `json:"online"`
	ConnectedOn        *time.Time             `json:"connected_on"`
	Model              AgentModel             `json:"model"`
	Serial             *string                `json:"serial"`
	Version            *string                `json:"version"`
	Port               int                    `json:"cccp_port"`
	TotalStorage       int64                  `json:"total_storage"`
	UsedStorage        int64                  `json:"used_storage"`
	Volume             AgentVolume            `json:"volume"`
	CRN                map[string]interface{} `json:"crn"`
	AnnouncedPrivateIP *string                `json:"announced_private_ip"`
	AnnouncedPublicIP  *string                `json:"announced_public_ip"`
}

type NewAgentResponse

type NewAgentResponse struct {
	ID       string                 `json:"id"`
	Secret   string                 `json:"secret"`
	Port     int                    `json:"port"`
	Features map[string]interface{} `json:"features"`
	Volume   AgentVolume            `json:"volume"`
	CRN      map[string]interface{} `json:"crn"`
}

type NewAgentsResponse

type NewAgentsResponse struct {
	Agents []*NewAgentResponse `json:"agents"`
}

func CreateAgent

func CreateAgent(urls configuration.URLs, accessToken string, swarmID string, nexusID string, nodeID string, agentsBody BulkInsertNewAgentRequestBody) (*NewAgentsResponse, error)

type NewNode

type NewNode struct {
	ID            string                 `json:"id"`
	Name          string                 `json:"name"`
	Label         *string                `json:"label"`
	Configuration map[string]interface{} `json:"config"`
	CreatedAt     time.Time              `json:"created_at"`
	DeletedAt     *time.Time             `json:"deleted_at"`
	NexusID       string                 `json:"nexus_id"`
	PrivateIP     string                 `json:"private_ip"`
	PublicIP      string                 `json:"public_ip"`
	CRN           map[string]interface{} `json:"crn"`
}

type NewNodeResponseItem

type NewNodeResponseItem struct {
	ID            string                 `json:"id"`
	Name          string                 `json:"name"`
	Label         *string                `json:"label"`
	Configuration map[string]interface{} `json:"config"`
	PublicIP      string                 `json:"public_ip"`
	PrivateIP     string                 `json:"private_ip"`
	Agents        []NewAgentResponse     `json:"agents"`
	CRN           map[string]interface{} `json:"crn"`
}

type NewNodesResponse

type NewNodesResponse struct {
	Nodes []*NewNodeResponseItem `json:"nodes"`
}

type Nexus

type Nexus struct {
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	Location     string    `json:"location"`
	CreationDate time.Time `json:"creation_date"`
	LastModified time.Time `json:"last_modified"`
	SwarmID      string    `json:"swarm_id"`
	Capacity     int       `json:"capacity"`
	Used         int       `json:"used"`
}

type NexusList

type NexusList struct {
	Nexuses  []*Nexus `json:"nexuses"`
	Page     int      `json:"page"`
	Count    int      `json:"count"`
	NextPage *int     `json:"next_page"`
}

type Node

type Node struct {
	ID           string                 `json:"id"`
	Name         string                 `json:"name"`
	Description  string                 `json:"description"`
	Status       string                 `json:"status"`
	CreationDate time.Time              `json:"creation_date"`
	ProviderID   string                 `json:"provider_id"`
	SecretID     string                 `json:"secret_id"`
	NexusID      string                 `json:"nexus_id"`
	Config       map[string]interface{} `json:"config"`
}

type NodeConfig

type NodeConfig struct {
	ID        string        `json:"id,omitempty"`
	Name      string        `json:"name"`
	PublicIP  string        `json:"public_ip"`
	PrivateIP string        `json:"private_ip"`
	Label     string        `json:"label,omitempty"`
	Agents    []AgentConfig `json:"agents"`
}

type NodeList

type NodeList struct {
	Nodes []*Node `json:"nodes"`
	Page  int     `json:"page"`
	Count int     `json:"count"`
}

type Notification

type Notification struct {
	NotifyOwner bool     `json:"notify_owner"`
	Emails      []string `json:"emails"`
}

type OperatorAPI

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

func NewOperatorAPI

func NewOperatorAPI(config *configuration.Config) *OperatorAPI

func (*OperatorAPI) Connect

func (api *OperatorAPI) Connect(
	urlConfig configuration.URLs,
	apiKey string,
	organizationID string,
) (string, error)

type OperatorAPIInterface

type OperatorAPIInterface interface {
	Connect(
		urlConfig configuration.URLs,
		apiKey string,
		organizationID string,
	) (string, error)
}

type OperatorAPIKey

type OperatorAPIKey struct {
	ID         string     `json:"id" example:"695ed3dd-e77d-42b9-88ed-70bd3a1704ee"`
	Name       string     `json:"name" example:"API Key for Mario Rossi"`
	Key        string     `json:"key" example:"4f2a1b3c5d6e7f8a9b0c1d2e3f4a5b6c"`
	OperatorID string     `json:"operator_id" example:"695ed3dd-e77d-42b9-88ed-70bd3a1704ee"`
	CreatedAt  time.Time  `json:"created_at" example:"2023-01-18T12:42:59.089247Z"`
	ExpiresAt  *time.Time `json:"expires_at" example:"2023-01-18T12:42:59.089247Z"`
	DeletedAt  *time.Time `json:"deleted_at" example:"2023-01-18T12:42:59.089247Z"`
	BannedAt   *time.Time `json:"banned_at" example:"2023-01-18T12:42:59.089247Z"`
	Enabled    bool       `json:"enabled" example:"true"`
}

type PaginatorHandlerOptions

type PaginatorHandlerOptions struct {
	PageSize       int
	PageNumer      int
	NextPageNumber *int
	FetchAllPages  bool
}

func NewDefaultPaginatorHandlerOptions

func NewDefaultPaginatorHandlerOptions() *PaginatorHandlerOptions

func (*PaginatorHandlerOptions) GetNextPageNumber

func (o *PaginatorHandlerOptions) GetNextPageNumber() *int

func (*PaginatorHandlerOptions) SetNextPage

func (o *PaginatorHandlerOptions) SetNextPage(nextPage *int)

type PaginatorHandlerOptionsFunc

type PaginatorHandlerOptionsFunc = func(*PaginatorHandlerOptions) error

func WithFetchAllPages

func WithFetchAllPages(fetchAll bool) PaginatorHandlerOptionsFunc

func WithPageNumber

func WithPageNumber(pageNumber int) PaginatorHandlerOptionsFunc

func WithPageSize

func WithPageSize(pageSize int) PaginatorHandlerOptionsFunc

type Policy

type Policy struct {
	ID        string `json:"id"`
	AuthorID  string `json:"author_id"`
	Name      string `json:"name"`
	UserCount int    `json:"user_count"`
	Version   string `json:"version"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type PolicyList

type PolicyList struct {
	Policies []Policy `json:"policies"`
}

type ProjectItem

type ProjectItem struct {
	ProjectID          string     `json:"project_id"`
	ProjectName        string     `json:"project_name"`
	ProjectDescription string     `json:"project_description"`
	ProjectEmail       string     `json:"project_email"`
	ProjectCreatedAt   time.Time  `json:"project_created_at"`
	ProjectDeletedAt   *time.Time `json:"project_deleted_at"`
	ProjectBannedAt    *time.Time `json:"project_banned_at"`
	ProjectImageURL    string     `json:"project_image_url"`
	ProjectTenantID    string     `json:"project_tenant_id"`
	RootAccountEmail   string     `json:"root_account_email"`
	RootAccountID      string     `json:"root_account_id"`
}

type ProjectReport

type ProjectReport struct {
	ID                  string        `json:"id"`
	ExternalID          string        `json:"external_id"`
	ProjectName         string        `json:"project_name"`
	StorageBH           string        `json:"storage_bh"`
	StorageAVGTB        string        `json:"storage_avg_tb"`
	StorageMaxTB        string        `json:"storage_max_tb"`
	StorageTB           string        `json:"storage_tb"`
	StorageReservedTB   string        `json:"storage_reserved_tb"`
	BandwidthReservedTB string        `json:"bandwidth_reserved_tb"`
	EgressTB            string        `json:"egress_tb"`
	IngressTB           string        `json:"ingress_tb"`
	FromTime            string        `json:"from_time"`
	ToTime              string        `json:"to_time"`
	Status              string        `json:"status"`
	Timestamp           time.Duration `json:"timestamp"`
}

type Provider

type Provider struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	SwarmID string `json:"swarm_id"`
	Email   string `json:"email"`
}

type ProviderList

type ProviderList struct {
	Providers []Provider `json:"providers"`
	Page      int        `json:"page"`
	Count     int        `json:"count"`
}

type RCProgress

type RCProgress struct {
	Session           RCSession          `json:"session"`
	ActiveRecoveries  []RecoveryProgress `json:"active_recoveries"`
	FailedRecoveries  []RecoveryProgress `json:"failed_recoveries"`
	CompletionPercent float64            `json:"completion_percent"`
}

type RCSession

type RCSession struct {
	Status RCSessionStatus `json:"status"`
}

type RCSessionStatus

type RCSessionStatus string
const (
	RCSessionStatusRunning   RCSessionStatus = "running"
	RCSessionStatusCompleted RCSessionStatus = "completed"
	RCSessionStatusFailed    RCSessionStatus = "failed"
)

type RecoveryProgress

type RecoveryProgress struct {
	RecoveryID      string  `json:"recovery_id"`
	ProgressPercent float64 `json:"progress_percent"`
}

type RecoveryStatus

type RecoveryStatus string

type RedundancyClass

type RedundancyClass struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	Description       string    `json:"description"`
	InnerK            int       `json:"inner_k"`
	InnerN            int       `json:"inner_n"`
	OuterK            int       `json:"outer_k"`
	OuterN            int       `json:"outer_n"`
	AntiAffinityGroup int       `json:"anti_affinity_group"`
	Capacity          int       `json:"capacity"`
	CreationDate      time.Time `json:"creation_date"`
	SwarmID           string    `json:"swarm_id"`
}

type RedundancyClassErrorData

type RedundancyClassErrorData struct {
	IssueFound []interface{} `json:"issue_found"`
}

type RedundancyClassExpanded

type RedundancyClassExpanded struct {
	Status         ExpansionStatus `json:"status"`
	Message        string          `json:"message"`
	ExpandedSize   int64           `json:"expanded_size"`
	AgentsInvolved []string        `json:"agents_involved"`
}

type RedundancyClassList

type RedundancyClassList struct {
	Data []*RedundancyClass `json:"data"`
	Page int                `json:"page"`
}

type RedundancyClassRecovery

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

type Ring

type Ring struct {
	ID           string      `json:"id"`
	N            int         `json:"n"`
	K            int         `json:"k"`
	SwarmID      string      `json:"swarm_id"`
	Capacity     int         `json:"capacity"`
	Used         int         `json:"used"`
	Status       string      `json:"status"`
	CreationDate string      `json:"creation_date"`
	Nexuses      []RingNexus `json:"nexuses"`
	Nodes        []RingNode  `json:"nodes"`
}

type RingBulk

type RingBulk struct {
	RedundancyClassID string   `json:"redundancy_class_id"`
	Nexuses           []string `json:"nexuses"`
	RingsNumber       *int     `json:"number_of_rings"`
	AntiAffinityGroup *int     `json:"anti_affinity_group"`
}

type RingList

type RingList struct {
	Data  []*Ring `json:"data"`
	Page  int     `json:"page"`
	Count int     `json:"count"`
}

type RingNexus

type RingNexus struct {
	NexusID  string `json:"nexus_id"`
	N        int    `json:"n"`
	K        int    `json:"k"`
	Sequence int    `json:"sequence"`
}

type RingNode

type RingNode struct {
	NodeID    string `json:"node_id"`
	NexusID   string `json:"nexus_id"`
	Sequence1 int    `json:"sequence1"`
	Sequence2 int    `json:"sequence2"`
}

type Severity

type Severity string

type SeverityForNotificationType

type SeverityForNotificationType map[Severity]SeverityNotificationType

type SeverityNotificationType

type SeverityNotificationType struct {
	Threshold int          `json:"threshold"`
	Notify    Notification `json:"notify"`
}

type SignInToken

type SignInToken struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type SignUpRequestBody

type SignUpRequestBody struct {
	Operator     CreateOperatorRequestBodyV2     `json:"operator"`
	Organization CreateOrganizationRequestBodyV2 `json:"organization"`
}

func CreateSignUpRequestBody

func CreateSignUpRequestBody(
	email string,
	username string,
	firstName *string,
	lastName *string,
	authenticationPublicKey *string,
	organizationName string,
	organizationBasePolicy map[string]interface{},
	organizationSettings map[string]interface{},
) SignUpRequestBody

type SummaryDetails

type SummaryDetails struct {
	Pending int `json:"pending"`
	Online  int `json:"online"`
	Offline int `json:"offline"`
	Warning int `json:"warning"`
	Error   int `json:"error"`
}

type SummaryDetailsWithStatusNullable

type SummaryDetailsWithStatusNullable struct {
	Details *SummaryDetails `json:"details"`
	SummaryStatusNullable
}

func (*SummaryDetailsWithStatusNullable) ToHumanReadableStatus

func (s *SummaryDetailsWithStatusNullable) ToHumanReadableStatus(childEntityType string) HumanReadableStatus

type SummaryStatusNullable

type SummaryStatusNullable struct {
	EvaluatedStatus              *EvaluatedStatusType `json:"evaluated_status"`
	EvaluatedStatusLastUpdatedAt *time.Time           `json:"evaluated_status_last_updated_at"`
}

type Swarm

type Swarm struct {
	ID             string                 `json:"id"`
	Name           string                 `json:"name"`
	Configuration  map[string]interface{} `json:"configuration"`
	Size           int64                  `json:"size"`
	OwnerID        string                 `json:"owner_id"`
	Used           int64                  `json:"used"`
	CreationDate   time.Time              `json:"creation_date"`
	Description    *string                `json:"description"`
	OrganizationID *string                `json:"organization_id"`
}

type SwarmList

type SwarmList struct {
	Swarms []Swarm `json:"swarms"`
}

type Tenant

type Tenant struct {
	ID          string          `json:"id"`
	Name        string          `json:"name"`
	Description *string         `json:"description"`
	OwnerID     string          `json:"owner_id"`
	CreatedAt   time.Time       `json:"created_at"`
	DeletedAt   *time.Time      `json:"deleted_at"`
	Settings    *TenantSettings `json:"settings"`
	CouponID    *string         `json:"coupon_id"`
}

type TenantList

type TenantList struct {
	Tenants []*Tenant `json:"tenants"`
}

type TenantReport

type TenantReport struct {
	ID         string        `json:"id"`
	ExternalID string        `json:"external_id"`
	TenantName string        `json:"tenant_name"`
	Code       string        `json:"code"`
	StorageBH  string        `json:"storage_bh"`
	StorageGB  string        `json:"storage_gb"`
	EngressGB  string        `json:"engress_gb"`
	FromTime   string        `json:"from_time"`
	ToTime     string        `json:"to_time"`
	Status     string        `json:"status"`
	Timestamp  time.Duration `json:"timestamp"`
}

type TenantReportResponseModel

type TenantReportResponseModel struct {
	Report []ProjectReport `json:"report"`
}

type TenantSettings

type TenantSettings struct {
	ConsoleURL        *string                                    `json:"console_url"`
	GatewayURL        *string                                    `json:"gateway_url"`
	Project           *TenantSettingsProject                     `json:"project"`
	Account           *TenantSettingsAccount                     `json:"account"`
	AllowedDomains    *[]string                                  `json:"allowed_domains"`
	BlockedDomains    *[]string                                  `json:"blocked_domains"`
	Notifications     *MonitoredResourceForSeverityNotifications `json:"notifications"`
	SignupDisabled    bool                                       `json:"signup_disabled"`
	SupportLink       *string                                    `json:"support_link"`
	DisplayName       *string                                    `json:"display_name"`
	WhitelabelEnabled bool                                       `json:"whitelabel_enabled"`
	WhiteLabel        *WhiteLabel                                `json:"white_label"`
}

type TenantSettingsAccount

type TenantSettingsAccount struct {
	DefaultMaxProject          *int                        `json:"default_max_project"`
	EnabledAuthProviders       *[]AccountAuthProvider      `json:"enabled_auth_providers"`
	EnabledAuthProvidersConfig *EnabledAuthProvidersConfig `json:"enabled_auth_providers_config"`
}

type TenantSettingsProject

type TenantSettingsProject struct {
	DefaultMaxProjectEgressBandwidth *int64 `json:"default_max_egress_bandwidth"`
	DefaultMaxProjectStorage         *int64 `json:"default_max_storage"`
}

type TenantSwarm

type TenantSwarm struct {
	ID                  string `json:"id"`
	SwarmID             string `json:"swarm_id"`
	TenantID            string `json:"tenant_id"`
	RedundancyClassID   string `json:"redundancy_class_id"`
	Default             bool   `json:"default"`
	SwarmName           string `json:"swarm_name"`
	RedundancyClassName string `json:"redundancy_class_name"`
}

type TenantSwarmList

type TenantSwarmList struct {
	Swarms []*TenantSwarm `json:"swarms"`
}

type TokenAndExpirationResponseModel

type TokenAndExpirationResponseModel struct {
	Token   string    `json:"token"`
	Exp     int       `json:"exp"`
	ExpDate time.Time `json:"expDate"`
}

type URLBuilder

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

func NewURLBuilder

func NewURLBuilder(baseURL string) *URLBuilder

func (*URLBuilder) Build

func (ub *URLBuilder) Build() string

func (*URLBuilder) Path

func (ub *URLBuilder) Path(segments ...string) *URLBuilder

func (*URLBuilder) QueryParam

func (ub *URLBuilder) QueryParam(key, value string) *URLBuilder

func (*URLBuilder) QueryParamInt

func (ub *URLBuilder) QueryParamInt(key string, value int) *URLBuilder

type UpdateAccountRequest

type UpdateAccountRequest struct {
	FirstName          *string `json:"first_name"`
	LastName           *string `json:"last_name"`
	EndpointGateway    *string `json:"endpoint_gateway"`
	Internal           *bool   `json:"internal"`
	MaxAllowedProjects *int    `json:"max_allowed_projects"`
}

type UpdateAgentVolumeRequest

type UpdateAgentVolumeRequest struct {
	MountPoint *string `json:"mount_point"`
	Disk       *string `json:"disk"`
}

type UpdateGatewayRequestBody

type UpdateGatewayRequestBody struct {
	Name     *string `json:"name"`
	Location *string `json:"location"`
}

type UpdateNewAgentRequestBody

type UpdateNewAgentRequestBody struct {
	Port     *int                      `json:"port"`
	Features map[string]interface{}    `json:"features"`
	Volume   *UpdateAgentVolumeRequest `json:"volume"`
}

type UpdateNewNodeRequestBody

type UpdateNewNodeRequestBody struct {
	Name      *string `json:"name"`
	Label     *string `json:"label"`
	PublicIP  *string `json:"public_ip"`
	PrivateIP *string `json:"private_ip"`
}

type UpdateNexusRequestBody

type UpdateNexusRequestBody struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Location    string `json:"location"`
}

type UpdateNodeBodyRequest

type UpdateNodeBodyRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type UpdateSwarmRequest

type UpdateSwarmRequest struct {
	Name        *string `json:"name"`
	Description *string `json:"description"`
}

type UpdateTenantProjectRequestBody

type UpdateTenantProjectRequestBody struct {
	Name        *string `json:"name"`
	Description *string `json:"description"`
	ImageURL    *string `json:"image_url"`
}

type UpdateTenantRequestBody

type UpdateTenantRequestBody struct {
	Description *string         `json:"description"`
	Settings    *TenantSettings `json:"settings"`
}

type UserAPI

type UserAPI struct{}

func NewUserAPI

func NewUserAPI() *UserAPI

func (*UserAPI) GetIAMUser

func (a *UserAPI) GetIAMUser(urls configuration.URLs, accessToken, apiKey string, meOrID string) (*IAMUser, error)

func (*UserAPI) GetIAMUserSelf

func (a *UserAPI) GetIAMUserSelf(urls configuration.URLs, accessToken, apiKey string) (*IAMUser, error)

func (*UserAPI) PromoteIAMUser

func (a *UserAPI) PromoteIAMUser(urls configuration.URLs, email, policyName, secret string) error

type UserAPIInterface

type UserAPIInterface interface {
	GetIAMUser(
		urls configuration.URLs,
		accessToken, apiKey string,
		meOrID string,
	) (*IAMUser, error)

	GetIAMUserSelf(
		urls configuration.URLs,
		accessToken, apiKey string,
	) (*IAMUser, error)

	PromoteIAMUser(
		urls configuration.URLs,
		email,
		policyName,
		secret string,
	) error
}

type WhiteLabel

type WhiteLabel struct {
	DNS         *WhiteLabelDNS         `json:"dns"`
	EmailDomain *WhiteLabelEmailDomain `json:"email_domain"`
}

type WhiteLabelDNS

type WhiteLabelDNS struct {
	Value     string `json:"value"`
	Challenge string `json:"challenge"`
	Verified  bool   `json:"verified"`
}

type WhiteLabelEmailDomain

type WhiteLabelEmailDomain struct {
	Value     string               `json:"value"`
	User      *string              `json:"user"`
	Challenge []DNSChallengeRecord `json:"challenge"`
	Verified  bool                 `json:"verified"`
}

type ZoneMap

type ZoneMap struct {
	Zones map[string]ZoneResponse `json:"zones"`
}

type ZoneResponse

type ZoneResponse struct {
	Name        string `json:"name"`
	Key         string `json:"key"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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