google-cloud-spanner-admin-database-v1 0.2.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.md +188 -190
- data/README.md +66 -2
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/client.rb +96 -70
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/operations.rb +94 -9
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/paths.rb +44 -0
- data/lib/google/cloud/spanner/admin/database/v1/version.rb +1 -1
- data/lib/google/spanner/admin/database/v1/backup_pb.rb +16 -0
- data/lib/google/spanner/admin/database/v1/common_pb.rb +18 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +19 -0
- data/proto_docs/google/api/field_behavior.rb +6 -0
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- data/proto_docs/google/spanner/admin/database/v1/backup.rb +72 -12
- data/proto_docs/google/spanner/admin/database/v1/common.rb +45 -0
- data/proto_docs/google/spanner/admin/database/v1/spanner_database_admin.rb +94 -5
- metadata +13 -9
@@ -67,7 +67,7 @@ module Google
|
|
67
67
|
parent_config = while namespace.any?
|
68
68
|
parent_name = namespace.join "::"
|
69
69
|
parent_const = const_get parent_name
|
70
|
-
break parent_const.configure if parent_const
|
70
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
71
71
|
namespace.pop
|
72
72
|
end
|
73
73
|
default_config = Client::Configuration.new parent_config
|
@@ -75,9 +75,9 @@ module Google
|
|
75
75
|
default_config.rpcs.list_databases.timeout = 3600.0
|
76
76
|
default_config.rpcs.list_databases.retry_policy = {
|
77
77
|
initial_delay: 1.0,
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
max_delay: 32.0,
|
79
|
+
multiplier: 1.3,
|
80
|
+
retry_codes: [14, 4]
|
81
81
|
}
|
82
82
|
|
83
83
|
default_config.rpcs.create_database.timeout = 3600.0
|
@@ -85,33 +85,33 @@ module Google
|
|
85
85
|
default_config.rpcs.get_database.timeout = 3600.0
|
86
86
|
default_config.rpcs.get_database.retry_policy = {
|
87
87
|
initial_delay: 1.0,
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
max_delay: 32.0,
|
89
|
+
multiplier: 1.3,
|
90
|
+
retry_codes: [14, 4]
|
91
91
|
}
|
92
92
|
|
93
93
|
default_config.rpcs.update_database_ddl.timeout = 3600.0
|
94
94
|
default_config.rpcs.update_database_ddl.retry_policy = {
|
95
95
|
initial_delay: 1.0,
|
96
|
-
|
97
|
-
|
98
|
-
|
96
|
+
max_delay: 32.0,
|
97
|
+
multiplier: 1.3,
|
98
|
+
retry_codes: [14, 4]
|
99
99
|
}
|
100
100
|
|
101
101
|
default_config.rpcs.drop_database.timeout = 3600.0
|
102
102
|
default_config.rpcs.drop_database.retry_policy = {
|
103
103
|
initial_delay: 1.0,
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
max_delay: 32.0,
|
105
|
+
multiplier: 1.3,
|
106
|
+
retry_codes: [14, 4]
|
107
107
|
}
|
108
108
|
|
109
109
|
default_config.rpcs.get_database_ddl.timeout = 3600.0
|
110
110
|
default_config.rpcs.get_database_ddl.retry_policy = {
|
111
111
|
initial_delay: 1.0,
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
max_delay: 32.0,
|
113
|
+
multiplier: 1.3,
|
114
|
+
retry_codes: [14, 4]
|
115
115
|
}
|
116
116
|
|
117
117
|
default_config.rpcs.set_iam_policy.timeout = 30.0
|
@@ -119,9 +119,9 @@ module Google
|
|
119
119
|
default_config.rpcs.get_iam_policy.timeout = 30.0
|
120
120
|
default_config.rpcs.get_iam_policy.retry_policy = {
|
121
121
|
initial_delay: 1.0,
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
max_delay: 32.0,
|
123
|
+
multiplier: 1.3,
|
124
|
+
retry_codes: [14, 4]
|
125
125
|
}
|
126
126
|
|
127
127
|
default_config.rpcs.test_iam_permissions.timeout = 30.0
|
@@ -131,33 +131,33 @@ module Google
|
|
131
131
|
default_config.rpcs.get_backup.timeout = 3600.0
|
132
132
|
default_config.rpcs.get_backup.retry_policy = {
|
133
133
|
initial_delay: 1.0,
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
max_delay: 32.0,
|
135
|
+
multiplier: 1.3,
|
136
|
+
retry_codes: [14, 4]
|
137
137
|
}
|
138
138
|
|
139
139
|
default_config.rpcs.update_backup.timeout = 3600.0
|
140
140
|
default_config.rpcs.update_backup.retry_policy = {
|
141
141
|
initial_delay: 1.0,
|
142
|
-
|
143
|
-
|
144
|
-
|
142
|
+
max_delay: 32.0,
|
143
|
+
multiplier: 1.3,
|
144
|
+
retry_codes: [14, 4]
|
145
145
|
}
|
146
146
|
|
147
147
|
default_config.rpcs.delete_backup.timeout = 3600.0
|
148
148
|
default_config.rpcs.delete_backup.retry_policy = {
|
149
149
|
initial_delay: 1.0,
|
150
|
-
|
151
|
-
|
152
|
-
|
150
|
+
max_delay: 32.0,
|
151
|
+
multiplier: 1.3,
|
152
|
+
retry_codes: [14, 4]
|
153
153
|
}
|
154
154
|
|
155
155
|
default_config.rpcs.list_backups.timeout = 3600.0
|
156
156
|
default_config.rpcs.list_backups.retry_policy = {
|
157
157
|
initial_delay: 1.0,
|
158
|
-
|
159
|
-
|
160
|
-
|
158
|
+
max_delay: 32.0,
|
159
|
+
multiplier: 1.3,
|
160
|
+
retry_codes: [14, 4]
|
161
161
|
}
|
162
162
|
|
163
163
|
default_config.rpcs.restore_database.timeout = 3600.0
|
@@ -165,17 +165,17 @@ module Google
|
|
165
165
|
default_config.rpcs.list_database_operations.timeout = 3600.0
|
166
166
|
default_config.rpcs.list_database_operations.retry_policy = {
|
167
167
|
initial_delay: 1.0,
|
168
|
-
|
169
|
-
|
170
|
-
|
168
|
+
max_delay: 32.0,
|
169
|
+
multiplier: 1.3,
|
170
|
+
retry_codes: [14, 4]
|
171
171
|
}
|
172
172
|
|
173
173
|
default_config.rpcs.list_backup_operations.timeout = 3600.0
|
174
174
|
default_config.rpcs.list_backup_operations.retry_policy = {
|
175
175
|
initial_delay: 1.0,
|
176
|
-
|
177
|
-
|
178
|
-
|
176
|
+
max_delay: 32.0,
|
177
|
+
multiplier: 1.3,
|
178
|
+
retry_codes: [14, 4]
|
179
179
|
}
|
180
180
|
|
181
181
|
default_config
|
@@ -239,7 +239,13 @@ module Google
|
|
239
239
|
|
240
240
|
# Create credentials
|
241
241
|
credentials = @config.credentials
|
242
|
-
|
242
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
243
|
+
# but only if the default endpoint does not have a region prefix.
|
244
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
245
|
+
@config.endpoint == Client.configure.endpoint &&
|
246
|
+
!@config.endpoint.split(".").first.include?("-")
|
247
|
+
credentials ||= Credentials.default scope: @config.scope,
|
248
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
243
249
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
244
250
|
credentials = Credentials.new credentials, scope: @config.scope
|
245
251
|
end
|
@@ -364,7 +370,7 @@ module Google
|
|
364
370
|
# @param options [::Gapic::CallOptions, ::Hash]
|
365
371
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
366
372
|
#
|
367
|
-
# @overload create_database(parent: nil, create_statement: nil, extra_statements: nil)
|
373
|
+
# @overload create_database(parent: nil, create_statement: nil, extra_statements: nil, encryption_config: nil)
|
368
374
|
# Pass arguments to `create_database` via keyword arguments. Note that at
|
369
375
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
370
376
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -383,6 +389,10 @@ module Google
|
|
383
389
|
# database. Statements can create tables, indexes, etc. These
|
384
390
|
# statements execute atomically with the creation of the database:
|
385
391
|
# if there is an error in any statement, the database is not created.
|
392
|
+
# @param encryption_config [::Google::Cloud::Spanner::Admin::Database::V1::EncryptionConfig, ::Hash]
|
393
|
+
# Optional. The encryption configuration for the database. If this field is not
|
394
|
+
# specified, Cloud Spanner will encrypt/decrypt all data at rest using
|
395
|
+
# Google default encryption.
|
386
396
|
#
|
387
397
|
# @yield [response, operation] Access the result along with the RPC operation
|
388
398
|
# @yieldparam response [::Gapic::Operation]
|
@@ -682,6 +692,8 @@ module Google
|
|
682
692
|
#
|
683
693
|
# @param database [::String]
|
684
694
|
# Required. The database whose schema we wish to get.
|
695
|
+
# Values are of the form
|
696
|
+
# `projects/<project>/instances/<instance>/databases/<database>`
|
685
697
|
#
|
686
698
|
# @yield [response, operation] Access the result along with the RPC operation
|
687
699
|
# @yieldparam response [::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlResponse]
|
@@ -988,7 +1000,7 @@ module Google
|
|
988
1000
|
# @param options [::Gapic::CallOptions, ::Hash]
|
989
1001
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
990
1002
|
#
|
991
|
-
# @overload create_backup(parent: nil, backup_id: nil, backup: nil)
|
1003
|
+
# @overload create_backup(parent: nil, backup_id: nil, backup: nil, encryption_config: nil)
|
992
1004
|
# Pass arguments to `create_backup` via keyword arguments. Note that at
|
993
1005
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
994
1006
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -1006,6 +1018,12 @@ module Google
|
|
1006
1018
|
# `projects/<project>/instances/<instance>/backups/<backup_id>`.
|
1007
1019
|
# @param backup [::Google::Cloud::Spanner::Admin::Database::V1::Backup, ::Hash]
|
1008
1020
|
# Required. The backup to create.
|
1021
|
+
# @param encryption_config [::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupEncryptionConfig, ::Hash]
|
1022
|
+
# Optional. The encryption configuration used to encrypt the backup. If this field is
|
1023
|
+
# not specified, the backup will use the same
|
1024
|
+
# encryption configuration as the database by default, namely
|
1025
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupEncryptionConfig#encryption_type encryption_type} =
|
1026
|
+
# `USE_DATABASE_ENCRYPTION`.
|
1009
1027
|
#
|
1010
1028
|
# @yield [response, operation] Access the result along with the RPC operation
|
1011
1029
|
# @yieldparam response [::Gapic::Operation]
|
@@ -1301,8 +1319,9 @@ module Google
|
|
1301
1319
|
# * `name`
|
1302
1320
|
# * `database`
|
1303
1321
|
# * `state`
|
1304
|
-
# * `create_time`
|
1305
|
-
# * `expire_time`
|
1322
|
+
# * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
1323
|
+
# * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
1324
|
+
# * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
1306
1325
|
# * `size_bytes`
|
1307
1326
|
#
|
1308
1327
|
# You can combine multiple expressions by enclosing each expression in
|
@@ -1406,7 +1425,7 @@ module Google
|
|
1406
1425
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1407
1426
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1408
1427
|
#
|
1409
|
-
# @overload restore_database(parent: nil, database_id: nil, backup: nil)
|
1428
|
+
# @overload restore_database(parent: nil, database_id: nil, backup: nil, encryption_config: nil)
|
1410
1429
|
# Pass arguments to `restore_database` via keyword arguments. Note that at
|
1411
1430
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1412
1431
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -1425,6 +1444,13 @@ module Google
|
|
1425
1444
|
# @param backup [::String]
|
1426
1445
|
# Name of the backup from which to restore. Values are of the form
|
1427
1446
|
# `projects/<project>/instances/<instance>/backups/<backup>`.
|
1447
|
+
# @param encryption_config [::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseEncryptionConfig, ::Hash]
|
1448
|
+
# Optional. An encryption configuration describing the encryption type and key
|
1449
|
+
# resources in Cloud KMS used to encrypt/decrypt the database to restore to.
|
1450
|
+
# If this field is not specified, the restored database will use
|
1451
|
+
# the same encryption configuration as the backup by default, namely
|
1452
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseEncryptionConfig#encryption_type encryption_type} =
|
1453
|
+
# `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
|
1428
1454
|
#
|
1429
1455
|
# @yield [response, operation] Access the result along with the RPC operation
|
1430
1456
|
# @yieldparam response [::Gapic::Operation]
|
@@ -1529,11 +1555,11 @@ module Google
|
|
1529
1555
|
# Here are a few examples:
|
1530
1556
|
#
|
1531
1557
|
# * `done:true` - The operation is complete.
|
1532
|
-
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND`
|
1533
|
-
# `(metadata.source_type:BACKUP) AND`
|
1534
|
-
# `(metadata.backup_info.backup:backup_howl) AND`
|
1535
|
-
# `(metadata.name:restored_howl) AND`
|
1536
|
-
# `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND`
|
1558
|
+
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
|
1559
|
+
# `(metadata.source_type:BACKUP) AND` \
|
1560
|
+
# `(metadata.backup_info.backup:backup_howl) AND` \
|
1561
|
+
# `(metadata.name:restored_howl) AND` \
|
1562
|
+
# `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
1537
1563
|
# `(error:*)` - Return operations where:
|
1538
1564
|
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseMetadata RestoreDatabaseMetadata}.
|
1539
1565
|
# * The database is restored from a backup.
|
@@ -1658,9 +1684,9 @@ module Google
|
|
1658
1684
|
# * `done:true` - The operation is complete.
|
1659
1685
|
# * `metadata.database:prod` - The database the backup was taken from has
|
1660
1686
|
# a name containing the string "prod".
|
1661
|
-
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND`
|
1662
|
-
# `(metadata.name:howl) AND`
|
1663
|
-
# `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND`
|
1687
|
+
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
1688
|
+
# `(metadata.name:howl) AND` \
|
1689
|
+
# `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
1664
1690
|
# `(error:*)` - Returns operations where:
|
1665
1691
|
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupMetadata CreateBackupMetadata}.
|
1666
1692
|
# * The backup name contains the string "howl".
|
@@ -1814,7 +1840,7 @@ module Google
|
|
1814
1840
|
config_attr :scope, nil, ::String, ::Array, nil
|
1815
1841
|
config_attr :lib_name, nil, ::String, nil
|
1816
1842
|
config_attr :lib_version, nil, ::String, nil
|
1817
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1843
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1818
1844
|
config_attr :interceptors, nil, ::Array, nil
|
1819
1845
|
config_attr :timeout, nil, ::Numeric, nil
|
1820
1846
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -1835,7 +1861,7 @@ module Google
|
|
1835
1861
|
def rpcs
|
1836
1862
|
@rpcs ||= begin
|
1837
1863
|
parent_rpcs = nil
|
1838
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
1864
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1839
1865
|
Rpcs.new parent_rpcs
|
1840
1866
|
end
|
1841
1867
|
end
|
@@ -1946,39 +1972,39 @@ module Google
|
|
1946
1972
|
|
1947
1973
|
# @private
|
1948
1974
|
def initialize parent_rpcs = nil
|
1949
|
-
list_databases_config = parent_rpcs
|
1975
|
+
list_databases_config = parent_rpcs.list_databases if parent_rpcs.respond_to? :list_databases
|
1950
1976
|
@list_databases = ::Gapic::Config::Method.new list_databases_config
|
1951
|
-
create_database_config = parent_rpcs
|
1977
|
+
create_database_config = parent_rpcs.create_database if parent_rpcs.respond_to? :create_database
|
1952
1978
|
@create_database = ::Gapic::Config::Method.new create_database_config
|
1953
|
-
get_database_config = parent_rpcs
|
1979
|
+
get_database_config = parent_rpcs.get_database if parent_rpcs.respond_to? :get_database
|
1954
1980
|
@get_database = ::Gapic::Config::Method.new get_database_config
|
1955
|
-
update_database_ddl_config = parent_rpcs
|
1981
|
+
update_database_ddl_config = parent_rpcs.update_database_ddl if parent_rpcs.respond_to? :update_database_ddl
|
1956
1982
|
@update_database_ddl = ::Gapic::Config::Method.new update_database_ddl_config
|
1957
|
-
drop_database_config = parent_rpcs
|
1983
|
+
drop_database_config = parent_rpcs.drop_database if parent_rpcs.respond_to? :drop_database
|
1958
1984
|
@drop_database = ::Gapic::Config::Method.new drop_database_config
|
1959
|
-
get_database_ddl_config = parent_rpcs
|
1985
|
+
get_database_ddl_config = parent_rpcs.get_database_ddl if parent_rpcs.respond_to? :get_database_ddl
|
1960
1986
|
@get_database_ddl = ::Gapic::Config::Method.new get_database_ddl_config
|
1961
|
-
set_iam_policy_config = parent_rpcs
|
1987
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
1962
1988
|
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1963
|
-
get_iam_policy_config = parent_rpcs
|
1989
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
1964
1990
|
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
1965
|
-
test_iam_permissions_config = parent_rpcs
|
1991
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
1966
1992
|
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1967
|
-
create_backup_config = parent_rpcs
|
1993
|
+
create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup
|
1968
1994
|
@create_backup = ::Gapic::Config::Method.new create_backup_config
|
1969
|
-
get_backup_config = parent_rpcs
|
1995
|
+
get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
|
1970
1996
|
@get_backup = ::Gapic::Config::Method.new get_backup_config
|
1971
|
-
update_backup_config = parent_rpcs
|
1997
|
+
update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup
|
1972
1998
|
@update_backup = ::Gapic::Config::Method.new update_backup_config
|
1973
|
-
delete_backup_config = parent_rpcs
|
1999
|
+
delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
|
1974
2000
|
@delete_backup = ::Gapic::Config::Method.new delete_backup_config
|
1975
|
-
list_backups_config = parent_rpcs
|
2001
|
+
list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
|
1976
2002
|
@list_backups = ::Gapic::Config::Method.new list_backups_config
|
1977
|
-
restore_database_config = parent_rpcs
|
2003
|
+
restore_database_config = parent_rpcs.restore_database if parent_rpcs.respond_to? :restore_database
|
1978
2004
|
@restore_database = ::Gapic::Config::Method.new restore_database_config
|
1979
|
-
list_database_operations_config = parent_rpcs
|
2005
|
+
list_database_operations_config = parent_rpcs.list_database_operations if parent_rpcs.respond_to? :list_database_operations
|
1980
2006
|
@list_database_operations = ::Gapic::Config::Method.new list_database_operations_config
|
1981
|
-
list_backup_operations_config = parent_rpcs
|
2007
|
+
list_backup_operations_config = parent_rpcs.list_backup_operations if parent_rpcs.respond_to? :list_backup_operations
|
1982
2008
|
@list_backup_operations = ::Gapic::Config::Method.new list_backup_operations_config
|
1983
2009
|
|
1984
2010
|
yield self if block_given?
|
@@ -105,8 +105,13 @@ module Google
|
|
105
105
|
# Lists operations that match the specified filter in the request. If the
|
106
106
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
107
107
|
#
|
108
|
-
# NOTE: the `name` binding
|
109
|
-
# to use different resource name schemes, such as `users/*/operations`.
|
108
|
+
# NOTE: the `name` binding allows API services to override the binding
|
109
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
110
|
+
# override the binding, API services can add a binding such as
|
111
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
112
|
+
# For backwards compatibility, the default name includes the operations
|
113
|
+
# collection id, however overriding users must ensure the name binding
|
114
|
+
# is the parent resource, without the operations collection id.
|
110
115
|
#
|
111
116
|
# @overload list_operations(request, options = nil)
|
112
117
|
# Pass arguments to `list_operations` via a request object, either of type
|
@@ -124,7 +129,7 @@ module Google
|
|
124
129
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
125
130
|
#
|
126
131
|
# @param name [::String]
|
127
|
-
# The name of the operation
|
132
|
+
# The name of the operation's parent resource.
|
128
133
|
# @param filter [::String]
|
129
134
|
# The standard list filter.
|
130
135
|
# @param page_size [::Integer]
|
@@ -392,6 +397,79 @@ module Google
|
|
392
397
|
raise ::Google::Cloud::Error.from_error(e)
|
393
398
|
end
|
394
399
|
|
400
|
+
##
|
401
|
+
# Waits for the specified long-running operation until it is done or reaches
|
402
|
+
# at most a specified timeout, returning the latest state. If the operation
|
403
|
+
# is already done, the latest state is immediately returned. If the timeout
|
404
|
+
# specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
|
405
|
+
# timeout is used. If the server does not support this method, it returns
|
406
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
407
|
+
# Note that this method is on a best-effort basis. It may return the latest
|
408
|
+
# state before the specified timeout (including immediately), meaning even an
|
409
|
+
# immediate response is no guarantee that the operation is done.
|
410
|
+
#
|
411
|
+
# @overload wait_operation(request, options = nil)
|
412
|
+
# Pass arguments to `wait_operation` via a request object, either of type
|
413
|
+
# {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
|
414
|
+
#
|
415
|
+
# @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
|
416
|
+
# A request object representing the call parameters. Required. To specify no
|
417
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
418
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
419
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
420
|
+
#
|
421
|
+
# @overload wait_operation(name: nil, timeout: nil)
|
422
|
+
# Pass arguments to `wait_operation` via keyword arguments. Note that at
|
423
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
424
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
425
|
+
#
|
426
|
+
# @param name [::String]
|
427
|
+
# The name of the operation resource to wait on.
|
428
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
429
|
+
# The maximum duration to wait before timing out. If left blank, the wait
|
430
|
+
# will be at most the time permitted by the underlying HTTP/RPC protocol.
|
431
|
+
# If RPC context deadline is also specified, the shorter one will be used.
|
432
|
+
#
|
433
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
434
|
+
# @yieldparam response [::Gapic::Operation]
|
435
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
436
|
+
#
|
437
|
+
# @return [::Gapic::Operation]
|
438
|
+
#
|
439
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
440
|
+
#
|
441
|
+
def wait_operation request, options = nil
|
442
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
443
|
+
|
444
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
|
445
|
+
|
446
|
+
# Converts hash and nil to an options object
|
447
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
448
|
+
|
449
|
+
# Customize the options with defaults
|
450
|
+
metadata = @config.rpcs.wait_operation.metadata.to_h
|
451
|
+
|
452
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
453
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
454
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
455
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
|
456
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
457
|
+
|
458
|
+
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
|
459
|
+
metadata: metadata,
|
460
|
+
retry_policy: @config.rpcs.wait_operation.retry_policy
|
461
|
+
options.apply_defaults metadata: @config.metadata,
|
462
|
+
retry_policy: @config.retry_policy
|
463
|
+
|
464
|
+
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
|
465
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
466
|
+
yield response, operation if block_given?
|
467
|
+
return response
|
468
|
+
end
|
469
|
+
rescue ::GRPC::BadStatus => e
|
470
|
+
raise ::Google::Cloud::Error.from_error(e)
|
471
|
+
end
|
472
|
+
|
395
473
|
##
|
396
474
|
# Configuration class for the Operations API.
|
397
475
|
#
|
@@ -484,7 +562,7 @@ module Google
|
|
484
562
|
config_attr :scope, nil, ::String, ::Array, nil
|
485
563
|
config_attr :lib_name, nil, ::String, nil
|
486
564
|
config_attr :lib_version, nil, ::String, nil
|
487
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
565
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
488
566
|
config_attr :interceptors, nil, ::Array, nil
|
489
567
|
config_attr :timeout, nil, ::Numeric, nil
|
490
568
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -505,7 +583,7 @@ module Google
|
|
505
583
|
def rpcs
|
506
584
|
@rpcs ||= begin
|
507
585
|
parent_rpcs = nil
|
508
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
586
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
509
587
|
Rpcs.new parent_rpcs
|
510
588
|
end
|
511
589
|
end
|
@@ -548,17 +626,24 @@ module Google
|
|
548
626
|
# @return [::Gapic::Config::Method]
|
549
627
|
#
|
550
628
|
attr_reader :cancel_operation
|
629
|
+
##
|
630
|
+
# RPC-specific configuration for `wait_operation`
|
631
|
+
# @return [::Gapic::Config::Method]
|
632
|
+
#
|
633
|
+
attr_reader :wait_operation
|
551
634
|
|
552
635
|
# @private
|
553
636
|
def initialize parent_rpcs = nil
|
554
|
-
list_operations_config = parent_rpcs
|
637
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
555
638
|
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
556
|
-
get_operation_config = parent_rpcs
|
639
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
557
640
|
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
558
|
-
delete_operation_config = parent_rpcs
|
641
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
559
642
|
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
560
|
-
cancel_operation_config = parent_rpcs
|
643
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
561
644
|
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
645
|
+
wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
|
646
|
+
@wait_operation = ::Gapic::Config::Method.new wait_operation_config
|
562
647
|
|
563
648
|
yield self if block_given?
|
564
649
|
end
|