(c *cli.Context)
| 172 | } |
| 173 | |
| 174 | func validateHeadCommand(c *cli.Context) error { |
| 175 | if c.Args().Len() > 1 { |
| 176 | return fmt.Errorf("object or bucket name is required") |
| 177 | } |
| 178 | |
| 179 | srcurl, err := url.New(c.Args().Get(0), url.WithVersion(c.String("version-id")), |
| 180 | url.WithRaw(c.Bool("raw"))) |
| 181 | if err != nil { |
| 182 | return err |
| 183 | } |
| 184 | |
| 185 | if srcurl.IsPrefix() { |
| 186 | return fmt.Errorf("target have to be a object or a bucket") |
| 187 | } |
| 188 | |
| 189 | if !srcurl.IsRemote() { |
| 190 | return fmt.Errorf("target should be remote object or bucket") |
| 191 | } |
| 192 | |
| 193 | if srcurl.IsWildcard() && !srcurl.IsRaw() { |
| 194 | return fmt.Errorf("remote source %q can not contain glob characters", srcurl) |
| 195 | } |
| 196 | |
| 197 | if err := checkVersinoningURLRemote(srcurl); err != nil { |
| 198 | return err |
| 199 | } |
| 200 | |
| 201 | if err := checkVersioningWithGoogleEndpoint(c); err != nil { |
| 202 | return err |
| 203 | } |
| 204 | |
| 205 | return nil |
| 206 | } |
no test coverage detected