Esempio n. 1
0
func (command *commandCreate) Execute(resource *handler.Resource) {
	opts := resource.Params.(*paramsCreate).opts
	volume, err := osVolumes.Create(command.Ctx.ServiceClient, opts).Extract()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = volumeSingle(volume)
}
Esempio n. 2
0
func (command *commandCreate) Execute(resource *handler.Resource) {
	opts := resource.Params.(*paramsCreate).opts
	volume, err := osVolumes.Create(command.Ctx.ServiceClient, opts).Extract()
	if err != nil {
		resource.Err = err
		return
	}

	if resource.Params.(*paramsCreate).wait {
		err = osVolumes.WaitForStatus(command.Ctx.ServiceClient, volume.ID, "available", 600)
		if err != nil {
			resource.Err = err
			return
		}

		volume, err = osVolumes.Get(command.Ctx.ServiceClient, volume.ID).Extract()
		if err != nil {
			resource.Err = err
			return
		}
	}

	resource.Result = volumeSingle(volume)
}