service

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActiveClusterStatus   = "Active"
	CreatingClusterStatus = "Creating"
	UpdatingClusterStatus = "Updating"
	DeletedClusterStatus  = "Deleted"
	ErrorClusterStatus    = "Error"
)
View Source
const (
	LoadBalancerStatusActive  = "ACTIVE"
	LoadBalancerStatusDeleted = "DELETED"
	LoadBalancerStatusError   = "ERROR"
)
View Source
const (
	NodeGroupCreatingStatus = "Creating"
	NodeGroupActiveStatus   = "Active"
	NodeGroupUpdatingStatus = "Updating"
	NodeGroupDeletedStatus  = "Deleted"
)
View Source
const (
	NodeGroupMasterType = "master"
	NodeGroupWorkerType = "worker"
)
View Source
const (
	MasterServerType = "server"
	WorkerServerType = "agent"
)
View Source
const (
	SecurityGroupRulesPath = "v2.0/security-group-rules"
	ListenerPoolPath       = "v2/lbaas/pools"
)

Variables

This section is empty.

Functions

func Base64Encoder

func Base64Encoder(data string) string

func ConvertDataJSONtoStringArray

func ConvertDataJSONtoStringArray(jsonData datatypes.JSON) []string

func DeleteItemFromArray

func DeleteItemFromArray(a []string, item string) []string

func GenerateUserDataFromTemplate

func GenerateUserDataFromTemplate(initiliazeFlag, rke2AgentType, rke2Token, serverAddress, kubeVersion, clusterName, clusterUUID, projectUUID, vkeAPIEndpoint, authToken, vkeAgentVersion, rke2NodeLabel, vkeCloudAuthURL, clusterAutoscalerVersion, cloudProviderVkeVersion, applicationCredentialID, applicationCredentialKey string) (string, error)

func GetRandomStringFromArray

func GetRandomStringFromArray(a []string) string

func IsValidBase64

func IsValidBase64(s string) bool

Types

type IAppService

type IAppService interface {
	Cluster() IClusterService
	Compute() IComputeService
	NodeGroups() INodeGroupsService
}

type ICloudflareService

type ICloudflareService interface {
	AddDNSRecordToCloudflare(ctx context.Context, loadBalancerIP, loadBalancerSubdomainHash, clusterName string) (resource.AddDNSRecordResponse, error)
	DeleteDNSRecordFromCloudflare(ctx context.Context, dnsRecordID string) error
}

func NewCloudflareService

func NewCloudflareService(logger *logrus.Logger) ICloudflareService

type IClusterService

type IClusterService interface {
	CreateCluster(ctx context.Context, authToken string, req request.CreateClusterRequest, clUUID chan string)
	GetCluster(ctx context.Context, authToken, clusterID string) (resource.GetClusterResponse, error)
	GetClusterDetails(ctx context.Context, authToken, clusterID string) (resource.GetClusterDetailsResponse, error)
	GetClustersByProjectId(ctx context.Context, authToken, projectID string) ([]resource.GetClusterResponse, error)
	DestroyCluster(ctx context.Context, authToken, clusterID string, clUUID chan string)
	GetKubeConfig(ctx context.Context, authToken, clusterID string) (resource.GetKubeConfigResponse, error)
	CreateKubeConfig(ctx context.Context, authToken string, req request.CreateKubeconfigRequest) (resource.CreateKubeconfigResponse, error)
	CreateAuditLog(ctx context.Context, clusterUUID, projectUUID, event string) error
}

type IComputeService

type IComputeService interface {
	CreateCompute(ctx context.Context, authToken string, req request.CreateComputeRequest) (resource.CreateComputeResponse, error)
	CreateServerGroup(ctx context.Context, authToken string, req request.CreateServerGroupRequest) (resource.ServerGroupResponse, error)
	DeleteServerGroup(ctx context.Context, authToken, clusterServerGroupUUID string) error
	GetCountOfServerFromServerGroup(ctx context.Context, authToken, serverGroupID, projectUUID string) (int, error)
	GetInstances(ctx context.Context, authToken, nodeGroupUUID string) ([]resource.Servers, error)
	GetClusterFlavor(ctx context.Context, authToken string, clusterUUID string) ([]resource.Flavor, error)
	DeleteCompute(ctx context.Context, authToken, serverID string) error
	GetServerGroupMemberList(ctx context.Context, authToken, ServerGroupID string) (resource.GetServerGroupMemberListResponse, error)
}

func NewComputeService

func NewComputeService(l *logrus.Logger, i IIdentityService, repository repository.IRepository) IComputeService

type IIdentityService

type IIdentityService interface {
	CheckAuthToken(ctx context.Context, authToken, projectUUID string) error
	CreateApplicationCredential(ctx context.Context, clusterUUID, authToken string) (*resource.CreateApplicationCredentialResponse, error)
	GetTokenDetail(ctx context.Context, authToken string) (string, error)
	DeleteApplicationCredential(ctx context.Context, authToken, applicationCredentialID string) error
}

func NewIdentityService

func NewIdentityService(logger *logrus.Logger) IIdentityService

type ILoadbalancerService

