Documentation
¶
Index ¶
- type APIClient
- type App
- type AppClient
- type AuthClient
- type Client
- func (client *Client) APIServer() string
- func (client *Client) CreateApp(data *CreateAppData, configFile string) error
- func (client *Client) CreateService(data *CreateServiceData) error
- func (client *Client) CreateVolume(data *CreateVolumeData) error
- func (client *Client) Initialize(apiServer string, namespace string, token string)
- func (client *Client) InspectApp(name string) (*App, error)
- func (client *Client) InspectCluster(name string) (*Cluster, error)
- func (client *Client) InspectLoadBalancer(name string) (*LoadBalancer, error)
- func (client *Client) InspectService(name string, params *ServiceParams) (*Service, error)
- func (client *Client) InspectSpace(name string) (*Space, error)
- func (client *Client) InspectVolume(id string) (*Volume, error)
- func (client *Client) ListApps(params *ListAppsParams) (*ListAppsResult, error)
- func (client *Client) ListClusters() (*ListClustersResult, error)
- func (client *Client) ListLoadBalancers(params *ListLoadBalancersParams) (*ListLoadBalancersResult, error)
- func (client *Client) ListServices(params *ListServicesParams) (*ListServicesResult, error)
- func (client *Client) ListSpaces() (*ListSpacesResult, error)
- func (client *Client) ListVolumes(params *ListVolumesParams) (*ListVolumesResult, error)
- func (client *Client) Login(data *LoginData) (*LoginResult, error)
- func (client *Client) Namespace() string
- func (client *Client) RemoveApp(name string) error
- func (client *Client) RemoveService(name string, params *ServiceParams) error
- func (client *Client) RemoveVolume(id string) error
- func (client *Client) RestartService(name string, params *ServiceParams) error
- func (client *Client) ScaleService(name string, data *ScaleServiceData, params *ServiceParams) error
- func (client *Client) StartApp(name string) error
- func (client *Client) StartService(name string, params *ServiceParams) error
- func (client *Client) StopApp(name string) error
- func (client *Client) StopService(name string, params *ServiceParams) error
- func (client *Client) Token() string
- func (client *Client) UpdateLoadBalancer(name string, data *UpdateLoadBalancerData) error
- func (client *Client) UpdateService(name string, data *UpdateServiceData, params *ServiceParams) error
- type Cluster
- type ClusterAttributes
- type ClusterClient
- type ClusterCloudInfo
- type CreateAppData
- type CreateServiceData
- type CreateVolumeData
- type ListAppsParams
- type ListAppsResult
- type ListClustersResult
- type ListLoadBalancersParams
- type ListLoadBalancersResult
- type ListServicesParams
- type ListServicesResult
- type ListSpacesResult
- type ListVolumesParams
- type ListVolumesResult
- type Listener
- type ListenerData
- type LoadBalancer
- type LoadBalancerClient
- type LoginData
- type LoginResult
- type ScaleServiceData
- type Service
- type ServiceClient
- type ServiceInstanceSize
- type ServiceListener
- type ServiceLoadBalancer
- type ServiceParams
- type ServiceVolume
- type Space
- type SpaceClient
- type UpdateLoadBalancerData
- type UpdateServiceData
- type Volume
- type VolumeClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient interface {
APIServer() string
Namespace() string
Token() string
Initialize(string, string, string)
AuthClient
ServiceClient
SpaceClient
ClusterClient
LoadBalancerClient
VolumeClient
AppClient
}
APIClient is the interface implemented by the Alauda API client.
type App ¶
type App struct {
Name string `json:"app_name"`
ID string `json:"uuid"`
State string `json:"current_status"`
CreatedBy string `json:"created_by"`
Services []Service `json:"services"`
}
App defines the response body of the InspectApp API.
type AppClient ¶
type AppClient interface {
CreateApp(*CreateAppData, string) error
ListApps(*ListAppsParams) (*ListAppsResult, error)
InspectApp(string) (*App, error)
StartApp(string) error
StopApp(string) error
RemoveApp(string) error
}
AppClient is the API client for the app related APIs.
type AuthClient ¶
type AuthClient interface {
Login(*LoginData) (*LoginResult, error)
}
AuthClient is the API client for authentication related APIs.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client for the Alauda platform.
func (*Client) CreateApp ¶
func (client *Client) CreateApp(data *CreateAppData, configFile string) error
CreateApp creates and starts the specified application.
func (*Client) CreateService ¶
func (client *Client) CreateService(data *CreateServiceData) error
CreateService creates and deploys a new service.
func (*Client) CreateVolume ¶
func (client *Client) CreateVolume(data *CreateVolumeData) error
CreateVolume creates a new volume.
func (*Client) Initialize ¶
Initialize should be called before using the client.
func (*Client) InspectApp ¶
InspectApp retrieves details about a specific application.
func (*Client) InspectCluster ¶
InspectCluster retrieves details about the specified cluster.
func (*Client) InspectLoadBalancer ¶
func (client *Client) InspectLoadBalancer(name string) (*LoadBalancer, error)
InspectLoadBalancer retrieves details about a specific LB.
func (*Client) InspectService ¶
func (client *Client) InspectService(name string, params *ServiceParams) (*Service, error)
InspectService retrieves details about the specified service.
func (*Client) InspectSpace ¶
InspectSpace retrieves details about a specific space.
func (*Client) InspectVolume ¶
InspectVolume retrieves details about a specific volume.
func (*Client) ListApps ¶
func (client *Client) ListApps(params *ListAppsParams) (*ListAppsResult, error)
ListApps returns all apps in a cluster.
func (*Client) ListClusters ¶
func (client *Client) ListClusters() (*ListClustersResult, error)
ListClusters returns all clusters in an account.
func (*Client) ListLoadBalancers ¶
func (client *Client) ListLoadBalancers(params *ListLoadBalancersParams) (*ListLoadBalancersResult, error)
ListLoadBalancers returns all LBs in a cluster, potentially filtered by a specific service.
func (*Client) ListServices ¶
func (client *Client) ListServices(params *ListServicesParams) (*ListServicesResult, error)
ListServices returns all services deployed.
func (*Client) ListSpaces ¶
func (client *Client) ListSpaces() (*ListSpacesResult, error)
ListSpaces returns all spaces in an account.
func (*Client) ListVolumes ¶
func (client *Client) ListVolumes(params *ListVolumesParams) (*ListVolumesResult, error)
ListVolumes returns all volumes in a cluster.
func (*Client) Login ¶
func (client *Client) Login(data *LoginData) (*LoginResult, error)
Login authenticates against the Alauda server.
func (*Client) RemoveService ¶
func (client *Client) RemoveService(name string, params *ServiceParams) error
RemoveService deletes the specified service.
func (*Client) RemoveVolume ¶
RemoveVolume deletes the specified volume.
func (*Client) RestartService ¶
func (client *Client) RestartService(name string, params *ServiceParams) error
RestartService restarts the specified service.
func (*Client) ScaleService ¶
func (client *Client) ScaleService(name string, data *ScaleServiceData, params *ServiceParams) error
ScaleService scales the service to the specified number of instances
func (*Client) StartService ¶
func (client *Client) StartService(name string, params *ServiceParams) error
StartService starts the specified service.
func (*Client) StopService ¶
func (client *Client) StopService(name string, params *ServiceParams) error
StopService stops the specified service.
func (*Client) UpdateLoadBalancer ¶
func (client *Client) UpdateLoadBalancer(name string, data *UpdateLoadBalancerData) error
UpdateLoadBalancer creates or removes listeners for the service endpoints on the load balancer.
func (*Client) UpdateService ¶
func (client *Client) UpdateService(name string, data *UpdateServiceData, params *ServiceParams) error
UpdateService scales the service to the specified number of instances
type Cluster ¶
type Cluster struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
ID string `json:"id"`
Type string `json:"container_manager"`
State string `json:"state"`
CreatedAt string `json:"created_at"`
Attributes ClusterAttributes `json:"attr"`
}
Cluster defines the response body for one cluster returned by the ListClusters API.
type ClusterAttributes ¶
type ClusterAttributes struct {
Cloud ClusterCloudInfo `json:"cloud"`
}
ClusterAttributes contains the attributes of a cluster.
type ClusterClient ¶
type ClusterClient interface {
ListClusters() (*ListClustersResult, error)
InspectCluster(string) (*Cluster, error)
}
ClusterClient is the API client for cluster related APIs.
type ClusterCloudInfo ¶
ClusterCloudInfo contains information about the cloud/region the cluster is deployed in.
type CreateAppData ¶
type CreateAppData struct {
Name string `json:"app_name"`
Cluster string `json:"region"`
Namespace string `json:"namespace"`
Strict bool `json:"strict_mode"`
Timeout int `json:"timeout"`
}
CreateAppData defines the request body for the CreateApp API.
type CreateServiceData ¶
type CreateServiceData struct {
Version string `json:"version"`
Name string `json:"service_name"`
Cluster string `json:"region_name"`
Space string `json:"space_name"`
ImageName string `json:"image_name"`
ImageTag string `json:"image_tag"`
Command string `json:"run_command"`
Entrypoint string `json:"entrypoint"`
TargetState string `json:"target_state"`
TargetInstances int `json:"target_num_instances"`
InstanceSize string `json:"instance_size"`
CustomInstanceSize ServiceInstanceSize `json:"custom_instance_size"`
ScalingMode string `json:"scaling_mode"`
Ports []int `json:"ports"`
NetworkMode string `json:"network_mode"`
Env map[string]string `json:"instance_envvars"`
LoadBalancers []ServiceLoadBalancer `json:"load_balancers"`
Volumes []ServiceVolume `json:"volumes"`
}
CreateServiceData defines the request body for the CreateService API.
type CreateVolumeData ¶
type CreateVolumeData struct {
Name string `json:"name"`
Driver string `json:"driver_name"`
Size int `json:"size"`
ClusterID string `json:"region_id"`
VolumeType string `json:"volume_type"`
Namespace string `json:"namespace"`
}
CreateVolumeData defines the request body for the CreateVolume API.
type ListAppsParams ¶
type ListAppsParams struct {
Cluster string
}
ListAppsParams defines the query parameters for the ListApps API.
type ListAppsResult ¶
type ListAppsResult struct {
Apps []App
}
ListAppsResult defines the response body for the ListApps API.
type ListClustersResult ¶
type ListClustersResult struct {
Clusters []Cluster
}
ListClustersResult defines the response body for the ListClusters API.
type ListLoadBalancersParams ¶
ListLoadBalancersParams defines the query parameters for the ListLoadBalancers API.
type ListLoadBalancersResult ¶
type ListLoadBalancersResult struct {
LoadBalancers []LoadBalancer
}
ListLoadBalancersResult defines the response body for the ListLoadBalancers API.
type ListServicesParams ¶
type ListServicesParams struct {
Cluster string
}
ListServicesParams defines the query parameters for the ListServices API.
type ListServicesResult ¶
ListServicesResult defines the response body for the ListServices API.
type ListSpacesResult ¶
type ListSpacesResult struct {
Spaces []Space
}
ListSpacesResult defines the response body for the ListSpaces API.
type ListVolumesParams ¶
type ListVolumesParams struct {
ClusterID string
}
ListVolumesParams defines the query parameters for the ListVolumes API.
type ListVolumesResult ¶
type ListVolumesResult struct {
Volumes []Volume
}
ListVolumesResult defines the response body for the ListVolumes API.
type Listener ¶
type Listener struct {
ServiceID string `json:"service_id"`
ServiceName string `json:"service_name"`
Protocol string `json:"protocol"`
ListenerPort int `json:"listener_port"`
ContainerPort int `json:"container_port"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Listener defines the response body for one listener from the InspectLoadBalancer API.
type ListenerData ¶
type ListenerData struct {
ServiceName string `json:"service_name"`
Protocol string `json:"protocol"`
ListenerPort int `json:"listener_port"`
ContainerPort int `json:"container_port"`
}
ListenerData defines one listener in the request body for the UpdateLoadBalancer API.
type LoadBalancer ¶
type LoadBalancer struct {
Name string `json:"name"`
ID string `json:"load_balancer_id"`
Type string `json:"type"`
Address string `json:"address"`
AddressType string `json:"address_type"`
CreatedWith string `json:"create_type"`
CreatedAt string `json:"created_at"`
Listeners []Listener `json:"listeners"`
}
LoadBalancer defines the response body of the InspectLoadBalancer API.
type LoadBalancerClient ¶
type LoadBalancerClient interface {
ListLoadBalancers(*ListLoadBalancersParams) (*ListLoadBalancersResult, error)
InspectLoadBalancer(string) (*LoadBalancer, error)
UpdateLoadBalancer(string, *UpdateLoadBalancerData) error
}
LoadBalancerClient is the API client for LB related APIs.
type LoginData ¶
type LoginData struct {
Organization string `json:"organization"`
Username string `json:"username"`
Password string `json:"password"`
}
LoginData defines the request body for the login API.
type LoginResult ¶
type LoginResult struct {
Namespace string `json:"namespace"`
Username string `json:"username"`
Email string `json:"email"`
Token string `json:"token"`
}
LoginResult defines the response body for the login API.
type ScaleServiceData ¶
type ScaleServiceData struct {
TargetInstances int `json:"target_num_instances"`
}
ScaleServiceData defines the request body for the ScaleService API.
type Service ¶
type Service struct {
Name string `json:"service_name"`
ImageName string `json:"image_name"`
ImageTag string `json:"image_tag"`
Command string `json:"run_command"`
Entrypoint string `json:"entrypoint"`
CreatedAt string `json:"created_at"`
Size ServiceInstanceSize `json:"custom_instance_size"`
Ports []int `json:"ports"`
TargetInstances int `json:"target_num_instances"`
HealthyInstances int `json:"healthy_num_instances"`
State string `json:"current_status"`
NetworkMode string `json:"network_mode"`
Env map[string]string `json:"instance_envvars"`
Volumes []ServiceVolume `json:"volumes"`
}
Service defines the response body for one service returned in the ListServices API.
type ServiceClient ¶
type ServiceClient interface {
CreateService(*CreateServiceData) error
ListServices(*ListServicesParams) (*ListServicesResult, error)
StartService(string, *ServiceParams) error
StopService(string, *ServiceParams) error
RemoveService(string, *ServiceParams) error
InspectService(string, *ServiceParams) (*Service, error)
RestartService(string, *ServiceParams) error
ScaleService(string, *ScaleServiceData, *ServiceParams) error
UpdateService(string, *UpdateServiceData, *ServiceParams) error
}
ServiceClient is the API client for service related APIs.
type ServiceInstanceSize ¶
ServiceInstanceSize defines the size of the service instances.
type ServiceListener ¶
type ServiceListener struct {
ListenerPort int `json:"listener_port"`
ContainerPort int `json:"container_port"`
Protocol string `json:"protocol"`
}
ServiceListener defines the load balancer listener data in the CreateService request.
type ServiceLoadBalancer ¶
type ServiceLoadBalancer struct {
ID string `json:"load_balancer_id"`
Type string `json:"type"`
Listeners []ServiceListener `json:"listeners"`
}
ServiceLoadBalancer defines the load balancer data in the CreateService request.
type ServiceParams ¶
type ServiceParams struct {
App string
}
ServiceParams defines the base query parameters for various service APIs.
type ServiceVolume ¶
type ServiceVolume struct {
Path string `json:"app_volume_dir"`
VolumeName string `json:"volume_name"`
VolumeID string `json:"volume_id"`
}
ServiceVolume defines the volume data in the CreateService request.
type Space ¶
type Space struct {
ID string `json:"uuid"`
Name string `json:"name"`
Description string `json:"description"`
State string `json:"status"`
CreatedBy string `json:"created_by"`
CreatedAt string `json:"created_at"`
}
Space defines the response body for one space returned by the ListSpaces API.
type SpaceClient ¶
type SpaceClient interface {
ListSpaces() (*ListSpacesResult, error)
InspectSpace(string) (*Space, error)
}
SpaceClient is the API client for space related APIs.
type UpdateLoadBalancerData ¶
type UpdateLoadBalancerData struct {
Action string `json:"action"`
Listeners []ListenerData `json:"listeners"`
}
UpdateLoadBalancerData defines the request body for the UpdateLoadBalancer API.
type UpdateServiceData ¶
type UpdateServiceData struct {
ImageTag string `json:"image_tag"`
Command string `json:"run_command"`
Entrypoint string `json:"entrypoint"`
InstanceSize string `json:"instance_size"`
CustomInstanceSize ServiceInstanceSize `json:"custom_instance_size"`
Env map[string]string `json:"instance_envvars"`
}
UpdateServiceData defines the request body for the ScaleService API.
type Volume ¶
type Volume struct {
Name string `json:"name"`
ID string `json:"id"`
Driver string `json:"driver_name"`
State string `json:"state"`
Size int `json:"size"`
CreatedAt string `json:"created_at"`
CreatedBy string `json:"created_by"`
}
Volume defines the response body of the InspectVolume API.
type VolumeClient ¶
type VolumeClient interface {
ListVolumes(*ListVolumesParams) (*ListVolumesResult, error)
InspectVolume(string) (*Volume, error)
CreateVolume(*CreateVolumeData) error
RemoveVolume(string) error
}
VolumeClient is the API client for volume related APIs.
Source Files
¶
- app.go
- app_create.go
- app_inspect.go
- app_list.go
- app_remove.go
- app_start.go
- app_stop.go
- client.go
- cluster.go
- cluster_inspect.go
- cluster_list.go
- interface.go
- lb.go
- lb_inspect.go
- lb_list.go
- lb_update.go
- login.go
- service.go
- service_create.go
- service_inspect.go
- service_list.go
- service_remove.go
- service_restart.go
- service_scale.go
- service_start.go
- service_stop.go
- service_update.go
- space.go
- space_inspect.go
- space_list.go
- volume.go
- volume_create.go
- volume_inspect.go
- volume_list.go
- volume_remove.go