Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
bucket_autoclass.h
1// Copyright 2022 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// https://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_BUCKET_AUTOCLASS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_AUTOCLASS_H
17
18#include "google/cloud/storage/version.h"
19#include <chrono>
20#include <iosfwd>
21#include <tuple>
22
23namespace google {
24namespace cloud {
25namespace storage {
26GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
27
28/**
29 * The autoclass configuration for a Bucket.
30 *
31 * @par Example
32 *
33 * @snippet storage_bucket_autoclass_samples.cc get-autoclass
34 *
35 * @par Example
36 *
37 * @snippet storage_bucket_autoclass_samples.cc set-autoclass
38 */
39struct BucketAutoclass {
40 explicit BucketAutoclass(bool e) : enabled(e) {}
41 explicit BucketAutoclass(bool e, std::chrono::system_clock::time_point tp)
42 : enabled(e), toggle_time(tp) {}
43
44 bool enabled;
45 std::chrono::system_clock::time_point toggle_time;
46};
47
48inline bool operator==(BucketAutoclass const& lhs, BucketAutoclass const& rhs) {
49 return std::tie(lhs.enabled, lhs.toggle_time) ==
50 std::tie(rhs.enabled, rhs.toggle_time);
51}
52
53inline bool operator!=(BucketAutoclass const& lhs, BucketAutoclass const& rhs) {
54 return !(lhs == rhs);
55}
56
57std::ostream& operator<<(std::ostream& os, BucketAutoclass const& rhs);
58
59GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
60} // namespace storage
61} // namespace cloud
62} // namespace google
63
64#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_AUTOCLASS_H
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
bool operator!=(BucketAutoclass const &lhs, BucketAutoclass const &rhs)
Definition: bucket_autoclass.h:53
bool operator==(BucketAutoclass const &lhs, BucketAutoclass const &rhs)
Definition: bucket_autoclass.h:48
The autoclass configuration for a Bucket.
Definition: bucket_autoclass.h:39
BucketAutoclass(bool e, std::chrono::system_clock::time_point tp)
Definition: bucket_autoclass.h:41
BucketAutoclass(bool e)
Definition: bucket_autoclass.h:40
std::chrono::system_clock::time_point toggle_time
Definition: bucket_autoclass.h:45
bool enabled
Definition: bucket_autoclass.h:44