go.fuchsia.dev/infra@v0.0.0-20240507153436-9b593402251b/cmd/gcs-util/types/types.go (about)

     1  // Copyright 2022 The Fuchsia Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license that can be
     3  // found in the LICENSE file.
     4  
     5  package types
     6  
     7  import (
     8  	"archive/tar"
     9  )
    10  
    11  // Upload is a struct that contains source and destination paths to files to
    12  // upload to GCS.
    13  type Upload struct {
    14  	// Source is the path to the local file to upload.
    15  	Source string `json:"source"`
    16  
    17  	// Contents contains the contents to upload to Destination. This field
    18  	// will only be used if Source is empty.
    19  	Contents []byte `json:"contents"`
    20  
    21  	// Destination is the path to upload to relative to a GCS bucket and
    22  	// namespace.
    23  	Destination string `json:"destination"`
    24  
    25  	// Compress is a directive to gzip the object before uploading.
    26  	Compress bool `json:"compress"`
    27  
    28  	// Deduplicate gives a collision strategy. If true, then an upload should
    29  	// not fail in the event of a collision, allowing for deduplication of, for
    30  	// example, content-addressed uploads.
    31  	//
    32  	// If false, use the namespace provided via the command line. When not
    33  	// deduplicating, it is an error for the caller to use the same destination
    34  	// more than once.
    35  	Deduplicate bool `json:"deduplicate"`
    36  
    37  	// Recursive determines whether to recursively upload all files in Source if
    38  	// Source is a directory.
    39  	Recursive bool `json:"recursive"`
    40  
    41  	// Signed determines whether the object should be signed, provided that a
    42  	// private key is provided.
    43  	Signed bool `json:"signed"`
    44  
    45  	// Metadata contains the metadata to be uploaded with the file.
    46  	Metadata map[string]string
    47  
    48  	// TarHeader tells whether or not to compress with tar and contains the
    49  	// associated header.
    50  	TarHeader *tar.Header `json:"tar_header"`
    51  }