Class: SDM::Resources
Overview
Resources are databases, servers, clusters, websites, or clouds that strongDM delegates access to.
See: AKS AKSBasicAuth AKSServiceAccount AKSServiceAccountUserImpersonation AKSUserImpersonation AmazonEKS AmazonEKSInstanceProfile AmazonEKSUserImpersonation AmazonES AmazonMQAMQP091 Athena AuroraMysql AuroraPostgres AWS AWSConsole AWSConsoleStaticKeyPair Azure AzureCertificate AzureMysql AzurePostgres BigQuery Cassandra Citus Clustrix Cockroach DB2I DB2LUW DocumentDBHost DocumentDBReplicaSet Druid DynamoDB Elastic ElasticacheRedis GCP GoogleGKE GoogleGKEUserImpersonation Greenplum HTTPAuth HTTPBasicAuth HTTPNoAuth Kubernetes KubernetesBasicAuth KubernetesServiceAccount KubernetesServiceAccountUserImpersonation KubernetesUserImpersonation Maria Memcached Memsql MongoHost MongoLegacyHost MongoLegacyReplicaset MongoReplicaSet MongoShardedCluster MTLSMysql MTLSPostgres Mysql Neptune NeptuneIAM Oracle Postgres Presto RabbitMQAMQP091 RawTCP RDP Redis Redshift SingleStore Snowflake Snowsight SQLServer SSH SSHCert SSHCustomerKey Sybase SybaseIQ Teradata
Instance Method Summary collapse
-
#create(resource, deadline: nil) ⇒ Object
Create registers a new Resource.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a Resource by ID.
-
#enumerate_tags(filter, *args, deadline: nil) ⇒ Object
EnumerateTags gets a list of the filter matching tags.
-
#get(id, deadline: nil) ⇒ Object
Get reads one Resource by ID.
-
#initialize(channel, parent) ⇒ Resources
constructor
A new instance of Resources.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Resources matching a given set of criteria.
-
#update(resource, deadline: nil) ⇒ Object
Update replaces all the fields of a Resource by ID.
Constructor Details
#initialize(channel, parent) ⇒ Resources
Returns a new instance of Resources.
2081 2082 2083 2084 2085 2086 2087 2088 |
# File 'lib/svc.rb', line 2081 def initialize(channel, parent) begin @stub = V1::Resources::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(resource, deadline: nil) ⇒ Object
Create registers a new Resource.
2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 |
# File 'lib/svc.rb', line 2131 def create( resource, deadline: nil ) req = V1::ResourceCreateRequest.new() req.resource = Plumbing::convert_resource_to_plumbing(resource) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("Resources.Create", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = ResourceCreateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a Resource by ID.
2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 |
# File 'lib/svc.rb', line 2225 def delete( id, deadline: nil ) req = V1::ResourceDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("Resources.Delete", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = ResourceDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#enumerate_tags(filter, *args, deadline: nil) ⇒ Object
EnumerateTags gets a list of the filter matching tags.
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 |
# File 'lib/svc.rb', line 2091 def ( filter, *args, deadline: nil ) req = V1::EnumerateTagsRequest.new() req. = V1::ListRequestMetadata.new() page_size_option = @parent.["PageSize"] if page_size_option.is_a? Integer req..limit = page_size_option end if not @parent.snapshot_time.nil? req..snapshot_at = @parent.snapshot_time end req.filter = Plumbing::quote_filter_args(filter, *args) resp = Enumerator::Generator.new { |g| tries = 0 loop do begin plumbing_response = @stub.(req, metadata: @parent.("Resources.EnumerateTags", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.matches.each do |plumbing_item| g.yield Plumbing::convert_tag_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one Resource by ID.
2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 |
# File 'lib/svc.rb', line 2161 def get( id, deadline: nil ) req = V1::ResourceGetRequest.new() if not @parent.snapshot_time.nil? req. = V1::GetRequestMetadata.new() req..snapshot_at = @parent.snapshot_time end req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("Resources.Get", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = ResourceGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Resources matching a given set of criteria.
2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 |
# File 'lib/svc.rb', line 2254 def list( filter, *args, deadline: nil ) req = V1::ResourceListRequest.new() req. = V1::ListRequestMetadata.new() page_size_option = @parent.["PageSize"] if page_size_option.is_a? Integer req..limit = page_size_option end if not @parent.snapshot_time.nil? req..snapshot_at = @parent.snapshot_time end req.filter = Plumbing::quote_filter_args(filter, *args) resp = Enumerator::Generator.new { |g| tries = 0 loop do begin plumbing_response = @stub.list(req, metadata: @parent.("Resources.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.resources.each do |plumbing_item| g.yield Plumbing::convert_resource_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |
#update(resource, deadline: nil) ⇒ Object
Update replaces all the fields of a Resource by ID.
2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 |
# File 'lib/svc.rb', line 2195 def update( resource, deadline: nil ) req = V1::ResourceUpdateRequest.new() req.resource = Plumbing::convert_resource_to_plumbing(resource) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.update(req, metadata: @parent.("Resources.Update", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = ResourceUpdateResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.resource = Plumbing::convert_resource_to_porcelain(plumbing_response.resource) resp end |