MCPcopy
hub / github.com/cortexlabs/cortex / IsS3File

Method IsS3File

pkg/lib/aws/s3.go:251–268  ·  view source on GitHub ↗
(bucket string, fileKey string, fileKeys ...string)

Source from the content-addressed store, hash-verified

249}
250
251func (c *Client) IsS3File(bucket string, fileKey string, fileKeys ...string) (bool, error) {
252 allFileKeys := append(fileKeys, fileKey)
253 for _, key := range allFileKeys {
254 _, err := c.S3().HeadObject(&s3.HeadObjectInput{
255 Bucket: aws.String(bucket),
256 Key: aws.String(key),
257 })
258
259 if IsNotFoundErr(err) {
260 return false, nil
261 }
262 if err != nil {
263 return false, errors.Wrap(err, S3Path(bucket, key))
264 }
265 }
266
267 return true, nil
268}
269
270func (c *Client) IsS3PathPrefix(s3Path string, s3Paths ...string) (bool, error) {
271 allS3Paths := append(s3Paths, s3Path)

Callers 1

IsS3PathFileMethod · 0.95

Calls 5

S3Method · 0.95
WrapFunction · 0.92
IsNotFoundErrFunction · 0.85
S3PathFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected