google-cloud-spanner 1.16.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +23 -0
  4. data/lib/google-cloud-spanner.rb +10 -13
  5. data/lib/google/cloud/spanner.rb +6 -8
  6. data/lib/google/cloud/spanner/admin/database/credentials.rb +2 -2
  7. data/lib/google/cloud/spanner/admin/instance/credentials.rb +2 -2
  8. data/lib/google/cloud/spanner/backup.rb +1 -1
  9. data/lib/google/cloud/spanner/backup/job.rb +2 -2
  10. data/lib/google/cloud/spanner/backup/job/list.rb +2 -2
  11. data/lib/google/cloud/spanner/backup/list.rb +1 -2
  12. data/lib/google/cloud/spanner/backup/restore/job.rb +2 -2
  13. data/lib/google/cloud/spanner/batch_client.rb +2 -2
  14. data/lib/google/cloud/spanner/batch_snapshot.rb +6 -8
  15. data/lib/google/cloud/spanner/batch_update.rb +1 -1
  16. data/lib/google/cloud/spanner/client.rb +8 -8
  17. data/lib/google/cloud/spanner/commit.rb +14 -14
  18. data/lib/google/cloud/spanner/convert.rb +7 -7
  19. data/lib/google/cloud/spanner/credentials.rb +2 -2
  20. data/lib/google/cloud/spanner/data.rb +2 -2
  21. data/lib/google/cloud/spanner/database.rb +22 -22
  22. data/lib/google/cloud/spanner/database/backup_info.rb +1 -1
  23. data/lib/google/cloud/spanner/database/job.rb +3 -3
  24. data/lib/google/cloud/spanner/database/job/list.rb +2 -2
  25. data/lib/google/cloud/spanner/database/list.rb +1 -1
  26. data/lib/google/cloud/spanner/database/restore_info.rb +1 -1
  27. data/lib/google/cloud/spanner/fields.rb +8 -8
  28. data/lib/google/cloud/spanner/instance.rb +5 -12
  29. data/lib/google/cloud/spanner/instance/config.rb +1 -1
  30. data/lib/google/cloud/spanner/instance/config/list.rb +1 -1
  31. data/lib/google/cloud/spanner/instance/job.rb +2 -2
  32. data/lib/google/cloud/spanner/instance/list.rb +1 -1
  33. data/lib/google/cloud/spanner/partition.rb +4 -4
  34. data/lib/google/cloud/spanner/policy.rb +2 -2
  35. data/lib/google/cloud/spanner/service.rb +209 -297
  36. data/lib/google/cloud/spanner/session.rb +9 -9
  37. data/lib/google/cloud/spanner/snapshot.rb +2 -2
  38. data/lib/google/cloud/spanner/transaction.rb +2 -2
  39. data/lib/google/cloud/spanner/version.rb +1 -1
  40. metadata +18 -107
  41. data/lib/google/cloud/spanner/admin/database.rb +0 -149
  42. data/lib/google/cloud/spanner/admin/database/v1.rb +0 -147
  43. data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +0 -46
  44. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +0 -1513
  45. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +0 -111
  46. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  47. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/options.rb +0 -33
  48. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +0 -151
  49. data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +0 -51
  50. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +0 -131
  51. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +0 -29
  52. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/field_mask.rb +0 -222
  53. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/timestamp.rb +0 -113
  54. data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +0 -39
  55. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/backup.rb +0 -325
  56. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +0 -368
  57. data/lib/google/cloud/spanner/admin/database/v1/doc/google/type/expr.rb +0 -45
  58. data/lib/google/cloud/spanner/admin/instance.rb +0 -164
  59. data/lib/google/cloud/spanner/admin/instance/v1.rb +0 -162
  60. data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +0 -46
  61. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  62. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/options.rb +0 -33
  63. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +0 -151
  64. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +0 -51
  65. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +0 -131
  66. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +0 -29
  67. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +0 -222
  68. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +0 -39
  69. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +0 -334
  70. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/type/expr.rb +0 -45
  71. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +0 -975
  72. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +0 -76
  73. data/lib/google/cloud/spanner/v1.rb +0 -16
  74. data/lib/google/cloud/spanner/v1/credentials.rb +0 -42
  75. data/lib/google/cloud/spanner/v1/doc/google/protobuf/any.rb +0 -131
  76. data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +0 -91
  77. data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +0 -29
  78. data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +0 -74
  79. data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +0 -113
  80. data/lib/google/cloud/spanner/v1/doc/google/rpc/status.rb +0 -39
  81. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +0 -150
  82. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +0 -95
  83. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +0 -121
  84. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +0 -190
  85. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +0 -570
  86. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +0 -432
  87. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +0 -112
  88. data/lib/google/cloud/spanner/v1/spanner_client.rb +0 -1485
  89. data/lib/google/cloud/spanner/v1/spanner_client_config.json +0 -121
  90. data/lib/google/spanner/admin/database/v1/backup_pb.rb +0 -98
  91. data/lib/google/spanner/admin/database/v1/common_pb.rb +0 -28
  92. data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +0 -141
  93. data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +0 -169
  94. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +0 -125
  95. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +0 -181
  96. data/lib/google/spanner/v1/keys_pb.rb +0 -34
  97. data/lib/google/spanner/v1/mutation_pb.rb +0 -39
  98. data/lib/google/spanner/v1/query_plan_pb.rb +0 -48
  99. data/lib/google/spanner/v1/result_set_pb.rb +0 -48
  100. data/lib/google/spanner/v1/spanner_pb.rb +0 -179
  101. data/lib/google/spanner/v1/spanner_services_pb.rb +0 -179
  102. data/lib/google/spanner/v1/transaction_pb.rb +0 -56
  103. data/lib/google/spanner/v1/type_pb.rb +0 -44
