Google Cloud Storage C++ Client  1.24.0
A C++ Client Library for Google Cloud Storage
upload_options.h
Go to the documentation of this file.
1 // Copyright 2018 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_UPLOAD_OPTIONS_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_UPLOAD_OPTIONS_H
17 
18 #include "google/cloud/storage/internal/complex_option.h"
21 #include <string>
22 
23 namespace google {
24 namespace cloud {
25 namespace storage {
26 inline namespace STORAGE_CLIENT_NS {
38  : public internal::ComplexOption<UseResumableUploadSession, std::string> {
39  using ComplexOption<UseResumableUploadSession, std::string>::ComplexOption;
40  // GCC <= 7.0 does not use the inherited default constructor, redeclare it
41  // explicitly
43 
44  static char const* name() { return "resumable-upload"; }
45 };
46 
49  std::string session_id) {
50  return UseResumableUploadSession(std::move(session_id));
51 }
52 
55  return UseResumableUploadSession("");
56 }
57 
66  : public internal::WellKnownHeader<UploadContentLength, std::uintmax_t> {
67  using internal::WellKnownHeader<UploadContentLength,
68  std::uintmax_t>::WellKnownHeader;
69  static char const* header_name() { return "X-Upload-Content-Length"; }
70 };
71 
76  : public internal::ComplexOption<UploadFromOffset, std::uint64_t> {
77  using ComplexOption::ComplexOption;
78  // GCC <= 7.0 does not use the inherited default constructor, redeclare it
79  // explicitly
80  UploadFromOffset() = default;
81  static char const* name() { return "upload-offset"; }
82 };
83 
88  : public internal::ComplexOption<UploadLimit, std::uint64_t> {
89  using ComplexOption::ComplexOption;
90  // GCC <= 7.0 does not use the inherited default constructor, redeclare it
91  // explicitly
92  UploadLimit() = default;
93  static char const* name() { return "upload-limit"; }
94 };
95 
96 } // namespace STORAGE_CLIENT_NS
97 } // namespace storage
98 } // namespace cloud
99 } // namespace google
100 
101 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_UPLOAD_OPTIONS_H
google::cloud::storage::v1::UploadLimit
The maximum length of the local file to upload to GCS server.
Definition: upload_options.h:88
google::cloud::storage::v1::NewResumableUploadSession
UseResumableUploadSession NewResumableUploadSession()
Create a UseResumableUploadSession option that requests new sessions.
Definition: upload_options.h:54
google::cloud::storage::v1::UseResumableUploadSession::name
static char const * name()
Definition: upload_options.h:44
google::cloud::storage::v1::UploadContentLength
Provide an expected final length of an uploaded object.
Definition: upload_options.h:66
well_known_headers.h
google::cloud::storage::v1::UploadFromOffset::name
static char const * name()
Definition: upload_options.h:81
google::cloud::storage::v1::UploadLimit::name
static char const * name()
Definition: upload_options.h:93
version.h
google::cloud::storage::v1::UseResumableUploadSession::UseResumableUploadSession
UseResumableUploadSession()=default
google::cloud::storage::v1::UseResumableUploadSession
Request a resumable upload, restoring a previous session if necessary.
Definition: upload_options.h:38
google::cloud::storage::v1::UploadLimit::UploadLimit
UploadLimit()=default
google::cloud::storage::v1::UploadFromOffset::UploadFromOffset
UploadFromOffset()=default
google::cloud::storage::v1::UploadContentLength::header_name
static char const * header_name()
Definition: upload_options.h:69
google::cloud::storage::v1::RestoreResumableUploadSession
UseResumableUploadSession RestoreResumableUploadSession(std::string session_id)
Create a UseResumableUploadSession option that restores previous sessions.
Definition: upload_options.h:48
STORAGE_CLIENT_NS
#define STORAGE_CLIENT_NS
Definition: version.h:22
google::cloud::storage::v1::UploadFromOffset
Upload the local file to GCS server starting at the given offset.
Definition: upload_options.h:76
google