Exemple #1
0
func (command *commandGet) Execute(resource *handler.Resource) {
	imageID := resource.Params.(*paramsGet).image
	image, err := images.Get(command.Ctx.ServiceClient, imageID).Extract()
	if err != nil {
		resource.Err = err
		return
	}
	resource.Result = structs.Map(image)
}
Exemple #2
0
func TestGetImage(t *testing.T) {
	client, err := newClient()
	th.AssertNoErr(t, err)

	options, err := optionsFromEnv()
	th.AssertNoErr(t, err)

	image, err := images.Get(client, options.imageID).Extract()
	th.AssertNoErr(t, err)

	t.Logf("Requested image:")
	t.Logf("       id=[%s]", image.ID)
	t.Logf("     name=[%s]", image.Name)
	t.Logf("  created=[%s]", image.Created)
	t.Logf("  updated=[%s]", image.Updated)
	t.Logf(" min disk=[%d]", image.MinDisk)
	t.Logf("  min RAM=[%d]", image.MinRAM)
	t.Logf(" progress=[%d]", image.Progress)
	t.Logf("   status=[%s]", image.Status)
}