@@ -1,334 +0,0 @@
1
- # Copyright 2020 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
-
16
- module Google
17
- module Spanner
18
- module Admin
19
- module Instance
20
- module V1
21
- # @!attribute [rw] location
22
- # @return [String]
23
- # The location of the serving resources, e.g. "us-central1".
24
- # @!attribute [rw] type
25
- # @return [Google::Spanner::Admin::Instance::V1::ReplicaInfo::ReplicaType]
26
- # The type of replica.
27
- # @!attribute [rw] default_leader_location
28
- # @return [true, false]
29
- # If true, this location is designated as the default leader location where
30
- # leader replicas are placed. See the [region types
31
- # documentation](https://cloud.google.com/spanner/docs/instances#region_types)
32
- # for more details.
33
- class ReplicaInfo
34
- # Indicates the type of replica. See the [replica types
35
- # documentation](https://cloud.google.com/spanner/docs/replication#replica_types)
36
- # for more details.
37
- module ReplicaType
38
- # Not specified.
39
- TYPE_UNSPECIFIED = 0
40
-
41
- # Read-write replicas support both reads and writes. These replicas:
42
- #
43
- # * Maintain a full copy of your data.
44
- # * Serve reads.
45
- # * Can vote whether to commit a write.
46
- # * Participate in leadership election.
47
- # * Are eligible to become a leader.
48
- READ_WRITE = 1
49
-
50
- # Read-only replicas only support reads (not writes). Read-only replicas:
51
- #
52
- # * Maintain a full copy of your data.
53
- # * Serve reads.
54
- # * Do not participate in voting to commit writes.
55
- # * Are not eligible to become a leader.
56
- READ_ONLY = 2
57
-
58
- # Witness replicas don't support reads but do participate in voting to
59
- # commit writes. Witness replicas:
60
- #
61
- # * Do not maintain a full copy of data.
62
- # * Do not serve reads.
63
- # * Vote whether to commit writes.
64
- # * Participate in leader election but are not eligible to become leader.
65
- WITNESS = 3
66
- end
67
- end
68
-
69
- # A possible configuration for a Cloud Spanner instance. Configurations
70
- # define the geographic placement of nodes and their replication.
71
- # @!attribute [rw] name
72
- # @return [String]
73
- # A unique identifier for the instance configuration. Values
74
- # are of the form
75
- # `projects/<project>/instanceConfigs/[a-z][-a-z0-9]*`
76
- # @!attribute [rw] display_name
77
- # @return [String]
78
- # The name of this instance configuration as it appears in UIs.
79
- # @!attribute [rw] replicas
80
- # @return [Array<Google::Spanner::Admin::Instance::V1::ReplicaInfo>]
81
- # The geographic placement of nodes in this instance configuration and their
82
- # replication properties.
83
- class InstanceConfig; end
84
-
85
- # An isolated set of Cloud Spanner resources on which databases can be hosted.
86
- # @!attribute [rw] name
87
- # @return [String]
88
- # Required. A unique identifier for the instance, which cannot be changed
89
- # after the instance is created. Values are of the form
90
- # `projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]`. The final
91
- # segment of the name must be between 2 and 64 characters in length.
92
- # @!attribute [rw] config
93
- # @return [String]
94
- # Required. The name of the instance's configuration. Values are of the form
95
- # `projects/<project>/instanceConfigs/<configuration>`. See
96
- # also {Google::Spanner::Admin::Instance::V1::InstanceConfig InstanceConfig} and
97
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::ListInstanceConfigs ListInstanceConfigs}.
98
- # @!attribute [rw] display_name
99
- # @return [String]
100
- # Required. The descriptive name for this instance as it appears in UIs.
101
- # Must be unique per project and between 4 and 30 characters in length.
102
- # @!attribute [rw] node_count
103
- # @return [Integer]
104
- # Required. The number of nodes allocated to this instance. This may be zero
105
- # in API responses for instances that are not yet in state `READY`.
106
- #
107
- # See [the
108
- # documentation](https://cloud.google.com/spanner/docs/instances#node_count)
109
- # for more information about nodes.
110
- # @!attribute [rw] state
111
- # @return [Google::Spanner::Admin::Instance::V1::Instance::State]
112
- # Output only. The current instance state. For
113
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::CreateInstance CreateInstance}, the state must be
114
- # either omitted or set to `CREATING`. For
115
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::UpdateInstance UpdateInstance}, the state must be
116
- # either omitted or set to `READY`.
117
- # @!attribute [rw] labels
118
- # @return [Hash{String => String}]
119
- # Cloud Labels are a flexible and lightweight mechanism for organizing cloud
120
- # resources into groups that reflect a customer's organizational needs and
121
- # deployment strategies. Cloud Labels can be used to filter collections of
122
- # resources. They can be used to control how resource metrics are aggregated.
123
- # And they can be used as arguments to policy management rules (e.g. route,
124
- # firewall, load balancing, etc.).
125
- #
126
- # * Label keys must be between 1 and 63 characters long and must conform to
127
- # the following regular expression: `[a-z](https://cloud.google.com[-a-z0-9]*[a-z0-9])?`.
128
- # * Label values must be between 0 and 63 characters long and must conform
129
- # to the regular expression `([a-z](https://cloud.google.com[-a-z0-9]*[a-z0-9])?)?`.
130
- # * No more than 64 labels can be associated with a given resource.
131
- #
132
- # See https://goo.gl/xmQnxf for more information on and examples of labels.
133
- #
134
- # If you plan to use labels in your own code, please note that additional
135
- # characters may be allowed in the future. And so you are advised to use an
136
- # internal label representation, such as JSON, which doesn't rely upon
137
- # specific characters being disallowed. For example, representing labels
138
- # as the string: name + "_" + value would prove problematic if we were to
139
- # allow "_" in a future release.
140
- # @!attribute [rw] endpoint_uris
141
- # @return [Array<String>]
142
- # Deprecated. This field is not populated.
143
- class Instance
144
- # Indicates the current state of the instance.
145
- module State
146
- # Not specified.
147
- STATE_UNSPECIFIED = 0
148
-
149
- # The instance is still being created. Resources may not be
150
- # available yet, and operations such as database creation may not
151
- # work.
152
- CREATING = 1
153
-
154
- # The instance is fully created and ready to do work such as
155
- # creating databases.
156
- READY = 2
157
- end
158
- end
159
-
160
- # The request for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::ListInstanceConfigs ListInstanceConfigs}.
161
- # @!attribute [rw] parent
162
- # @return [String]
163
- # Required. The name of the project for which a list of supported instance
164
- # configurations is requested. Values are of the form
165
- # `projects/<project>`.
166
- # @!attribute [rw] page_size
167
- # @return [Integer]
168
- # Number of instance configurations to be returned in the response. If 0 or
169
- # less, defaults to the server's maximum allowed page size.
170
- # @!attribute [rw] page_token
171
- # @return [String]
172
- # If non-empty, `page_token` should contain a
173
- # {Google::Spanner::Admin::Instance::V1::ListInstanceConfigsResponse#next_page_token next_page_token}
174
- # from a previous {Google::Spanner::Admin::Instance::V1::ListInstanceConfigsResponse ListInstanceConfigsResponse}.
175
- class ListInstanceConfigsRequest; end
176
-
177
- # The response for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::ListInstanceConfigs ListInstanceConfigs}.
178
- # @!attribute [rw] instance_configs
179
- # @return [Array<Google::Spanner::Admin::Instance::V1::InstanceConfig>]
180
- # The list of requested instance configurations.
181
- # @!attribute [rw] next_page_token
182
- # @return [String]
183
- # `next_page_token` can be sent in a subsequent
184
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::ListInstanceConfigs ListInstanceConfigs} call to
185
- # fetch more of the matching instance configurations.
186
- class ListInstanceConfigsResponse; end
187
-
188
- # The request for
189
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::GetInstanceConfig GetInstanceConfigRequest}.
190
- # @!attribute [rw] name
191
- # @return [String]
192
- # Required. The name of the requested instance configuration. Values are of
193
- # the form `projects/<project>/instanceConfigs/<config>`.
194
- class GetInstanceConfigRequest; end
195
-
196
- # The request for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::GetInstance GetInstance}.
197
- # @!attribute [rw] name
198
- # @return [String]
199
- # Required. The name of the requested instance. Values are of the form
200
- # `projects/<project>/instances/<instance>`.
201
- # @!attribute [rw] field_mask
202
- # @return [Google::Protobuf::FieldMask]
203
- # If field_mask is present, specifies the subset of {Google::Spanner::Admin::Instance::V1::Instance Instance} fields that
204
- # should be returned.
205
- # If absent, all {Google::Spanner::Admin::Instance::V1::Instance Instance} fields are returned.
206
- class GetInstanceRequest; end
207
-
208
- # The request for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::CreateInstance CreateInstance}.
209
- # @!attribute [rw] parent
210
- # @return [String]
211
- # Required. The name of the project in which to create the instance. Values
212
- # are of the form `projects/<project>`.
213
- # @!attribute [rw] instance_id
214
- # @return [String]
215
- # Required. The ID of the instance to create. Valid identifiers are of the
216
- # form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
217
- # length.
218
- # @!attribute [rw] instance
219
- # @return [Google::Spanner::Admin::Instance::V1::Instance]
220
- # Required. The instance to create. The name may be omitted, but if
221
- # specified must be `<parent>/instances/<instance_id>`.
222
- class CreateInstanceRequest; end
223
-
224
- # The request for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::ListInstances ListInstances}.
225
- # @!attribute [rw] parent
226
- # @return [String]
227
- # Required. The name of the project for which a list of instances is
228
- # requested. Values are of the form `projects/<project>`.
229
- # @!attribute [rw] page_size
230
- # @return [Integer]
231
- # Number of instances to be returned in the response. If 0 or less, defaults
232
- # to the server's maximum allowed page size.
233
- # @!attribute [rw] page_token
234
- # @return [String]
235
- # If non-empty, `page_token` should contain a
236
- # {Google::Spanner::Admin::Instance::V1::ListInstancesResponse#next_page_token next_page_token} from a
237
- # previous {Google::Spanner::Admin::Instance::V1::ListInstancesResponse ListInstancesResponse}.
238
- # @!attribute [rw] filter
239
- # @return [String]
240
- # An expression for filtering the results of the request. Filter rules are
241
- # case insensitive. The fields eligible for filtering are:
242
- #
243
- # * `name`
244
- # * `display_name`
245
- # * `labels.key` where key is the name of a label
246
- #
247
- # Some examples of using filters are:
248
- #
249
- # * `name:*` --> The instance has a name.
250
- # * `name:Howl` --> The instance's name contains the string "howl".
251
- # * `name:HOWL` --> Equivalent to above.
252
- # * `NAME:howl` --> Equivalent to above.
253
- # * `labels.env:*` --> The instance has the label "env".
254
- # * `labels.env:dev` --> The instance has the label "env" and the value of
255
- # the label contains the string "dev".
256
- # * `name:howl labels.env:dev` --> The instance's name contains "howl" and
257
- # it has the label "env" with its value
258
- # containing "dev".
259
- class ListInstancesRequest; end
260
-
261
- # The response for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::ListInstances ListInstances}.
262
- # @!attribute [rw] instances
263
- # @return [Array<Google::Spanner::Admin::Instance::V1::Instance>]
264
- # The list of requested instances.
265
- # @!attribute [rw] next_page_token
266
- # @return [String]
267
- # `next_page_token` can be sent in a subsequent
268
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::ListInstances ListInstances} call to fetch more
269
- # of the matching instances.
270
- class ListInstancesResponse; end
271
-
272
- # The request for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::UpdateInstance UpdateInstance}.
273
- # @!attribute [rw] instance
274
- # @return [Google::Spanner::Admin::Instance::V1::Instance]
275
- # Required. The instance to update, which must always include the instance
276
- # name. Otherwise, only fields mentioned in {Google::Spanner::Admin::Instance::V1::UpdateInstanceRequest#field_mask field_mask} need be included.
277
- # @!attribute [rw] field_mask
278
- # @return [Google::Protobuf::FieldMask]
279
- # Required. A mask specifying which fields in {Google::Spanner::Admin::Instance::V1::Instance Instance} should be updated.
280
- # The field mask must always be specified; this prevents any future fields in
281
- # {Google::Spanner::Admin::Instance::V1::Instance Instance} from being erased accidentally by clients that do not know
282
- # about them.
283
- class UpdateInstanceRequest; end
284
-
285
- # The request for {Google::Spanner::Admin::Instance::V1::InstanceAdmin::DeleteInstance DeleteInstance}.
286
- # @!attribute [rw] name
287
- # @return [String]
288
- # Required. The name of the instance to be deleted. Values are of the form
289
- # `projects/<project>/instances/<instance>`
290
- class DeleteInstanceRequest; end
291
-
292
- # Metadata type for the operation returned by
293
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::CreateInstance CreateInstance}.
294
- # @!attribute [rw] instance
295
- # @return [Google::Spanner::Admin::Instance::V1::Instance]
296
- # The instance being created.
297
- # @!attribute [rw] start_time
298
- # @return [Google::Protobuf::Timestamp]
299
- # The time at which the
300
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::CreateInstance CreateInstance} request was
301
- # received.
302
- # @!attribute [rw] cancel_time
303
- # @return [Google::Protobuf::Timestamp]
304
- # The time at which this operation was cancelled. If set, this operation is
305
- # in the process of undoing itself (which is guaranteed to succeed) and
306
- # cannot be cancelled again.
307
- # @!attribute [rw] end_time
308
- # @return [Google::Protobuf::Timestamp]
309
- # The time at which this operation failed or was completed successfully.
310
- class CreateInstanceMetadata; end
311
-
312
- # Metadata type for the operation returned by
313
- # {Google::Spanner::Admin::Instance::V1::InstanceAdmin::UpdateInstance UpdateInstance}.
314
- # @!attribute [rw] instance
315
- # @return [Google::Spanner::Admin::Instance::V1::Instance]
316
- # The desired end state of the update.
317
- # @!attribute [rw] start_time
318
- # @return [Google::Protobuf::Timestamp]
319
- # The time at which {Google::Spanner::Admin::Instance::V1::InstanceAdmin::UpdateInstance UpdateInstance}
320
- # request was received.
321
- # @!attribute [rw] cancel_time
322
- # @return [Google::Protobuf::Timestamp]
323
- # The time at which this operation was cancelled. If set, this operation is
324
- # in the process of undoing itself (which is guaranteed to succeed) and
325
- # cannot be cancelled again.
326
- # @!attribute [rw] end_time
327
- # @return [Google::Protobuf::Timestamp]
328
- # The time at which this operation failed or was completed successfully.
329
- class UpdateInstanceMetadata; end
330
- end
331
- end
332
- end
333
- end
334
- end
@@ -1,45 +0,0 @@
1
- # Copyright 2020 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
-
16
- module Google
17
- module Type
18
- # Represents an expression text. Example:
19
- #
20
- # title: "User account presence"
21
- # description: "Determines whether the request has a user account"
22
- # expression: "size(request.user) > 0"
23
- # @!attribute [rw] expression
24
- # @return [String]
25
- # Textual representation of an expression in
26
- # Common Expression Language syntax.
27
- #
28
- # The application context of the containing message determines which
29
- # well-known feature set of CEL is supported.
30
- # @!attribute [rw] title
31
- # @return [String]
32
- # An optional title for the expression, i.e. a short string describing
33
- # its purpose. This can be used e.g. in UIs which allow to enter the
34
- # expression.
35
- # @!attribute [rw] description
36
- # @return [String]
37
- # An optional description of the expression. This is a longer text which
38
- # describes the expression, e.g. when hovered over it in a UI.
39
- # @!attribute [rw] location
40
- # @return [String]
41
- # An optional string indicating the location of the expression for error
42
- # reporting, e.g. a file name and a position in the file.
43
- class Expr; end
44
- end
45
- end
@@ -1,975 +0,0 @@
1
- # Copyright 2020 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
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/spanner/admin/instance/v1/spanner_instance_admin.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
- require "google/gax/operation"
28
- require "google/longrunning/operations_client"
29
-
30
- require "google/spanner/admin/instance/v1/spanner_instance_admin_pb"
31
- require "google/cloud/spanner/admin/instance/v1/credentials"
32
- require "google/cloud/spanner/version"
33
-
34
- module Google
35
- module Cloud
36
- module Spanner
37
- module Admin
38
- module Instance
39
- module V1
40
- # Cloud Spanner Instance Admin API
41
- #
42
- # The Cloud Spanner Instance Admin API can be used to create, delete,
43
- # modify and list instances. Instances are dedicated Cloud Spanner serving
44
- # and storage resources to be used by Cloud Spanner databases.
45
- #
46
- # Each instance has a "configuration", which dictates where the
47
- # serving resources for the Cloud Spanner instance are located (e.g.,
48
- # US-central, Europe). Configurations are created by Google based on
49
- # resource availability.
50
- #
51
- # Cloud Spanner billing is based on the instances that exist and their
52
- # sizes. After an instance exists, there are no additional
53
- # per-database or per-operation charges for use of the instance
54
- # (though there may be additional network bandwidth charges).
55
- # Instances offer isolation: problems with databases in one instance
56
- # will not affect other instances. However, within an instance
57
- # databases can affect each other. For example, if one database in an
58
- # instance receives a lot of requests and consumes most of the
59
- # instance resources, fewer resources are available for other
60
- # databases in that instance, and their performance may suffer.
61
- #
62
- # @!attribute [r] instance_admin_stub
63
- # @return [Google::Spanner::Admin::Instance::V1::InstanceAdmin::Stub]
64
- class InstanceAdminClient
65
- # @private
66
- attr_reader :instance_admin_stub
67
-
68
- # The default address of the service.
69
- SERVICE_ADDRESS = "spanner.googleapis.com".freeze
70
-
71
- # The default port of the service.
72
- DEFAULT_SERVICE_PORT = 443
73
-
74
- # The default set of gRPC interceptors.
75
- GRPC_INTERCEPTORS = []
76
-
77
- DEFAULT_TIMEOUT = 30
78
-
79
- PAGE_DESCRIPTORS = {
80
- "list_instance_configs" => Google::Gax::PageDescriptor.new(
81
- "page_token",
82
- "next_page_token",
83
- "instance_configs"),
84
- "list_instances" => Google::Gax::PageDescriptor.new(
85
- "page_token",
86
- "next_page_token",
87
- "instances")
88
- }.freeze
89
-
90
- private_constant :PAGE_DESCRIPTORS
91
-
92
- # The scopes needed to make gRPC calls to all of the methods defined in
93
- # this service.
94
- ALL_SCOPES = [
95
- "https://www.googleapis.com/auth/cloud-platform",
96
- "https://www.googleapis.com/auth/spanner.admin"
97
- ].freeze
98
-
99
- # @private
100
- class OperationsClient < Google::Longrunning::OperationsClient
101
- self::SERVICE_ADDRESS = InstanceAdminClient::SERVICE_ADDRESS
102
- self::GRPC_INTERCEPTORS = InstanceAdminClient::GRPC_INTERCEPTORS
103
- end
104
-
105
- INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
106
- "projects/{project}/instances/{instance}"
107
- )
108
-
109
- private_constant :INSTANCE_PATH_TEMPLATE
110
-
111
- INSTANCE_CONFIG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
112
- "projects/{project}/instanceConfigs/{instance_config}"
113
- )
114
-
115
- private_constant :INSTANCE_CONFIG_PATH_TEMPLATE
116
-
117
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
118
- "projects/{project}"
119
- )
120
-
121
- private_constant :PROJECT_PATH_TEMPLATE
122
-
123
- # Returns a fully-qualified instance resource name string.
124
- # @param project [String]
125
- # @param instance [String]
126
- # @return [String]
127
- def self.instance_path project, instance
128
- INSTANCE_PATH_TEMPLATE.render(
129
- :"project" => project,
130
- :"instance" => instance
131
- )
132
- end
133
-
134
- # Returns a fully-qualified instance_config resource name string.
135
- # @param project [String]
136
- # @param instance_config [String]
137
- # @return [String]
138
- def self.instance_config_path project, instance_config
139
- INSTANCE_CONFIG_PATH_TEMPLATE.render(
140
- :"project" => project,
141
- :"instance_config" => instance_config
142
- )
143
- end
144
-
145
- # Returns a fully-qualified project resource name string.
146
- # @param project [String]
147
- # @return [String]
148
- def self.project_path project
149
- PROJECT_PATH_TEMPLATE.render(
150
- :"project" => project
151
- )
152
- end
153
-
154
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
155
- # Provides the means for authenticating requests made by the client. This parameter can
156
- # be many types.
157
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
158
- # authenticating requests made by this client.
159
- # A `String` will be treated as the path to the keyfile to be used for the construction of
160
- # credentials for this client.
161
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
162
- # credentials for this client.
163
- # A `GRPC::Core::Channel` will be used to make calls through.
164
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
165
- # should already be composed with a `GRPC::Core::CallCredentials` object.
166
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
167
- # metadata for requests, generally, to give OAuth credentials.
168
- # @param scopes [Array<String>]
169
- # The OAuth scopes for this service. This parameter is ignored if
170
- # an updater_proc is supplied.
171
- # @param client_config [Hash]
172
- # A Hash for call options for each method. See
173
- # Google::Gax#construct_settings for the structure of
174
- # this data. Falls back to the default config if not specified
175
- # or the specified config is missing data points.
176
- # @param timeout [Numeric]
177
- # The default timeout, in seconds, for calls made through this client.
178
- # @param metadata [Hash]
179
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
180
- # @param service_address [String]
181
- # Override for the service hostname, or `nil` to leave as the default.
182
- # @param service_port [Integer]
183
- # Override for the service port, or `nil` to leave as the default.
184
- # @param exception_transformer [Proc]
185
- # An optional proc that intercepts any exceptions raised during an API call to inject
186
- # custom error handling.
187
- def initialize \
188
- credentials: nil,
189
- scopes: ALL_SCOPES,
190
- client_config: {},
191
- timeout: DEFAULT_TIMEOUT,
192
- metadata: nil,
193
- service_address: nil,
194
- service_port: nil,
195
- exception_transformer: nil,
196
- lib_name: nil,
197
- lib_version: ""
198
- # These require statements are intentionally placed here to initialize
199
- # the gRPC module only when it's required.
200
- # See https://github.com/googleapis/toolkit/issues/446
201
- require "google/gax/grpc"
202
- require "google/spanner/admin/instance/v1/spanner_instance_admin_services_pb"
203
-
204
- credentials ||= Google::Cloud::Spanner::Admin::Instance::V1::Credentials.default
205
-
206
- @operations_client = OperationsClient.new(
207
- credentials: credentials,
208
- scopes: scopes,
209
- client_config: client_config,
210
- timeout: timeout,
211
- service_address: service_address,
212
- service_port: service_port,
213
- lib_name: lib_name,
214
- lib_version: lib_version,
215
- metadata: metadata,
216
- )
217
-
218
- if credentials.is_a?(String) || credentials.is_a?(Hash)
219
- updater_proc = Google::Cloud::Spanner::Admin::Instance::V1::Credentials.new(credentials).updater_proc
220
- end
221
- if credentials.is_a?(GRPC::Core::Channel)
222
- channel = credentials
223
- end
224
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
225
- chan_creds = credentials
226
- end
227
- if credentials.is_a?(Proc)
228
- updater_proc = credentials
229
- end
230
- if credentials.is_a?(Google::Auth::Credentials)
231
- updater_proc = credentials.updater_proc
232
- end
233
-
234
- package_version = Google::Cloud::Spanner::VERSION
235
-
236
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
237
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
238
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
239
- google_api_client << " grpc/#{GRPC::VERSION}"
240
- google_api_client.freeze
241
-
242
- headers = { :"x-goog-api-client" => google_api_client }
243
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
244
- headers[:"x-goog-user-project"] = credentials.quota_project_id
245
- end
246
- headers.merge!(metadata) unless metadata.nil?
247
- client_config_file = Pathname.new(__dir__).join(
248
- "instance_admin_client_config.json"
249
- )
250
- defaults = client_config_file.open do |f|
251
- Google::Gax.construct_settings(
252
- "google.spanner.admin.instance.v1.InstanceAdmin",
253
- JSON.parse(f.read),
254
- client_config,
255
- Google::Gax::Grpc::STATUS_CODE_NAMES,
256
- timeout,
257
- page_descriptors: PAGE_DESCRIPTORS,
258
- errors: Google::Gax::Grpc::API_ERRORS,
259
- metadata: headers
260
- )
261
- end
262
-
263
- # Allow overriding the service path/port in subclasses.
264
- service_path = service_address || self.class::SERVICE_ADDRESS
265
- port = service_port || self.class::DEFAULT_SERVICE_PORT
266
- interceptors = self.class::GRPC_INTERCEPTORS
267
- @instance_admin_stub = Google::Gax::Grpc.create_stub(
268
- service_path,
269
- port,
270
- chan_creds: chan_creds,
271
- channel: channel,
272
- updater_proc: updater_proc,
273
- scopes: scopes,
274
- interceptors: interceptors,
275
- &Google::Spanner::Admin::Instance::V1::InstanceAdmin::Stub.method(:new)
276
- )
277
-
278
- @list_instance_configs = Google::Gax.create_api_call(
279
- @instance_admin_stub.method(:list_instance_configs),
280
- defaults["list_instance_configs"],
281
- exception_transformer: exception_transformer,
282
- params_extractor: proc do |request|
283
- {'parent' => request.parent}
284
- end
285
- )
286
- @get_instance_config = Google::Gax.create_api_call(
287
- @instance_admin_stub.method(:get_instance_config),
288
- defaults["get_instance_config"],
289
- exception_transformer: exception_transformer,
290
- params_extractor: proc do |request|
291
- {'name' => request.name}
292
- end
293
- )
294
- @list_instances = Google::Gax.create_api_call(
295
- @instance_admin_stub.method(:list_instances),
296
- defaults["list_instances"],
297
- exception_transformer: exception_transformer,
298
- params_extractor: proc do |request|
299
- {'parent' => request.parent}
300
- end
301
- )
302
- @get_instance = Google::Gax.create_api_call(
303
- @instance_admin_stub.method(:get_instance),
304
- defaults["get_instance"],
305
- exception_transformer: exception_transformer,
306
- params_extractor: proc do |request|
307
- {'name' => request.name}
308
- end
309
- )
310
- @create_instance = Google::Gax.create_api_call(
311
- @instance_admin_stub.method(:create_instance),
312
- defaults["create_instance"],
313
- exception_transformer: exception_transformer,
314
- params_extractor: proc do |request|
315
- {'parent' => request.parent}
316
- end
317
- )
318
- @update_instance = Google::Gax.create_api_call(
319
- @instance_admin_stub.method(:update_instance),
320
- defaults["update_instance"],
321
- exception_transformer: exception_transformer,
322
- params_extractor: proc do |request|
323
- {'instance.name' => request.instance.name}
324
- end
325
- )
326
- @delete_instance = Google::Gax.create_api_call(
327
- @instance_admin_stub.method(:delete_instance),
328
- defaults["delete_instance"],
329
- exception_transformer: exception_transformer,
330
- params_extractor: proc do |request|
331
- {'name' => request.name}
332
- end
333
- )
334
- @set_iam_policy = Google::Gax.create_api_call(
335
- @instance_admin_stub.method(:set_iam_policy),
336
- defaults["set_iam_policy"],
337
- exception_transformer: exception_transformer,
338
- params_extractor: proc do |request|
339
- {'resource' => request.resource}
340
- end
341
- )
342
- @get_iam_policy = Google::Gax.create_api_call(
343
- @instance_admin_stub.method(:get_iam_policy),
344
- defaults["get_iam_policy"],
345
- exception_transformer: exception_transformer,
346
- params_extractor: proc do |request|
347
- {'resource' => request.resource}
348
- end
349
- )
350
- @test_iam_permissions = Google::Gax.create_api_call(
351
- @instance_admin_stub.method(:test_iam_permissions),
352
- defaults["test_iam_permissions"],
353
- exception_transformer: exception_transformer,
354
- params_extractor: proc do |request|
355
- {'resource' => request.resource}
356
- end
357
- )
358
- end
359
-
360
- # Service calls
361
-
362
- # Lists the supported instance configurations for a given project.
363
- #
364
- # @param parent [String]
365
- # Required. The name of the project for which a list of supported instance
366
- # configurations is requested. Values are of the form
367
- # `projects/<project>`.
368
- # @param page_size [Integer]
369
- # The maximum number of resources contained in the underlying API
370
- # response. If page streaming is performed per-resource, this
371
- # parameter does not affect the return value. If page streaming is
372
- # performed per-page, this determines the maximum number of
373
- # resources in a page.
374
- # @param options [Google::Gax::CallOptions]
375
- # Overrides the default settings for this call, e.g, timeout,
376
- # retries, etc.
377
- # @yield [result, operation] Access the result along with the RPC operation
378
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::InstanceConfig>]
379
- # @yieldparam operation [GRPC::ActiveCall::Operation]
380
- # @return [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::InstanceConfig>]
381
- # An enumerable of Google::Spanner::Admin::Instance::V1::InstanceConfig instances.
382
- # See Google::Gax::PagedEnumerable documentation for other
383
- # operations such as per-page iteration or access to the response
384
- # object.
385
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
386
- # @example
387
- # require "google/cloud/spanner/admin/instance"
388
- #
389
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
390
- # formatted_parent = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.project_path("[PROJECT]")
391
- #
392
- # # Iterate over all results.
393
- # instance_admin_client.list_instance_configs(formatted_parent).each do |element|
394
- # # Process element.
395
- # end
396
- #
397
- # # Or iterate over results one page at a time.
398
- # instance_admin_client.list_instance_configs(formatted_parent).each_page do |page|
399
- # # Process each page at a time.
400
- # page.each do |element|
401
- # # Process element.
402
- # end
403
- # end
404
-
405
- def list_instance_configs \
406
- parent,
407
- page_size: nil,
408
- options: nil,
409
- &block
410
- req = {
411
- parent: parent,
412
- page_size: page_size
413
- }.delete_if { |_, v| v.nil? }
414
- req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest)
415
- @list_instance_configs.call(req, options, &block)
416
- end
417
-
418
- # Gets information about a particular instance configuration.
419
- #
420
- # @param name [String]
421
- # Required. The name of the requested instance configuration. Values are of
422
- # the form `projects/<project>/instanceConfigs/<config>`.
423
- # @param options [Google::Gax::CallOptions]
424
- # Overrides the default settings for this call, e.g, timeout,
425
- # retries, etc.
426
- # @yield [result, operation] Access the result along with the RPC operation
427
- # @yieldparam result [Google::Spanner::Admin::Instance::V1::InstanceConfig]
428
- # @yieldparam operation [GRPC::ActiveCall::Operation]
429
- # @return [Google::Spanner::Admin::Instance::V1::InstanceConfig]
430
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
431
- # @example
432
- # require "google/cloud/spanner/admin/instance"
433
- #
434
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
435
- # formatted_name = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_config_path("[PROJECT]", "[INSTANCE_CONFIG]")
436
- # response = instance_admin_client.get_instance_config(formatted_name)
437
-
438
- def get_instance_config \
439
- name,
440
- options: nil,
441
- &block
442
- req = {
443
- name: name
444
- }.delete_if { |_, v| v.nil? }
445
- req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::GetInstanceConfigRequest)
446
- @get_instance_config.call(req, options, &block)
447
- end
448
-
449
- # Lists all instances in the given project.
450
- #
451
- # @param parent [String]
452
- # Required. The name of the project for which a list of instances is
453
- # requested. Values are of the form `projects/<project>`.
454
- # @param page_size [Integer]
455
- # The maximum number of resources contained in the underlying API
456
- # response. If page streaming is performed per-resource, this
457
- # parameter does not affect the return value. If page streaming is
458
- # performed per-page, this determines the maximum number of
459
- # resources in a page.
460
- # @param filter [String]
461
- # An expression for filtering the results of the request. Filter rules are
462
- # case insensitive. The fields eligible for filtering are:
463
- #
464
- # * `name`
465
- # * `display_name`
466
- # * `labels.key` where key is the name of a label
467
- #
468
- # Some examples of using filters are:
469
- #
470
- # * `name:*` --> The instance has a name.
471
- # * `name:Howl` --> The instance's name contains the string "howl".
472
- # * `name:HOWL` --> Equivalent to above.
473
- # * `NAME:howl` --> Equivalent to above.
474
- # * `labels.env:*` --> The instance has the label "env".
475
- # * `labels.env:dev` --> The instance has the label "env" and the value of
476
- # the label contains the string "dev".
477
- # * `name:howl labels.env:dev` --> The instance's name contains "howl" and
478
- # it has the label "env" with its value
479
- # containing "dev".
480
- # @param options [Google::Gax::CallOptions]
481
- # Overrides the default settings for this call, e.g, timeout,
482
- # retries, etc.
483
- # @yield [result, operation] Access the result along with the RPC operation
484
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::Instance>]
485
- # @yieldparam operation [GRPC::ActiveCall::Operation]
486
- # @return [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::Instance>]
487
- # An enumerable of Google::Spanner::Admin::Instance::V1::Instance instances.
488
- # See Google::Gax::PagedEnumerable documentation for other
489
- # operations such as per-page iteration or access to the response
490
- # object.
491
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
492
- # @example
493
- # require "google/cloud/spanner/admin/instance"
494
- #
495
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
496
- # formatted_parent = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.project_path("[PROJECT]")
497
- #
498
- # # Iterate over all results.
499
- # instance_admin_client.list_instances(formatted_parent).each do |element|
500
- # # Process element.
501
- # end
502
- #
503
- # # Or iterate over results one page at a time.
504
- # instance_admin_client.list_instances(formatted_parent).each_page do |page|
505
- # # Process each page at a time.
506
- # page.each do |element|
507
- # # Process element.
508
- # end
509
- # end
510
-
511
- def list_instances \
512
- parent,
513
- page_size: nil,
514
- filter: nil,
515
- options: nil,
516
- &block
517
- req = {
518
- parent: parent,
519
- page_size: page_size,
520
- filter: filter
521
- }.delete_if { |_, v| v.nil? }
522
- req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::ListInstancesRequest)
523
- @list_instances.call(req, options, &block)
524
- end
525
-
526
- # Gets information about a particular instance.
527
- #
528
- # @param name [String]
529
- # Required. The name of the requested instance. Values are of the form
530
- # `projects/<project>/instances/<instance>`.
531
- # @param field_mask [Google::Protobuf::FieldMask | Hash]
532
- # If field_mask is present, specifies the subset of {Google::Spanner::Admin::Instance::V1::Instance Instance} fields that
533
- # should be returned.
534
- # If absent, all {Google::Spanner::Admin::Instance::V1::Instance Instance} fields are returned.
535
- # A hash of the same form as `Google::Protobuf::FieldMask`
536
- # can also be provided.
537
- # @param options [Google::Gax::CallOptions]
538
- # Overrides the default settings for this call, e.g, timeout,
539
- # retries, etc.
540
- # @yield [result, operation] Access the result along with the RPC operation
541
- # @yieldparam result [Google::Spanner::Admin::Instance::V1::Instance]
542
- # @yieldparam operation [GRPC::ActiveCall::Operation]
543
- # @return [Google::Spanner::Admin::Instance::V1::Instance]
544
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
545
- # @example
546
- # require "google/cloud/spanner/admin/instance"
547
- #
548
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
549
- # formatted_name = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
550
- # response = instance_admin_client.get_instance(formatted_name)
551
-
552
- def get_instance \
553
- name,
554
- field_mask: nil,
555
- options: nil,
556
- &block
557
- req = {
558
- name: name,
559
- field_mask: field_mask
560
- }.delete_if { |_, v| v.nil? }
561
- req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::GetInstanceRequest)
562
- @get_instance.call(req, options, &block)
563
- end
564
-
565
- # Creates an instance and begins preparing it to begin serving. The
566
- # returned {Google::Longrunning::Operation long-running operation}
567
- # can be used to track the progress of preparing the new
568
- # instance. The instance name is assigned by the caller. If the
569
- # named instance already exists, `CreateInstance` returns
570
- # `ALREADY_EXISTS`.
571
- #
572
- # Immediately upon completion of this request:
573
- #
574
- # * The instance is readable via the API, with all requested attributes
575
- # but no allocated resources. Its state is `CREATING`.
576
- #
577
- # Until completion of the returned operation:
578
- #
579
- # * Cancelling the operation renders the instance immediately unreadable
580
- # via the API.
581
- # * The instance can be deleted.
582
- # * All other attempts to modify the instance are rejected.
583
- #
584
- # Upon completion of the returned operation:
585
- #
586
- # * Billing for all successfully-allocated resources begins (some types
587
- # may have lower than the requested levels).
588
- # * Databases can be created in the instance.
589
- # * The instance's allocated resource levels are readable via the API.
590
- # * The instance's state becomes `READY`.
591
- #
592
- # The returned {Google::Longrunning::Operation long-running operation} will
593
- # have a name of the format `<instance_name>/operations/<operation_id>` and
594
- # can be used to track creation of the instance. The
595
- # {Google::Longrunning::Operation#metadata metadata} field type is
596
- # {Google::Spanner::Admin::Instance::V1::CreateInstanceMetadata CreateInstanceMetadata}.
597
- # The {Google::Longrunning::Operation#response response} field type is
598
- # {Google::Spanner::Admin::Instance::V1::Instance Instance}, if successful.
599
- #
600
- # @param parent [String]
601
- # Required. The name of the project in which to create the instance. Values
602
- # are of the form `projects/<project>`.
603
- # @param instance_id [String]
604
- # Required. The ID of the instance to create. Valid identifiers are of the
605
- # form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
606
- # length.
607
- # @param instance [Google::Spanner::Admin::Instance::V1::Instance | Hash]
608
- # Required. The instance to create. The name may be omitted, but if
609
- # specified must be `<parent>/instances/<instance_id>`.
610
- # A hash of the same form as `Google::Spanner::Admin::Instance::V1::Instance`
611
- # can also be provided.
612
- # @param options [Google::Gax::CallOptions]
613
- # Overrides the default settings for this call, e.g, timeout,
614
- # retries, etc.
615
- # @return [Google::Gax::Operation]
616
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
617
- # @example
618
- # require "google/cloud/spanner/admin/instance"
619
- #
620
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
621
- # formatted_parent = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.project_path("[PROJECT]")
622
- #
623
- # # TODO: Initialize `instance_id`:
624
- # instance_id = ''
625
- #
626
- # # TODO: Initialize `instance`:
627
- # instance = {}
628
- #
629
- # # Register a callback during the method call.
630
- # operation = instance_admin_client.create_instance(formatted_parent, instance_id, instance) do |op|
631
- # raise op.results.message if op.error?
632
- # op_results = op.results
633
- # # Process the results.
634
- #
635
- # metadata = op.metadata
636
- # # Process the metadata.
637
- # end
638
- #
639
- # # Or use the return value to register a callback.
640
- # operation.on_done do |op|
641
- # raise op.results.message if op.error?
642
- # op_results = op.results
643
- # # Process the results.
644
- #
645
- # metadata = op.metadata
646
- # # Process the metadata.
647
- # end
648
- #
649
- # # Manually reload the operation.
650
- # operation.reload!
651
- #
652
- # # Or block until the operation completes, triggering callbacks on
653
- # # completion.
654
- # operation.wait_until_done!
655
-
656
- def create_instance \
657
- parent,
658
- instance_id,
659
- instance,
660
- options: nil
661
- req = {
662
- parent: parent,
663
- instance_id: instance_id,
664
- instance: instance
665
- }.delete_if { |_, v| v.nil? }
666
- req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::CreateInstanceRequest)
667
- operation = Google::Gax::Operation.new(
668
- @create_instance.call(req, options),
669
- @operations_client,
670
- Google::Spanner::Admin::Instance::V1::Instance,
671
- Google::Spanner::Admin::Instance::V1::CreateInstanceMetadata,
672
- call_options: options
673
- )
674
- operation.on_done { |operation| yield(operation) } if block_given?
675
- operation
676
- end
677
-
678
- # Updates an instance, and begins allocating or releasing resources
679
- # as requested. The returned [long-running
680
- # operation][google.longrunning.Operation] can be used to track the
681
- # progress of updating the instance. If the named instance does not
682
- # exist, returns `NOT_FOUND`.
683
- #
684
- # Immediately upon completion of this request:
685
- #
686
- # * For resource types for which a decrease in the instance's allocation
687
- # has been requested, billing is based on the newly-requested level.
688
- #
689
- # Until completion of the returned operation:
690
- #
691
- # * Cancelling the operation sets its metadata's
692
- # {Google::Spanner::Admin::Instance::V1::UpdateInstanceMetadata#cancel_time cancel_time}, and begins
693
- # restoring resources to their pre-request values. The operation
694
- # is guaranteed to succeed at undoing all resource changes,
695
- # after which point it terminates with a `CANCELLED` status.
696
- # * All other attempts to modify the instance are rejected.
697
- # * Reading the instance via the API continues to give the pre-request
698
- # resource levels.
699
- #
700
- # Upon completion of the returned operation:
701
- #
702
- # * Billing begins for all successfully-allocated resources (some types
703
- # may have lower than the requested levels).
704
- # * All newly-reserved resources are available for serving the instance's
705
- # tables.
706
- # * The instance's new resource levels are readable via the API.
707
- #
708
- # The returned {Google::Longrunning::Operation long-running operation} will
709
- # have a name of the format `<instance_name>/operations/<operation_id>` and
710
- # can be used to track the instance modification. The
711
- # {Google::Longrunning::Operation#metadata metadata} field type is
712
- # {Google::Spanner::Admin::Instance::V1::UpdateInstanceMetadata UpdateInstanceMetadata}.
713
- # The {Google::Longrunning::Operation#response response} field type is
714
- # {Google::Spanner::Admin::Instance::V1::Instance Instance}, if successful.
715
- #
716
- # Authorization requires `spanner.instances.update` permission on
717
- # resource {Google::Spanner::Admin::Instance::V1::Instance#name name}.
718
- #
719
- # @param instance [Google::Spanner::Admin::Instance::V1::Instance | Hash]
720
- # Required. The instance to update, which must always include the instance
721
- # name. Otherwise, only fields mentioned in {Google::Spanner::Admin::Instance::V1::UpdateInstanceRequest#field_mask field_mask} need be included.
722
- # A hash of the same form as `Google::Spanner::Admin::Instance::V1::Instance`
723
- # can also be provided.
724
- # @param field_mask [Google::Protobuf::FieldMask | Hash]
725
- # Required. A mask specifying which fields in {Google::Spanner::Admin::Instance::V1::Instance Instance} should be updated.
726
- # The field mask must always be specified; this prevents any future fields in
727
- # {Google::Spanner::Admin::Instance::V1::Instance Instance} from being erased accidentally by clients that do not know
728
- # about them.
729
- # A hash of the same form as `Google::Protobuf::FieldMask`
730
- # can also be provided.
731
- # @param options [Google::Gax::CallOptions]
732
- # Overrides the default settings for this call, e.g, timeout,
733
- # retries, etc.
734
- # @return [Google::Gax::Operation]
735
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
736
- # @example
737
- # require "google/cloud/spanner/admin/instance"
738
- #
739
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
740
- #
741
- # # TODO: Initialize `instance`:
742
- # instance = {}
743
- #
744
- # # TODO: Initialize `field_mask`:
745
- # field_mask = {}
746
- #
747
- # # Register a callback during the method call.
748
- # operation = instance_admin_client.update_instance(instance, field_mask) do |op|
749
- # raise op.results.message if op.error?
750
- # op_results = op.results
751
- # # Process the results.
752
- #
753
- # metadata = op.metadata
754
- # # Process the metadata.
755
- # end
756
- #
757
- # # Or use the return value to register a callback.
758
- # operation.on_done do |op|
759
- # raise op.results.message if op.error?
760
- # op_results = op.results
761
- # # Process the results.
762
- #
763
- # metadata = op.metadata
764
- # # Process the metadata.
765
- # end
766
- #
767
- # # Manually reload the operation.
768
- # operation.reload!
769
- #
770
- # # Or block until the operation completes, triggering callbacks on
771
- # # completion.
772
- # operation.wait_until_done!
773
-
774
- def update_instance \
775
- instance,
776
- field_mask,
777
- options: nil
778
- req = {
779
- instance: instance,
780
- field_mask: field_mask
781
- }.delete_if { |_, v| v.nil? }
782
- req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::UpdateInstanceRequest)
783
- operation = Google::Gax::Operation.new(
784
- @update_instance.call(req, options),
785
- @operations_client,
786
- Google::Spanner::Admin::Instance::V1::Instance,
787
- Google::Spanner::Admin::Instance::V1::UpdateInstanceMetadata,
788
- call_options: options
789
- )
790
- operation.on_done { |operation| yield(operation) } if block_given?
791
- operation
792
- end
793
-
794
- # Deletes an instance.
795
- #
796
- # Immediately upon completion of the request:
797
- #
798
- # * Billing ceases for all of the instance's reserved resources.
799
- #
800
- # Soon afterward:
801
- #
802
- # * The instance and *all of its databases* immediately and
803
- # irrevocably disappear from the API. All data in the databases
804
- # is permanently deleted.
805
- #
806
- # @param name [String]
807
- # Required. The name of the instance to be deleted. Values are of the form
808
- # `projects/<project>/instances/<instance>`
809
- # @param options [Google::Gax::CallOptions]
810
- # Overrides the default settings for this call, e.g, timeout,
811
- # retries, etc.
812
- # @yield [result, operation] Access the result along with the RPC operation
813
- # @yieldparam result []
814
- # @yieldparam operation [GRPC::ActiveCall::Operation]
815
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
816
- # @example
817
- # require "google/cloud/spanner/admin/instance"
818
- #
819
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
820
- # formatted_name = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
821
- # instance_admin_client.delete_instance(formatted_name)
822
-
823
- def delete_instance \
824
- name,
825
- options: nil,
826
- &block
827
- req = {
828
- name: name
829
- }.delete_if { |_, v| v.nil? }
830
- req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::DeleteInstanceRequest)
831
- @delete_instance.call(req, options, &block)
832
- nil
833
- end
834
-
835
- # Sets the access control policy on an instance resource. Replaces any
836
- # existing policy.
837
- #
838
- # Authorization requires `spanner.instances.setIamPolicy` on
839
- # {Google::Iam::V1::SetIamPolicyRequest#resource resource}.
840
- #
841
- # @param resource [String]
842
- # REQUIRED: The resource for which the policy is being specified.
843
- # See the operation documentation for the appropriate value for this field.
844
- # @param policy [Google::Iam::V1::Policy | Hash]
845
- # REQUIRED: The complete policy to be applied to the `resource`. The size of
846
- # the policy is limited to a few 10s of KB. An empty policy is a
847
- # valid policy but certain Cloud Platform services (such as Projects)
848
- # might reject them.
849
- # A hash of the same form as `Google::Iam::V1::Policy`
850
- # can also be provided.
851
- # @param options [Google::Gax::CallOptions]
852
- # Overrides the default settings for this call, e.g, timeout,
853
- # retries, etc.
854
- # @yield [result, operation] Access the result along with the RPC operation
855
- # @yieldparam result [Google::Iam::V1::Policy]
856
- # @yieldparam operation [GRPC::ActiveCall::Operation]
857
- # @return [Google::Iam::V1::Policy]
858
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
859
- # @example
860
- # require "google/cloud/spanner/admin/instance"
861
- #
862
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
863
- # formatted_resource = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
864
- #
865
- # # TODO: Initialize `policy`:
866
- # policy = {}
867
- # response = instance_admin_client.set_iam_policy(formatted_resource, policy)
868
-
869
- def set_iam_policy \
870
- resource,
871
- policy,
872
- options: nil,
873
- &block
874
- req = {
875
- resource: resource,
876
- policy: policy
877
- }.delete_if { |_, v| v.nil? }
878
- req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
879
- @set_iam_policy.call(req, options, &block)
880
- end
881
-
882
- # Gets the access control policy for an instance resource. Returns an empty
883
- # policy if an instance exists but does not have a policy set.
884
- #
885
- # Authorization requires `spanner.instances.getIamPolicy` on
886
- # {Google::Iam::V1::GetIamPolicyRequest#resource resource}.
887
- #
888
- # @param resource [String]
889
- # REQUIRED: The resource for which the policy is being requested.
890
- # See the operation documentation for the appropriate value for this field.
891
- # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
892
- # OPTIONAL: A `GetPolicyOptions` object for specifying options to
893
- # `GetIamPolicy`. This field is only used by Cloud IAM.
894
- # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
895
- # can also be provided.
896
- # @param options [Google::Gax::CallOptions]
897
- # Overrides the default settings for this call, e.g, timeout,
898
- # retries, etc.
899
- # @yield [result, operation] Access the result along with the RPC operation
900
- # @yieldparam result [Google::Iam::V1::Policy]
901
- # @yieldparam operation [GRPC::ActiveCall::Operation]
902
- # @return [Google::Iam::V1::Policy]
903
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
904
- # @example
905
- # require "google/cloud/spanner/admin/instance"
906
- #
907
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
908
- # formatted_resource = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
909
- # response = instance_admin_client.get_iam_policy(formatted_resource)
910
-
911
- def get_iam_policy \
912
- resource,
913
- options_: nil,
914
- options: nil,
915
- &block
916
- req = {
917
- resource: resource,
918
- options: options_
919
- }.delete_if { |_, v| v.nil? }
920
- req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
921
- @get_iam_policy.call(req, options, &block)
922
- end
923
-
924
- # Returns permissions that the caller has on the specified instance resource.
925
- #
926
- # Attempting this RPC on a non-existent Cloud Spanner instance resource will
927
- # result in a NOT_FOUND error if the user has `spanner.instances.list`
928
- # permission on the containing Google Cloud Project. Otherwise returns an
929
- # empty set of permissions.
930
- #
931
- # @param resource [String]
932
- # REQUIRED: The resource for which the policy detail is being requested.
933
- # See the operation documentation for the appropriate value for this field.
934
- # @param permissions [Array<String>]
935
- # The set of permissions to check for the `resource`. Permissions with
936
- # wildcards (such as '*' or 'storage.*') are not allowed. For more
937
- # information see
938
- # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
939
- # @param options [Google::Gax::CallOptions]
940
- # Overrides the default settings for this call, e.g, timeout,
941
- # retries, etc.
942
- # @yield [result, operation] Access the result along with the RPC operation
943
- # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
944
- # @yieldparam operation [GRPC::ActiveCall::Operation]
945
- # @return [Google::Iam::V1::TestIamPermissionsResponse]
946
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
947
- # @example
948
- # require "google/cloud/spanner/admin/instance"
949
- #
950
- # instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
951
- # formatted_resource = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
952
- #
953
- # # TODO: Initialize `permissions`:
954
- # permissions = []
955
- # response = instance_admin_client.test_iam_permissions(formatted_resource, permissions)
956
-
957
- def test_iam_permissions \
958
- resource,
959
- permissions,
960
- options: nil,
961
- &block
962
- req = {
963
- resource: resource,
964
- permissions: permissions
965
- }.delete_if { |_, v| v.nil? }
966
- req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
967
- @test_iam_permissions.call(req, options, &block)
968
- end
969
- end
970
- end
971
- end
972
- end
973
- end
974
- end
975
- end