(ctx context.Context, r io.Reader, resource *pb.CASResource)
| 153 | } |
| 154 | |
| 155 | func (b *Backend) Upload(ctx context.Context, r io.Reader, resource *pb.CASResource) error { |
| 156 | uploader := manager.NewUploader(b.client) |
| 157 | input := &s3.PutObjectInput{ |
| 158 | Bucket: aws.String(b.bucket), |
| 159 | Key: aws.String(resourceName(resource.Digest)), |
| 160 | Body: r, |
| 161 | Metadata: map[string]string{ |
| 162 | annotationNameAuthor: backend.AuthorAnnotation, |
| 163 | annotationNameFilename: resource.FileName, |
| 164 | }, |
| 165 | } |
| 166 | |
| 167 | // if b.checksumVerificationEnabled() { |
| 168 | // // Check that the object is uploaded correctly |
| 169 | // input.ChecksumSHA256 = aws.String(hexSha256ToBinaryB64(resource.Digest)) |
| 170 | // } |
| 171 | |
| 172 | if _, err := uploader.Upload(ctx, input); err != nil { |
| 173 | return fmt.Errorf("failed to upload to bucket: %w", err) |
| 174 | } |
| 175 | |
| 176 | return nil |
| 177 | } |
| 178 | |
| 179 | func (b *Backend) Describe(ctx context.Context, digest string) (*pb.CASResource, error) { |
| 180 | input := &s3.HeadObjectInput{ |
nothing calls this directly
no test coverage detected