示例#1
0
// StartCluster starts a cluster by its ID
func (cl *ClusterService) StartCluster(clusterVector *map[string]string, ID string) (err error) {
	log.Debug("StartCluster")

	data, status, err := cl.concertoService.Put(fmt.Sprintf("/v1/kaas/fleets/%s/start", ID), clusterVector)
	if err != nil {
		return err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return err
	}

	return nil
}
示例#2
0
// StartNode starts a node by its ID
func (cl *NodeService) StartNode(nodeVector *map[string]string, ID string) (err error) {
	log.Debug("StartNode")

	data, status, err := cl.concertoService.Put(fmt.Sprintf("/v1/kaas/ships/%s/start", ID), nodeVector)
	if err != nil {
		return err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return err
	}

	return nil
}
示例#3
0
// DeleteCluster deletes a cluster by its ID
func (cl *ClusterService) DeleteCluster(ID string) (err error) {
	log.Debug("DeleteCluster")

	data, status, err := cl.concertoService.Delete(fmt.Sprintf("/v1/kaas/fleets/%s", ID))
	if err != nil {
		return err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return err
	}

	return nil
}
示例#4
0
// DeleteDomainRecord deletes a domain record
func (dm *DomainService) DeleteDomainRecord(DOM_ID string, ID string) (err error) {
	log.Debug("DeleteDomainRecord")

	data, status, err := dm.concertoService.Delete(fmt.Sprintf("/v1/dns/domains/%s/records/%s", DOM_ID, ID))
	if err != nil {
		return err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return err
	}

	return nil
}
示例#5
0
// CreateCluster creates a cluster
func (cl *ClusterService) CreateCluster(clusterVector *map[string]string) (cluster *Cluster, err error) {
	log.Debug("CreateCluster")

	data, status, err := cl.concertoService.Post("/v1/kaas/fleets", clusterVector)
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return nil, err
	}

	if err = json.Unmarshal(data, &cluster); err != nil {
		return nil, err
	}

	return cluster, nil
}
示例#6
0
// GetClusterList returns the list of clusters as an array of Cluster
func (cl *ClusterService) GetClusterList() (clusters []Cluster, err error) {
	log.Debug("GetClusterList")

	data, status, err := cl.concertoService.Get("/v1/kaas/fleets")
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {

	}

	if err = json.Unmarshal(data, &clusters); err != nil {
		return nil, err
	}

	return clusters, nil
}
示例#7
0
// CreateDomain creates a domain
func (dm *DomainService) CreateDomain(domainVector *map[string]string) (domain *Domain, err error) {
	log.Debug("CreateDomain")

	data, status, err := dm.concertoService.Post("/v1/dns/domains/", domainVector)
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return nil, err
	}

	if err = json.Unmarshal(data, &domain); err != nil {
		return nil, err
	}

	return domain, nil
}
示例#8
0
// GetDomain returns a domain by its ID
func (dm *DomainService) GetDomain(ID string) (domain *Domain, err error) {
	log.Debug("GetDomain")

	data, status, err := dm.concertoService.Get(fmt.Sprintf("/v1/dns/domains/%s", ID))
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return nil, err
	}

	if err = json.Unmarshal(data, &domain); err != nil {
		return nil, err
	}

	return domain, nil
}
示例#9
0
// GetDomainList returns the list of domains as an array of Domain
func (dm *DomainService) GetDomainList() (domains []Domain, err error) {
	log.Debug("GetDomainList")

	data, status, err := dm.concertoService.Get("/v1/dns/domains")
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {

	}

	if err = json.Unmarshal(data, &domains); err != nil {
		return nil, err
	}

	return domains, nil
}
示例#10
0
// UpdateDomainRecord returns a list of domainRecord
func (dm *DomainService) UpdateDomainRecord(domainRecordVector *map[string]string, DOM_ID string, ID string) (domainRecord *DomainRecord, err error) {
	log.Debug("UpdateDomainRecord")

	data, status, err := dm.concertoService.Put(fmt.Sprintf("/v1/dns/domains/%s/records/%s", DOM_ID, ID), domainRecordVector)
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return nil, err
	}

	if err = json.Unmarshal(data, &domainRecord); err != nil {
		return nil, err
	}

	return domainRecord, nil
}
示例#11
0
// ListDomainRecords returns a list of domainRecord
func (dm *DomainService) ListDomainRecords(ID string) (domainRecord *[]DomainRecord, err error) {
	log.Debug("ListDomainRecords")

	data, status, err := dm.concertoService.Get(fmt.Sprintf("/v1/dns/domains/%s/records", ID))
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return nil, err
	}

	if err = json.Unmarshal(data, &domainRecord); err != nil {
		return nil, err
	}

	return domainRecord, nil
}
示例#12
0
// CreateNode creates a node
func (cl *NodeService) CreateNode(nodeVector *map[string]string) (node *Node, err error) {
	log.Debug("CreateNode")

	data, status, err := cl.concertoService.Post("/v1/kaas/ships", nodeVector)
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {
		return nil, err
	}

	if err = json.Unmarshal(data, &node); err != nil {
		return nil, err
	}

	return node, nil
}
示例#13
0
// GetNodeList returns the list of nodes as an array of Node
func (cl *NodeService) GetNodeList() (nodes []Node, err error) {
	log.Debug("GetNodeList")

	data, status, err := cl.concertoService.Get("/v1/kaas/ships")
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {

	}

	if err = json.Unmarshal(data, &nodes); err != nil {
		return nil, err
	}

	return nodes, nil
}
示例#14
0
// GetSysEventList returns the list of events as an array of Event
func (cl *EventService) GetSysEventList() (events []Event, err error) {
	log.Debug("GetEventList")

	data, status, err := cl.concertoService.Get("/v1/audit/system_events")
	if err != nil {
		return nil, err
	}

	if err = utils.CheckStandardStatus(status, data); err != nil {

	}

	if err = json.Unmarshal(data, &events); err != nil {
		return nil, err
	}

	return events, nil
}