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)
		}
	})
})
	//		template = entity.MicroBOSHTemplateTextV3
	//	}

	//	ok, err := microBOSHTemplate.CreateMicroBOSHYaml(template, microPath)
	ok, err := microBOSHTemplate.CreateMicroBOSHYamlFile(iaasVersion, microPath)
	if !ok {
		this.Data["Message"] = fmt.Sprintf("Error: %s", err)
	} else {
		this.Data["Message"] = fmt.Sprintf("Successful make deployment file: %s", microPath)
	}
}

//write data to const or database
func (this *MicroBoshController) CommitData(microbosh entity.MicroBOSH) {
	mi = microbosh

	mi.Update()

	mi.NetWork.Update()

	mi.CloudProperties.Update()

	mi.Resources.Update()

}

var mi entity.MicroBOSH = entity.NewMicroBOSH("microbosh-openstack",
	entity.NewNetWork("192.168.133.108", "8bb21e6e-dc6a-409c-82d0-a110fb3c9fe1"),
	entity.NewResources("16384", "flavor_71", "zone2"),
	entity.NewCloudProperties("http://192.168.128.2:5000/v2.0", "paas", "paas123", "Project_paas", "test_microbosh", "/home/ubuntu/bosh-workspace/key/test_microbosh.private", "http://192.168.128.5:8080/EBS", "7fd292943f3a46c491fbe4152cf3c8f0", "8e100b9430ab429397352359b16f01b0"))