strongdm 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +30 -0
  4. data/doc/Google.html +95 -0
  5. data/doc/Google/Protobuf.html +95 -0
  6. data/doc/LICENSE.html +294 -0
  7. data/doc/Object.html +290 -0
  8. data/doc/README_md.html +128 -0
  9. data/doc/SDM.html +143 -0
  10. data/doc/SDM/AKS.html +347 -0
  11. data/doc/SDM/AKSBasicAuth.html +279 -0
  12. data/doc/SDM/AKSServiceAccount.html +262 -0
  13. data/doc/SDM/AccountAttachment.html +217 -0
  14. data/doc/SDM/AccountAttachmentCreateOptions.html +182 -0
  15. data/doc/SDM/AccountAttachmentCreateResponse.html +216 -0
  16. data/doc/SDM/AccountAttachmentDeleteResponse.html +199 -0
  17. data/doc/SDM/AccountAttachmentGetResponse.html +215 -0
  18. data/doc/SDM/AccountAttachments.html +429 -0
  19. data/doc/SDM/AccountCreateResponse.html +232 -0
  20. data/doc/SDM/AccountDeleteResponse.html +197 -0
  21. data/doc/SDM/AccountGetResponse.html +214 -0
  22. data/doc/SDM/AccountGrant.html +253 -0
  23. data/doc/SDM/AccountGrantCreateResponse.html +215 -0
  24. data/doc/SDM/AccountGrantDeleteResponse.html +198 -0
  25. data/doc/SDM/AccountGrantGetResponse.html +214 -0
  26. data/doc/SDM/AccountGrants.html +425 -0
  27. data/doc/SDM/AccountUpdateResponse.html +214 -0
  28. data/doc/SDM/Accounts.html +492 -0
  29. data/doc/SDM/AlreadyExistsError.html +161 -0
  30. data/doc/SDM/AmazonEKS.html +330 -0
  31. data/doc/SDM/AmazonES.html +296 -0
  32. data/doc/SDM/Athena.html +296 -0
  33. data/doc/SDM/AuroraMysql.html +313 -0
  34. data/doc/SDM/AuroraPostgres.html +330 -0
  35. data/doc/SDM/AuthenticationError.html +161 -0
  36. data/doc/SDM/BadRequestError.html +161 -0
  37. data/doc/SDM/BigQuery.html +296 -0
  38. data/doc/SDM/Cassandra.html +313 -0
  39. data/doc/SDM/Client.html +549 -0
  40. data/doc/SDM/Clustrix.html +313 -0
  41. data/doc/SDM/Cockroach.html +330 -0
  42. data/doc/SDM/CreateResponseMetadata.html +156 -0
  43. data/doc/SDM/DeadlineExceededError.html +161 -0
  44. data/doc/SDM/DeleteResponseMetadata.html +156 -0
  45. data/doc/SDM/Druid.html +296 -0
  46. data/doc/SDM/DynamoDB.html +296 -0
  47. data/doc/SDM/Elastic.html +313 -0
  48. data/doc/SDM/ElasticacheRedis.html +296 -0
  49. data/doc/SDM/Gateway.html +252 -0
  50. data/doc/SDM/GetResponseMetadata.html +156 -0
  51. data/doc/SDM/GoogleGKE.html +296 -0
  52. data/doc/SDM/Greenplum.html +330 -0
  53. data/doc/SDM/HTTPAuth.html +313 -0
  54. data/doc/SDM/HTTPBasicAuth.html +330 -0
  55. data/doc/SDM/HTTPNoAuth.html +296 -0
  56. data/doc/SDM/InternalError.html +161 -0
  57. data/doc/SDM/Kubernetes.html +347 -0
  58. data/doc/SDM/KubernetesBasicAuth.html +279 -0
  59. data/doc/SDM/KubernetesServiceAccount.html +262 -0
  60. data/doc/SDM/Maria.html +313 -0
  61. data/doc/SDM/Memcached.html +262 -0
  62. data/doc/SDM/Memsql.html +313 -0
  63. data/doc/SDM/MongoHost.html +330 -0
  64. data/doc/SDM/MongoLegacyHost.html +347 -0
  65. data/doc/SDM/MongoLegacyReplicaset.html +364 -0
  66. data/doc/SDM/MongoReplicaSet.html +364 -0
  67. data/doc/SDM/Mysql.html +313 -0
  68. data/doc/SDM/NodeCreateResponse.html +232 -0
  69. data/doc/SDM/NodeDeleteResponse.html +197 -0
  70. data/doc/SDM/NodeGetResponse.html +214 -0
  71. data/doc/SDM/NodeUpdateResponse.html +214 -0
  72. data/doc/SDM/Nodes.html +493 -0
  73. data/doc/SDM/NotFoundError.html +161 -0
  74. data/doc/SDM/Oracle.html +330 -0
  75. data/doc/SDM/PermissionError.html +161 -0
  76. data/doc/SDM/Plumbing.html +15821 -0
  77. data/doc/SDM/Postgres.html +330 -0
  78. data/doc/SDM/Presto.html +330 -0
  79. data/doc/SDM/RDP.html +296 -0
  80. data/doc/SDM/RPCError.html +182 -0
  81. data/doc/SDM/RateLimitError.html +183 -0
  82. data/doc/SDM/RateLimitMetadata.html +233 -0
  83. data/doc/SDM/Redis.html +279 -0
  84. data/doc/SDM/Redshift.html +330 -0
  85. data/doc/SDM/Relay.html +216 -0
  86. data/doc/SDM/ResourceCreateResponse.html +214 -0
  87. data/doc/SDM/ResourceDeleteResponse.html +197 -0
  88. data/doc/SDM/ResourceGetResponse.html +214 -0
  89. data/doc/SDM/ResourceUpdateResponse.html +215 -0
  90. data/doc/SDM/Resources.html +482 -0
  91. data/doc/SDM/Role.html +216 -0
  92. data/doc/SDM/RoleAttachment.html +216 -0
  93. data/doc/SDM/RoleAttachmentCreateResponse.html +216 -0
  94. data/doc/SDM/RoleAttachmentDeleteResponse.html +199 -0
  95. data/doc/SDM/RoleAttachmentGetResponse.html +214 -0
  96. data/doc/SDM/RoleAttachments.html +427 -0
  97. data/doc/SDM/RoleCreateResponse.html +215 -0
  98. data/doc/SDM/RoleDeleteResponse.html +197 -0
  99. data/doc/SDM/RoleGetResponse.html +214 -0
  100. data/doc/SDM/RoleGrant.html +214 -0
  101. data/doc/SDM/RoleGrantCreateResponse.html +215 -0
  102. data/doc/SDM/RoleGrantDeleteResponse.html +198 -0
  103. data/doc/SDM/RoleGrantGetResponse.html +214 -0
  104. data/doc/SDM/RoleGrants.html +427 -0
  105. data/doc/SDM/RoleUpdateResponse.html +215 -0
  106. data/doc/SDM/Roles.html +490 -0
  107. data/doc/SDM/SQLServer.html +347 -0
  108. data/doc/SDM/SSH.html +296 -0
  109. data/doc/SDM/Service.html +215 -0
  110. data/doc/SDM/Snowflake.html +313 -0
  111. data/doc/SDM/Sybase.html +296 -0
  112. data/doc/SDM/SybaseIQ.html +296 -0
  113. data/doc/SDM/Teradata.html +296 -0
  114. data/doc/SDM/UpdateResponseMetadata.html +156 -0
  115. data/doc/SDM/User.html +248 -0
  116. data/doc/V1.html +864 -0
  117. data/doc/V1/AccountAttachments.html +109 -0
  118. data/doc/V1/AccountAttachments/Service.html +116 -0
  119. data/doc/V1/AccountGrants.html +109 -0
  120. data/doc/V1/AccountGrants/Service.html +117 -0
  121. data/doc/V1/Accounts.html +109 -0
  122. data/doc/V1/Accounts/Service.html +122 -0
  123. data/doc/V1/Nodes.html +109 -0
  124. data/doc/V1/Nodes/Service.html +124 -0
  125. data/doc/V1/Resources.html +109 -0
  126. data/doc/V1/Resources/Service.html +113 -0
  127. data/doc/V1/RoleAttachments.html +109 -0
  128. data/doc/V1/RoleAttachments/Service.html +119 -0
  129. data/doc/V1/RoleGrants.html +109 -0
  130. data/doc/V1/RoleGrants/Service.html +119 -0
  131. data/doc/V1/Roles.html +109 -0
  132. data/doc/V1/Roles/Service.html +120 -0
  133. data/doc/created.rid +37 -0
  134. data/doc/css/fonts.css +167 -0
  135. data/doc/css/rdoc.css +590 -0
  136. data/doc/examples/Gemfile.html +95 -0
  137. data/doc/examples/Gemfile_lock.html +112 -0
  138. data/doc/examples/README_md.html +95 -0
  139. data/doc/fonts/Lato-Light.ttf +0 -0
  140. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  141. data/doc/fonts/Lato-Regular.ttf +0 -0
  142. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  143. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  144. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  145. data/doc/images/add.png +0 -0
  146. data/doc/images/arrow_up.png +0 -0
  147. data/doc/images/brick.png +0 -0
  148. data/doc/images/brick_link.png +0 -0
  149. data/doc/images/bug.png +0 -0
  150. data/doc/images/bullet_black.png +0 -0
  151. data/doc/images/bullet_toggle_minus.png +0 -0
  152. data/doc/images/bullet_toggle_plus.png +0 -0
  153. data/doc/images/date.png +0 -0
  154. data/doc/images/delete.png +0 -0
  155. data/doc/images/find.png +0 -0
  156. data/doc/images/loadingAnimation.gif +0 -0
  157. data/doc/images/macFFBgHack.png +0 -0
  158. data/doc/images/package.png +0 -0
  159. data/doc/images/page_green.png +0 -0
  160. data/doc/images/page_white_text.png +0 -0
  161. data/doc/images/page_white_width.png +0 -0
  162. data/doc/images/plugin.png +0 -0
  163. data/doc/images/ruby.png +0 -0
  164. data/doc/images/tag_blue.png +0 -0
  165. data/doc/images/tag_green.png +0 -0
  166. data/doc/images/transparent.png +0 -0
  167. data/doc/images/wrench.png +0 -0
  168. data/doc/images/wrench_orange.png +0 -0
  169. data/doc/images/zoom.png +0 -0
  170. data/doc/index.html +353 -0
  171. data/doc/js/darkfish.js +161 -0
  172. data/doc/js/jquery.js +4 -0
  173. data/doc/js/navigation.js +142 -0
  174. data/doc/js/navigation.js.gz +0 -0
  175. data/doc/js/search.js +109 -0
  176. data/doc/js/search_index.js +1 -0
  177. data/doc/js/search_index.js.gz +0 -0
  178. data/doc/js/searcher.js +228 -0
  179. data/doc/js/searcher.js.gz +0 -0
  180. data/doc/lib/version.html +98 -0
  181. data/doc/strongdm_gemspec.html +117 -0
  182. data/doc/table_of_contents.html +3002 -0
  183. data/examples/Gemfile +3 -0
  184. data/examples/Gemfile.lock +14 -0
  185. data/examples/README.md +5 -0
  186. data/examples/listUsers.rb +21 -0
  187. data/examples/panicButton.rb +154 -0
  188. data/lib/errors/errors.rb +85 -0
  189. data/lib/grpc/account_attachments_pb.rb +84 -0
  190. data/lib/grpc/account_attachments_services_pb.rb +44 -0
  191. data/lib/grpc/account_grants_pb.rb +82 -0
  192. data/lib/grpc/account_grants_services_pb.rb +44 -0
  193. data/lib/grpc/accounts_pb.rb +107 -0
  194. data/lib/grpc/accounts_services_pb.rb +49 -0
  195. data/lib/grpc/drivers_pb.rb +601 -0
  196. data/lib/grpc/nodes_pb.rb +107 -0
  197. data/lib/grpc/nodes_services_pb.rb +49 -0
  198. data/lib/grpc/options_pb.rb +60 -0
  199. data/lib/grpc/plumbing.rb +4283 -0
  200. data/lib/grpc/protoc-gen-swagger/options/annotations_pb.rb +15 -0
  201. data/lib/grpc/resources_pb.rb +85 -0
  202. data/lib/grpc/resources_services_pb.rb +45 -0
  203. data/lib/grpc/role_attachments_pb.rb +79 -0
  204. data/lib/grpc/role_attachments_services_pb.rb +47 -0
  205. data/lib/grpc/role_grants_pb.rb +79 -0
  206. data/lib/grpc/role_grants_services_pb.rb +47 -0
  207. data/lib/grpc/roles_pb.rb +91 -0
  208. data/lib/grpc/roles_services_pb.rb +50 -0
  209. data/lib/grpc/spec_pb.rb +95 -0
  210. data/lib/models/porcelain.rb +4033 -0
  211. data/lib/strongdm.rb +128 -0
  212. data/lib/svc.rb +1331 -0
  213. data/lib/version +3 -0
  214. data/lib/version.rb +17 -0
  215. data/strongdm.gemspec +23 -0
  216. metadata +318 -0
