MCPcopy Index your code
hub / github.com/peak/s5cmd / validatePresignCommand

Function validatePresignCommand

command/presign.go:107–134  ·  view source on GitHub ↗
(c *cli.Context)

Source from the content-addressed store, hash-verified

105}
106
107func validatePresignCommand(c *cli.Context) error {
108 if c.Args().Len() != 1 {
109 return fmt.Errorf("expected remote object url")
110 }
111
112 src, err := url.New(c.Args().Get(0), url.WithVersion(c.String("version-id")))
113 if err != nil {
114 return err
115 }
116
117 if !src.IsRemote() {
118 return fmt.Errorf("source must be a remote object")
119 }
120
121 if src.IsBucket() || src.IsPrefix() {
122 return fmt.Errorf("remote source must be an object")
123 }
124
125 if src.IsWildcard() {
126 return fmt.Errorf("remote source %q can not contain glob characters", src)
127 }
128
129 if err := checkVersioningWithGoogleEndpoint(c); err != nil {
130 return err
131 }
132
133 return nil
134}

Callers 1

NewPresignCommandFunction · 0.85

Calls 9

NewFunction · 0.92
WithVersionFunction · 0.92
IsRemoteMethod · 0.80
IsBucketMethod · 0.80
IsPrefixMethod · 0.80
IsWildcardMethod · 0.80
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected