go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/blogctl/pkg/aws/s3/file.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package s3
     9  
    10  // File is info for a file upload.
    11  type File struct {
    12  	ETag                 string
    13  	Contents             []byte
    14  	ACL                  string
    15  	FilePath             string
    16  	Bucket               string
    17  	Key                  string
    18  	ContentType          string
    19  	ContentDisposition   string
    20  	ServerSideEncryption string
    21  }
    22  
    23  // IsZero returns if the file is set or not.
    24  func (f File) IsZero() bool {
    25  	return len(f.Key) == 0
    26  }
    27  
    28  // ACLOrDefault returns the file ACL or a default.
    29  func (f File) ACLOrDefault() string {
    30  	if f.ACL != "" {
    31  		return f.ACL
    32  	}
    33  	return ACLPrivate
    34  }