Documentation ¶
Index ¶
- Constants
- func InitDefaultClusterService(config ibmcloud.Configuration)
- type Cluster
- type ClusterService
- func (s *ClusterService) CreateNewRequest(requestedBy string, n int, zone string, deleteInHours int, noSubnet bool) (Request, error)
- func (s *ClusterService) CreateUsers(n, startIndex int) ([]User, error)
- func (s *ClusterService) DeleteCluster(id string) error
- func (s *ClusterService) GetCluster(id string) (*Cluster, error)
- func (s *ClusterService) GetClusters(zone string) ([]Cluster, error)
- func (s *ClusterService) GetRequestWithClusters(requestID string) (*RequestWithClusters, error)
- func (s *ClusterService) GetZones() ([]ibmcloud.Location, error)
- func (s *ClusterService) Requests() ([]Request, error)
- func (s *ClusterService) ResumeProvisioningRequests() error
- func (s *ClusterService) StartDeletingExpiredClusters(intervalInSec int)
- func (s *ClusterService) Users() ([]User, error)
- type Request
- type RequestWithClusters
- type User
Constants ¶
const ( StatusDeleted = "deleted" StatusDeleting = "deleting" StatusFailed = "failed" StatusNormal = "normal" StatusReady = "ready" StatusProvisioning = "provisioning" StatusFailedToDelete = "failed to delete" StatusExpired = "expired" StatusFailedToExpire = "failed to expire" )
Variables ¶
This section is empty.
Functions ¶
func InitDefaultClusterService ¶
func InitDefaultClusterService(config ibmcloud.Configuration)
Types ¶
type ClusterService ¶
type ClusterService struct { IbmCloudClient ibmcloud.ICClient Config ibmcloud.Configuration }
ClusterService represents a registry of all cluster resources
var DefaultClusterService *ClusterService
func (*ClusterService) CreateNewRequest ¶
func (s *ClusterService) CreateNewRequest(requestedBy string, n int, zone string, deleteInHours int, noSubnet bool) (Request, error)
CreateNewRequest creates a new request and starts provisioning clusters
func (*ClusterService) CreateUsers ¶
func (s *ClusterService) CreateUsers(n, startIndex int) ([]User, error)
CreateUsers creates n number of users For example if n == 3 and startIndex == 1000 then the following users will be created: rd-dev-1001, rd-dev-1002, rd-dev-1003
func (*ClusterService) DeleteCluster ¶
func (s *ClusterService) DeleteCluster(id string) error
DeleteCluster deletes the cluster with the given ID
func (*ClusterService) GetCluster ¶
func (s *ClusterService) GetCluster(id string) (*Cluster, error)
GetCluster returns the cluster with the given ID
func (*ClusterService) GetClusters ¶
func (s *ClusterService) GetClusters(zone string) ([]Cluster, error)
GetClusters returns an array of the clusters with status not equal to "deleted" for the given zone.
func (*ClusterService) GetRequestWithClusters ¶
func (s *ClusterService) GetRequestWithClusters(requestID string) (*RequestWithClusters, error)
func (*ClusterService) Requests ¶
func (s *ClusterService) Requests() ([]Request, error)
func (*ClusterService) ResumeProvisioningRequests ¶
func (s *ClusterService) ResumeProvisioningRequests() error
ResumeProvisioningRequests load requests that are still provisioning and wait for their clusters to be ready to update the status
func (*ClusterService) StartDeletingExpiredClusters ¶
func (s *ClusterService) StartDeletingExpiredClusters(intervalInSec int)
StartDeletingExpiredClusters starts a goroutine to check expired clusters every n seconds and delete them
func (*ClusterService) Users ¶
func (s *ClusterService) Users() ([]User, error)
type Request ¶
type Request struct { ID string Requested int // Number of clusters requested Created int64 Status string Error string RequestedBy string Zone string DeleteInHours int NoSubnet bool }
Request represents a cluster request
type RequestWithClusters ¶
Request represents a cluster request with detailed information about all request clusters
type User ¶
type User struct { ID string // <iam_object>.user_id & <cloud_direct_object>.username CloudDirectID string // <cloud_direct_object>.id Email string Password string ClusterID string PolicyID string Recycled int64 // last recycle timestamp }
func GetUserByClusterID ¶
getUserByClusterID returns the first found user with the given cluster_id and with the earliest "recycled" timestamp returns an error if no user found