(imageName, commercialType, arch string)
| 93 | } |
| 94 | |
| 95 | func (s *ScalewayClient) getImageID(imageName, commercialType, arch string) (string, error) { |
| 96 | imagesResp, err := s.marketplaceAPI.ListImages(&marketplace.ListImagesRequest{}) |
| 97 | if err != nil { |
| 98 | return "", err |
| 99 | } |
| 100 | for _, image := range imagesResp.Images { |
| 101 | if image.Name == imageName { |
| 102 | for _, version := range image.Versions { |
| 103 | for _, localImage := range version.LocalImages { |
| 104 | if localImage.Arch == arch && localImage.Zone == s.zone { |
| 105 | for _, compatibleCommercialType := range localImage.CompatibleCommercialTypes { |
| 106 | if compatibleCommercialType == commercialType { |
| 107 | return localImage.ID, nil |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | return "", errors.New("no image matching given requests") |
| 116 | } |
| 117 | |
| 118 | // CreateInstance create an instance with one additional volume |
| 119 | func (s *ScalewayClient) CreateInstance(volumeSize int) (string, error) { |
no outgoing calls
no test coverage detected