blob: 11c51a0f72422a57925158d4917d46f3f49ecc0e [file] [log] [blame]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package types
import (
"archive/tar"
)
// Upload is a struct that contains source and destination paths to files to
// upload to GCS.
type Upload struct {
// Source is the path to the local file to upload.
Source string `json:"source"`
// Contents contains the contents to upload to Destination. This field
// will only be used if Source is empty.
Contents []byte `json:"contents"`
// Destination is the path to upload to relative to a GCS bucket and
// namespace.
Destination string `json:"destination"`
// Compress is a directive to gzip the object before uploading.
Compress bool `json:"compress"`
// Deduplicate gives a collision strategy. If true, then an upload should
// not fail in the event of a collision, allowing for deduplication of, for
// example, content-addressed uploads.
//
// If false, use the namespace provided via the command line. When not
// deduplicating, it is an error for the caller to use the same destination
// more than once.
Deduplicate bool `json:"deduplicate"`
// Recursive determines whether to recursively upload all files in Source if
// Source is a directory.
Recursive bool `json:"recursive"`
// Signed determines whether the object should be signed, provided that a
// private key is provided.
Signed bool `json:"signed"`
// Metadata contains the metadata to be uploaded with the file.
Metadata map[string]string
// TarHeader tells whether or not to compress with tar and contains the
// associated header.
TarHeader *tar.Header `json:"tar_header"`
}