|
| 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_REST_OPTIONS_H |
| 16 | +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_REST_OPTIONS_H |
| 17 | + |
| 18 | +#include "google/cloud/options.h" |
| 19 | +#include "google/cloud/version.h" |
| 20 | +#include <chrono> |
| 21 | +#include <cstdint> |
| 22 | +#include <memory> |
| 23 | +#include <string> |
| 24 | + |
| 25 | +namespace google { |
| 26 | +namespace cloud { |
| 27 | +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN |
| 28 | + |
| 29 | +/** |
| 30 | + * Configure the QuotaUser system parameter. |
| 31 | + * |
| 32 | + * A pseudo user identifier for charging per-user quotas. If not specified, the |
| 33 | + * authenticated principal is used. If there is no authenticated principal, the |
| 34 | + * client IP address will be used. When specified, a valid API key with service |
| 35 | + * restrictions must be used to identify the quota project. Otherwise, this |
| 36 | + * parameter is ignored. |
| 37 | + */ |
| 38 | +struct QuotaUser { |
| 39 | + using Type = std::string; |
| 40 | +}; |
| 41 | + |
| 42 | +/** |
| 43 | + * Configure the UserIp query parameter. |
| 44 | + * |
| 45 | + * This can be used to separate quota usage by source IP address. |
| 46 | + * |
| 47 | + * @deprecated prefer using `google::cloud::QuotaUser`. |
| 48 | + */ |
| 49 | +struct UserIpOption { |
| 50 | + using Type = std::string; |
| 51 | +}; |
| 52 | + |
| 53 | +/** |
| 54 | + * Timeout (in seconds) for the server to finish processing the request. This |
| 55 | + * system param only applies to REST APIs for which client-side timeout is not |
| 56 | + * applicable. |
| 57 | + */ |
| 58 | +struct ServerTimeout { |
| 59 | + using Type = float; |
| 60 | +}; |
| 61 | + |
| 62 | +/// The complete list of options accepted by `CurlRestClient` |
| 63 | +using RestOptionList = |
| 64 | + ::google::cloud::OptionList<QuotaUser, ServerTimeout, UserIpOption>; |
| 65 | + |
| 66 | +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END |
| 67 | +} // namespace cloud |
| 68 | +} // namespace google |
| 69 | + |
| 70 | +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_REST_OPTIONS_H |
0 commit comments