type ILoadbalancerService interface {
	GetAmphoraesVrrpIp(authToken, loadBalancerID string) (resource.GetAmphoraesVrrpIpResponse, error)
	ListLoadBalancer(ctx context.Context, authToken, loadBalancerID string) (resource.ListLoadBalancerResponse, error)
	CreateLoadBalancer(ctx context.Context, authToken string, req request.CreateLoadBalancerRequest) (resource.CreateLoadBalancerResponse, error)
	CreateListener(ctx context.Context, authToken string, req request.CreateListenerRequest) (resource.CreateListenerResponse, error)
	CreatePool(ctx context.Context, authToken string, req request.CreatePoolRequest) (resource.CreatePoolResponse, error)
	CreateMember(ctx context.Context, authToken, poolID string, req request.AddMemberRequest) error
	ListListener(ctx context.Context, authToken, listenerID string) (resource.ListListenerResponse, error)
	CheckLoadBalancerStatus(ctx context.Context, authToken, loadBalancerID string) (resource.ListLoadBalancerResponse, error)
	CreateHealthHTTPMonitor(ctx context.Context, authToken string, req request.CreateHealthMonitorHTTPRequest) error
	CreateHealthTCPMonitor(ctx context.Context, authToken string, req request.CreateHealthMonitorTCPRequest) error
	CheckLoadBalancerOperationStatus(ctx context.Context, authToken, loadBalancerID string) (resource.ListLoadBalancerResponse, error)
	DeleteLoadbalancer(ctx context.Context, authToken, loadBalancerID string) error
	GetLoadBalancerPools(ctx context.Context, authToken, loadBalancerID string) (resource.GetLoadBalancerPoolsResponse, error)
	CheckLoadBalancerDeletingPools(ctx context.Context, authToken, poolID string) error
	DeleteLoadbalancerPools(ctx context.Context, authToken, poolID string) error
	GetLoadBalancerListeners(ctx context.Context, authToken, loadBalancerID string) (resource.GetLoadBalancerListenersResponse, error)
	DeleteLoadbalancerListeners(ctx context.Context, authToken, listenerID string) error
	CheckLoadBalancerDeletingListeners(ctx context.Context, authToken, listenerID string) error
}

func NewLoadbalancerService

func NewLoadbalancerService(logger *logrus.Logger) ILoadbalancerService

type INetworkService

type INetworkService interface {
	ListSubnetByName(ctx context.Context, subnetName, authToken string) (resource.ListSubnetByNameResponse, error)
	GetNetworkID(ctx context.Context, authToken, subnetID string) (resource.GetNetworkIdResponse, error)
	CreateSecurityGroup(ctx context.Context, authToken string, req request.CreateSecurityGroupRequest) (resource.CreateSecurityGroupResponse, error)
	CreateNetworkPort(ctx context.Context, authToken string, req request.CreateNetworkPortRequest) (resource.CreateNetworkPortResponse, error)
	CreateSecurityGroupRuleForIP(ctx context.Context, authToken string, req request.CreateSecurityGroupRuleForIpRequest) error
	CreateSecurityGroupRuleForSG(ctx context.Context, authToken string, req request.CreateSecurityGroupRuleForSgRequest) error
	CreateFloatingIP(ctx context.Context, authToken string, req request.CreateFloatingIPRequest) (resource.CreateFloatingIPResponse, error)
	DeleteSecurityGroup(ctx context.Context, authToken, clusterSecurityGroupId string) error
	DeleteFloatingIP(ctx context.Context, authToken, floatingIPID string) error
	DeleteNetworkPort(ctx context.Context, authToken string, portID string) error
	GetSecurityGroupByID(ctx context.Context, authToken, securityGroupID string) (resource.GetSecurityGroupResponse, error)
	GetSubnetByID(ctx context.Context, authToken, subnetID string) (resource.SubnetResponse, error)
	GetComputeNetworkPorts(ctx context.Context, authToken, instanceID string) (resource.NetworkPortsResponse, error)
}

func NewNetworkService

func NewNetworkService(logger *logrus.Logger) INetworkService

type INodeGroupsService

type INodeGroupsService interface {
	GetNodeGroups(ctx context.Context, authToken, clusterID, nodeGroupID string) ([]resource.NodeGroup, error)
	GetNodeGroupsByClusterUUID(ctx context.Context, clusterUUID string) ([]resource.NodeGroup, error)
	UpdateNodeGroups(ctx context.Context, authToken, clusterID, nodeGroupID string, req request.UpdateNodeGroupRequest) (resource.UpdateNodeGroupResponse, error)
	AddNode(ctx context.Context, authToken string, clusterUUID, nodeGroupUUID string) (resource.AddNodeResponse, error)
	DeleteNode(ctx context.Context, authToken, clusterID, nodeGroupID, instanceName string) (resource.DeleteNodeResponse, error)
	CreateNodeGroup(ctx context.Context, authToken, clusterID string, req request.CreateNodeGroupRequest) (resource.CreateNodeGroupResponse, error)
	DeleteNodeGroup(ctx context.Context, authToken, clusterID, nodeGroupID string) error
}

Jump to

Keyboard shortcuts

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