strongdm 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/LICENSE.html +6 -5
- data/doc/Object.html +16 -16
- data/doc/README_md.html +6 -5
- data/doc/SDM/AKS.html +27 -6
- data/doc/SDM/AKSBasicAuth.html +27 -6
- data/doc/SDM/AKSServiceAccount.html +27 -6
- data/doc/SDM/AccountAttachment.html +6 -3
- data/doc/SDM/AccountAttachmentCreateOptions.html +6 -3
- data/doc/SDM/AccountAttachmentCreateResponse.html +6 -3
- data/doc/SDM/AccountAttachmentDeleteResponse.html +6 -3
- data/doc/SDM/AccountAttachmentGetResponse.html +6 -3
- data/doc/SDM/AccountAttachments.html +24 -21
- data/doc/SDM/AccountCreateResponse.html +6 -3
- data/doc/SDM/AccountDeleteResponse.html +6 -3
- data/doc/SDM/AccountGetResponse.html +6 -3
- data/doc/SDM/AccountGrant.html +6 -3
- data/doc/SDM/AccountGrantCreateResponse.html +6 -3
- data/doc/SDM/AccountGrantDeleteResponse.html +6 -3
- data/doc/SDM/AccountGrantGetResponse.html +6 -3
- data/doc/SDM/AccountGrants.html +24 -21
- data/doc/SDM/AccountUpdateResponse.html +6 -3
- data/doc/SDM/Accounts.html +29 -26
- data/doc/SDM/AlreadyExistsError.html +6 -3
- data/doc/SDM/AmazonEKS.html +27 -6
- data/doc/SDM/AmazonES.html +27 -6
- data/doc/SDM/Athena.html +27 -6
- data/doc/SDM/AuroraMysql.html +27 -6
- data/doc/SDM/AuroraPostgres.html +27 -6
- data/doc/SDM/AuthenticationError.html +6 -3
- data/doc/SDM/BadRequestError.html +6 -3
- data/doc/SDM/BigQuery.html +27 -6
- data/doc/SDM/Cassandra.html +27 -6
- data/doc/SDM/Client.html +7 -4
- data/doc/SDM/Clustrix.html +27 -6
- data/doc/SDM/Cockroach.html +27 -6
- data/doc/SDM/CreateResponseMetadata.html +6 -3
- data/doc/SDM/DeadlineExceededError.html +6 -3
- data/doc/SDM/DeleteResponseMetadata.html +6 -3
- data/doc/SDM/Druid.html +27 -6
- data/doc/SDM/DynamoDB.html +27 -6
- data/doc/SDM/Elastic.html +27 -6
- data/doc/SDM/ElasticacheRedis.html +27 -6
- data/doc/SDM/Gateway.html +8 -5
- data/doc/SDM/GetResponseMetadata.html +6 -3
- data/doc/SDM/GoogleGKE.html +27 -6
- data/doc/SDM/Greenplum.html +27 -6
- data/doc/SDM/HTTPAuth.html +27 -6
- data/doc/SDM/HTTPBasicAuth.html +27 -6
- data/doc/SDM/HTTPNoAuth.html +27 -6
- data/doc/SDM/InternalError.html +6 -3
- data/doc/SDM/Kubernetes.html +27 -6
- data/doc/SDM/KubernetesBasicAuth.html +27 -6
- data/doc/SDM/KubernetesServiceAccount.html +27 -6
- data/doc/SDM/Maria.html +27 -6
- data/doc/SDM/Memcached.html +27 -6
- data/doc/SDM/Memsql.html +27 -6
- data/doc/SDM/MongoHost.html +27 -6
- data/doc/SDM/MongoLegacyHost.html +27 -6
- data/doc/SDM/MongoLegacyReplicaset.html +27 -6
- data/doc/SDM/MongoReplicaSet.html +27 -6
- data/doc/SDM/Mysql.html +27 -6
- data/doc/SDM/NodeCreateResponse.html +8 -5
- data/doc/SDM/NodeDeleteResponse.html +8 -5
- data/doc/SDM/NodeGetResponse.html +8 -5
- data/doc/SDM/NodeUpdateResponse.html +8 -5
- data/doc/SDM/Nodes.html +29 -26
- data/doc/SDM/NotFoundError.html +6 -3
- data/doc/SDM/Oracle.html +27 -6
- data/doc/SDM/PermissionError.html +6 -3
- data/doc/SDM/Plumbing.html +3701 -3523
- data/doc/SDM/Postgres.html +27 -6
- data/doc/SDM/Presto.html +27 -6
- data/doc/SDM/RDP.html +27 -6
- data/doc/SDM/RPCError.html +6 -3
- data/doc/SDM/RateLimitError.html +6 -3
- data/doc/SDM/RateLimitMetadata.html +6 -3
- data/doc/SDM/Redis.html +27 -6
- data/doc/SDM/Redshift.html +27 -6
- data/doc/SDM/Relay.html +8 -5
- data/doc/SDM/ResourceCreateResponse.html +8 -5
- data/doc/SDM/ResourceDeleteResponse.html +8 -5
- data/doc/SDM/ResourceGetResponse.html +8 -5
- data/doc/SDM/ResourceUpdateResponse.html +8 -5
- data/doc/SDM/Resources.html +28 -25
- data/doc/SDM/Role.html +8 -5
- data/doc/SDM/RoleAttachment.html +8 -5
- data/doc/SDM/RoleAttachmentCreateResponse.html +8 -5
- data/doc/SDM/RoleAttachmentDeleteResponse.html +8 -5
- data/doc/SDM/RoleAttachmentGetResponse.html +8 -5
- data/doc/SDM/RoleAttachments.html +23 -20
- data/doc/SDM/RoleCreateResponse.html +8 -5
- data/doc/SDM/RoleDeleteResponse.html +8 -5
- data/doc/SDM/RoleGetResponse.html +8 -5
- data/doc/SDM/RoleGrant.html +8 -5
- data/doc/SDM/RoleGrantCreateResponse.html +8 -5
- data/doc/SDM/RoleGrantDeleteResponse.html +8 -5
- data/doc/SDM/RoleGrantGetResponse.html +8 -5
- data/doc/SDM/RoleGrants.html +23 -20
- data/doc/SDM/RoleUpdateResponse.html +8 -5
- data/doc/SDM/Roles.html +28 -25
- data/doc/SDM/SQLServer.html +27 -6
- data/doc/SDM/SSH.html +27 -6
- data/doc/SDM/Service.html +6 -3
- data/doc/SDM/Snowflake.html +27 -6
- data/doc/SDM/Sybase.html +27 -6
- data/doc/SDM/SybaseIQ.html +27 -6
- data/doc/SDM/Teradata.html +27 -6
- data/doc/SDM/UpdateResponseMetadata.html +6 -3
- data/doc/SDM/User.html +6 -3
- data/doc/SDM.html +6 -3
- data/doc/V1/AccountAttachments/Service.html +6 -3
- data/doc/V1/AccountAttachments.html +6 -3
- data/doc/V1/AccountGrants/Service.html +7 -4
- data/doc/V1/AccountGrants.html +6 -3
- data/doc/V1/Accounts/Service.html +6 -3
- data/doc/V1/Accounts.html +6 -3
- data/doc/V1/Nodes/Service.html +6 -3
- data/doc/V1/Nodes.html +6 -3
- data/doc/V1/Resources/Service.html +6 -3
- data/doc/V1/Resources.html +6 -3
- data/doc/V1/RoleAttachments/Service.html +6 -3
- data/doc/V1/RoleAttachments.html +6 -3
- data/doc/V1/RoleGrants/Service.html +6 -3
- data/doc/V1/RoleGrants.html +6 -3
- data/doc/V1/Roles/Service.html +6 -3
- data/doc/V1/Roles.html +6 -3
- data/doc/V1/Tags.html +113 -0
- data/doc/V1.html +16 -3
- data/doc/created.rid +34 -35
- data/doc/css/rdoc.css +35 -6
- data/doc/examples/Gemfile.html +6 -5
- data/doc/examples/Gemfile_lock.html +6 -5
- data/doc/examples/README_md.html +6 -5
- data/doc/examples/okta-sync/Gemfile.html +6 -5
- data/doc/examples/okta-sync/Gemfile_lock.html +6 -5
- data/doc/index.html +8 -5
- data/doc/js/darkfish.js +22 -99
- data/doc/js/navigation.js +4 -40
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +32 -31
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +6 -6
- data/doc/js/searcher.js.gz +0 -0
- data/doc/lib/version.html +6 -5
- data/doc/table_of_contents.html +927 -914
- data/examples/Gemfile +2 -2
- data/examples/listUsers.rb +4 -4
- data/examples/okta-sync/oktaSync.rb +17 -59
- data/examples/panicButton.rb +4 -46
- data/lib/errors/errors.rb +53 -55
- data/lib/grpc/account_attachments_pb.rb +9 -9
- data/lib/grpc/account_attachments_services_pb.rb +8 -7
- data/lib/grpc/account_grants_pb.rb +10 -10
- data/lib/grpc/account_grants_services_pb.rb +9 -8
- data/lib/grpc/accounts_pb.rb +9 -9
- data/lib/grpc/accounts_services_pb.rb +8 -7
- data/lib/grpc/drivers_pb.rb +52 -7
- data/lib/grpc/nodes_pb.rb +9 -9
- data/lib/grpc/nodes_services_pb.rb +8 -7
- data/lib/grpc/options_pb.rb +14 -5
- data/lib/grpc/plumbing.rb +4200 -4085
- data/lib/grpc/protoc-gen-swagger/options/annotations_pb.rb +4 -4
- data/lib/grpc/resources_pb.rb +9 -9
- data/lib/grpc/resources_services_pb.rb +8 -7
- data/lib/grpc/role_attachments_pb.rb +9 -9
- data/lib/grpc/role_attachments_services_pb.rb +8 -7
- data/lib/grpc/role_grants_pb.rb +9 -9
- data/lib/grpc/role_grants_services_pb.rb +8 -7
- data/lib/grpc/roles_pb.rb +9 -9
- data/lib/grpc/roles_services_pb.rb +8 -7
- data/lib/grpc/spec_pb.rb +8 -8
- data/lib/grpc/tags_pb.rb +36 -0
- data/lib/models/porcelain.rb +4941 -4415
- data/lib/strongdm.rb +95 -94
- data/lib/svc.rb +1224 -1202
- data/lib/version.rb +5 -5
- data/strongdm.gemspec +10 -10
- metadata +4 -2
data/lib/svc.rb
CHANGED
@@ -1,1309 +1,1331 @@
|
|
1
1
|
# Copyright 2020 StrongDM Inc
|
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.
|
5
5
|
# You may obtain a copy of the License at
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
|
16
16
|
# This file was generated by protogen. DO NOT EDIT.
|
17
17
|
|
18
18
|
this_dir = File.expand_path(File.dirname(__FILE__))
|
19
|
-
lib_dir = File.join(this_dir,
|
19
|
+
lib_dir = File.join(this_dir, 'grpc')
|
20
20
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
21
|
-
require
|
22
|
-
require
|
23
|
-
Dir[File.join(__dir__,
|
24
|
-
Dir[File.join(__dir__,
|
21
|
+
require 'grpc'
|
22
|
+
require 'enumerator'
|
23
|
+
Dir[File.join(__dir__, 'grpc', '*.rb')].each {|file| require file }
|
24
|
+
Dir[File.join(__dir__, 'models', '*.rb')].each {|file| require file }
|
25
25
|
|
26
26
|
module SDM
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
# AccountAttachments assign an account to a role.
|
28
|
+
class AccountAttachments
|
29
|
+
def initialize(host, insecure, parent)
|
30
|
+
begin
|
31
|
+
if insecure
|
32
|
+
@stub = V1::AccountAttachments::Stub.new(host, :this_channel_is_insecure)
|
33
|
+
else
|
34
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
35
|
+
@stub = V1::AccountAttachments::Stub.new(host, cred)
|
36
|
+
end
|
37
|
+
rescue => exception
|
38
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
39
|
+
end
|
40
|
+
@parent = parent
|
36
41
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
# Create registers a new AccountAttachment.
|
43
|
+
def create(
|
44
|
+
account_attachment \
|
45
|
+
,
|
46
|
+
options:nil,
|
47
|
+
deadline:nil)
|
48
|
+
req = V1::AccountAttachmentCreateRequest.new()
|
49
|
+
|
50
|
+
req.account_attachment = Plumbing::convert_account_attachment_to_plumbing(account_attachment)
|
51
|
+
req.options = Plumbing::convert_account_attachment_create_options_to_plumbing(options)
|
52
|
+
tries = 0
|
53
|
+
plumbing_response = nil
|
54
|
+
loop do
|
55
|
+
begin
|
56
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('AccountAttachments.Create', req), deadline:deadline)
|
57
|
+
rescue => exception
|
58
|
+
if (@parent.shouldRetry(tries, exception))
|
59
|
+
tries++
|
60
|
+
@parent.jitterSleep(tries)
|
61
|
+
next
|
62
|
+
end
|
63
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
64
|
+
end
|
65
|
+
break
|
66
|
+
end
|
50
67
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
plumbing_response = @stub.create(req, metadata: @parent.get_metadata("AccountAttachments.Create", req), deadline: deadline)
|
58
|
-
rescue => exception
|
59
|
-
if (@parent.shouldRetry(tries, exception))
|
60
|
-
tries + +@parent.jitterSleep(tries)
|
61
|
-
next
|
62
|
-
end
|
63
|
-
raise Plumbing::error_to_porcelain(exception)
|
68
|
+
|
69
|
+
resp = AccountAttachmentCreateResponse.new()
|
70
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
71
|
+
resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)
|
72
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
73
|
+
resp
|
64
74
|
end
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
# Get reads one AccountAttachment by ID.
|
76
|
+
def get(
|
77
|
+
id \
|
78
|
+
,
|
79
|
+
deadline:nil)
|
80
|
+
req = V1::AccountAttachmentGetRequest.new()
|
81
|
+
|
82
|
+
req.id = (id)
|
83
|
+
tries = 0
|
84
|
+
plumbing_response = nil
|
85
|
+
loop do
|
86
|
+
begin
|
87
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('AccountAttachments.Get', req), deadline:deadline)
|
88
|
+
rescue => exception
|
89
|
+
if (@parent.shouldRetry(tries, exception))
|
90
|
+
tries++
|
91
|
+
@parent.jitterSleep(tries)
|
92
|
+
next
|
93
|
+
end
|
94
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
95
|
+
end
|
96
|
+
break
|
97
|
+
end
|
81
98
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
rescue => exception
|
89
|
-
if (@parent.shouldRetry(tries, exception))
|
90
|
-
tries + +@parent.jitterSleep(tries)
|
91
|
-
next
|
92
|
-
end
|
93
|
-
raise Plumbing::error_to_porcelain(exception)
|
99
|
+
|
100
|
+
resp = AccountAttachmentGetResponse.new()
|
101
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
102
|
+
resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)
|
103
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
104
|
+
resp
|
94
105
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
106
|
+
# Delete removes a AccountAttachment by ID.
|
107
|
+
def delete(
|
108
|
+
id \
|
109
|
+
,
|
110
|
+
deadline:nil)
|
111
|
+
req = V1::AccountAttachmentDeleteRequest.new()
|
112
|
+
|
113
|
+
req.id = (id)
|
114
|
+
tries = 0
|
115
|
+
plumbing_response = nil
|
116
|
+
loop do
|
117
|
+
begin
|
118
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('AccountAttachments.Delete', req), deadline:deadline)
|
119
|
+
rescue => exception
|
120
|
+
if (@parent.shouldRetry(tries, exception))
|
121
|
+
tries++
|
122
|
+
@parent.jitterSleep(tries)
|
123
|
+
next
|
124
|
+
end
|
125
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
126
|
+
end
|
127
|
+
break
|
128
|
+
end
|
111
129
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("AccountAttachments.Delete", req), deadline: deadline)
|
118
|
-
rescue => exception
|
119
|
-
if (@parent.shouldRetry(tries, exception))
|
120
|
-
tries + +@parent.jitterSleep(tries)
|
121
|
-
next
|
122
|
-
end
|
123
|
-
raise Plumbing::error_to_porcelain(exception)
|
130
|
+
|
131
|
+
resp = AccountAttachmentDeleteResponse.new()
|
132
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
133
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
134
|
+
resp
|
124
135
|
end
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
filter,
|
137
|
-
*args,
|
138
|
-
deadline: nil
|
139
|
-
)
|
140
|
-
req = V1::AccountAttachmentListRequest.new()
|
141
|
-
req.meta = V1::ListRequestMetadata.new()
|
142
|
-
page_size_option = @parent._test_options["PageSize"]
|
143
|
-
if page_size_option.is_a? Integer
|
144
|
-
req.meta.limit = page_size_option
|
145
|
-
end
|
146
|
-
|
147
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
148
|
-
resp = Enumerator::Generator.new { |g|
|
149
|
-
tries = 0
|
150
|
-
loop do
|
151
|
-
begin
|
152
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("AccountAttachments.List", req), deadline: deadline)
|
153
|
-
rescue => exception
|
154
|
-
if (@parent.shouldRetry(tries, exception))
|
155
|
-
tries + +@parent.jitterSleep(tries)
|
156
|
-
next
|
136
|
+
# List gets a list of AccountAttachments matching a given set of criteria.
|
137
|
+
def list(
|
138
|
+
filter \
|
139
|
+
,
|
140
|
+
*args,
|
141
|
+
deadline:nil)
|
142
|
+
req = V1::AccountAttachmentListRequest.new()
|
143
|
+
req.meta = V1::ListRequestMetadata.new()
|
144
|
+
page_size_option = @parent._test_options['PageSize']
|
145
|
+
if page_size_option.is_a? Integer
|
146
|
+
req.meta.limit = page_size_option
|
157
147
|
end
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
148
|
+
|
149
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
150
|
+
resp = Enumerator::Generator.new { |g|
|
151
|
+
tries = 0
|
152
|
+
loop do
|
153
|
+
begin
|
154
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('AccountAttachments.List', req), deadline:deadline)
|
155
|
+
rescue => exception
|
156
|
+
if (@parent.shouldRetry(tries, exception))
|
157
|
+
tries++
|
158
|
+
@parent.jitterSleep(tries)
|
159
|
+
next
|
160
|
+
end
|
161
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
162
|
+
end
|
163
|
+
tries = 0
|
164
|
+
plumbing_response.account_attachments.each do |plumbing_item|
|
165
|
+
g.yield Plumbing::convert_account_attachment_to_porcelain(plumbing_item)
|
166
|
+
end
|
167
|
+
break if plumbing_response.meta.next_cursor == ""
|
168
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
169
|
+
end
|
170
|
+
}
|
171
|
+
resp
|
166
172
|
end
|
167
|
-
}
|
168
|
-
resp
|
169
173
|
end
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
174
|
+
# AccountGrants assign a resource directly to an account, giving the account the permission to connect to that resource.
|
175
|
+
class AccountGrants
|
176
|
+
def initialize(host, insecure, parent)
|
177
|
+
begin
|
178
|
+
if insecure
|
179
|
+
@stub = V1::AccountGrants::Stub.new(host, :this_channel_is_insecure)
|
180
|
+
else
|
181
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
182
|
+
@stub = V1::AccountGrants::Stub.new(host, cred)
|
183
|
+
end
|
184
|
+
rescue => exception
|
185
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
186
|
+
end
|
187
|
+
@parent = parent
|
181
188
|
end
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
189
|
+
# Create registers a new AccountGrant.
|
190
|
+
def create(
|
191
|
+
account_grant \
|
192
|
+
,
|
193
|
+
deadline:nil)
|
194
|
+
req = V1::AccountGrantCreateRequest.new()
|
195
|
+
|
196
|
+
req.account_grant = Plumbing::convert_account_grant_to_plumbing(account_grant)
|
197
|
+
tries = 0
|
198
|
+
plumbing_response = nil
|
199
|
+
loop do
|
200
|
+
begin
|
201
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('AccountGrants.Create', req), deadline:deadline)
|
202
|
+
rescue => exception
|
203
|
+
if (@parent.shouldRetry(tries, exception))
|
204
|
+
tries++
|
205
|
+
@parent.jitterSleep(tries)
|
206
|
+
next
|
207
|
+
end
|
208
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
209
|
+
end
|
210
|
+
break
|
211
|
+
end
|
194
212
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
rescue => exception
|
202
|
-
if (@parent.shouldRetry(tries, exception))
|
203
|
-
tries + +@parent.jitterSleep(tries)
|
204
|
-
next
|
205
|
-
end
|
206
|
-
raise Plumbing::error_to_porcelain(exception)
|
213
|
+
|
214
|
+
resp = AccountGrantCreateResponse.new()
|
215
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
216
|
+
resp.account_grant = Plumbing::convert_account_grant_to_porcelain(plumbing_response.account_grant)
|
217
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
218
|
+
resp
|
207
219
|
end
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
220
|
+
# Get reads one AccountGrant by ID.
|
221
|
+
def get(
|
222
|
+
id \
|
223
|
+
,
|
224
|
+
deadline:nil)
|
225
|
+
req = V1::AccountGrantGetRequest.new()
|
226
|
+
|
227
|
+
req.id = (id)
|
228
|
+
tries = 0
|
229
|
+
plumbing_response = nil
|
230
|
+
loop do
|
231
|
+
begin
|
232
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('AccountGrants.Get', req), deadline:deadline)
|
233
|
+
rescue => exception
|
234
|
+
if (@parent.shouldRetry(tries, exception))
|
235
|
+
tries++
|
236
|
+
@parent.jitterSleep(tries)
|
237
|
+
next
|
238
|
+
end
|
239
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
240
|
+
end
|
241
|
+
break
|
242
|
+
end
|
224
243
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
rescue => exception
|
232
|
-
if (@parent.shouldRetry(tries, exception))
|
233
|
-
tries + +@parent.jitterSleep(tries)
|
234
|
-
next
|
235
|
-
end
|
236
|
-
raise Plumbing::error_to_porcelain(exception)
|
244
|
+
|
245
|
+
resp = AccountGrantGetResponse.new()
|
246
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
247
|
+
resp.account_grant = Plumbing::convert_account_grant_to_porcelain(plumbing_response.account_grant)
|
248
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
249
|
+
resp
|
237
250
|
end
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
251
|
+
# Delete removes a AccountGrant by ID.
|
252
|
+
def delete(
|
253
|
+
id \
|
254
|
+
,
|
255
|
+
deadline:nil)
|
256
|
+
req = V1::AccountGrantDeleteRequest.new()
|
257
|
+
|
258
|
+
req.id = (id)
|
259
|
+
tries = 0
|
260
|
+
plumbing_response = nil
|
261
|
+
loop do
|
262
|
+
begin
|
263
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('AccountGrants.Delete', req), deadline:deadline)
|
264
|
+
rescue => exception
|
265
|
+
if (@parent.shouldRetry(tries, exception))
|
266
|
+
tries++
|
267
|
+
@parent.jitterSleep(tries)
|
268
|
+
next
|
269
|
+
end
|
270
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
271
|
+
end
|
272
|
+
break
|
273
|
+
end
|
254
274
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("AccountGrants.Delete", req), deadline: deadline)
|
261
|
-
rescue => exception
|
262
|
-
if (@parent.shouldRetry(tries, exception))
|
263
|
-
tries + +@parent.jitterSleep(tries)
|
264
|
-
next
|
265
|
-
end
|
266
|
-
raise Plumbing::error_to_porcelain(exception)
|
275
|
+
|
276
|
+
resp = AccountGrantDeleteResponse.new()
|
277
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
278
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
279
|
+
resp
|
267
280
|
end
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
filter,
|
280
|
-
*args,
|
281
|
-
deadline: nil
|
282
|
-
)
|
283
|
-
req = V1::AccountGrantListRequest.new()
|
284
|
-
req.meta = V1::ListRequestMetadata.new()
|
285
|
-
page_size_option = @parent._test_options["PageSize"]
|
286
|
-
if page_size_option.is_a? Integer
|
287
|
-
req.meta.limit = page_size_option
|
288
|
-
end
|
289
|
-
|
290
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
291
|
-
resp = Enumerator::Generator.new { |g|
|
292
|
-
tries = 0
|
293
|
-
loop do
|
294
|
-
begin
|
295
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("AccountGrants.List", req), deadline: deadline)
|
296
|
-
rescue => exception
|
297
|
-
if (@parent.shouldRetry(tries, exception))
|
298
|
-
tries + +@parent.jitterSleep(tries)
|
299
|
-
next
|
281
|
+
# List gets a list of AccountGrants matching a given set of criteria.
|
282
|
+
def list(
|
283
|
+
filter \
|
284
|
+
,
|
285
|
+
*args,
|
286
|
+
deadline:nil)
|
287
|
+
req = V1::AccountGrantListRequest.new()
|
288
|
+
req.meta = V1::ListRequestMetadata.new()
|
289
|
+
page_size_option = @parent._test_options['PageSize']
|
290
|
+
if page_size_option.is_a? Integer
|
291
|
+
req.meta.limit = page_size_option
|
300
292
|
end
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
293
|
+
|
294
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
295
|
+
resp = Enumerator::Generator.new { |g|
|
296
|
+
tries = 0
|
297
|
+
loop do
|
298
|
+
begin
|
299
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('AccountGrants.List', req), deadline:deadline)
|
300
|
+
rescue => exception
|
301
|
+
if (@parent.shouldRetry(tries, exception))
|
302
|
+
tries++
|
303
|
+
@parent.jitterSleep(tries)
|
304
|
+
next
|
305
|
+
end
|
306
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
307
|
+
end
|
308
|
+
tries = 0
|
309
|
+
plumbing_response.account_grants.each do |plumbing_item|
|
310
|
+
g.yield Plumbing::convert_account_grant_to_porcelain(plumbing_item)
|
311
|
+
end
|
312
|
+
break if plumbing_response.meta.next_cursor == ""
|
313
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
314
|
+
end
|
315
|
+
}
|
316
|
+
resp
|
309
317
|
end
|
310
|
-
}
|
311
|
-
resp
|
312
318
|
end
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
319
|
+
# Accounts are users that have access to strongDM.
|
320
|
+
# There are two types of accounts:
|
321
|
+
# 1. **Regular users:** humans who are authenticated through username and password or SSO
|
322
|
+
# 2. **Service users:** machines that are authneticated using a service token
|
323
|
+
class Accounts
|
324
|
+
def initialize(host, insecure, parent)
|
325
|
+
begin
|
326
|
+
if insecure
|
327
|
+
@stub = V1::Accounts::Stub.new(host, :this_channel_is_insecure)
|
328
|
+
else
|
329
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
330
|
+
@stub = V1::Accounts::Stub.new(host, cred)
|
331
|
+
end
|
332
|
+
rescue => exception
|
333
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
334
|
+
end
|
335
|
+
@parent = parent
|
327
336
|
end
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
337
|
+
# Create registers a new Account.
|
338
|
+
def create(
|
339
|
+
account \
|
340
|
+
,
|
341
|
+
deadline:nil)
|
342
|
+
req = V1::AccountCreateRequest.new()
|
343
|
+
|
344
|
+
req.account = Plumbing::convert_account_to_plumbing(account)
|
345
|
+
tries = 0
|
346
|
+
plumbing_response = nil
|
347
|
+
loop do
|
348
|
+
begin
|
349
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('Accounts.Create', req), deadline:deadline)
|
350
|
+
rescue => exception
|
351
|
+
if (@parent.shouldRetry(tries, exception))
|
352
|
+
tries++
|
353
|
+
@parent.jitterSleep(tries)
|
354
|
+
next
|
355
|
+
end
|
356
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
357
|
+
end
|
358
|
+
break
|
359
|
+
end
|
340
360
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
if (@parent.shouldRetry(tries, exception))
|
349
|
-
tries + +@parent.jitterSleep(tries)
|
350
|
-
next
|
351
|
-
end
|
352
|
-
raise Plumbing::error_to_porcelain(exception)
|
361
|
+
|
362
|
+
resp = AccountCreateResponse.new()
|
363
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
364
|
+
resp.account = Plumbing::convert_account_to_porcelain(plumbing_response.account)
|
365
|
+
resp.token = (plumbing_response.token)
|
366
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
367
|
+
resp
|
353
368
|
end
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
369
|
+
# Get reads one Account by ID.
|
370
|
+
def get(
|
371
|
+
id \
|
372
|
+
,
|
373
|
+
deadline:nil)
|
374
|
+
req = V1::AccountGetRequest.new()
|
375
|
+
|
376
|
+
req.id = (id)
|
377
|
+
tries = 0
|
378
|
+
plumbing_response = nil
|
379
|
+
loop do
|
380
|
+
begin
|
381
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('Accounts.Get', req), deadline:deadline)
|
382
|
+
rescue => exception
|
383
|
+
if (@parent.shouldRetry(tries, exception))
|
384
|
+
tries++
|
385
|
+
@parent.jitterSleep(tries)
|
386
|
+
next
|
387
|
+
end
|
388
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
389
|
+
end
|
390
|
+
break
|
391
|
+
end
|
371
392
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
rescue => exception
|
379
|
-
if (@parent.shouldRetry(tries, exception))
|
380
|
-
tries + +@parent.jitterSleep(tries)
|
381
|
-
next
|
382
|
-
end
|
383
|
-
raise Plumbing::error_to_porcelain(exception)
|
393
|
+
|
394
|
+
resp = AccountGetResponse.new()
|
395
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
396
|
+
resp.account = Plumbing::convert_account_to_porcelain(plumbing_response.account)
|
397
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
398
|
+
resp
|
384
399
|
end
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
400
|
+
# Update patches a Account by ID.
|
401
|
+
def update(
|
402
|
+
account \
|
403
|
+
,
|
404
|
+
deadline:nil)
|
405
|
+
req = V1::AccountUpdateRequest.new()
|
406
|
+
|
407
|
+
req.account = Plumbing::convert_account_to_plumbing(account)
|
408
|
+
tries = 0
|
409
|
+
plumbing_response = nil
|
410
|
+
loop do
|
411
|
+
begin
|
412
|
+
plumbing_response = @stub.update(req, metadata: @parent.get_metadata('Accounts.Update', req), deadline:deadline)
|
413
|
+
rescue => exception
|
414
|
+
if (@parent.shouldRetry(tries, exception))
|
415
|
+
tries++
|
416
|
+
@parent.jitterSleep(tries)
|
417
|
+
next
|
418
|
+
end
|
419
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
420
|
+
end
|
421
|
+
break
|
422
|
+
end
|
401
423
|
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
rescue => exception
|
409
|
-
if (@parent.shouldRetry(tries, exception))
|
410
|
-
tries + +@parent.jitterSleep(tries)
|
411
|
-
next
|
412
|
-
end
|
413
|
-
raise Plumbing::error_to_porcelain(exception)
|
424
|
+
|
425
|
+
resp = AccountUpdateResponse.new()
|
426
|
+
resp.meta = Plumbing::convert_update_response_metadata_to_porcelain(plumbing_response.meta)
|
427
|
+
resp.account = Plumbing::convert_account_to_porcelain(plumbing_response.account)
|
428
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
429
|
+
resp
|
414
430
|
end
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
+
# Delete removes a Account by ID.
|
432
|
+
def delete(
|
433
|
+
id \
|
434
|
+
,
|
435
|
+
deadline:nil)
|
436
|
+
req = V1::AccountDeleteRequest.new()
|
437
|
+
|
438
|
+
req.id = (id)
|
439
|
+
tries = 0
|
440
|
+
plumbing_response = nil
|
441
|
+
loop do
|
442
|
+
begin
|
443
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('Accounts.Delete', req), deadline:deadline)
|
444
|
+
rescue => exception
|
445
|
+
if (@parent.shouldRetry(tries, exception))
|
446
|
+
tries++
|
447
|
+
@parent.jitterSleep(tries)
|
448
|
+
next
|
449
|
+
end
|
450
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
451
|
+
end
|
452
|
+
break
|
453
|
+
end
|
431
454
|
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("Accounts.Delete", req), deadline: deadline)
|
438
|
-
rescue => exception
|
439
|
-
if (@parent.shouldRetry(tries, exception))
|
440
|
-
tries + +@parent.jitterSleep(tries)
|
441
|
-
next
|
442
|
-
end
|
443
|
-
raise Plumbing::error_to_porcelain(exception)
|
455
|
+
|
456
|
+
resp = AccountDeleteResponse.new()
|
457
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
458
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
459
|
+
resp
|
444
460
|
end
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
filter,
|
457
|
-
*args,
|
458
|
-
deadline: nil
|
459
|
-
)
|
460
|
-
req = V1::AccountListRequest.new()
|
461
|
-
req.meta = V1::ListRequestMetadata.new()
|
462
|
-
page_size_option = @parent._test_options["PageSize"]
|
463
|
-
if page_size_option.is_a? Integer
|
464
|
-
req.meta.limit = page_size_option
|
465
|
-
end
|
466
|
-
|
467
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
468
|
-
resp = Enumerator::Generator.new { |g|
|
469
|
-
tries = 0
|
470
|
-
loop do
|
471
|
-
begin
|
472
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("Accounts.List", req), deadline: deadline)
|
473
|
-
rescue => exception
|
474
|
-
if (@parent.shouldRetry(tries, exception))
|
475
|
-
tries + +@parent.jitterSleep(tries)
|
476
|
-
next
|
461
|
+
# List gets a list of Accounts matching a given set of criteria.
|
462
|
+
def list(
|
463
|
+
filter \
|
464
|
+
,
|
465
|
+
*args,
|
466
|
+
deadline:nil)
|
467
|
+
req = V1::AccountListRequest.new()
|
468
|
+
req.meta = V1::ListRequestMetadata.new()
|
469
|
+
page_size_option = @parent._test_options['PageSize']
|
470
|
+
if page_size_option.is_a? Integer
|
471
|
+
req.meta.limit = page_size_option
|
477
472
|
end
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
473
|
+
|
474
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
475
|
+
resp = Enumerator::Generator.new { |g|
|
476
|
+
tries = 0
|
477
|
+
loop do
|
478
|
+
begin
|
479
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('Accounts.List', req), deadline:deadline)
|
480
|
+
rescue => exception
|
481
|
+
if (@parent.shouldRetry(tries, exception))
|
482
|
+
tries++
|
483
|
+
@parent.jitterSleep(tries)
|
484
|
+
next
|
485
|
+
end
|
486
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
487
|
+
end
|
488
|
+
tries = 0
|
489
|
+
plumbing_response.accounts.each do |plumbing_item|
|
490
|
+
g.yield Plumbing::convert_account_to_porcelain(plumbing_item)
|
491
|
+
end
|
492
|
+
break if plumbing_response.meta.next_cursor == ""
|
493
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
494
|
+
end
|
495
|
+
}
|
496
|
+
resp
|
486
497
|
end
|
487
|
-
}
|
488
|
-
resp
|
489
498
|
end
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
499
|
+
# Nodes make up the strongDM network, and allow your users to connect securely to your resources.
|
500
|
+
# There are two types of nodes:
|
501
|
+
# 1. **Relay:** creates connectivity to your datasources, while maintaining the egress-only nature of your firewall
|
502
|
+
# 1. **Gateways:** a relay that also listens for connections from strongDM clients
|
503
|
+
class Nodes
|
504
|
+
def initialize(host, insecure, parent)
|
505
|
+
begin
|
506
|
+
if insecure
|
507
|
+
@stub = V1::Nodes::Stub.new(host, :this_channel_is_insecure)
|
508
|
+
else
|
509
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
510
|
+
@stub = V1::Nodes::Stub.new(host, cred)
|
511
|
+
end
|
512
|
+
rescue => exception
|
513
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
514
|
+
end
|
515
|
+
@parent = parent
|
504
516
|
end
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
+
# Create registers a new Node.
|
518
|
+
def create(
|
519
|
+
node \
|
520
|
+
,
|
521
|
+
deadline:nil)
|
522
|
+
req = V1::NodeCreateRequest.new()
|
523
|
+
|
524
|
+
req.node = Plumbing::convert_node_to_plumbing(node)
|
525
|
+
tries = 0
|
526
|
+
plumbing_response = nil
|
527
|
+
loop do
|
528
|
+
begin
|
529
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('Nodes.Create', req), deadline:deadline)
|
530
|
+
rescue => exception
|
531
|
+
if (@parent.shouldRetry(tries, exception))
|
532
|
+
tries++
|
533
|
+
@parent.jitterSleep(tries)
|
534
|
+
next
|
535
|
+
end
|
536
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
537
|
+
end
|
538
|
+
break
|
539
|
+
end
|
517
540
|
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
if (@parent.shouldRetry(tries, exception))
|
526
|
-
tries + +@parent.jitterSleep(tries)
|
527
|
-
next
|
528
|
-
end
|
529
|
-
raise Plumbing::error_to_porcelain(exception)
|
541
|
+
|
542
|
+
resp = NodeCreateResponse.new()
|
543
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
544
|
+
resp.node = Plumbing::convert_node_to_porcelain(plumbing_response.node)
|
545
|
+
resp.token = (plumbing_response.token)
|
546
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
547
|
+
resp
|
530
548
|
end
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
549
|
+
# Get reads one Node by ID.
|
550
|
+
def get(
|
551
|
+
id \
|
552
|
+
,
|
553
|
+
deadline:nil)
|
554
|
+
req = V1::NodeGetRequest.new()
|
555
|
+
|
556
|
+
req.id = (id)
|
557
|
+
tries = 0
|
558
|
+
plumbing_response = nil
|
559
|
+
loop do
|
560
|
+
begin
|
561
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('Nodes.Get', req), deadline:deadline)
|
562
|
+
rescue => exception
|
563
|
+
if (@parent.shouldRetry(tries, exception))
|
564
|
+
tries++
|
565
|
+
@parent.jitterSleep(tries)
|
566
|
+
next
|
567
|
+
end
|
568
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
569
|
+
end
|
570
|
+
break
|
571
|
+
end
|
548
572
|
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
rescue => exception
|
556
|
-
if (@parent.shouldRetry(tries, exception))
|
557
|
-
tries + +@parent.jitterSleep(tries)
|
558
|
-
next
|
559
|
-
end
|
560
|
-
raise Plumbing::error_to_porcelain(exception)
|
573
|
+
|
574
|
+
resp = NodeGetResponse.new()
|
575
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
576
|
+
resp.node = Plumbing::convert_node_to_porcelain(plumbing_response.node)
|
577
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
578
|
+
resp
|
561
579
|
end
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
580
|
+
# Update patches a Node by ID.
|
581
|
+
def update(
|
582
|
+
node \
|
583
|
+
,
|
584
|
+
deadline:nil)
|
585
|
+
req = V1::NodeUpdateRequest.new()
|
586
|
+
|
587
|
+
req.node = Plumbing::convert_node_to_plumbing(node)
|
588
|
+
tries = 0
|
589
|
+
plumbing_response = nil
|
590
|
+
loop do
|
591
|
+
begin
|
592
|
+
plumbing_response = @stub.update(req, metadata: @parent.get_metadata('Nodes.Update', req), deadline:deadline)
|
593
|
+
rescue => exception
|
594
|
+
if (@parent.shouldRetry(tries, exception))
|
595
|
+
tries++
|
596
|
+
@parent.jitterSleep(tries)
|
597
|
+
next
|
598
|
+
end
|
599
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
600
|
+
end
|
601
|
+
break
|
602
|
+
end
|
578
603
|
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
rescue => exception
|
586
|
-
if (@parent.shouldRetry(tries, exception))
|
587
|
-
tries + +@parent.jitterSleep(tries)
|
588
|
-
next
|
589
|
-
end
|
590
|
-
raise Plumbing::error_to_porcelain(exception)
|
604
|
+
|
605
|
+
resp = NodeUpdateResponse.new()
|
606
|
+
resp.meta = Plumbing::convert_update_response_metadata_to_porcelain(plumbing_response.meta)
|
607
|
+
resp.node = Plumbing::convert_node_to_porcelain(plumbing_response.node)
|
608
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
609
|
+
resp
|
591
610
|
end
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
611
|
+
# Delete removes a Node by ID.
|
612
|
+
def delete(
|
613
|
+
id \
|
614
|
+
,
|
615
|
+
deadline:nil)
|
616
|
+
req = V1::NodeDeleteRequest.new()
|
617
|
+
|
618
|
+
req.id = (id)
|
619
|
+
tries = 0
|
620
|
+
plumbing_response = nil
|
621
|
+
loop do
|
622
|
+
begin
|
623
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('Nodes.Delete', req), deadline:deadline)
|
624
|
+
rescue => exception
|
625
|
+
if (@parent.shouldRetry(tries, exception))
|
626
|
+
tries++
|
627
|
+
@parent.jitterSleep(tries)
|
628
|
+
next
|
629
|
+
end
|
630
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
631
|
+
end
|
632
|
+
break
|
633
|
+
end
|
608
634
|
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("Nodes.Delete", req), deadline: deadline)
|
615
|
-
rescue => exception
|
616
|
-
if (@parent.shouldRetry(tries, exception))
|
617
|
-
tries + +@parent.jitterSleep(tries)
|
618
|
-
next
|
619
|
-
end
|
620
|
-
raise Plumbing::error_to_porcelain(exception)
|
635
|
+
|
636
|
+
resp = NodeDeleteResponse.new()
|
637
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
638
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
639
|
+
resp
|
621
640
|
end
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
filter,
|
634
|
-
*args,
|
635
|
-
deadline: nil
|
636
|
-
)
|
637
|
-
req = V1::NodeListRequest.new()
|
638
|
-
req.meta = V1::ListRequestMetadata.new()
|
639
|
-
page_size_option = @parent._test_options["PageSize"]
|
640
|
-
if page_size_option.is_a? Integer
|
641
|
-
req.meta.limit = page_size_option
|
642
|
-
end
|
643
|
-
|
644
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
645
|
-
resp = Enumerator::Generator.new { |g|
|
646
|
-
tries = 0
|
647
|
-
loop do
|
648
|
-
begin
|
649
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("Nodes.List", req), deadline: deadline)
|
650
|
-
rescue => exception
|
651
|
-
if (@parent.shouldRetry(tries, exception))
|
652
|
-
tries + +@parent.jitterSleep(tries)
|
653
|
-
next
|
641
|
+
# List gets a list of Nodes matching a given set of criteria.
|
642
|
+
def list(
|
643
|
+
filter \
|
644
|
+
,
|
645
|
+
*args,
|
646
|
+
deadline:nil)
|
647
|
+
req = V1::NodeListRequest.new()
|
648
|
+
req.meta = V1::ListRequestMetadata.new()
|
649
|
+
page_size_option = @parent._test_options['PageSize']
|
650
|
+
if page_size_option.is_a? Integer
|
651
|
+
req.meta.limit = page_size_option
|
654
652
|
end
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
653
|
+
|
654
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
655
|
+
resp = Enumerator::Generator.new { |g|
|
656
|
+
tries = 0
|
657
|
+
loop do
|
658
|
+
begin
|
659
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('Nodes.List', req), deadline:deadline)
|
660
|
+
rescue => exception
|
661
|
+
if (@parent.shouldRetry(tries, exception))
|
662
|
+
tries++
|
663
|
+
@parent.jitterSleep(tries)
|
664
|
+
next
|
665
|
+
end
|
666
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
667
|
+
end
|
668
|
+
tries = 0
|
669
|
+
plumbing_response.nodes.each do |plumbing_item|
|
670
|
+
g.yield Plumbing::convert_node_to_porcelain(plumbing_item)
|
671
|
+
end
|
672
|
+
break if plumbing_response.meta.next_cursor == ""
|
673
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
674
|
+
end
|
675
|
+
}
|
676
|
+
resp
|
663
677
|
end
|
664
|
-
}
|
665
|
-
resp
|
666
678
|
end
|
667
|
-
end
|
668
679
|
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
680
|
+
class Resources
|
681
|
+
def initialize(host, insecure, parent)
|
682
|
+
begin
|
683
|
+
if insecure
|
684
|
+
@stub = V1::Resources::Stub.new(host, :this_channel_is_insecure)
|
685
|
+
else
|
686
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
687
|
+
@stub = V1::Resources::Stub.new(host, cred)
|
688
|
+
end
|
689
|
+
rescue => exception
|
690
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
691
|
+
end
|
692
|
+
@parent = parent
|
677
693
|
end
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
694
|
+
# Create registers a new Resource.
|
695
|
+
def create(
|
696
|
+
resource \
|
697
|
+
,
|
698
|
+
deadline:nil)
|
699
|
+
req = V1::ResourceCreateRequest.new()
|
700
|
+
|
701
|
+
req.resource = Plumbing::convert_resource_to_plumbing(resource)
|
702
|
+
tries = 0
|
703
|
+
plumbing_response = nil
|
704
|
+
loop do
|
705
|
+
begin
|
706
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('Resources.Create', req), deadline:deadline)
|
707
|
+
rescue => exception
|
708
|
+
if (@parent.shouldRetry(tries, exception))
|
709
|
+
tries++
|
710
|
+
@parent.jitterSleep(tries)
|
711
|
+
next
|
712
|
+
end
|
713
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
714
|
+
end
|
715
|
+
break
|
716
|
+
end
|
690
717
|
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
rescue => exception
|
698
|
-
if (@parent.shouldRetry(tries, exception))
|
699
|
-
tries + +@parent.jitterSleep(tries)
|
700
|
-
next
|
701
|
-
end
|
702
|
-
raise Plumbing::error_to_porcelain(exception)
|
718
|
+
|
719
|
+
resp = ResourceCreateResponse.new()
|
720
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
721
|
+
resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource)
|
722
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
723
|
+
resp
|
703
724
|
end
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
725
|
+
# Get reads one Resource by ID.
|
726
|
+
def get(
|
727
|
+
id \
|
728
|
+
,
|
729
|
+
deadline:nil)
|
730
|
+
req = V1::ResourceGetRequest.new()
|
731
|
+
|
732
|
+
req.id = (id)
|
733
|
+
tries = 0
|
734
|
+
plumbing_response = nil
|
735
|
+
loop do
|
736
|
+
begin
|
737
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('Resources.Get', req), deadline:deadline)
|
738
|
+
rescue => exception
|
739
|
+
if (@parent.shouldRetry(tries, exception))
|
740
|
+
tries++
|
741
|
+
@parent.jitterSleep(tries)
|
742
|
+
next
|
743
|
+
end
|
744
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
745
|
+
end
|
746
|
+
break
|
747
|
+
end
|
720
748
|
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
rescue => exception
|
728
|
-
if (@parent.shouldRetry(tries, exception))
|
729
|
-
tries + +@parent.jitterSleep(tries)
|
730
|
-
next
|
731
|
-
end
|
732
|
-
raise Plumbing::error_to_porcelain(exception)
|
749
|
+
|
750
|
+
resp = ResourceGetResponse.new()
|
751
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
752
|
+
resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource)
|
753
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
754
|
+
resp
|
733
755
|
end
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
756
|
+
# Update patches a Resource by ID.
|
757
|
+
def update(
|
758
|
+
resource \
|
759
|
+
,
|
760
|
+
deadline:nil)
|
761
|
+
req = V1::ResourceUpdateRequest.new()
|
762
|
+
|
763
|
+
req.resource = Plumbing::convert_resource_to_plumbing(resource)
|
764
|
+
tries = 0
|
765
|
+
plumbing_response = nil
|
766
|
+
loop do
|
767
|
+
begin
|
768
|
+
plumbing_response = @stub.update(req, metadata: @parent.get_metadata('Resources.Update', req), deadline:deadline)
|
769
|
+
rescue => exception
|
770
|
+
if (@parent.shouldRetry(tries, exception))
|
771
|
+
tries++
|
772
|
+
@parent.jitterSleep(tries)
|
773
|
+
next
|
774
|
+
end
|
775
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
776
|
+
end
|
777
|
+
break
|
778
|
+
end
|
750
779
|
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
rescue => exception
|
758
|
-
if (@parent.shouldRetry(tries, exception))
|
759
|
-
tries + +@parent.jitterSleep(tries)
|
760
|
-
next
|
761
|
-
end
|
762
|
-
raise Plumbing::error_to_porcelain(exception)
|
780
|
+
|
781
|
+
resp = ResourceUpdateResponse.new()
|
782
|
+
resp.meta = Plumbing::convert_update_response_metadata_to_porcelain(plumbing_response.meta)
|
783
|
+
resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource)
|
784
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
785
|
+
resp
|
763
786
|
end
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
787
|
+
# Delete removes a Resource by ID.
|
788
|
+
def delete(
|
789
|
+
id \
|
790
|
+
,
|
791
|
+
deadline:nil)
|
792
|
+
req = V1::ResourceDeleteRequest.new()
|
793
|
+
|
794
|
+
req.id = (id)
|
795
|
+
tries = 0
|
796
|
+
plumbing_response = nil
|
797
|
+
loop do
|
798
|
+
begin
|
799
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('Resources.Delete', req), deadline:deadline)
|
800
|
+
rescue => exception
|
801
|
+
if (@parent.shouldRetry(tries, exception))
|
802
|
+
tries++
|
803
|
+
@parent.jitterSleep(tries)
|
804
|
+
next
|
805
|
+
end
|
806
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
807
|
+
end
|
808
|
+
break
|
809
|
+
end
|
780
810
|
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("Resources.Delete", req), deadline: deadline)
|
787
|
-
rescue => exception
|
788
|
-
if (@parent.shouldRetry(tries, exception))
|
789
|
-
tries + +@parent.jitterSleep(tries)
|
790
|
-
next
|
791
|
-
end
|
792
|
-
raise Plumbing::error_to_porcelain(exception)
|
811
|
+
|
812
|
+
resp = ResourceDeleteResponse.new()
|
813
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
814
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
815
|
+
resp
|
793
816
|
end
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
filter,
|
806
|
-
*args,
|
807
|
-
deadline: nil
|
808
|
-
)
|
809
|
-
req = V1::ResourceListRequest.new()
|
810
|
-
req.meta = V1::ListRequestMetadata.new()
|
811
|
-
page_size_option = @parent._test_options["PageSize"]
|
812
|
-
if page_size_option.is_a? Integer
|
813
|
-
req.meta.limit = page_size_option
|
814
|
-
end
|
815
|
-
|
816
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
817
|
-
resp = Enumerator::Generator.new { |g|
|
818
|
-
tries = 0
|
819
|
-
loop do
|
820
|
-
begin
|
821
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("Resources.List", req), deadline: deadline)
|
822
|
-
rescue => exception
|
823
|
-
if (@parent.shouldRetry(tries, exception))
|
824
|
-
tries + +@parent.jitterSleep(tries)
|
825
|
-
next
|
817
|
+
# List gets a list of Resources matching a given set of criteria.
|
818
|
+
def list(
|
819
|
+
filter \
|
820
|
+
,
|
821
|
+
*args,
|
822
|
+
deadline:nil)
|
823
|
+
req = V1::ResourceListRequest.new()
|
824
|
+
req.meta = V1::ListRequestMetadata.new()
|
825
|
+
page_size_option = @parent._test_options['PageSize']
|
826
|
+
if page_size_option.is_a? Integer
|
827
|
+
req.meta.limit = page_size_option
|
826
828
|
end
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
829
|
+
|
830
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
831
|
+
resp = Enumerator::Generator.new { |g|
|
832
|
+
tries = 0
|
833
|
+
loop do
|
834
|
+
begin
|
835
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('Resources.List', req), deadline:deadline)
|
836
|
+
rescue => exception
|
837
|
+
if (@parent.shouldRetry(tries, exception))
|
838
|
+
tries++
|
839
|
+
@parent.jitterSleep(tries)
|
840
|
+
next
|
841
|
+
end
|
842
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
843
|
+
end
|
844
|
+
tries = 0
|
845
|
+
plumbing_response.resources.each do |plumbing_item|
|
846
|
+
g.yield Plumbing::convert_resource_to_porcelain(plumbing_item)
|
847
|
+
end
|
848
|
+
break if plumbing_response.meta.next_cursor == ""
|
849
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
850
|
+
end
|
851
|
+
}
|
852
|
+
resp
|
835
853
|
end
|
836
|
-
}
|
837
|
-
resp
|
838
854
|
end
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
855
|
+
# RoleAttachments represent relationships between composite roles and the roles
|
856
|
+
# that make up those composite roles. When a composite role is attached to another
|
857
|
+
# role, the permissions granted to members of the composite role are augmented to
|
858
|
+
# include the permissions granted to members of the attached role.
|
859
|
+
class RoleAttachments
|
860
|
+
def initialize(host, insecure, parent)
|
861
|
+
begin
|
862
|
+
if insecure
|
863
|
+
@stub = V1::RoleAttachments::Stub.new(host, :this_channel_is_insecure)
|
864
|
+
else
|
865
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
866
|
+
@stub = V1::RoleAttachments::Stub.new(host, cred)
|
867
|
+
end
|
868
|
+
rescue => exception
|
869
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
870
|
+
end
|
871
|
+
@parent = parent
|
853
872
|
end
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
873
|
+
# Create registers a new RoleAttachment.
|
874
|
+
def create(
|
875
|
+
role_attachment \
|
876
|
+
,
|
877
|
+
deadline:nil)
|
878
|
+
req = V1::RoleAttachmentCreateRequest.new()
|
879
|
+
|
880
|
+
req.role_attachment = Plumbing::convert_role_attachment_to_plumbing(role_attachment)
|
881
|
+
tries = 0
|
882
|
+
plumbing_response = nil
|
883
|
+
loop do
|
884
|
+
begin
|
885
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('RoleAttachments.Create', req), deadline:deadline)
|
886
|
+
rescue => exception
|
887
|
+
if (@parent.shouldRetry(tries, exception))
|
888
|
+
tries++
|
889
|
+
@parent.jitterSleep(tries)
|
890
|
+
next
|
891
|
+
end
|
892
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
893
|
+
end
|
894
|
+
break
|
895
|
+
end
|
866
896
|
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
rescue => exception
|
874
|
-
if (@parent.shouldRetry(tries, exception))
|
875
|
-
tries + +@parent.jitterSleep(tries)
|
876
|
-
next
|
877
|
-
end
|
878
|
-
raise Plumbing::error_to_porcelain(exception)
|
897
|
+
|
898
|
+
resp = RoleAttachmentCreateResponse.new()
|
899
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
900
|
+
resp.role_attachment = Plumbing::convert_role_attachment_to_porcelain(plumbing_response.role_attachment)
|
901
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
902
|
+
resp
|
879
903
|
end
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
904
|
+
# Get reads one RoleAttachment by ID.
|
905
|
+
def get(
|
906
|
+
id \
|
907
|
+
,
|
908
|
+
deadline:nil)
|
909
|
+
req = V1::RoleAttachmentGetRequest.new()
|
910
|
+
|
911
|
+
req.id = (id)
|
912
|
+
tries = 0
|
913
|
+
plumbing_response = nil
|
914
|
+
loop do
|
915
|
+
begin
|
916
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('RoleAttachments.Get', req), deadline:deadline)
|
917
|
+
rescue => exception
|
918
|
+
if (@parent.shouldRetry(tries, exception))
|
919
|
+
tries++
|
920
|
+
@parent.jitterSleep(tries)
|
921
|
+
next
|
922
|
+
end
|
923
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
924
|
+
end
|
925
|
+
break
|
926
|
+
end
|
896
927
|
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
rescue => exception
|
904
|
-
if (@parent.shouldRetry(tries, exception))
|
905
|
-
tries + +@parent.jitterSleep(tries)
|
906
|
-
next
|
907
|
-
end
|
908
|
-
raise Plumbing::error_to_porcelain(exception)
|
928
|
+
|
929
|
+
resp = RoleAttachmentGetResponse.new()
|
930
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
931
|
+
resp.role_attachment = Plumbing::convert_role_attachment_to_porcelain(plumbing_response.role_attachment)
|
932
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
933
|
+
resp
|
909
934
|
end
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
935
|
+
# Delete removes a RoleAttachment by ID.
|
936
|
+
def delete(
|
937
|
+
id \
|
938
|
+
,
|
939
|
+
deadline:nil)
|
940
|
+
req = V1::RoleAttachmentDeleteRequest.new()
|
941
|
+
|
942
|
+
req.id = (id)
|
943
|
+
tries = 0
|
944
|
+
plumbing_response = nil
|
945
|
+
loop do
|
946
|
+
begin
|
947
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('RoleAttachments.Delete', req), deadline:deadline)
|
948
|
+
rescue => exception
|
949
|
+
if (@parent.shouldRetry(tries, exception))
|
950
|
+
tries++
|
951
|
+
@parent.jitterSleep(tries)
|
952
|
+
next
|
953
|
+
end
|
954
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
955
|
+
end
|
956
|
+
break
|
957
|
+
end
|
926
958
|
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("RoleAttachments.Delete", req), deadline: deadline)
|
933
|
-
rescue => exception
|
934
|
-
if (@parent.shouldRetry(tries, exception))
|
935
|
-
tries + +@parent.jitterSleep(tries)
|
936
|
-
next
|
937
|
-
end
|
938
|
-
raise Plumbing::error_to_porcelain(exception)
|
959
|
+
|
960
|
+
resp = RoleAttachmentDeleteResponse.new()
|
961
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
962
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
963
|
+
resp
|
939
964
|
end
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
filter,
|
952
|
-
*args,
|
953
|
-
deadline: nil
|
954
|
-
)
|
955
|
-
req = V1::RoleAttachmentListRequest.new()
|
956
|
-
req.meta = V1::ListRequestMetadata.new()
|
957
|
-
page_size_option = @parent._test_options["PageSize"]
|
958
|
-
if page_size_option.is_a? Integer
|
959
|
-
req.meta.limit = page_size_option
|
960
|
-
end
|
961
|
-
|
962
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
963
|
-
resp = Enumerator::Generator.new { |g|
|
964
|
-
tries = 0
|
965
|
-
loop do
|
966
|
-
begin
|
967
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("RoleAttachments.List", req), deadline: deadline)
|
968
|
-
rescue => exception
|
969
|
-
if (@parent.shouldRetry(tries, exception))
|
970
|
-
tries + +@parent.jitterSleep(tries)
|
971
|
-
next
|
965
|
+
# List gets a list of RoleAttachments matching a given set of criteria.
|
966
|
+
def list(
|
967
|
+
filter \
|
968
|
+
,
|
969
|
+
*args,
|
970
|
+
deadline:nil)
|
971
|
+
req = V1::RoleAttachmentListRequest.new()
|
972
|
+
req.meta = V1::ListRequestMetadata.new()
|
973
|
+
page_size_option = @parent._test_options['PageSize']
|
974
|
+
if page_size_option.is_a? Integer
|
975
|
+
req.meta.limit = page_size_option
|
972
976
|
end
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
977
|
+
|
978
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
979
|
+
resp = Enumerator::Generator.new { |g|
|
980
|
+
tries = 0
|
981
|
+
loop do
|
982
|
+
begin
|
983
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('RoleAttachments.List', req), deadline:deadline)
|
984
|
+
rescue => exception
|
985
|
+
if (@parent.shouldRetry(tries, exception))
|
986
|
+
tries++
|
987
|
+
@parent.jitterSleep(tries)
|
988
|
+
next
|
989
|
+
end
|
990
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
991
|
+
end
|
992
|
+
tries = 0
|
993
|
+
plumbing_response.role_attachments.each do |plumbing_item|
|
994
|
+
g.yield Plumbing::convert_role_attachment_to_porcelain(plumbing_item)
|
995
|
+
end
|
996
|
+
break if plumbing_response.meta.next_cursor == ""
|
997
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
998
|
+
end
|
999
|
+
}
|
1000
|
+
resp
|
981
1001
|
end
|
982
|
-
}
|
983
|
-
resp
|
984
1002
|
end
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
1003
|
+
# RoleGrants represent relationships between composite roles and the roles
|
1004
|
+
# that make up those composite roles. When a composite role is attached to another
|
1005
|
+
# role, the permissions granted to members of the composite role are augmented to
|
1006
|
+
# include the permissions granted to members of the attached role.
|
1007
|
+
class RoleGrants
|
1008
|
+
def initialize(host, insecure, parent)
|
1009
|
+
begin
|
1010
|
+
if insecure
|
1011
|
+
@stub = V1::RoleGrants::Stub.new(host, :this_channel_is_insecure)
|
1012
|
+
else
|
1013
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
1014
|
+
@stub = V1::RoleGrants::Stub.new(host, cred)
|
1015
|
+
end
|
1016
|
+
rescue => exception
|
1017
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1018
|
+
end
|
1019
|
+
@parent = parent
|
999
1020
|
end
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1021
|
+
# Create registers a new RoleGrant.
|
1022
|
+
def create(
|
1023
|
+
role_grant \
|
1024
|
+
,
|
1025
|
+
deadline:nil)
|
1026
|
+
req = V1::RoleGrantCreateRequest.new()
|
1027
|
+
|
1028
|
+
req.role_grant = Plumbing::convert_role_grant_to_plumbing(role_grant)
|
1029
|
+
tries = 0
|
1030
|
+
plumbing_response = nil
|
1031
|
+
loop do
|
1032
|
+
begin
|
1033
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('RoleGrants.Create', req), deadline:deadline)
|
1034
|
+
rescue => exception
|
1035
|
+
if (@parent.shouldRetry(tries, exception))
|
1036
|
+
tries++
|
1037
|
+
@parent.jitterSleep(tries)
|
1038
|
+
next
|
1039
|
+
end
|
1040
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1041
|
+
end
|
1042
|
+
break
|
1043
|
+
end
|
1012
1044
|
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
rescue => exception
|
1020
|
-
if (@parent.shouldRetry(tries, exception))
|
1021
|
-
tries + +@parent.jitterSleep(tries)
|
1022
|
-
next
|
1023
|
-
end
|
1024
|
-
raise Plumbing::error_to_porcelain(exception)
|
1045
|
+
|
1046
|
+
resp = RoleGrantCreateResponse.new()
|
1047
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
1048
|
+
resp.role_grant = Plumbing::convert_role_grant_to_porcelain(plumbing_response.role_grant)
|
1049
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
1050
|
+
resp
|
1025
1051
|
end
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1052
|
+
# Get reads one RoleGrant by ID.
|
1053
|
+
def get(
|
1054
|
+
id \
|
1055
|
+
,
|
1056
|
+
deadline:nil)
|
1057
|
+
req = V1::RoleGrantGetRequest.new()
|
1058
|
+
|
1059
|
+
req.id = (id)
|
1060
|
+
tries = 0
|
1061
|
+
plumbing_response = nil
|
1062
|
+
loop do
|
1063
|
+
begin
|
1064
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('RoleGrants.Get', req), deadline:deadline)
|
1065
|
+
rescue => exception
|
1066
|
+
if (@parent.shouldRetry(tries, exception))
|
1067
|
+
tries++
|
1068
|
+
@parent.jitterSleep(tries)
|
1069
|
+
next
|
1070
|
+
end
|
1071
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1072
|
+
end
|
1073
|
+
break
|
1074
|
+
end
|
1042
1075
|
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
rescue => exception
|
1050
|
-
if (@parent.shouldRetry(tries, exception))
|
1051
|
-
tries + +@parent.jitterSleep(tries)
|
1052
|
-
next
|
1053
|
-
end
|
1054
|
-
raise Plumbing::error_to_porcelain(exception)
|
1076
|
+
|
1077
|
+
resp = RoleGrantGetResponse.new()
|
1078
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
1079
|
+
resp.role_grant = Plumbing::convert_role_grant_to_porcelain(plumbing_response.role_grant)
|
1080
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
1081
|
+
resp
|
1055
1082
|
end
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1083
|
+
# Delete removes a RoleGrant by ID.
|
1084
|
+
def delete(
|
1085
|
+
id \
|
1086
|
+
,
|
1087
|
+
deadline:nil)
|
1088
|
+
req = V1::RoleGrantDeleteRequest.new()
|
1089
|
+
|
1090
|
+
req.id = (id)
|
1091
|
+
tries = 0
|
1092
|
+
plumbing_response = nil
|
1093
|
+
loop do
|
1094
|
+
begin
|
1095
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('RoleGrants.Delete', req), deadline:deadline)
|
1096
|
+
rescue => exception
|
1097
|
+
if (@parent.shouldRetry(tries, exception))
|
1098
|
+
tries++
|
1099
|
+
@parent.jitterSleep(tries)
|
1100
|
+
next
|
1101
|
+
end
|
1102
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1103
|
+
end
|
1104
|
+
break
|
1105
|
+
end
|
1072
1106
|
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("RoleGrants.Delete", req), deadline: deadline)
|
1079
|
-
rescue => exception
|
1080
|
-
if (@parent.shouldRetry(tries, exception))
|
1081
|
-
tries + +@parent.jitterSleep(tries)
|
1082
|
-
next
|
1083
|
-
end
|
1084
|
-
raise Plumbing::error_to_porcelain(exception)
|
1107
|
+
|
1108
|
+
resp = RoleGrantDeleteResponse.new()
|
1109
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
1110
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
1111
|
+
resp
|
1085
1112
|
end
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
filter,
|
1098
|
-
*args,
|
1099
|
-
deadline: nil
|
1100
|
-
)
|
1101
|
-
req = V1::RoleGrantListRequest.new()
|
1102
|
-
req.meta = V1::ListRequestMetadata.new()
|
1103
|
-
page_size_option = @parent._test_options["PageSize"]
|
1104
|
-
if page_size_option.is_a? Integer
|
1105
|
-
req.meta.limit = page_size_option
|
1106
|
-
end
|
1107
|
-
|
1108
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
1109
|
-
resp = Enumerator::Generator.new { |g|
|
1110
|
-
tries = 0
|
1111
|
-
loop do
|
1112
|
-
begin
|
1113
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("RoleGrants.List", req), deadline: deadline)
|
1114
|
-
rescue => exception
|
1115
|
-
if (@parent.shouldRetry(tries, exception))
|
1116
|
-
tries + +@parent.jitterSleep(tries)
|
1117
|
-
next
|
1113
|
+
# List gets a list of RoleGrants matching a given set of criteria.
|
1114
|
+
def list(
|
1115
|
+
filter \
|
1116
|
+
,
|
1117
|
+
*args,
|
1118
|
+
deadline:nil)
|
1119
|
+
req = V1::RoleGrantListRequest.new()
|
1120
|
+
req.meta = V1::ListRequestMetadata.new()
|
1121
|
+
page_size_option = @parent._test_options['PageSize']
|
1122
|
+
if page_size_option.is_a? Integer
|
1123
|
+
req.meta.limit = page_size_option
|
1118
1124
|
end
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1125
|
+
|
1126
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
1127
|
+
resp = Enumerator::Generator.new { |g|
|
1128
|
+
tries = 0
|
1129
|
+
loop do
|
1130
|
+
begin
|
1131
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('RoleGrants.List', req), deadline:deadline)
|
1132
|
+
rescue => exception
|
1133
|
+
if (@parent.shouldRetry(tries, exception))
|
1134
|
+
tries++
|
1135
|
+
@parent.jitterSleep(tries)
|
1136
|
+
next
|
1137
|
+
end
|
1138
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1139
|
+
end
|
1140
|
+
tries = 0
|
1141
|
+
plumbing_response.role_grants.each do |plumbing_item|
|
1142
|
+
g.yield Plumbing::convert_role_grant_to_porcelain(plumbing_item)
|
1143
|
+
end
|
1144
|
+
break if plumbing_response.meta.next_cursor == ""
|
1145
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
1146
|
+
end
|
1147
|
+
}
|
1148
|
+
resp
|
1127
1149
|
end
|
1128
|
-
}
|
1129
|
-
resp
|
1130
1150
|
end
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1151
|
+
# Roles are tools for controlling user access to resources. Each Role holds a
|
1152
|
+
# list of resources which they grant access to. Composite roles are a special
|
1153
|
+
# type of Role which have no resource associations of their own, but instead
|
1154
|
+
# grant access to the combined resources associated with a set of child roles.
|
1155
|
+
# Each user can be a member of one Role or composite role.
|
1156
|
+
class Roles
|
1157
|
+
def initialize(host, insecure, parent)
|
1158
|
+
begin
|
1159
|
+
if insecure
|
1160
|
+
@stub = V1::Roles::Stub.new(host, :this_channel_is_insecure)
|
1161
|
+
else
|
1162
|
+
cred = GRPC::Core::ChannelCredentials.new()
|
1163
|
+
@stub = V1::Roles::Stub.new(host, cred)
|
1164
|
+
end
|
1165
|
+
rescue => exception
|
1166
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1167
|
+
end
|
1168
|
+
@parent = parent
|
1146
1169
|
end
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1170
|
+
# Create registers a new Role.
|
1171
|
+
def create(
|
1172
|
+
role \
|
1173
|
+
,
|
1174
|
+
deadline:nil)
|
1175
|
+
req = V1::RoleCreateRequest.new()
|
1176
|
+
|
1177
|
+
req.role = Plumbing::convert_role_to_plumbing(role)
|
1178
|
+
tries = 0
|
1179
|
+
plumbing_response = nil
|
1180
|
+
loop do
|
1181
|
+
begin
|
1182
|
+
plumbing_response = @stub.create(req, metadata: @parent.get_metadata('Roles.Create', req), deadline:deadline)
|
1183
|
+
rescue => exception
|
1184
|
+
if (@parent.shouldRetry(tries, exception))
|
1185
|
+
tries++
|
1186
|
+
@parent.jitterSleep(tries)
|
1187
|
+
next
|
1188
|
+
end
|
1189
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1190
|
+
end
|
1191
|
+
break
|
1192
|
+
end
|
1159
1193
|
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
rescue => exception
|
1167
|
-
if (@parent.shouldRetry(tries, exception))
|
1168
|
-
tries + +@parent.jitterSleep(tries)
|
1169
|
-
next
|
1170
|
-
end
|
1171
|
-
raise Plumbing::error_to_porcelain(exception)
|
1194
|
+
|
1195
|
+
resp = RoleCreateResponse.new()
|
1196
|
+
resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)
|
1197
|
+
resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role)
|
1198
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
1199
|
+
resp
|
1172
1200
|
end
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1201
|
+
# Get reads one Role by ID.
|
1202
|
+
def get(
|
1203
|
+
id \
|
1204
|
+
,
|
1205
|
+
deadline:nil)
|
1206
|
+
req = V1::RoleGetRequest.new()
|
1207
|
+
|
1208
|
+
req.id = (id)
|
1209
|
+
tries = 0
|
1210
|
+
plumbing_response = nil
|
1211
|
+
loop do
|
1212
|
+
begin
|
1213
|
+
plumbing_response = @stub.get(req, metadata: @parent.get_metadata('Roles.Get', req), deadline:deadline)
|
1214
|
+
rescue => exception
|
1215
|
+
if (@parent.shouldRetry(tries, exception))
|
1216
|
+
tries++
|
1217
|
+
@parent.jitterSleep(tries)
|
1218
|
+
next
|
1219
|
+
end
|
1220
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1221
|
+
end
|
1222
|
+
break
|
1223
|
+
end
|
1189
1224
|
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
rescue => exception
|
1197
|
-
if (@parent.shouldRetry(tries, exception))
|
1198
|
-
tries + +@parent.jitterSleep(tries)
|
1199
|
-
next
|
1200
|
-
end
|
1201
|
-
raise Plumbing::error_to_porcelain(exception)
|
1225
|
+
|
1226
|
+
resp = RoleGetResponse.new()
|
1227
|
+
resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)
|
1228
|
+
resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role)
|
1229
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
1230
|
+
resp
|
1202
1231
|
end
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1232
|
+
# Update patches a Role by ID.
|
1233
|
+
def update(
|
1234
|
+
role \
|
1235
|
+
,
|
1236
|
+
deadline:nil)
|
1237
|
+
req = V1::RoleUpdateRequest.new()
|
1238
|
+
|
1239
|
+
req.role = Plumbing::convert_role_to_plumbing(role)
|
1240
|
+
tries = 0
|
1241
|
+
plumbing_response = nil
|
1242
|
+
loop do
|
1243
|
+
begin
|
1244
|
+
plumbing_response = @stub.update(req, metadata: @parent.get_metadata('Roles.Update', req), deadline:deadline)
|
1245
|
+
rescue => exception
|
1246
|
+
if (@parent.shouldRetry(tries, exception))
|
1247
|
+
tries++
|
1248
|
+
@parent.jitterSleep(tries)
|
1249
|
+
next
|
1250
|
+
end
|
1251
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1252
|
+
end
|
1253
|
+
break
|
1254
|
+
end
|
1219
1255
|
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
rescue => exception
|
1227
|
-
if (@parent.shouldRetry(tries, exception))
|
1228
|
-
tries + +@parent.jitterSleep(tries)
|
1229
|
-
next
|
1230
|
-
end
|
1231
|
-
raise Plumbing::error_to_porcelain(exception)
|
1256
|
+
|
1257
|
+
resp = RoleUpdateResponse.new()
|
1258
|
+
resp.meta = Plumbing::convert_update_response_metadata_to_porcelain(plumbing_response.meta)
|
1259
|
+
resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role)
|
1260
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
1261
|
+
resp
|
1232
1262
|
end
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1263
|
+
# Delete removes a Role by ID.
|
1264
|
+
def delete(
|
1265
|
+
id \
|
1266
|
+
,
|
1267
|
+
deadline:nil)
|
1268
|
+
req = V1::RoleDeleteRequest.new()
|
1269
|
+
|
1270
|
+
req.id = (id)
|
1271
|
+
tries = 0
|
1272
|
+
plumbing_response = nil
|
1273
|
+
loop do
|
1274
|
+
begin
|
1275
|
+
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata('Roles.Delete', req), deadline:deadline)
|
1276
|
+
rescue => exception
|
1277
|
+
if (@parent.shouldRetry(tries, exception))
|
1278
|
+
tries++
|
1279
|
+
@parent.jitterSleep(tries)
|
1280
|
+
next
|
1281
|
+
end
|
1282
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1283
|
+
end
|
1284
|
+
break
|
1285
|
+
end
|
1249
1286
|
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
plumbing_response = @stub.delete(req, metadata: @parent.get_metadata("Roles.Delete", req), deadline: deadline)
|
1256
|
-
rescue => exception
|
1257
|
-
if (@parent.shouldRetry(tries, exception))
|
1258
|
-
tries + +@parent.jitterSleep(tries)
|
1259
|
-
next
|
1260
|
-
end
|
1261
|
-
raise Plumbing::error_to_porcelain(exception)
|
1287
|
+
|
1288
|
+
resp = RoleDeleteResponse.new()
|
1289
|
+
resp.meta = Plumbing::convert_delete_response_metadata_to_porcelain(plumbing_response.meta)
|
1290
|
+
resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)
|
1291
|
+
resp
|
1262
1292
|
end
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
filter,
|
1275
|
-
*args,
|
1276
|
-
deadline: nil
|
1277
|
-
)
|
1278
|
-
req = V1::RoleListRequest.new()
|
1279
|
-
req.meta = V1::ListRequestMetadata.new()
|
1280
|
-
page_size_option = @parent._test_options["PageSize"]
|
1281
|
-
if page_size_option.is_a? Integer
|
1282
|
-
req.meta.limit = page_size_option
|
1283
|
-
end
|
1284
|
-
|
1285
|
-
req.filter = Plumbing::quote_filter_args(filter, *args)
|
1286
|
-
resp = Enumerator::Generator.new { |g|
|
1287
|
-
tries = 0
|
1288
|
-
loop do
|
1289
|
-
begin
|
1290
|
-
plumbing_response = @stub.list(req, metadata: @parent.get_metadata("Roles.List", req), deadline: deadline)
|
1291
|
-
rescue => exception
|
1292
|
-
if (@parent.shouldRetry(tries, exception))
|
1293
|
-
tries + +@parent.jitterSleep(tries)
|
1294
|
-
next
|
1293
|
+
# List gets a list of Roles matching a given set of criteria.
|
1294
|
+
def list(
|
1295
|
+
filter \
|
1296
|
+
,
|
1297
|
+
*args,
|
1298
|
+
deadline:nil)
|
1299
|
+
req = V1::RoleListRequest.new()
|
1300
|
+
req.meta = V1::ListRequestMetadata.new()
|
1301
|
+
page_size_option = @parent._test_options['PageSize']
|
1302
|
+
if page_size_option.is_a? Integer
|
1303
|
+
req.meta.limit = page_size_option
|
1295
1304
|
end
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1305
|
+
|
1306
|
+
req.filter = Plumbing::quote_filter_args(filter, *args)
|
1307
|
+
resp = Enumerator::Generator.new { |g|
|
1308
|
+
tries = 0
|
1309
|
+
loop do
|
1310
|
+
begin
|
1311
|
+
plumbing_response = @stub.list(req, metadata: @parent.get_metadata('Roles.List', req), deadline:deadline)
|
1312
|
+
rescue => exception
|
1313
|
+
if (@parent.shouldRetry(tries, exception))
|
1314
|
+
tries++
|
1315
|
+
@parent.jitterSleep(tries)
|
1316
|
+
next
|
1317
|
+
end
|
1318
|
+
raise Plumbing::convert_error_to_porcelain(exception)
|
1319
|
+
end
|
1320
|
+
tries = 0
|
1321
|
+
plumbing_response.roles.each do |plumbing_item|
|
1322
|
+
g.yield Plumbing::convert_role_to_porcelain(plumbing_item)
|
1323
|
+
end
|
1324
|
+
break if plumbing_response.meta.next_cursor == ""
|
1325
|
+
req.meta.cursor = plumbing_response.meta.next_cursor
|
1326
|
+
end
|
1327
|
+
}
|
1328
|
+
resp
|
1304
1329
|
end
|
1305
|
-
}
|
1306
|
-
resp
|
1307
1330
|
end
|
1308
|
-
end
|
1309
1331
|
end
|