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