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