google-cloud-spanner 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google-cloud-spanner.rb +5 -4
- data/lib/google/cloud/spanner.rb +2 -346
- data/lib/google/cloud/spanner/admin/database.rb +39 -3
- data/lib/google/cloud/spanner/admin/database/credentials.rb +5 -9
- data/lib/google/cloud/spanner/admin/database/v1.rb +69 -28
- data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +46 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +111 -53
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +63 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +8 -19
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +93 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +15 -9
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +2 -1
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +2 -12
- data/lib/google/cloud/spanner/admin/instance.rb +39 -3
- data/lib/google/cloud/spanner/admin/instance/credentials.rb +5 -9
- data/lib/google/cloud/spanner/admin/instance/v1.rb +69 -28
- data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +46 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +63 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +8 -19
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +93 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +15 -9
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +8 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +2 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +2 -12
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +125 -58
- data/lib/google/cloud/spanner/database/job.rb +1 -0
- data/lib/google/cloud/spanner/instance/job.rb +1 -0
- data/lib/google/cloud/spanner/v1/credentials.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +9 -6
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +1 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +1 -0
- data/lib/google/cloud/spanner/v1/spanner_client.rb +28 -26
- data/lib/google/cloud/spanner/version.rb +1 -1
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +1 -1
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +3 -2
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +1 -1
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +3 -2
- data/lib/google/spanner/v1/keys_pb.rb +1 -0
- data/lib/google/spanner/v1/mutation_pb.rb +1 -0
- data/lib/google/spanner/v1/query_plan_pb.rb +1 -0
- data/lib/google/spanner/v1/result_set_pb.rb +1 -0
- data/lib/google/spanner/v1/spanner_pb.rb +1 -0
- data/lib/google/spanner/v1/spanner_services_pb.rb +1 -0
- data/lib/google/spanner/v1/transaction_pb.rb +1 -0
- data/lib/google/spanner/v1/type_pb.rb +1 -0
- metadata +14 -8
- data/lib/google/cloud/spanner/admin/database/v1/doc/overview.rb +0 -58
- data/lib/google/cloud/spanner/admin/instance/v1/doc/overview.rb +0 -58
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright 2018 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
|
+
require "googleauth"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Spanner
|
21
|
+
module Admin
|
22
|
+
module Instance
|
23
|
+
module V1
|
24
|
+
class Credentials < Google::Auth::Credentials
|
25
|
+
SCOPE = [
|
26
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
27
|
+
"https://www.googleapis.com/auth/spanner.admin"
|
28
|
+
].freeze
|
29
|
+
PATH_ENV_VARS = %w(SPANNER_ADMIN_INSTANCE_CREDENTIALS
|
30
|
+
SPANNER_ADMIN_INSTANCE_KEYFILE
|
31
|
+
GOOGLE_CLOUD_CREDENTIALS
|
32
|
+
GOOGLE_CLOUD_KEYFILE
|
33
|
+
GCLOUD_KEYFILE)
|
34
|
+
JSON_ENV_VARS = %w(SPANNER_ADMIN_INSTANCE_CREDENTIALS_JSON
|
35
|
+
SPANNER_ADMIN_INSTANCE_KEYFILE_JSON
|
36
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
37
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
38
|
+
GCLOUD_KEYFILE_JSON)
|
39
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Copyright 2018 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 Iam
|
18
|
+
module V1
|
19
|
+
# Request message for +SetIamPolicy+ method.
|
20
|
+
# @!attribute [rw] resource
|
21
|
+
# @return [String]
|
22
|
+
# REQUIRED: The resource for which the policy is being specified.
|
23
|
+
# +resource+ is usually specified as a path. For example, a Project
|
24
|
+
# resource is specified as +projects/\\{project}+.
|
25
|
+
# @!attribute [rw] policy
|
26
|
+
# @return [Google::Iam::V1::Policy]
|
27
|
+
# REQUIRED: The complete policy to be applied to the +resource+. The size of
|
28
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
29
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
30
|
+
# might reject them.
|
31
|
+
class SetIamPolicyRequest; end
|
32
|
+
|
33
|
+
# Request message for +GetIamPolicy+ method.
|
34
|
+
# @!attribute [rw] resource
|
35
|
+
# @return [String]
|
36
|
+
# REQUIRED: The resource for which the policy is being requested.
|
37
|
+
# +resource+ is usually specified as a path. For example, a Project
|
38
|
+
# resource is specified as +projects/\\{project}+.
|
39
|
+
class GetIamPolicyRequest; end
|
40
|
+
|
41
|
+
# Request message for +TestIamPermissions+ method.
|
42
|
+
# @!attribute [rw] resource
|
43
|
+
# @return [String]
|
44
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
45
|
+
# +resource+ is usually specified as a path. For example, a Project
|
46
|
+
# resource is specified as +projects/\\{project}+.
|
47
|
+
# @!attribute [rw] permissions
|
48
|
+
# @return [Array<String>]
|
49
|
+
# The set of permissions to check for the +resource+. Permissions with
|
50
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
51
|
+
# information see
|
52
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
53
|
+
class TestIamPermissionsRequest; end
|
54
|
+
|
55
|
+
# Response message for +TestIamPermissions+ method.
|
56
|
+
# @!attribute [rw] permissions
|
57
|
+
# @return [Array<String>]
|
58
|
+
# A subset of +TestPermissionsRequest.permissions+ that the caller is
|
59
|
+
# allowed.
|
60
|
+
class TestIamPermissionsResponse; end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Iam
|
17
18
|
module V1
|
@@ -85,17 +86,17 @@ module Google
|
|
85
86
|
# * +allAuthenticatedUsers+: A special identifier that represents anyone
|
86
87
|
# who is authenticated with a Google account or a service account.
|
87
88
|
#
|
88
|
-
# * +user
|
89
|
+
# * +user:\\{emailid}+: An email address that represents a specific Google
|
89
90
|
# account. For example, +alice@gmail.com+ or +joe@example.com+.
|
90
91
|
#
|
91
92
|
#
|
92
|
-
# * +serviceAccount
|
93
|
+
# * +serviceAccount:\\{emailid}+: An email address that represents a service
|
93
94
|
# account. For example, +my-other-app@appspot.gserviceaccount.com+.
|
94
95
|
#
|
95
|
-
# * +group
|
96
|
+
# * +group:\\{emailid}+: An email address that represents a Google group.
|
96
97
|
# For example, +admins@example.com+.
|
97
98
|
#
|
98
|
-
# * +domain
|
99
|
+
# * +domain:\\{domain}+: A Google Apps domain name that represents all the
|
99
100
|
# users of that domain. For example, +google.com+ or +example.com+.
|
100
101
|
class Binding; end
|
101
102
|
|
@@ -121,19 +122,7 @@ module Google
|
|
121
122
|
# A single identity requesting access for a Cloud Platform resource.
|
122
123
|
# Follows the same format of Binding.members.
|
123
124
|
# Required
|
124
|
-
class BindingDelta
|
125
|
-
# The type of action performed on a Binding in a policy.
|
126
|
-
module Action
|
127
|
-
# Unspecified.
|
128
|
-
ACTION_UNSPECIFIED = 0
|
129
|
-
|
130
|
-
# Addition of a Binding.
|
131
|
-
ADD = 1
|
132
|
-
|
133
|
-
# Removal of a Binding.
|
134
|
-
REMOVE = 2
|
135
|
-
end
|
136
|
-
end
|
125
|
+
class BindingDelta; end
|
137
126
|
end
|
138
127
|
end
|
139
|
-
end
|
128
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Copyright 2018 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 Longrunning
|
18
|
+
# This resource represents a long-running operation that is the result of a
|
19
|
+
# network API call.
|
20
|
+
# @!attribute [rw] name
|
21
|
+
# @return [String]
|
22
|
+
# The server-assigned name, which is only unique within the same service that
|
23
|
+
# originally returns it. If you use the default HTTP mapping, the
|
24
|
+
# +name+ should have the format of +operations/some/unique/name+.
|
25
|
+
# @!attribute [rw] metadata
|
26
|
+
# @return [Google::Protobuf::Any]
|
27
|
+
# Service-specific metadata associated with the operation. It typically
|
28
|
+
# contains progress information and common metadata such as create time.
|
29
|
+
# Some services might not provide such metadata. Any method that returns a
|
30
|
+
# long-running operation should document the metadata type, if any.
|
31
|
+
# @!attribute [rw] done
|
32
|
+
# @return [true, false]
|
33
|
+
# If the value is +false+, it means the operation is still in progress.
|
34
|
+
# If true, the operation is completed, and either +error+ or +response+ is
|
35
|
+
# available.
|
36
|
+
# @!attribute [rw] error
|
37
|
+
# @return [Google::Rpc::Status]
|
38
|
+
# The error result of the operation in case of failure or cancellation.
|
39
|
+
# @!attribute [rw] response
|
40
|
+
# @return [Google::Protobuf::Any]
|
41
|
+
# The normal response of the operation in case of success. If the original
|
42
|
+
# method returns no data on success, such as +Delete+, the response is
|
43
|
+
# +google.protobuf.Empty+. If the original method is standard
|
44
|
+
# +Get+/+Create+/+Update+, the response should be the resource. For other
|
45
|
+
# methods, the response should have the type +XxxResponse+, where +Xxx+
|
46
|
+
# is the original method name. For example, if the original method name
|
47
|
+
# is +TakeSnapshot()+, the inferred response type is
|
48
|
+
# +TakeSnapshotResponse+.
|
49
|
+
class Operation; end
|
50
|
+
|
51
|
+
# The request message for {Google::Longrunning::Operations::GetOperation Operations::GetOperation}.
|
52
|
+
# @!attribute [rw] name
|
53
|
+
# @return [String]
|
54
|
+
# The name of the operation resource.
|
55
|
+
class GetOperationRequest; end
|
56
|
+
|
57
|
+
# The request message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
58
|
+
# @!attribute [rw] name
|
59
|
+
# @return [String]
|
60
|
+
# The name of the operation collection.
|
61
|
+
# @!attribute [rw] filter
|
62
|
+
# @return [String]
|
63
|
+
# The standard list filter.
|
64
|
+
# @!attribute [rw] page_size
|
65
|
+
# @return [Integer]
|
66
|
+
# The standard list page size.
|
67
|
+
# @!attribute [rw] page_token
|
68
|
+
# @return [String]
|
69
|
+
# The standard list page token.
|
70
|
+
class ListOperationsRequest; end
|
71
|
+
|
72
|
+
# The response message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
|
73
|
+
# @!attribute [rw] operations
|
74
|
+
# @return [Array<Google::Longrunning::Operation>]
|
75
|
+
# A list of operations that matches the specified filter in the request.
|
76
|
+
# @!attribute [rw] next_page_token
|
77
|
+
# @return [String]
|
78
|
+
# The standard List next-page token.
|
79
|
+
class ListOperationsResponse; end
|
80
|
+
|
81
|
+
# The request message for {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}.
|
82
|
+
# @!attribute [rw] name
|
83
|
+
# @return [String]
|
84
|
+
# The name of the operation resource to be cancelled.
|
85
|
+
class CancelOperationRequest; end
|
86
|
+
|
87
|
+
# The request message for {Google::Longrunning::Operations::DeleteOperation Operations::DeleteOperation}.
|
88
|
+
# @!attribute [rw] name
|
89
|
+
# @return [String]
|
90
|
+
# The name of the operation resource to be deleted.
|
91
|
+
class DeleteOperationRequest; end
|
92
|
+
end
|
93
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Protobuf
|
17
18
|
# +Any+ contains an arbitrary serialized protocol buffer message along with a
|
@@ -95,17 +96,18 @@ module Google
|
|
95
96
|
# }
|
96
97
|
# @!attribute [rw] type_url
|
97
98
|
# @return [String]
|
98
|
-
# A URL/resource name
|
99
|
-
#
|
99
|
+
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
+
# protocol buffer message. The last segment of the URL's path must represent
|
101
|
+
# the fully qualified name of the type (as in
|
102
|
+
# +path/google.protobuf.Duration+). The name should be in a canonical form
|
103
|
+
# (e.g., leading "." is not accepted).
|
100
104
|
#
|
101
|
-
#
|
102
|
-
#
|
105
|
+
# In practice, teams usually precompile into the binary all types that they
|
106
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
107
|
+
# scheme +http+, +https+, or no scheme, one can optionally set up a type
|
108
|
+
# server that maps type URLs to message definitions as follows:
|
103
109
|
#
|
104
110
|
# * If no scheme is provided, +https+ is assumed.
|
105
|
-
# * The last segment of the URL's path must represent the fully
|
106
|
-
# qualified name of the type (as in +path/google.protobuf.Duration+).
|
107
|
-
# The name should be in a canonical form (e.g., leading "." is
|
108
|
-
# not accepted).
|
109
111
|
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
110
112
|
# value in binary format, or produce an error.
|
111
113
|
# * Applications are allowed to cache lookup results based on the
|
@@ -114,6 +116,10 @@ module Google
|
|
114
116
|
# on changes to types. (Use versioned type names to manage
|
115
117
|
# breaking changes.)
|
116
118
|
#
|
119
|
+
# Note: this functionality is not currently available in the official
|
120
|
+
# protobuf release, and it is not used for type URLs beginning with
|
121
|
+
# type.googleapis.com.
|
122
|
+
#
|
117
123
|
# Schemes other than +http+, +https+ (or the empty scheme) might be
|
118
124
|
# used with implementation specific semantics.
|
119
125
|
# @!attribute [rw] value
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright 2018 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 Protobuf
|
18
|
+
# A generic empty message that you can re-use to avoid defining duplicated
|
19
|
+
# empty messages in your APIs. A typical example is to use it as the request
|
20
|
+
# or the response type of an API method. For instance:
|
21
|
+
#
|
22
|
+
# service Foo {
|
23
|
+
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
24
|
+
# }
|
25
|
+
#
|
26
|
+
# The JSON representation for +Empty+ is empty JSON object +{}+.
|
27
|
+
class Empty; end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Protobuf
|
17
18
|
# +FieldMask+ represents a set of symbolic field paths, for example:
|
@@ -215,6 +216,12 @@ module Google
|
|
215
216
|
#
|
216
217
|
# Note that oneof type names ("test_oneof" in this case) cannot be used in
|
217
218
|
# paths.
|
219
|
+
#
|
220
|
+
# == Field Mask Verification
|
221
|
+
#
|
222
|
+
# The implementation of any API method which has a FieldMask type field in the
|
223
|
+
# request should verify the included field paths, and return an
|
224
|
+
# +INVALID_ARGUMENT+ error if any path is duplicated or unmappable.
|
218
225
|
# @!attribute [rw] paths
|
219
226
|
# @return [Array<String>]
|
220
227
|
# The set of field mask paths.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Rpc
|
17
18
|
# The +Status+ type defines a logical error model that is suitable for different
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,21 +12,11 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
|
15
16
|
module Google
|
16
17
|
module Spanner
|
17
18
|
module Admin
|
18
19
|
module Instance
|
19
|
-
##
|
20
|
-
# # Cloud Spanner Instance Admin API Contents
|
21
|
-
#
|
22
|
-
# | Class | Description |
|
23
|
-
# | ----- | ----------- |
|
24
|
-
# | [InstanceAdminClient][] | |
|
25
|
-
# | [Data Types][] | Data types for Google::Cloud::Spanner::Admin::Instance::V1 |
|
26
|
-
#
|
27
|
-
# [InstanceAdminClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-spanner-admin-instance/latest/google/spanner/admin/instance/v1/instanceadminclient
|
28
|
-
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-spanner-admin-instance/latest/google/spanner/admin/instance/v1/datatypes
|
29
|
-
#
|
30
20
|
module V1
|
31
21
|
# A possible configuration for a Cloud Spanner instance. Configurations
|
32
22
|
# define the geographic placement of nodes and their replication.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -18,9 +18,7 @@
|
|
18
18
|
# and updates to that file get reflected here through a refresh process.
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
|
-
|
22
|
-
# The only allowed edits are to method and file documentation. A 3-way
|
23
|
-
# merge preserves those additions if the generated source changes.
|
21
|
+
|
24
22
|
|
25
23
|
require "json"
|
26
24
|
require "pathname"
|
@@ -30,7 +28,7 @@ require "google/gax/operation"
|
|
30
28
|
require "google/longrunning/operations_client"
|
31
29
|
|
32
30
|
require "google/spanner/admin/instance/v1/spanner_instance_admin_pb"
|
33
|
-
require "google/cloud/spanner/admin/instance/credentials"
|
31
|
+
require "google/cloud/spanner/admin/instance/v1/credentials"
|
34
32
|
|
35
33
|
module Google
|
36
34
|
module Cloud
|
@@ -63,6 +61,7 @@ module Google
|
|
63
61
|
# @!attribute [r] instance_admin_stub
|
64
62
|
# @return [Google::Spanner::Admin::Instance::V1::InstanceAdmin::Stub]
|
65
63
|
class InstanceAdminClient
|
64
|
+
# @private
|
66
65
|
attr_reader :instance_admin_stub
|
67
66
|
|
68
67
|
# The default address of the service.
|
@@ -71,6 +70,9 @@ module Google
|
|
71
70
|
# The default port of the service.
|
72
71
|
DEFAULT_SERVICE_PORT = 443
|
73
72
|
|
73
|
+
# The default set of gRPC interceptors.
|
74
|
+
GRPC_INTERCEPTORS = []
|
75
|
+
|
74
76
|
DEFAULT_TIMEOUT = 30
|
75
77
|
|
76
78
|
PAGE_DESCRIPTORS = {
|
@@ -95,7 +97,8 @@ module Google
|
|
95
97
|
|
96
98
|
# @private
|
97
99
|
class OperationsClient < Google::Longrunning::OperationsClient
|
98
|
-
SERVICE_ADDRESS = SERVICE_ADDRESS
|
100
|
+
self::SERVICE_ADDRESS = InstanceAdminClient::SERVICE_ADDRESS
|
101
|
+
self::GRPC_INTERCEPTORS = InstanceAdminClient::GRPC_INTERCEPTORS
|
99
102
|
end
|
100
103
|
|
101
104
|
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
@@ -171,11 +174,18 @@ module Google
|
|
171
174
|
# or the specified config is missing data points.
|
172
175
|
# @param timeout [Numeric]
|
173
176
|
# The default timeout, in seconds, for calls made through this client.
|
177
|
+
# @param metadata [Hash]
|
178
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
179
|
+
# @param exception_transformer [Proc]
|
180
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
181
|
+
# custom error handling.
|
174
182
|
def initialize \
|
175
183
|
credentials: nil,
|
176
184
|
scopes: ALL_SCOPES,
|
177
185
|
client_config: {},
|
178
186
|
timeout: DEFAULT_TIMEOUT,
|
187
|
+
metadata: nil,
|
188
|
+
exception_transformer: nil,
|
179
189
|
lib_name: nil,
|
180
190
|
lib_version: ""
|
181
191
|
# These require statements are intentionally placed here to initialize
|
@@ -184,7 +194,7 @@ module Google
|
|
184
194
|
require "google/gax/grpc"
|
185
195
|
require "google/spanner/admin/instance/v1/spanner_instance_admin_services_pb"
|
186
196
|
|
187
|
-
credentials ||= Google::Cloud::Spanner::Admin::Instance::Credentials.default
|
197
|
+
credentials ||= Google::Cloud::Spanner::Admin::Instance::V1::Credentials.default
|
188
198
|
|
189
199
|
@operations_client = OperationsClient.new(
|
190
200
|
credentials: credentials,
|
@@ -196,7 +206,7 @@ module Google
|
|
196
206
|
)
|
197
207
|
|
198
208
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
199
|
-
updater_proc = Google::Cloud::Spanner::Admin::Instance::Credentials.new(credentials).updater_proc
|
209
|
+
updater_proc = Google::Cloud::Spanner::Admin::Instance::V1::Credentials.new(credentials).updater_proc
|
200
210
|
end
|
201
211
|
if credentials.is_a?(GRPC::Core::Channel)
|
202
212
|
channel = credentials
|
@@ -220,6 +230,7 @@ module Google
|
|
220
230
|
google_api_client.freeze
|
221
231
|
|
222
232
|
headers = { :"x-goog-api-client" => google_api_client }
|
233
|
+
headers.merge!(metadata) unless metadata.nil?
|
223
234
|
client_config_file = Pathname.new(__dir__).join(
|
224
235
|
"instance_admin_client_config.json"
|
225
236
|
)
|
@@ -232,13 +243,14 @@ module Google
|
|
232
243
|
timeout,
|
233
244
|
page_descriptors: PAGE_DESCRIPTORS,
|
234
245
|
errors: Google::Gax::Grpc::API_ERRORS,
|
235
|
-
|
246
|
+
metadata: headers
|
236
247
|
)
|
237
248
|
end
|
238
249
|
|
239
250
|
# Allow overriding the service path/port in subclasses.
|
240
251
|
service_path = self.class::SERVICE_ADDRESS
|
241
252
|
port = self.class::DEFAULT_SERVICE_PORT
|
253
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
242
254
|
@instance_admin_stub = Google::Gax::Grpc.create_stub(
|
243
255
|
service_path,
|
244
256
|
port,
|
@@ -246,48 +258,59 @@ module Google
|
|
246
258
|
channel: channel,
|
247
259
|
updater_proc: updater_proc,
|
248
260
|
scopes: scopes,
|
261
|
+
interceptors: interceptors,
|
249
262
|
&Google::Spanner::Admin::Instance::V1::InstanceAdmin::Stub.method(:new)
|
250
263
|
)
|
251
264
|
|
252
265
|
@list_instance_configs = Google::Gax.create_api_call(
|
253
266
|
@instance_admin_stub.method(:list_instance_configs),
|
254
|
-
defaults["list_instance_configs"]
|
267
|
+
defaults["list_instance_configs"],
|
268
|
+
exception_transformer: exception_transformer
|
255
269
|
)
|
256
270
|
@get_instance_config = Google::Gax.create_api_call(
|
257
271
|
@instance_admin_stub.method(:get_instance_config),
|
258
|
-
defaults["get_instance_config"]
|
272
|
+
defaults["get_instance_config"],
|
273
|
+
exception_transformer: exception_transformer
|
259
274
|
)
|
260
275
|
@list_instances = Google::Gax.create_api_call(
|
261
276
|
@instance_admin_stub.method(:list_instances),
|
262
|
-
defaults["list_instances"]
|
277
|
+
defaults["list_instances"],
|
278
|
+
exception_transformer: exception_transformer
|
263
279
|
)
|
264
280
|
@get_instance = Google::Gax.create_api_call(
|
265
281
|
@instance_admin_stub.method(:get_instance),
|
266
|
-
defaults["get_instance"]
|
282
|
+
defaults["get_instance"],
|
283
|
+
exception_transformer: exception_transformer
|
267
284
|
)
|
268
285
|
@create_instance = Google::Gax.create_api_call(
|
269
286
|
@instance_admin_stub.method(:create_instance),
|
270
|
-
defaults["create_instance"]
|
287
|
+
defaults["create_instance"],
|
288
|
+
exception_transformer: exception_transformer
|
271
289
|
)
|
272
290
|
@update_instance = Google::Gax.create_api_call(
|
273
291
|
@instance_admin_stub.method(:update_instance),
|
274
|
-
defaults["update_instance"]
|
292
|
+
defaults["update_instance"],
|
293
|
+
exception_transformer: exception_transformer
|
275
294
|
)
|
276
295
|
@delete_instance = Google::Gax.create_api_call(
|
277
296
|
@instance_admin_stub.method(:delete_instance),
|
278
|
-
defaults["delete_instance"]
|
297
|
+
defaults["delete_instance"],
|
298
|
+
exception_transformer: exception_transformer
|
279
299
|
)
|
280
300
|
@set_iam_policy = Google::Gax.create_api_call(
|
281
301
|
@instance_admin_stub.method(:set_iam_policy),
|
282
|
-
defaults["set_iam_policy"]
|
302
|
+
defaults["set_iam_policy"],
|
303
|
+
exception_transformer: exception_transformer
|
283
304
|
)
|
284
305
|
@get_iam_policy = Google::Gax.create_api_call(
|
285
306
|
@instance_admin_stub.method(:get_iam_policy),
|
286
|
-
defaults["get_iam_policy"]
|
307
|
+
defaults["get_iam_policy"],
|
308
|
+
exception_transformer: exception_transformer
|
287
309
|
)
|
288
310
|
@test_iam_permissions = Google::Gax.create_api_call(
|
289
311
|
@instance_admin_stub.method(:test_iam_permissions),
|
290
|
-
defaults["test_iam_permissions"]
|
312
|
+
defaults["test_iam_permissions"],
|
313
|
+
exception_transformer: exception_transformer
|
291
314
|
)
|
292
315
|
end
|
293
316
|
|
@@ -308,6 +331,9 @@ module Google
|
|
308
331
|
# @param options [Google::Gax::CallOptions]
|
309
332
|
# Overrides the default settings for this call, e.g, timeout,
|
310
333
|
# retries, etc.
|
334
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
335
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::InstanceConfig>]
|
336
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
311
337
|
# @return [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::InstanceConfig>]
|
312
338
|
# An enumerable of Google::Spanner::Admin::Instance::V1::InstanceConfig instances.
|
313
339
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -315,9 +341,9 @@ module Google
|
|
315
341
|
# object.
|
316
342
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
317
343
|
# @example
|
318
|
-
# require "google/cloud/spanner/admin/instance
|
344
|
+
# require "google/cloud/spanner/admin/instance"
|
319
345
|
#
|
320
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
346
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
321
347
|
# formatted_parent = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.project_path("[PROJECT]")
|
322
348
|
#
|
323
349
|
# # Iterate over all results.
|
@@ -336,13 +362,14 @@ module Google
|
|
336
362
|
def list_instance_configs \
|
337
363
|
parent,
|
338
364
|
page_size: nil,
|
339
|
-
options: nil
|
365
|
+
options: nil,
|
366
|
+
&block
|
340
367
|
req = {
|
341
368
|
parent: parent,
|
342
369
|
page_size: page_size
|
343
370
|
}.delete_if { |_, v| v.nil? }
|
344
371
|
req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest)
|
345
|
-
@list_instance_configs.call(req, options)
|
372
|
+
@list_instance_configs.call(req, options, &block)
|
346
373
|
end
|
347
374
|
|
348
375
|
# Gets information about a particular instance configuration.
|
@@ -353,23 +380,27 @@ module Google
|
|
353
380
|
# @param options [Google::Gax::CallOptions]
|
354
381
|
# Overrides the default settings for this call, e.g, timeout,
|
355
382
|
# retries, etc.
|
383
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
384
|
+
# @yieldparam result [Google::Spanner::Admin::Instance::V1::InstanceConfig]
|
385
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
356
386
|
# @return [Google::Spanner::Admin::Instance::V1::InstanceConfig]
|
357
387
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
358
388
|
# @example
|
359
|
-
# require "google/cloud/spanner/admin/instance
|
389
|
+
# require "google/cloud/spanner/admin/instance"
|
360
390
|
#
|
361
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
391
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
362
392
|
# formatted_name = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_config_path("[PROJECT]", "[INSTANCE_CONFIG]")
|
363
393
|
# response = instance_admin_client.get_instance_config(formatted_name)
|
364
394
|
|
365
395
|
def get_instance_config \
|
366
396
|
name,
|
367
|
-
options: nil
|
397
|
+
options: nil,
|
398
|
+
&block
|
368
399
|
req = {
|
369
400
|
name: name
|
370
401
|
}.delete_if { |_, v| v.nil? }
|
371
402
|
req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::GetInstanceConfigRequest)
|
372
|
-
@get_instance_config.call(req, options)
|
403
|
+
@get_instance_config.call(req, options, &block)
|
373
404
|
end
|
374
405
|
|
375
406
|
# Lists all instances in the given project.
|
@@ -406,6 +437,9 @@ module Google
|
|
406
437
|
# @param options [Google::Gax::CallOptions]
|
407
438
|
# Overrides the default settings for this call, e.g, timeout,
|
408
439
|
# retries, etc.
|
440
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
441
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::Instance>]
|
442
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
409
443
|
# @return [Google::Gax::PagedEnumerable<Google::Spanner::Admin::Instance::V1::Instance>]
|
410
444
|
# An enumerable of Google::Spanner::Admin::Instance::V1::Instance instances.
|
411
445
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -413,9 +447,9 @@ module Google
|
|
413
447
|
# object.
|
414
448
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
415
449
|
# @example
|
416
|
-
# require "google/cloud/spanner/admin/instance
|
450
|
+
# require "google/cloud/spanner/admin/instance"
|
417
451
|
#
|
418
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
452
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
419
453
|
# formatted_parent = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.project_path("[PROJECT]")
|
420
454
|
#
|
421
455
|
# # Iterate over all results.
|
@@ -435,14 +469,15 @@ module Google
|
|
435
469
|
parent,
|
436
470
|
page_size: nil,
|
437
471
|
filter: nil,
|
438
|
-
options: nil
|
472
|
+
options: nil,
|
473
|
+
&block
|
439
474
|
req = {
|
440
475
|
parent: parent,
|
441
476
|
page_size: page_size,
|
442
477
|
filter: filter
|
443
478
|
}.delete_if { |_, v| v.nil? }
|
444
479
|
req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::ListInstancesRequest)
|
445
|
-
@list_instances.call(req, options)
|
480
|
+
@list_instances.call(req, options, &block)
|
446
481
|
end
|
447
482
|
|
448
483
|
# Gets information about a particular instance.
|
@@ -453,23 +488,27 @@ module Google
|
|
453
488
|
# @param options [Google::Gax::CallOptions]
|
454
489
|
# Overrides the default settings for this call, e.g, timeout,
|
455
490
|
# retries, etc.
|
491
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
492
|
+
# @yieldparam result [Google::Spanner::Admin::Instance::V1::Instance]
|
493
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
456
494
|
# @return [Google::Spanner::Admin::Instance::V1::Instance]
|
457
495
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
458
496
|
# @example
|
459
|
-
# require "google/cloud/spanner/admin/instance
|
497
|
+
# require "google/cloud/spanner/admin/instance"
|
460
498
|
#
|
461
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
499
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
462
500
|
# formatted_name = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
|
463
501
|
# response = instance_admin_client.get_instance(formatted_name)
|
464
502
|
|
465
503
|
def get_instance \
|
466
504
|
name,
|
467
|
-
options: nil
|
505
|
+
options: nil,
|
506
|
+
&block
|
468
507
|
req = {
|
469
508
|
name: name
|
470
509
|
}.delete_if { |_, v| v.nil? }
|
471
510
|
req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::GetInstanceRequest)
|
472
|
-
@get_instance.call(req, options)
|
511
|
+
@get_instance.call(req, options, &block)
|
473
512
|
end
|
474
513
|
|
475
514
|
# Creates an instance and begins preparing it to begin serving. The
|
@@ -525,11 +564,15 @@ module Google
|
|
525
564
|
# @return [Google::Gax::Operation]
|
526
565
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
527
566
|
# @example
|
528
|
-
# require "google/cloud/spanner/admin/instance
|
567
|
+
# require "google/cloud/spanner/admin/instance"
|
529
568
|
#
|
530
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
569
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
531
570
|
# formatted_parent = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.project_path("[PROJECT]")
|
571
|
+
#
|
572
|
+
# # TODO: Initialize +instance_id+:
|
532
573
|
# instance_id = ''
|
574
|
+
#
|
575
|
+
# # TODO: Initialize +instance+:
|
533
576
|
# instance = {}
|
534
577
|
#
|
535
578
|
# # Register a callback during the method call.
|
@@ -640,10 +683,14 @@ module Google
|
|
640
683
|
# @return [Google::Gax::Operation]
|
641
684
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
642
685
|
# @example
|
643
|
-
# require "google/cloud/spanner/admin/instance
|
686
|
+
# require "google/cloud/spanner/admin/instance"
|
687
|
+
#
|
688
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
644
689
|
#
|
645
|
-
#
|
690
|
+
# # TODO: Initialize +instance+:
|
646
691
|
# instance = {}
|
692
|
+
#
|
693
|
+
# # TODO: Initialize +field_mask+:
|
647
694
|
# field_mask = {}
|
648
695
|
#
|
649
696
|
# # Register a callback during the method call.
|
@@ -711,22 +758,26 @@ module Google
|
|
711
758
|
# @param options [Google::Gax::CallOptions]
|
712
759
|
# Overrides the default settings for this call, e.g, timeout,
|
713
760
|
# retries, etc.
|
761
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
762
|
+
# @yieldparam result []
|
763
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
714
764
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
715
765
|
# @example
|
716
|
-
# require "google/cloud/spanner/admin/instance
|
766
|
+
# require "google/cloud/spanner/admin/instance"
|
717
767
|
#
|
718
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
768
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
719
769
|
# formatted_name = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
|
720
770
|
# instance_admin_client.delete_instance(formatted_name)
|
721
771
|
|
722
772
|
def delete_instance \
|
723
773
|
name,
|
724
|
-
options: nil
|
774
|
+
options: nil,
|
775
|
+
&block
|
725
776
|
req = {
|
726
777
|
name: name
|
727
778
|
}.delete_if { |_, v| v.nil? }
|
728
779
|
req = Google::Gax::to_proto(req, Google::Spanner::Admin::Instance::V1::DeleteInstanceRequest)
|
729
|
-
@delete_instance.call(req, options)
|
780
|
+
@delete_instance.call(req, options, &block)
|
730
781
|
nil
|
731
782
|
end
|
732
783
|
|
@@ -739,7 +790,7 @@ module Google
|
|
739
790
|
# @param resource [String]
|
740
791
|
# REQUIRED: The resource for which the policy is being specified.
|
741
792
|
# +resource+ is usually specified as a path. For example, a Project
|
742
|
-
# resource is specified as +projects
|
793
|
+
# resource is specified as +projects/\\{project}+.
|
743
794
|
# @param policy [Google::Iam::V1::Policy | Hash]
|
744
795
|
# REQUIRED: The complete policy to be applied to the +resource+. The size of
|
745
796
|
# the policy is limited to a few 10s of KB. An empty policy is a
|
@@ -750,26 +801,32 @@ module Google
|
|
750
801
|
# @param options [Google::Gax::CallOptions]
|
751
802
|
# Overrides the default settings for this call, e.g, timeout,
|
752
803
|
# retries, etc.
|
804
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
805
|
+
# @yieldparam result [Google::Iam::V1::Policy]
|
806
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
753
807
|
# @return [Google::Iam::V1::Policy]
|
754
808
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
755
809
|
# @example
|
756
|
-
# require "google/cloud/spanner/admin/instance
|
810
|
+
# require "google/cloud/spanner/admin/instance"
|
757
811
|
#
|
758
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
812
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
759
813
|
# formatted_resource = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
|
814
|
+
#
|
815
|
+
# # TODO: Initialize +policy+:
|
760
816
|
# policy = {}
|
761
817
|
# response = instance_admin_client.set_iam_policy(formatted_resource, policy)
|
762
818
|
|
763
819
|
def set_iam_policy \
|
764
820
|
resource,
|
765
821
|
policy,
|
766
|
-
options: nil
|
822
|
+
options: nil,
|
823
|
+
&block
|
767
824
|
req = {
|
768
825
|
resource: resource,
|
769
826
|
policy: policy
|
770
827
|
}.delete_if { |_, v| v.nil? }
|
771
828
|
req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
|
772
|
-
@set_iam_policy.call(req, options)
|
829
|
+
@set_iam_policy.call(req, options, &block)
|
773
830
|
end
|
774
831
|
|
775
832
|
# Gets the access control policy for an instance resource. Returns an empty
|
@@ -781,27 +838,31 @@ module Google
|
|
781
838
|
# @param resource [String]
|
782
839
|
# REQUIRED: The resource for which the policy is being requested.
|
783
840
|
# +resource+ is usually specified as a path. For example, a Project
|
784
|
-
# resource is specified as +projects
|
841
|
+
# resource is specified as +projects/\\{project}+.
|
785
842
|
# @param options [Google::Gax::CallOptions]
|
786
843
|
# Overrides the default settings for this call, e.g, timeout,
|
787
844
|
# retries, etc.
|
845
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
846
|
+
# @yieldparam result [Google::Iam::V1::Policy]
|
847
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
788
848
|
# @return [Google::Iam::V1::Policy]
|
789
849
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
790
850
|
# @example
|
791
|
-
# require "google/cloud/spanner/admin/instance
|
851
|
+
# require "google/cloud/spanner/admin/instance"
|
792
852
|
#
|
793
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
853
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
794
854
|
# formatted_resource = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
|
795
855
|
# response = instance_admin_client.get_iam_policy(formatted_resource)
|
796
856
|
|
797
857
|
def get_iam_policy \
|
798
858
|
resource,
|
799
|
-
options: nil
|
859
|
+
options: nil,
|
860
|
+
&block
|
800
861
|
req = {
|
801
862
|
resource: resource
|
802
863
|
}.delete_if { |_, v| v.nil? }
|
803
864
|
req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
|
804
|
-
@get_iam_policy.call(req, options)
|
865
|
+
@get_iam_policy.call(req, options, &block)
|
805
866
|
end
|
806
867
|
|
807
868
|
# Returns permissions that the caller has on the specified instance resource.
|
@@ -814,7 +875,7 @@ module Google
|
|
814
875
|
# @param resource [String]
|
815
876
|
# REQUIRED: The resource for which the policy detail is being requested.
|
816
877
|
# +resource+ is usually specified as a path. For example, a Project
|
817
|
-
# resource is specified as +projects
|
878
|
+
# resource is specified as +projects/\\{project}+.
|
818
879
|
# @param permissions [Array<String>]
|
819
880
|
# The set of permissions to check for the +resource+. Permissions with
|
820
881
|
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
@@ -823,26 +884,32 @@ module Google
|
|
823
884
|
# @param options [Google::Gax::CallOptions]
|
824
885
|
# Overrides the default settings for this call, e.g, timeout,
|
825
886
|
# retries, etc.
|
887
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
888
|
+
# @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
|
889
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
826
890
|
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
827
891
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
828
892
|
# @example
|
829
|
-
# require "google/cloud/spanner/admin/instance
|
893
|
+
# require "google/cloud/spanner/admin/instance"
|
830
894
|
#
|
831
|
-
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance
|
895
|
+
# instance_admin_client = Google::Cloud::Spanner::Admin::Instance.new(version: :v1)
|
832
896
|
# formatted_resource = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
|
897
|
+
#
|
898
|
+
# # TODO: Initialize +permissions+:
|
833
899
|
# permissions = []
|
834
900
|
# response = instance_admin_client.test_iam_permissions(formatted_resource, permissions)
|
835
901
|
|
836
902
|
def test_iam_permissions \
|
837
903
|
resource,
|
838
904
|
permissions,
|
839
|
-
options: nil
|
905
|
+
options: nil,
|
906
|
+
&block
|
840
907
|
req = {
|
841
908
|
resource: resource,
|
842
909
|
permissions: permissions
|
843
910
|
}.delete_if { |_, v| v.nil? }
|
844
911
|
req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
|
845
|
-
@test_iam_permissions.call(req, options)
|
912
|
+
@test_iam_permissions.call(req, options, &block)
|
846
913
|
end
|
847
914
|
end
|
848
915
|
end
|