data/doc/Object.html ADDED
@@ -0,0 +1,290 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Object - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ </script>
12
+
13
+ <script src="./js/jquery.js"></script>
14
+ <script src="./js/darkfish.js"></script>
15
+
16
+ <link href="./css/fonts.css" rel="stylesheet">
17
+ <link href="./css/rdoc.css" rel="stylesheet">
18
+
19
+
20
+
21
+ <body id="top" role="document" class="class">
22
+ <nav role="navigation">
23
+ <div id="project-navigation">
24
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
+ <h2>
26
+ <a href="./index.html" rel="home">Home</a>
27
+ </h2>
28
+
29
+ <div id="table-of-contents-navigation">
30
+ <a href="./table_of_contents.html#pages">Pages</a>
31
+ <a href="./table_of_contents.html#classes">Classes</a>
32
+ <a href="./table_of_contents.html#methods">Methods</a>
33
+ </div>
34
+ </div>
35
+
36
+ <div id="search-section" role="search" class="project-section initially-hidden">
37
+ <form action="#" method="get" accept-charset="utf-8">
38
+ <div id="search-field-wrapper">
39
+ <input id="search-field" role="combobox" aria-label="Search"
40
+ aria-autocomplete="list" aria-controls="search-results"
41
+ type="text" name="search" placeholder="Search" spellcheck="false"
42
+ title="Type to search, Up and Down to navigate, Enter to load">
43
+ </div>
44
+
45
+ <ul id="search-results" aria-label="Search Results"
46
+ aria-busy="false" aria-expanded="false"
47
+ aria-atomic="false" class="initially-hidden"></ul>
48
+ </form>
49
+ </div>
50
+
51
+ </div>
52
+
53
+
54
+
55
+ <div id="class-metadata">
56
+
57
+ <div id="parent-class-section" class="nav-section">
58
+ <h3>Parent</h3>
59
+
60
+
61
+ <p class="link">BasicObject
62
+
63
+ </div>
64
+
65
+
66
+
67
+ <!-- Method Quickref -->
68
+ <div id="method-list-section" class="nav-section">
69
+ <h3>Methods</h3>
70
+
71
+ <ul class="link-list" role="directory">
72
+
73
+ <li ><a href="#method-i-main">#main</a>
74
+
75
+ </ul>
76
+ </div>
77
+
78
+ </div>
79
+ </nav>
80
+
81
+ <main role="main" aria-labelledby="class-Object">
82
+ <h1 id="class-Object" class="class">
83
+ class Object
84
+ </h1>
85
+
86
+ <section class="description">
87
+
88
+ </section>
89
+
90
+
91
+
92
+
93
+ <section id="5Buntitled-5D" class="documentation-section">
94
+
95
+
96
+
97
+
98
+
99
+ <section class="constants-list">
100
+ <header>
101
+ <h3>Constants</h3>
102
+ </header>
103
+ <dl>
104
+
105
+ <dt id="DEFAULT_BASE_RETRY_DELAY">DEFAULT_BASE_RETRY_DELAY
106
+
107
+ <dd>
108
+
109
+
110
+ <dt id="DEFAULT_MAX_RETRIES">DEFAULT_MAX_RETRIES
111
+
112
+ <dd>
113
+
114
+
115
+ <dt id="DEFAULT_MAX_RETRY_DELAY">DEFAULT_MAX_RETRY_DELAY
116
+
117
+ <dd>
118
+
119
+
120
+ </dl>
121
+ </section>
122
+
123
+
124
+
125
+
126
+
127
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
128
+ <header>
129
+ <h3>Public Instance Methods</h3>
130
+ </header>
131
+
132
+
133
+ <div id="method-i-main" class="method-detail ">
134
+
135
+ <div class="method-heading">
136
+ <span class="method-name">main</span><span
137
+ class="method-args">()</span>
138
+
139
+ <span class="method-click-advice">click to toggle source</span>
140
+
141
+ </div>
142
+
143
+
144
+ <div class="method-description">
145
+
146
+ <p>panicButton.rb suspends all users except for one admin, in the fake use
147
+ case of a critical break in or something usage: ruby panicButton.rb
148
+ adminuser@email.com to revert back to pre-panic state: ruby panicButton.rb
149
+ revert</p>
150
+
151
+
152
+
153
+
154
+ <div class="method-source-code" id="main-source">
155
+ <pre><span class="ruby-comment"># File examples/panicButton.rb, line 40</span>
156
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">main</span>
157
+ <span class="ruby-identifier">access_key</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SDM_API_ACCESS_KEY&quot;</span>]
158
+ <span class="ruby-identifier">secret_key</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SDM_API_SECRET_KEY&quot;</span>]
159
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">access_key</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">secret_key</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
160
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;SDM_API_ACCESS_KEY and SDM_API_SECRET_KEY must be provided&quot;</span>
161
+ <span class="ruby-keyword">return</span>
162
+ <span class="ruby-keyword">end</span>
163
+ <span class="ruby-identifier">client</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">access_key</span>, <span class="ruby-identifier">secret_key</span>)
164
+
165
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword">and</span> <span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;revert&quot;</span>
166
+ <span class="ruby-identifier">state_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&quot;state.json&quot;</span>)
167
+ <span class="ruby-identifier">state</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">state_file</span>)
168
+
169
+ <span class="ruby-identifier">reinstated_count</span> = <span class="ruby-value">0</span>
170
+
171
+ <span class="ruby-identifier">users</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">&#39;&#39;</span>)
172
+ <span class="ruby-identifier">users</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span>
173
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">suspended</span>
174
+ <span class="ruby-identifier">reinstated_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
175
+ <span class="ruby-identifier">user</span>.<span class="ruby-identifier">suspended</span> = <span class="ruby-keyword">false</span>
176
+ <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">user</span>)
177
+ <span class="ruby-keyword">end</span>
178
+ }
179
+ <span class="ruby-identifier">state</span>[<span class="ruby-string">&quot;attachments&quot;</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">attachment</span><span class="ruby-operator">|</span>
180
+ <span class="ruby-keyword">begin</span>
181
+ <span class="ruby-identifier">a</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AccountAttachment</span>.<span class="ruby-identifier">new</span>()
182
+ <span class="ruby-identifier">a</span>.<span class="ruby-identifier">account_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">&quot;account_id&quot;</span>]
183
+ <span class="ruby-identifier">a</span>.<span class="ruby-identifier">role_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">&quot;role_id&quot;</span>]
184
+ <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_attachments</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">a</span>)
185
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AlreadyExistsError</span>
186
+ <span class="ruby-keyword">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
187
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;skipping creation of attachment due to error: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>
188
+ <span class="ruby-keyword">end</span>
189
+ }
190
+ <span class="ruby-identifier">state</span>[<span class="ruby-string">&quot;grants&quot;</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">attachment</span><span class="ruby-operator">|</span>
191
+ <span class="ruby-keyword">begin</span>
192
+ <span class="ruby-identifier">g</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AccountGrant</span>.<span class="ruby-identifier">new</span>()
193
+ <span class="ruby-identifier">g</span>.<span class="ruby-identifier">account_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">&quot;account_id&quot;</span>]
194
+ <span class="ruby-identifier">g</span>.<span class="ruby-identifier">resource_id</span> = <span class="ruby-identifier">attachment</span>[<span class="ruby-string">&quot;resource_id&quot;</span>]
195
+ <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">g</span>)
196
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">AlreadyExistsError</span>
197
+ <span class="ruby-keyword">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
198
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;skipping creation of grant due to error: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>
199
+ <span class="ruby-keyword">end</span>
200
+ }
201
+
202
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;reinstated &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">reinstated_count</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; users&quot;</span>
203
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;recreated &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-string">&quot;attachments&quot;</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; account attachments&quot;</span>
204
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;recreated &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-string">&quot;grants&quot;</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; account grants&quot;</span>
205
+
206
+ <span class="ruby-keyword">return</span>
207
+ <span class="ruby-keyword">end</span>
208
+
209
+ <span class="ruby-identifier">admin_email</span> = <span class="ruby-string">&quot;&quot;</span>
210
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
211
+ <span class="ruby-identifier">admin_email</span> = <span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>]
212
+ <span class="ruby-keyword">else</span>
213
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;please provide an admin email to preserve&quot;</span>
214
+ <span class="ruby-keyword">return</span> <span class="ruby-value">1</span>
215
+ <span class="ruby-keyword">end</span>
216
+
217
+ <span class="ruby-identifier">admin_user_id</span> = <span class="ruby-string">&quot;&quot;</span>
218
+ <span class="ruby-identifier">users</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">&quot;email:?&quot;</span>, <span class="ruby-identifier">admin_email</span>)
219
+ <span class="ruby-identifier">users</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span>
220
+ <span class="ruby-identifier">admin_user_id</span> = <span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span>
221
+ }
222
+
223
+ <span class="ruby-identifier">account_attachments</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_attachments</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">&#39;&#39;</span>)
224
+ <span class="ruby-identifier">account_grants</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">&#39;&#39;</span>)
225
+
226
+ <span class="ruby-identifier">state</span> = {
227
+ <span class="ruby-string">&#39;attachments&#39;</span><span class="ruby-operator">:</span> <span class="ruby-identifier">account_attachments</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
228
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">admin_user_id</span>
229
+ <span class="ruby-identifier">out</span> = {
230
+ <span class="ruby-string">&#39;account_id&#39;</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span>,
231
+ <span class="ruby-string">&#39;role_id&#39;</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">role_id</span>,
232
+ }
233
+ <span class="ruby-keyword">end</span>
234
+ }.<span class="ruby-identifier">reject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>},
235
+ <span class="ruby-string">&#39;grants&#39;</span><span class="ruby-operator">:</span> <span class="ruby-identifier">account_grants</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
236
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">admin_user_id</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">valid_until</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
237
+ <span class="ruby-identifier">out</span> = {
238
+ <span class="ruby-string">&#39;account_id&#39;</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">account_id</span>,
239
+ <span class="ruby-string">&#39;resource_id&#39;</span><span class="ruby-operator">:</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">resource_id</span>,
240
+ }
241
+ <span class="ruby-keyword">end</span>
242
+ }.<span class="ruby-identifier">reject</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>},
243
+ }
244
+
245
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;storing &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-value">:attachments</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; account attachments in state&quot;</span>
246
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;storing &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">state</span>[<span class="ruby-value">:grants</span>].<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; account grants in state&quot;</span>
247
+
248
+ <span class="ruby-identifier">state_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-string">&quot;state.json&quot;</span>, <span class="ruby-string">&quot;w&quot;</span>)
249
+ <span class="ruby-identifier">state_file</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">state</span>.<span class="ruby-identifier">to_json</span>)
250
+
251
+ <span class="ruby-identifier">suspended_count</span> = <span class="ruby-value">0</span>
252
+ <span class="ruby-identifier">users</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">&#39;&#39;</span>)
253
+ <span class="ruby-identifier">users</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span>
254
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">instance_of?</span> <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">User</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">email</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">admin_email</span>
255
+ <span class="ruby-keyword">next</span>
256
+ <span class="ruby-keyword">end</span>
257
+ <span class="ruby-identifier">user</span>.<span class="ruby-identifier">suspended</span> = <span class="ruby-keyword">true</span>
258
+ <span class="ruby-keyword">begin</span>
259
+ <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">user</span>)
260
+ <span class="ruby-identifier">suspended_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
261
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
262
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;skipping user &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; on account of error: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span>
263
+ <span class="ruby-keyword">end</span>
264
+ }
265
+
266
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;suspended &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">suspended_count</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; users&quot;</span>
267
+
268
+ <span class="ruby-keyword">end</span></pre>
269
+ </div>
270
+
271
+ </div>
272
+
273
+
274
+
275
+
276
+ </div>
277
+
278
+
279
+ </section>
280
+
281
+ </section>
282
+ </main>
283
+
284
+
285
+ <footer id="validator-badges" role="contentinfo">
286
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
287
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
288
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
289
+ </footer>
290
+
@@ -0,0 +1,128 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>README - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ </script>
12
+
13
+ <script src="./js/jquery.js"></script>
14
+ <script src="./js/darkfish.js"></script>
15
+
16
+ <link href="./css/fonts.css" rel="stylesheet">
17
+ <link href="./css/rdoc.css" rel="stylesheet">
18
+
19
+
20
+
21
+ <body id="top" role="document" class="file">
22
+ <nav role="navigation">
23
+ <div id="project-navigation">
24
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
+ <h2>
26
+ <a href="./index.html" rel="home">Home</a>
27
+ </h2>
28
+
29
+ <div id="table-of-contents-navigation">
30
+ <a href="./table_of_contents.html#pages">Pages</a>
31
+ <a href="./table_of_contents.html#classes">Classes</a>
32
+ <a href="./table_of_contents.html#methods">Methods</a>
33
+ </div>
34
+ </div>
35
+
36
+ <div id="search-section" role="search" class="project-section initially-hidden">
37
+ <form action="#" method="get" accept-charset="utf-8">
38
+ <div id="search-field-wrapper">
39
+ <input id="search-field" role="combobox" aria-label="Search"
40
+ aria-autocomplete="list" aria-controls="search-results"
41
+ type="text" name="search" placeholder="Search" spellcheck="false"
42
+ title="Type to search, Up and Down to navigate, Enter to load">
43
+ </div>
44
+
45
+ <ul id="search-results" aria-label="Search Results"
46
+ aria-busy="false" aria-expanded="false"
47
+ aria-atomic="false" class="initially-hidden"></ul>
48
+ </form>
49
+ </div>
50
+
51
+ </div>
52
+
53
+
54
+ <div class="nav-section">
55
+ <h3>Table of Contents</h3>
56
+
57
+ <ul class="link-list" role="directory">
58
+ <li><a href="#label-strongDM+SDK+for+Ruby">strongDM SDK for Ruby</a>
59
+ <li><a href="#label-Quick+Start">Quick Start</a>
60
+ </ul>
61
+ </div>
62
+
63
+
64
+ <div id="project-metadata">
65
+ <div id="fileindex-section" class="nav-section">
66
+ <h3>Pages</h3>
67
+
68
+ <ul class="link-list">
69
+
70
+ <li><a href="./LICENSE.html">LICENSE</a>
71
+
72
+ <li><a href="./README_md.html">README</a>
73
+
74
+ <li><a href="./examples/Gemfile.html">Gemfile</a>
75
+
76
+ <li><a href="./examples/Gemfile_lock.html">Gemfile.lock</a>
77
+
78
+ <li><a href="./examples/README_md.html">README</a>
79
+
80
+ <li><a href="./lib/version.html">version</a>
81
+
82
+ <li><a href="./strongdm_gemspec.html">strongdm.gemspec</a>
83
+
84
+ </ul>
85
+ </div>
86
+
87
+ </div>
88
+ </nav>
89
+
90
+ <main role="main" aria-label="Page README.md">
91
+
92
+ <h1 id="label-strongDM+SDK+for+Ruby">strongDM SDK for Ruby<span><a href="#label-strongDM+SDK+for+Ruby">&para;</a> <a href="#top">&uarr;</a></span></h1>
93
+
94
+ <p>The official strongDM SDK for the Ruby programming language.</p>
95
+
96
+ <h2 id="label-Quick+Start">Quick Start<span><a href="#label-Quick+Start">&para;</a> <a href="#top">&uarr;</a></span></h2>
97
+
98
+ <p>First, install the gem:</p>
99
+
100
+ <pre>$ gem install strongdm</pre>
101
+
102
+ <p>Next, go to <a href="https://app.strongdm.com">app.strongdm.com</a> and
103
+ create an API key. Set the <code>SDM_API_ACCESS_KEY</code> and
104
+ <code>SDM_API_SECRET_KEY</code> environment variables.</p>
105
+
106
+ <pre>$ export SDM_API_ACCESS_KEY=&lt;YOUR ACCESS KEY&gt;
107
+ $ export SDM_API_SECRET_KEY=&lt;YOUR SECRET KEY&gt;</pre>
108
+
109
+ <p>Run some example code.</p>
110
+
111
+ <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&quot;strongdm&quot;</span>
112
+
113
+ <span class="ruby-identifier">client</span> = <span class="ruby-constant">SDM</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;SDM_API_ACCESS_KEY&#39;</span>], <span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;SDM_API_SECRET_KEY&#39;</span>])
114
+ <span class="ruby-identifier">users</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">accounts</span>.<span class="ruby-identifier">list</span>(<span class="ruby-string">&#39;&#39;</span>)
115
+ <span class="ruby-identifier">users</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">user</span><span class="ruby-operator">|</span>
116
+ <span class="ruby-identifier">p</span> <span class="ruby-identifier">user</span>
117
+ <span class="ruby-keyword">end</span>
118
+ </pre>
119
+ </main>
120
+
121
+
122
+
123
+ <footer id="validator-badges" role="contentinfo">
124
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
125
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
126
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
127
+ </footer>
128
+
data/doc/SDM.html ADDED
@@ -0,0 +1,143 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module SDM - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ </script>
12
+
13
+ <script src="./js/jquery.js"></script>
14
+ <script src="./js/darkfish.js"></script>
15
+
16
+ <link href="./css/fonts.css" rel="stylesheet">
17
+ <link href="./css/rdoc.css" rel="stylesheet">
18
+
19
+
20
+
21
+ <body id="top" role="document" class="module">
22
+ <nav role="navigation">
23
+ <div id="project-navigation">
24
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
+ <h2>
26
+ <a href="./index.html" rel="home">Home</a>
27
+ </h2>
28
+
29
+ <div id="table-of-contents-navigation">
30
+ <a href="./table_of_contents.html#pages">Pages</a>
31
+ <a href="./table_of_contents.html#classes">Classes</a>
32
+ <a href="./table_of_contents.html#methods">Methods</a>
33
+ </div>
34
+ </div>
35
+
36
+ <div id="search-section" role="search" class="project-section initially-hidden">
37
+ <form action="#" method="get" accept-charset="utf-8">
38
+ <div id="search-field-wrapper">
39
+ <input id="search-field" role="combobox" aria-label="Search"
40
+ aria-autocomplete="list" aria-controls="search-results"
41
+ type="text" name="search" placeholder="Search" spellcheck="false"
42
+ title="Type to search, Up and Down to navigate, Enter to load">
43
+ </div>
44
+
45
+ <ul id="search-results" aria-label="Search Results"
46
+ aria-busy="false" aria-expanded="false"
47
+ aria-atomic="false" class="initially-hidden"></ul>
48
+ </form>
49
+ </div>
50
+
51
+ </div>
52
+
53
+
54
+
55
+ <div id="class-metadata">
56
+
57
+
58
+
59
+
60
+
61
+ </div>
62
+ </nav>
63
+
64
+ <main role="main" aria-labelledby="module-SDM">
65
+ <h1 id="module-SDM" class="module">
66
+ module SDM
67
+ </h1>
68
+
69
+ <section class="description">
70
+
71
+ <p>Copyright 2020 StrongDM Inc</p>
72
+
73
+ <p>Licensed under the Apache License, Version 2.0 (the “License”); you may not
74
+ use this file except in compliance with the License. You may obtain a copy
75
+ of the License at</p>
76
+
77
+ <pre class="ruby"><span class="ruby-identifier">http</span>:<span class="ruby-operator">/</span><span class="ruby-regexp">/www.apache.org/</span><span class="ruby-identifier">licenses</span><span class="ruby-operator">/</span><span class="ruby-constant">LICENSE</span><span class="ruby-operator">-</span><span class="ruby-value">2.0</span>
78
+ </pre>
79
+
80
+ <p>Unless required by applicable law or agreed to in writing, software
81
+ distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
82
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
83
+ License for the specific language governing permissions and limitations
84
+ under the License.</p>
85
+
86
+ <p>This file was generated by protogen. DO NOT EDIT.</p>
87
+
88
+ <p>This file was generated by protogen. DO NOT EDIT.</p>
89
+
90
+ <p>Copyright 2020 StrongDM Inc</p>
91
+
92
+ <p>Licensed under the Apache License, Version 2.0 (the “License”); you may not
93
+ use this file except in compliance with the License. You may obtain a copy
94
+ of the License at</p>
95
+
96
+ <pre class="ruby"><span class="ruby-identifier">http</span>:<span class="ruby-operator">/</span><span class="ruby-regexp">/www.apache.org/</span><span class="ruby-identifier">licenses</span><span class="ruby-operator">/</span><span class="ruby-constant">LICENSE</span><span class="ruby-operator">-</span><span class="ruby-value">2.0</span>
97
+ </pre>
98
+
99
+ <p>Unless required by applicable law or agreed to in writing, software
100
+ distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
101
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
102
+ License for the specific language governing permissions and limitations
103
+ under the License.</p>
104
+
105
+ </section>
106
+
107
+
108
+
109
+
110
+ <section id="5Buntitled-5D" class="documentation-section">
111
+
112
+
113
+
114
+
115
+
116
+ <section class="constants-list">
117
+ <header>
118
+ <h3>Constants</h3>
119
+ </header>
120
+ <dl>
121
+
122
+ <dt id="VERSION">VERSION
123
+
124
+ <dd>
125
+
126
+
127
+ </dl>
128
+ </section>
129
+
130
+
131
+
132
+
133
+
134
+ </section>
135
+ </main>
136
+
137
+
138
+ <footer id="validator-badges" role="contentinfo">
139
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
140
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
141
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
142
+ </footer>
143
+