Google Cloud BigQuery C++ Client  2.1.0
A C++ Client Library for Google Cloud BigQuery
model_connection.h
Go to the documentation of this file.
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 // Generated by the Codegen C++ plugin.
16 // If you make any local changes, they will be lost.
17 // source: google/cloud/bigquery/v2/model.proto
18 
19 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_MODEL_CONNECTION_H
20 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_MODEL_CONNECTION_H
21 
22 #include "google/cloud/bigquery/internal/model_retry_traits.h"
23 #include "google/cloud/bigquery/internal/model_stub.h"
24 #include "google/cloud/bigquery/model_connection_idempotency_policy.h"
25 #include "google/cloud/backoff_policy.h"
26 #include "google/cloud/options.h"
27 #include "google/cloud/status_or.h"
28 #include "google/cloud/version.h"
29 #include <memory>
30 
31 namespace google {
32 namespace cloud {
33 namespace bigquery {
35 
36 using ModelServiceRetryPolicy =
37  ::google::cloud::internal::TraitBasedRetryPolicy<
38  bigquery_internal::ModelServiceRetryTraits>;
39 
40 using ModelServiceLimitedTimeRetryPolicy =
41  ::google::cloud::internal::LimitedTimeRetryPolicy<
42  bigquery_internal::ModelServiceRetryTraits>;
43 
44 using ModelServiceLimitedErrorCountRetryPolicy =
45  ::google::cloud::internal::LimitedErrorCountRetryPolicy<
46  bigquery_internal::ModelServiceRetryTraits>;
47 
48 /**
49  * The `ModelServiceConnection` object for `ModelServiceClient`.
50  *
51  * This interface defines virtual methods for each of the user-facing overload
52  * sets in `ModelServiceClient`. This allows users to inject custom behavior
53  * (e.g., with a Google Mock object) when writing tests that use objects of type
54  * `ModelServiceClient`.
55  *
56  * To create a concrete instance, see `MakeModelServiceConnection()`.
57  *
58  * For mocking, see `bigquery_mocks::MockModelServiceConnection`.
59  */
61  public:
62  virtual ~ModelServiceConnection() = 0;
63 
64  virtual Options options() { return Options{}; }
65 
66  virtual StatusOr<google::cloud::bigquery::v2::Model> GetModel(
67  google::cloud::bigquery::v2::GetModelRequest const& request);
68 
69  virtual StatusOr<google::cloud::bigquery::v2::ListModelsResponse> ListModels(
70  google::cloud::bigquery::v2::ListModelsRequest const& request);
71 
72  virtual StatusOr<google::cloud::bigquery::v2::Model> PatchModel(
73  google::cloud::bigquery::v2::PatchModelRequest const& request);
74 
76  google::cloud::bigquery::v2::DeleteModelRequest const& request);
77 };
78 
79 /**
80  * A factory function to construct an object of type `ModelServiceConnection`.
81  *
82  * The returned connection object should not be used directly; instead it
83  * should be passed as an argument to the constructor of ModelServiceClient,
84  * and that class used instead.
85  *
86  * The optional @p opts argument may be used to configure aspects of the
87  * returned `ModelServiceConnection`. Expected options are any of the types in
88  * the following option lists:
89  *
90  * - `google::cloud::CommonOptionList`
91  * - `google::cloud::GrpcOptionList`
92  * - `google::cloud::bigquery::ModelServicePolicyOptionList`
93  *
94  * @note Unrecognized options will be ignored. To debug issues with options set
95  * `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment and unexpected
96  * options will be logged.
97  *
98  * @param options (optional) Configure the `ModelServiceConnection` created by
99  * this function.
100  */
102  Options options = {});
103 
105 } // namespace bigquery
106 } // namespace cloud
107 } // namespace google
108 
109 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_MODEL_CONNECTION_H