Documentation ¶
Index ¶
- Constants
- type CRAuthorizationToken
- type Client
- func (client *Client) CreateCluster(region common.Region, args *ClusterCreationArgs) (cluster ClusterCreationResponse, err error)
- func (client *Client) CreateKubernetesCluster(region common.Region, args *KubernetesCreationArgs) (cluster ClusterCreationResponse, err error)
- func (client *Client) DeleteCluster(clusterID string) error
- func (client *Client) DescribeCluster(id string) (cluster ClusterType, err error)
- func (client *Client) DescribeClusters(nameFilter string) (clusters []ClusterType, err error)
- func (client *Client) GetCRAuthorizationToken() (crtoken CRAuthorizationToken, err error)
- func (client *Client) GetCRRepoInfo(repoNamespace, repoName string) (str string, err error)
- func (client *Client) GetClusterCerts(id string) (certs ClusterCerts, err error)
- func (client *Client) GetClusterConfig(id string) (config ClusterConfig, err error)
- func (client *Client) GetKubernetesClusterNodes(id string, pagination common.Pagination) (nodes []KubernetesNodeType, paginationResult *PaginationResult, err error)
- func (client *Client) GetProjectClient(clusterId string) (projectClient *ProjectClient, err error)
- func (client *Client) Invoke(region common.Region, method string, path string, query url.Values, ...) error
- func (client *Client) ModifyClusterName(clusterID, clusterName string) error
- func (client *Client) ResizeCluster(clusterID string, args *ClusterResizeArgs) error
- func (client *Client) ResizeKubernetes(clusterID string, args *KubernetesCreationArgs) error
- func (client *Client) SetDebug(debug bool)
- func (client *Client) SetUserAgent(userAgent string)
- func (client *Client) WaitForClusterAsyn(clusterId string, status ClusterState, timeout int) error
- type ClusterCerts
- type ClusterConfig
- type ClusterCreationArgs
- type ClusterCreationResponse
- type ClusterResizeArgs
- type ClusterState
- type ClusterType
- type Container
- type Definition
- type DriverOptions
- type GetKubernetesClusterNodesResponse
- type GetProjectResponse
- type GetProjectsResponse
- type GetServiceResponse
- type GetServicesResponse
- type GetSwarmClusterNodesResponse
- type GetVolumeResponse
- type GetVolumesResponse
- type KubernetesCreationArgs
- type KubernetesNodeType
- type KubernetesStackArgs
- type Labels
- type ModifyClusterNameArgs
- type NASOpts
- type NetworkModeType
- type NodeStatus
- type OSSOpts
- type PaginationResult
- type Port
- type Project
- type ProjectClient
- func (client *ProjectClient) ClusterId() string
- func (client *ProjectClient) ConfirmBlueGreenProject(name string, force bool) (err error)
- func (client *ProjectClient) CreateProject(args *ProjectCreationArgs) (err error)
- func (client *ProjectClient) CreateVolume(args *VolumeCreationArgs) (err error)
- func (client *ProjectClient) DeleteProject(name string, forceDelete, deleteVolume bool) (err error)
- func (client *ProjectClient) DeleteVolume(name string) (err error)
- func (client *ProjectClient) Endpoint() string
- func (client *ProjectClient) GetProject(name string) (project GetProjectResponse, err error)
- func (client *ProjectClient) GetProjects(q string, services, containers bool) (projects GetProjectsResponse, err error)
- func (client *ProjectClient) GetService(serviceId string) (service GetServiceResponse, err error)
- func (client *ProjectClient) GetServices(q string, containers bool) (services GetServicesResponse, err error)
- func (client *ProjectClient) GetSwarmClusterNodes() (project GetSwarmClusterNodesResponse, err error)
- func (client *ProjectClient) GetVolume(name string) (volume GetVolumeResponse, err error)
- func (client *ProjectClient) GetVolumes() (volumes GetVolumesResponse, err error)
- func (client *ProjectClient) Invoke(method string, path string, query url.Values, args interface{}, ...) error
- func (client *ProjectClient) KillProject(name string, signal ...string) (err error)
- func (client *ProjectClient) KillService(serviceId string, signal ...string) (err error)
- func (client *ProjectClient) RollBackBlueGreenProject(name string, force bool) (err error)
- func (client *ProjectClient) ScaleService(args *ScaleServiceArgs) (err error)
- func (client *ProjectClient) SetDebug(debug bool)
- func (client *ProjectClient) SetUserAgent(userAgent string)
- func (client *ProjectClient) StartProject(name string) (err error)
- func (client *ProjectClient) StartService(serviceId string) (err error)
- func (client *ProjectClient) StopProject(name string, timeout ...time.Duration) (err error)
- func (client *ProjectClient) StopService(serviceId string, timeout ...time.Duration) (err error)
- func (client *ProjectClient) UpdateProject(args *ProjectUpdationArgs) (err error)
- type ProjectCreationArgs
- type ProjectUpdationArgs
- type Request
- type Response
- type ScaleServiceArgs
- type ScaleType
- type Service
- type SwarmNodeType
- type VolumeCreationArgs
- type VolumeCreationResponse
- type VolumeDriverType
- type VolumeRef
Constants ¶
View Source
const ( // CRMDefaultEndpoint is the default API endpoint of CRM services CSDefaultEndpoint = "https://cs.aliyuncs.com" CSAPIVersion = "2015-12-15" )
View Source
const ( Initial = ClusterState("initial") Running = ClusterState("running") Updating = ClusterState("updating") Scaling = ClusterState("scaling") Failed = ClusterState("failed") Deleting = ClusterState("deleting") DeleteFailed = ClusterState("deleteFailed") Deleted = ClusterState("deleted") InActive = ClusterState("inactive") )
View Source
const ( ClassicNetwork = NetworkModeType("classic") VPCNetwork = NetworkModeType("vpc") )
View Source
const ( CRDefaultEndpoint = "https://cr.cn-hangzhou.aliyuncs.com" CRAPIVersion = "2016-06-07" )
View Source
const ClusterDefaultTimeout = 300
View Source
const DefaultPreSleepTime = 240
View Source
const DefaultWaitForInterval = 10
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CRAuthorizationToken ¶
type Client ¶
type Client struct { AccessKeyId string AccessKeySecret string SecurityToken string Version string // contains filtered or unexported fields }
The Client type encapsulates operations with an OSS region.
func NewClientForAussumeRole ¶
func (*Client) CreateCluster ¶
func (client *Client) CreateCluster(region common.Region, args *ClusterCreationArgs) (cluster ClusterCreationResponse, err error)
func (*Client) CreateKubernetesCluster ¶
func (client *Client) CreateKubernetesCluster(region common.Region, args *KubernetesCreationArgs) (cluster ClusterCreationResponse, err error)
func (*Client) DeleteCluster ¶
func (*Client) DescribeCluster ¶
func (client *Client) DescribeCluster(id string) (cluster ClusterType, err error)
func (*Client) DescribeClusters ¶
func (client *Client) DescribeClusters(nameFilter string) (clusters []ClusterType, err error)
func (*Client) GetCRAuthorizationToken ¶
func (client *Client) GetCRAuthorizationToken() (crtoken CRAuthorizationToken, err error)
func (*Client) GetCRRepoInfo ¶
func (*Client) GetClusterCerts ¶
func (client *Client) GetClusterCerts(id string) (certs ClusterCerts, err error)
func (*Client) GetClusterConfig ¶
func (client *Client) GetClusterConfig(id string) (config ClusterConfig, err error)
func (*Client) GetKubernetesClusterNodes ¶
func (client *Client) GetKubernetesClusterNodes(id string, pagination common.Pagination) (nodes []KubernetesNodeType, paginationResult *PaginationResult, err error)
func (*Client) GetProjectClient ¶
func (client *Client) GetProjectClient(clusterId string) (projectClient *ProjectClient, err error)
func (*Client) Invoke ¶
func (client *Client) Invoke(region common.Region, method string, path string, query url.Values, args interface{}, response interface{}) error
Invoke sends the raw HTTP request for ECS services
func (*Client) ModifyClusterName ¶
func (*Client) ResizeCluster ¶
func (client *Client) ResizeCluster(clusterID string, args *ClusterResizeArgs) error
func (*Client) ResizeKubernetes ¶
func (client *Client) ResizeKubernetes(clusterID string, args *KubernetesCreationArgs) error
func (*Client) SetUserAgent ¶
SetUserAgent sets user agent to log the request/response message
func (*Client) WaitForClusterAsyn ¶
func (client *Client) WaitForClusterAsyn(clusterId string, status ClusterState, timeout int) error
WaitForCluster waits for instance to given status when instance.NotFound wait until timeout
type ClusterCerts ¶
type ClusterConfig ¶
type ClusterConfig struct {
Config string `json:"config"`
}
type ClusterCreationArgs ¶
type ClusterCreationArgs struct { Name string `json:"name"` Size int64 `json:"size"` NetworkMode NetworkModeType `json:"network_mode"` SubnetCIDR string `json:"subnet_cidr,omitempty"` InstanceType string `json:"instance_type"` VPCID string `json:"vpc_id,omitempty"` VSwitchID string `json:"vswitch_id,omitempty"` Password string `json:"password"` DataDiskSize int64 `json:"data_disk_size"` DataDiskCategory ecs.DiskCategory `json:"data_disk_category"` ECSImageID string `json:"ecs_image_id,omitempty"` IOOptimized ecs.IoOptimized `json:"io_optimized"` ReleaseEipFlag bool `json:"release_eip_flag"` }
type ClusterCreationResponse ¶
type ClusterResizeArgs ¶
type ClusterResizeArgs struct { Size int64 `json:"size"` InstanceType string `json:"instance_type"` Password string `json:"password"` DataDiskSize int64 `json:"data_disk_size"` DataDiskCategory ecs.DiskCategory `json:"data_disk_category"` ECSImageID string `json:"ecs_image_id,omitempty"` IOOptimized ecs.IoOptimized `json:"io_optimized"` }
type ClusterState ¶
type ClusterState string
type ClusterType ¶
type ClusterType struct { AgentVersion string `json:"agent_version"` ClusterID string `json:"cluster_id"` Name string `json:"name"` Created util.ISO6801Time `json:"created"` ExternalLoadbalancerID string `json:"external_loadbalancer_id"` MasterURL string `json:"master_url"` NetworkMode NetworkModeType `json:"network_mode"` RegionID common.Region `json:"region_id"` SecurityGroupID string `json:"security_group_id"` Size int64 `json:"size"` State ClusterState `json:"state"` Updated util.ISO6801Time `json:"updated"` VPCID string `json:"vpc_id"` VSwitchID string `json:"vswitch_id"` NodeStatus string `json:"node_status"` DockerVersion string `json:"docker_version"` }
type Container ¶
type Container struct { Name string `json:"name"` Node string `json:"node"` VMID string `json:"vm_id"` IP string `json:"ip"` Running bool `json:"running"` Status string `json:"status"` Health string `json:"health"` StatusExt string `json:"status_ext"` FailCount int `json:"fail_count"` Ports map[string][]Port `json:"ports"` }
type Definition ¶
type Definition struct { Environment []string `json:"environment"` Image string `json:"image"` KernelMemory int `json:"kernel_memory"` Labels Labels `json:"labels"` MemLimit int `json:"mem_limit"` MemswapLimit int `json:"memswap_limit"` MemswapReservation int `json:"memswap_reservation"` OomKillDisable bool `json:"oom_kill_disable"` Restart string `json:"restart"` ShmSize int `json:"shm_size"` Volumes []string `json:"volumes"` }
type DriverOptions ¶
type DriverOptions interface {
// contains filtered or unexported methods
}
type GetKubernetesClusterNodesResponse ¶
type GetKubernetesClusterNodesResponse struct { Response Page PaginationResult `json:"page"` Nodes []KubernetesNodeType `json:"nodes"` }
type GetProjectResponse ¶
type GetProjectResponse Project
type GetProjectsResponse ¶
type GetProjectsResponse []Project
type GetServiceResponse ¶
type GetServiceResponse Service
type GetServicesResponse ¶
type GetServicesResponse []Service
type GetSwarmClusterNodesResponse ¶
type GetSwarmClusterNodesResponse []SwarmNodeType
type GetVolumeResponse ¶
type GetVolumesResponse ¶
type GetVolumesResponse struct {
Volumes []GetVolumeResponse `json:"Volumes"`
}
type KubernetesCreationArgs ¶
type KubernetesNodeType ¶
type KubernetesNodeType struct { InstanceType string `json:"instance_type"` IpAddress []string `json:"ip_address"` InstanceChargeType string `json:"instance_charge_type"` InstanceRole string `json:"instance_role"` CreationTime string `json:"creation_time"` InstanceName string `json:"instance_name"` InstanceTypeFamily string `json:"instance_type_family"` HostName string `json:"host_name"` ImageId string `json:"image_id"` InstanceId string `json:"instance_id"` }
type KubernetesStackArgs ¶
type KubernetesStackArgs struct { VPCID string `json:"VpcId,omitempty"` VSwitchID string `json:"VSwitchId,omitempty"` MasterInstanceType string `json:"MasterInstanceType"` WorkerInstanceType string `json:"WorkerInstanceType"` NumOfNodes int64 `json:"NumOfNodes"` Password string `json:"LoginPassword"` DockerVersion string `json:"DockerVersion"` KubernetesVersion string `json:"KubernetesVersion"` ZoneId string `json:"ZoneId"` ContainerCIDR string `json:"ContainerCIDR"` ServiceCIDR string `json:"ServiceCIDR"` SSHFlags bool `json:"SSHFlags"` MasterSystemDiskSize int64 `json:"MasterSystemDiskSize"` MasterSystemDiskCategory ecs.DiskCategory `json:"MasterSystemDiskCategory"` WorkerSystemDiskSize int64 `json:"WorkerSystemDiskSize"` WorkerSystemDiskCategory ecs.DiskCategory `json:"WorkerSystemDiskCategory"` ImageID string `json:"ImageId,omitempty"` CloudMonitorFlags bool `json:"CloudMonitorFlags"` SNatEntry bool `json:"SNatEntry"` }
type ModifyClusterNameArgs ¶
type ModifyClusterNameArgs struct {
Name string `json:"name"`
}
type NetworkModeType ¶
type NetworkModeType string
type NodeStatus ¶
type PaginationResult ¶
type Project ¶
type Project struct { Name string `json:"name"` Description string `json:"description"` Template string `json:"template"` Version string `json:"version"` Created string `json:"created"` Updated string `json:"updated"` DesiredState string `json:"desired_state"` CurrentState string `json:"current_state"` Environment map[string]string `json:"environment"` Services []Service `json:"services"` }
type ProjectClient ¶
type ProjectClient struct {
// contains filtered or unexported fields
}
func NewProjectClient ¶
func NewProjectClient(clusterId, endpoint string, clusterCerts ClusterCerts) (client *ProjectClient, err error)
func (*ProjectClient) ClusterId ¶
func (client *ProjectClient) ClusterId() string
func (*ProjectClient) ConfirmBlueGreenProject ¶
func (client *ProjectClient) ConfirmBlueGreenProject(name string, force bool) (err error)
func (*ProjectClient) CreateProject ¶
func (client *ProjectClient) CreateProject(args *ProjectCreationArgs) (err error)
func (*ProjectClient) CreateVolume ¶
func (client *ProjectClient) CreateVolume(args *VolumeCreationArgs) (err error)
func (*ProjectClient) DeleteProject ¶
func (client *ProjectClient) DeleteProject(name string, forceDelete, deleteVolume bool) (err error)
func (*ProjectClient) DeleteVolume ¶
func (client *ProjectClient) DeleteVolume(name string) (err error)
func (*ProjectClient) Endpoint ¶
func (client *ProjectClient) Endpoint() string
func (*ProjectClient) GetProject ¶
func (client *ProjectClient) GetProject(name string) (project GetProjectResponse, err error)
func (*ProjectClient) GetProjects ¶
func (client *ProjectClient) GetProjects(q string, services, containers bool) (projects GetProjectsResponse, err error)
func (*ProjectClient) GetService ¶
func (client *ProjectClient) GetService(serviceId string) (service GetServiceResponse, err error)
func (*ProjectClient) GetServices ¶
func (client *ProjectClient) GetServices(q string, containers bool) (services GetServicesResponse, err error)
func (*ProjectClient) GetSwarmClusterNodes ¶
func (client *ProjectClient) GetSwarmClusterNodes() (project GetSwarmClusterNodesResponse, err error)
func (*ProjectClient) GetVolume ¶
func (client *ProjectClient) GetVolume(name string) (volume GetVolumeResponse, err error)
func (*ProjectClient) GetVolumes ¶
func (client *ProjectClient) GetVolumes() (volumes GetVolumesResponse, err error)
func (*ProjectClient) KillProject ¶
func (client *ProjectClient) KillProject(name string, signal ...string) (err error)
func (*ProjectClient) KillService ¶
func (client *ProjectClient) KillService(serviceId string, signal ...string) (err error)
func (*ProjectClient) RollBackBlueGreenProject ¶
func (client *ProjectClient) RollBackBlueGreenProject(name string, force bool) (err error)
func (*ProjectClient) ScaleService ¶
func (client *ProjectClient) ScaleService(args *ScaleServiceArgs) (err error)
func (*ProjectClient) SetDebug ¶
func (client *ProjectClient) SetDebug(debug bool)
SetDebug sets debug mode to log the request/response message
func (*ProjectClient) SetUserAgent ¶
func (client *ProjectClient) SetUserAgent(userAgent string)
SetUserAgent sets user agent to log the request/response message
func (*ProjectClient) StartProject ¶
func (client *ProjectClient) StartProject(name string) (err error)
func (*ProjectClient) StartService ¶
func (client *ProjectClient) StartService(serviceId string) (err error)
func (*ProjectClient) StopProject ¶
func (client *ProjectClient) StopProject(name string, timeout ...time.Duration) (err error)
func (*ProjectClient) StopService ¶
func (client *ProjectClient) StopService(serviceId string, timeout ...time.Duration) (err error)
func (*ProjectClient) UpdateProject ¶
func (client *ProjectClient) UpdateProject(args *ProjectUpdationArgs) (err error)
type ProjectCreationArgs ¶
type ProjectUpdationArgs ¶
type ScaleServiceArgs ¶
type Service ¶
type Service struct { ID string `json:"id"` Name string `json:"name"` Project string `json:"project"` ComposeVersion string `json:"compose_version"` Containers map[string]Container `json:"containers"` Created time.Time `json:"created"` CurrentState string `json:"current_state"` Definition Definition `json:"definition"` DesiredState string `json:"desired_state"` Extensions map[string]interface{} `json:"extensions"` Hash string `json:"hash"` Updated time.Time `json:"updated"` Version string `json:"version"` }
type SwarmNodeType ¶
type VolumeCreationArgs ¶
type VolumeCreationArgs struct { Name string `json:"name"` Driver VolumeDriverType `json:"driver"` DriverOpts DriverOptions `json:"driverOpts"` }
type VolumeCreationResponse ¶
type VolumeDriverType ¶
type VolumeDriverType string
const ( OSSFSDriver VolumeDriverType = "ossfs" NASDriver VolumeDriverType = "nas" )
Click to show internal directories.
Click to hide internal directories.