forked from googleapis/google-cloud-cpp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstance_admin.h
More file actions
1427 lines (1366 loc) · 58.8 KB
/
instance_admin.h
File metadata and controls
1427 lines (1366 loc) · 58.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INSTANCE_ADMIN_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INSTANCE_ADMIN_H
#include "google/cloud/bigtable/app_profile_config.h"
#include "google/cloud/bigtable/cluster_config.h"
#include "google/cloud/bigtable/cluster_list_responses.h"
#include "google/cloud/bigtable/completion_queue.h"
#include "google/cloud/bigtable/iam_policy.h"
#include "google/cloud/bigtable/instance_admin_client.h"
#include "google/cloud/bigtable/instance_config.h"
#include "google/cloud/bigtable/instance_list_responses.h"
#include "google/cloud/bigtable/instance_update_config.h"
#include "google/cloud/bigtable/polling_policy.h"
#include "google/cloud/bigtable/resource_names.h"
#include "google/cloud/bigtable/version.h"
#include "google/cloud/future.h"
#include "google/cloud/iam_policy.h"
#include "google/cloud/status_or.h"
#include <future>
#include <memory>
namespace google {
namespace cloud {
namespace bigtable {
inline namespace BIGTABLE_CLIENT_NS {
/**
* Implements the APIs to administer Cloud Bigtable instances.
*
* @par Thread-safety
* Instances of this class created via copy-construction or copy-assignment
* share the underlying pool of connections. Access to these copies via multiple
* threads is guaranteed to work. Two threads operating concurrently on the same
* instance of this class is not guaranteed to work.
*
* @par Cost
* Creating a new object of type `InstanceAdmin` is comparable to creating a few
* objects of type `std::string` or a few objects of type
* `std::shared_ptr<int>`. The class represents a shallow handle to a remote
* object.
*
* @par Error Handling
* This class uses `StatusOr<T>` to report errors. When an operation fails to
* perform its work the returned `StatusOr<T>` contains the error details. If
* the `ok()` member function in the `StatusOr<T>` returns `true` then it
* contains the expected result. Operations that do not return a value simply
* return a `google::cloud::Status` indicating success or the details of the
* error Please consult the
* [`StatusOr<T>` documentation](#google::cloud::v1::StatusOr) for more details.
*
* @code
* namespace cbt = google::cloud::bigtable;
* namespace btadmin = google::bigtable::admin::v2;
* cbt::TableAdmin admin = ...;
* google::cloud::StatusOr<btadmin::Table> metadata = admin.GetTable(...);
*
* if (!metadata) {
* std::cerr << "Error fetching table metadata\n";
* return;
* }
*
* // Use "metadata" as a smart pointer here, e.g.:
* std::cout << "The full table name is " << table->name() << " the table has "
* << table->column_families_size() << " column families\n";
* @endcode
*
* In addition, the @ref index "main page" contains examples using `StatusOr<T>`
* to handle errors.
*
* @par Retry, Backoff, and Idempotency Policies
* The library automatically retries requests that fail with transient errors,
* and uses [truncated exponential backoff][backoff-link] to backoff between
* retries. The default policies are to continue retrying for up to 10 minutes.
* On each transient failure the backoff period is doubled, starting with an
* initial backoff of 100 milliseconds. The backoff period growth is truncated
* at 60 seconds. The default idempotency policy is to only retry idempotent
* operations. Note that most operations that change state are **not**
* idempotent.
*
* The application can override these policies when constructing objects of this
* class. The documentation for the constructors show examples of this in
* action.
*
* [backoff-link]: https://cloud.google.com/storage/docs/exponential-backoff
*
* @see https://cloud.google.com/bigtable/ for an overview of Cloud Bigtable.
*
* @see https://cloud.google.com/bigtable/docs/overview for an overview of the
* Cloud Bigtable data model.
*
* @see https://cloud.google.com/bigtable/docs/instances-clusters-nodes for an
* introduction of the main APIs into Cloud Bigtable.
*
* @see https://cloud.google.com/bigtable/docs/reference/service-apis-overview
* for an overview of the underlying Cloud Bigtable API.
*
* @see #google::cloud::v1::StatusOr for a description of the error reporting
* class used by this library.
*
* @see `LimitedTimeRetryPolicy` and `LimitedErrorCountRetryPolicy` for
* alternative retry policies.
*
* @see `ExponentialBackoffPolicy` to configure different parameters for the
* exponential backoff policy.
*
* @see `SafeIdempotentMutationPolicy` and `AlwaysRetryMutationPolicy` for
* alternative idempotency policies.
*/
class InstanceAdmin {
public:
/**
* @param client the interface to create grpc stubs, report errors, etc.
*/
explicit InstanceAdmin(std::shared_ptr<InstanceAdminClient> client)
: client_(std::move(client)),
project_name_("projects/" + project_id()),
rpc_retry_policy_prototype_(
DefaultRPCRetryPolicy(internal::kBigtableInstanceAdminLimits)),
rpc_backoff_policy_prototype_(
DefaultRPCBackoffPolicy(internal::kBigtableInstanceAdminLimits)),
polling_policy_prototype_(
DefaultPollingPolicy(internal::kBigtableInstanceAdminLimits)) {}
/**
* Create a new InstanceAdmin using explicit policies to handle RPC errors.
*
* @param client the interface to create grpc stubs, report errors, etc.
* @param policies the set of policy overrides for this object.
* @tparam Policies the types of the policies to override, the types must
* derive from one of the following types:
* - `RPCBackoffPolicy` how to backoff from a failed RPC. Currently only
* `ExponentialBackoffPolicy` is implemented. You can also create your
* own policies that backoff using a different algorithm.
* - `RPCRetryPolicy` for how long to retry failed RPCs. Use
* `LimitedErrorCountRetryPolicy` to limit the number of failures
* allowed. Use `LimitedTimeRetryPolicy` to bound the time for any
* request. You can also create your own policies that combine time and
* error counts.
* - `PollingPolicy` for how long will the class wait for
* `google.longrunning.Operation` to complete. This class combines both
* the backoff policy for checking long running operations and the
* retry policy.
*
* @see GenericPollingPolicy, ExponentialBackoffPolicy,
* LimitedErrorCountRetryPolicy, LimitedTimeRetryPolicy.
*/
template <typename... Policies>
// NOLINTNEXTLINE(performance-unnecessary-value-param) TODO(#4112)
explicit InstanceAdmin(std::shared_ptr<InstanceAdminClient> client,
Policies&&... policies)
: InstanceAdmin(std::move(client)) {
ChangePolicies(std::forward<Policies>(policies)...);
}
/// The full name (`projects/<project_id>`) of the project.
std::string const& project_name() const { return project_name_; }
/// The project id, i.e., `project_name()` without the `projects/` prefix.
std::string const& project_id() const { return client_->project(); }
/// Return the fully qualified name of the given instance_id.
std::string InstanceName(std::string const& instance_id) const {
return google::cloud::bigtable::InstanceName(project_id(), instance_id);
}
/// Return the fully qualified name of the given cluster_id in give
/// instance_id.
std::string ClusterName(std::string const& instance_id,
std::string const& cluster_id) const {
return google::cloud::bigtable::ClusterName(project_id(), instance_id,
cluster_id);
}
std::string AppProfileName(std::string const& instance_id,
std::string const& profile_id) const {
return google::cloud::bigtable::AppProfileName(project_id(), instance_id,
profile_id);
}
/**
* Create a new instance of Cloud Bigtable.
*
* @warning Note that this is operation can take seconds or minutes to
* complete. The application may prefer to perform other work while waiting
* for this operation.
*
* @param instance_config a description of the new instance to be created.
* instance_id and a display_name parameters must be set in instance_config,
* - instance_id : must be between 6 and 33 characters.
* - display_name : must be between 4 and 30 characters.
* @return a future that becomes satisfied when (a) the operation has
* completed successfully, in which case it returns a proto with the
* Instance details, (b) the operation has failed, in which case the future
* contains an `google::cloud::Status` with the details of the failure, or
* (c) the state of the operation is unknown after the time allocated by the
* retry policies has expired, in which case the future contains the last
* error status.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc create instance
*/
future<StatusOr<google::bigtable::admin::v2::Instance>> CreateInstance(
InstanceConfig instance_config);
/**
* Create an instance (asynchronously).
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param instance_config the desired configuration of the instance.
*
* @return a future satisfied when either (a) the cluster is created or (b)
* a permanent error occurs or (c) polling or retry policy has been
* exhausted.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async create instance
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::Instance>> AsyncCreateInstance(
CompletionQueue& cq, bigtable::InstanceConfig instance_config);
/**
* Create a new Cluster of Cloud Bigtable.
*
* @param cluster_config a description of the new cluster to be created.
* @param instance_id the id of the instance in the project
* @param cluster_id the id of the cluster in the project that needs to be
* created. It must be between 6 and 30 characters.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc create cluster
*/
future<StatusOr<google::bigtable::admin::v2::Cluster>> CreateCluster(
ClusterConfig cluster_config, std::string const& instance_id,
std::string const& cluster_id);
/**
* Create a new cluster (asynchronously).
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param cluster_config a description of the new cluster to be created.
* @param instance_id the id of the instance in the project
* @param cluster_id the id of the cluster in the project that needs to be
* created. It must be between 6 and 30 characters.
*
* @return a future satisfied when either (a) the cluster is created or (b)
* a permanent error occurs or (c) polling or retry policy has been
* exhausted.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async create cluster
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::Cluster>> AsyncCreateCluster(
CompletionQueue& cq, ClusterConfig cluster_config,
std::string const& instance_id, std::string const& cluster_id);
/**
* Update an existing instance of Cloud Bigtable.
*
* @warning Note that this is operation can take seconds or minutes to
* complete. The application may prefer to perform other work while waiting
* for this operation.
*
* @param instance_update_config config with modified instance.
* @return a future that becomes satisfied when (a) the operation has
* completed successfully, in which case it returns a proto with the
* Instance details, (b) the operation has failed, in which case the future
* contains an exception (typically `bigtable::GrpcError`) with the details
* of the failure, or (c) the state of the operation is unknown after the
* time allocated by the retry policies has expired, in which case the
* future contains an exception of type `bigtable::PollTimeout`.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc update instance
*/
future<StatusOr<google::bigtable::admin::v2::Instance>> UpdateInstance(
InstanceUpdateConfig instance_update_config);
/**
* Update an existing instance (asynchronously).
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param instance_update_config config with modified instance.
*
* @return a future satisfied when either (a) the instance is updated or (b)
* a non-retryable error occurs or (c) polling or retry policy has been
* exhausted.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async update instance
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::Instance>> AsyncUpdateInstance(
CompletionQueue& cq, InstanceUpdateConfig instance_update_config);
/**
* Obtain the list of instances in the project.
*
* @note In some circumstances Cloud Bigtable may be unable to obtain the full
* list of instances, typically because some transient failure has made
* specific zones unavailable. In this cases the service returns a separate
* list of `failed_locations` that represent the unavailable zones.
* Applications may want to retry the operation after the transient
* conditions have cleared.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc list instances
*/
StatusOr<InstanceList> ListInstances();
/**
* Query (asynchronously) the list of instances in the project.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @note In some circumstances Cloud Bigtable may be unable to obtain the full
* list of instances, typically because some transient failure has made
* specific zones unavailable. In this cases the service returns a separate
* list of `failed_locations` that represent the unavailable zones.
* Applications may want to retry the operation after the transient
* conditions have cleared.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @return the list of instances. It is possible that some zones are not
* currently available for querying. In that case this function returns the
* list of failed locations in the `projects/<project>/locations/<zone_id>`
* format.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async list instances
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<InstanceList>> AsyncListInstances(CompletionQueue& cq);
/**
* Return the details of @p instance_id.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc get instance
*/
StatusOr<google::bigtable::admin::v2::Instance> GetInstance(
std::string const& instance_id);
/**
* Sends an asynchronous request to get information about an existing
* instance.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param instance_id the id of the instance in the project that to be
* retrieved.
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
*
* @return a future that will be satisfied when the request succeeds or the
* retry policy expires. In the first case, the future will contain the
* response from the service. In the second the future is satisfied with
* an exception.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async get instance
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::Instance>> AsyncGetInstance(
CompletionQueue& cq, std::string const& instance_id);
/**
* Deletes the instances in the project.
*
* @param instance_id the id of the instance in the project that needs to be
* deleted
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc delete instance
*/
Status DeleteInstance(std::string const& instance_id);
/**
* Makes an asynchronous request to delete an instance.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param instance_id the id of the instance in the project to be deleted.
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async-delete-instance
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<Status> AsyncDeleteInstance(std::string const& instance_id,
CompletionQueue& cq);
/**
* Obtain the list of clusters in an instance.
*
* @note In some circumstances Cloud Bigtable may be unable to obtain the full
* list of clusters, typically because some transient failure has made
* specific zones unavailable. In this cases the service returns a separate
* list of `failed_locations` that represent the unavailable zones.
* Applications may want to retry the operation after the transient
* conditions have cleared.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc list clusters
*/
StatusOr<ClusterList> ListClusters();
/**
* Obtain the list of clusters in an instance.
*
* @note In some circumstances Cloud Bigtable may be unable to obtain the full
* list of clusters, typically because some transient failure has made
* specific zones unavailable. In this cases the service returns a separate
* list of `failed_locations` that represent the unavailable zones.
* Applications may want to retry the operation after the transient
* conditions have cleared.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc list clusters
*/
StatusOr<ClusterList> ListClusters(std::string const& instance_id);
/**
* Query (asynchronously) the list of clusters in a project.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @note In some circumstances Cloud Bigtable may be unable to obtain the full
* list of clusters, typically because some transient failure has made
* specific zones unavailable. In this cases the service returns a separate
* list of `failed_locations` that represent the unavailable zones.
* Applications may want to retry the operation after the transient
* conditions have cleared.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @return the list of clusters. It is possible that some zones are not
* currently available for querying. In that case this function returns
* the list of failed locations in the
* `projects/<project>/locations/<zone_id>` format.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc list clusters
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<ClusterList>> AsyncListClusters(CompletionQueue& cq);
/**
* Query (asynchronously) the list of clusters in an instance.
*
* @note In some circumstances Cloud Bigtable may be unable to obtain the full
* list of clusters, typically because some transient failure has made
* specific zones unavailable. In this cases the service returns a separate
* list of `failed_locations` that represent the unavailable zones.
* Applications may want to retry the operation after the transient
* conditions have cleared.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param instance_id the instance in a project.
* @return the list of clusters. It is possible that some zones are not
* currently available for querying. In that case this function returns
* the list of failed locations in the
* `projects/<project>/locations/<zone_id>` format.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc list clusters
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<ClusterList>> AsyncListClusters(
CompletionQueue& cq, std::string const& instance_id);
/**
* Update an existing cluster of Cloud Bigtable.
*
* @warning Note that this is operation can take seconds or minutes to
* complete. The application may prefer to perform other work while waiting
* for this operation.
*
* @param cluster_config cluster with updated values.
* @return a future that becomes satisfied when (a) the operation has
* completed successfully, in which case it returns a proto with the
* Instance details, (b) the operation has failed, in which case the future
* contains an exception (typically `bigtable::GrpcError`) with the details
* of the failure, or (c) the state of the operation is unknown after the
* time allocated by the retry policies has expired, in which case the
* future contains an exception of type `bigtable::PollTimeout`.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc update cluster
*/
future<StatusOr<google::bigtable::admin::v2::Cluster>> UpdateCluster(
ClusterConfig cluster_config);
/**
* Update an existing cluster (asynchronously).
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param cluster_config cluster with updated values.
*
* @return a future satisfied when either (a) the cluster is updated or (b)
* a non-retryable error occurs or (c) polling or retry policy has been
* exhausted.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async update cluster
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::Cluster>> AsyncUpdateCluster(
CompletionQueue& cq, ClusterConfig cluster_config);
/**
* Deletes the specified cluster of an instance in the project.
*
* @param instance_id the id of the instance in the project
* @param cluster_id the id of the cluster in the project that needs to be
* deleted
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc delete cluster
*/
Status DeleteCluster(std::string const& instance_id,
std::string const& cluster_id);
/**
* Sends an asynchronous request to delete a cluster.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param instance_id the id of the instance in the project.
* @param cluster_id the id of the cluster in the project that needs to be
* deleted.
*
* @return a future that will be satisfied when the request succeeds or the
* retry policy expires.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async delete cluster
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<Status> AsyncDeleteCluster(CompletionQueue& cq,
std::string const& instance_id,
std::string const& cluster_id);
/**
* Gets the specified cluster of an instance in the project.
*
* @param instance_id the id of the instance in the project
* @param cluster_id the id of the cluster in the project that needs to be
* deleted
* @return a Cluster for given instance_id and cluster_id.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc get cluster
*/
StatusOr<google::bigtable::admin::v2::Cluster> GetCluster(
std::string const& instance_id, std::string const& cluster_id);
/**
* Sends an asynchronous request to get information about existing cluster of
* an instance.
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param instance_id the id of the instance in the project.
* @param cluster_id the id of the cluster in the project that needs to be
* retrieved.
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
*
* @return a future that will be satisfied when the request succeeds or the
* retry policy expires. In the first case, the future will contain the
* response from the service. In the second the future is satisfied with
* an exception.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async get cluster
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::Cluster>> AsyncGetCluster(
CompletionQueue& cq, std::string const& instance_id,
std::string const& cluster_id);
/**
* Create a new application profile.
*
* @param instance_id the instance for the new application profile.
* @param config the configuration for the new application profile.
* @return The proto describing the new application profile.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Multi-cluster Routing Example
* @snippet bigtable_instance_admin_snippets.cc create app profile
*
* @par Single Cluster Routing Example
* @snippet bigtable_instance_admin_snippets.cc create app profile cluster
*/
StatusOr<google::bigtable::admin::v2::AppProfile> CreateAppProfile(
std::string const& instance_id, AppProfileConfig config);
/**
* Asynchronously create a new application profile.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param instance_id the instance for the new application profile.
* @param config the configuration for the new application profile.
* @return The proto describing the new application profile.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async create app profile
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::AppProfile>>
AsyncCreateAppProfile(CompletionQueue& cq, std::string const& instance_id,
AppProfileConfig config);
/**
* Fetch the detailed information about an existing application profile.
*
* @param instance_id the instance to look the profile in.
* @param profile_id the id of the profile within that instance.
* @return The proto describing the application profile.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc get app profile
*/
StatusOr<google::bigtable::admin::v2::AppProfile> GetAppProfile(
std::string const& instance_id, std::string const& profile_id);
/**
* Asynchronously fetch the information about an existing application profile.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param instance_id the instance to look the profile in.
* @param profile_id the id of the profile within that instance.
* @return a future satisfied when either (a) the profile is fetched or (b)
* a non-retryable error occurs or (c) retry policy has been exhausted.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async get app profile
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::AppProfile>> AsyncGetAppProfile(
CompletionQueue& cq, std::string const& instance_id,
std::string const& profile_id);
/**
* Updates an existing application profile.
*
* @param instance_id the instance for the new application profile.
* @param profile_id the id (not the full name) of the profile to update.
* @param config the configuration for the new application profile.
* @return The proto describing the new application profile.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Change Description Example
* @snippet bigtable_instance_admin_snippets.cc update app profile description
*
* @par Change Routing to Any Cluster Example
* @snippet bigtable_instance_admin_snippets.cc update app profile routing any
*
* @par Change Routing to a Specific Cluster Example
* @snippet bigtable_instance_admin_snippets.cc update app profile routing
*/
future<StatusOr<google::bigtable::admin::v2::AppProfile>> UpdateAppProfile(
std::string const& instance_id, std::string const& profile_id,
AppProfileUpdateConfig config);
/**
* Updates an application profile (asynchronously).
*
* @warning This is an early version of the asynchronous APIs for Cloud
* Bigtable. These APIs might be changed in backward-incompatible ways. It
* is not subject to any SLA or deprecation policy.
*
* @param cq the completion queue that will execute the asynchronous calls,
* the application must ensure that one or more threads are blocked on
* `cq.Run()`.
* @param instance_id the instance for the new application profile.
* @param profile_id the id (not the full name) of the profile to update.
* @param config the configuration for the new application profile.
*
* @return a future satisfied when either (a) the profile is updated or (b)
* a non-retryable error occurs or (c) polling or retry policy has been
* exhausted.
*
* @par Idempotency
* This operation is always treated as non-idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet instance_admin_async_snippets.cc async update app profile
*/
GOOGLE_CLOUD_CPP_BIGTABLE_ADMIN_ASYNC_DEPRECATED
future<StatusOr<google::bigtable::admin::v2::AppProfile>>
AsyncUpdateAppProfile(CompletionQueue& cq, std::string const& instance_id,
std::string const& profile_id,
AppProfileUpdateConfig config);
/**
* List the application profiles in an instance.
*
* @param instance_id the instance to list the profiles for.
* @return a std::vector with the protos describing any profiles.
*
* @par Idempotency
* This operation is read-only and therefore it is always idempotent.
*
* @par Thread-safety
* Two threads concurrently calling this member function on the same instance
* of this class are **not** guaranteed to work. Consider copying the object
* and using different copies in each thread.
*
* @par Example
* @snippet bigtable_instance_admin_snippets.cc list app profiles
*/
StatusOr<std::vector<google::bigtable::admin::v2::AppProfile>>
ListAppProfiles(std::string const& instance_id);
/**
* Query (asynchronously) the list of app profiles in an instance.
*
* @param cq the completion queue that will execute the asynchronous calls,