Пример #1
0
func (this *MicroBoshController) Post() {
	path := workSpace + "/" + "keys" + "/" + this.GetString("default_key_name") + ".private"

	errors := this.SavePrivateKeyFile("private_key", path)

	if errors != nil {
		path = mi.CloudProperties.PrivateKey
	}

	network := entity.NewNetWork(this.GetString("vip"),
		this.GetString("net_id"))

	networkId, _ := this.GetInt64("networkId", 0)
	network.Id = networkId

	resources := entity.NewResources(this.GetString("persistent_disk"),
		this.GetString("instance_type"),
		this.GetString("availability_zone"))
	resourcesId, _ := this.GetInt64("resourcesId", 0)
	resources.Id = resourcesId
	cloudproperties := entity.NewCloudProperties(this.GetString("auth_url"),
		this.GetString("username"),
		this.GetString("api_key"),
		this.GetString("tenant"),
		this.GetString("default_key_name"),
		path,
		this.GetString("cci_ebs_url"),
		this.GetString("cci_ebs_accesskey"),
		this.GetString("cci_ebs_secretkey"))
	cloudPropertiesId, _ := this.GetInt64("cloudPropertiesId", 0)
	cloudproperties.Id = cloudPropertiesId
	microbosh := entity.NewMicroBOSH(this.GetString("name"),
		network,
		resources,
		cloudproperties)
	microboshId, _ := this.GetInt64("id", 0)
	microbosh.Id = microboshId
	this.CommitData(microbosh)
	this.Get()
}
package entity_test

import (
	"github.com/citycloud/citycloud.cf-deploy-ui/entity"
	. "github.com/onsi/ginkgo"
)

var _ = Describe("Testing with Ginkgo", func() {
	It("microbosh template", func() {

		var test = entity.NewMicroBOSH("deployment-microbosh",
			entity.NewNetWork("vip", "netid"),
			entity.NewResources("16384", "flavor_100", "zone2"),
			entity.NewCloudProperties("auth_url", "username", "apikey", "tenant", "defaultkeyname", "privatekey", "ebsurl", "ebskey", "ebssercetkey"))

		var mt = entity.NewMicroBOSHTemplate(test)
		_, err := mt.CreateMicroBOSHYaml(entity.MicroBOSHTemplateTextV2, "/home/ubuntu/temp/microbosh.yml")

		if err != nil {
			GinkgoT().Error(err)
		}
	})
})