예제 #1
0
파일: create.go 프로젝트: nelsnelson/rack
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)
}
예제 #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)
}