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 AmazonEKSInstanceProfileUserImpersonation AmazonEKSUserImpersonation AmazonES AmazonMQAMQP091 Athena AuroraMysql AuroraPostgres AuroraPostgresIAM AWS AWSConsole AWSConsoleStaticKeyPair Azure AzureCertificate AzureMysql AzurePostgres AzurePostgresManagedIdentity 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 RDPCert RDSPostgresIAM Redis Redshift SingleStore Snowflake Snowsight SQLServer SQLServerAzureAD SQLServerKerberosAD SSH SSHCert SSHCustomerKey Sybase SybaseIQ Teradata Trino
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.
-
#healthcheck(id, deadline: nil) ⇒ Object
Healthcheck triggers a remote healthcheck.
-
#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.
4126 4127 4128 4129 4130 4131 4132 4133 |
# File 'lib/svc.rb', line 4126 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.
4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 |
# File 'lib/svc.rb', line 4175 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.
4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 |
# File 'lib/svc.rb', line 4269 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.
4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 |
# File 'lib/svc.rb', line 4136 def ( filter, *args, deadline: nil ) req = V1::EnumerateTagsRequest.new() req. = V1::ListRequestMetadata.new() if @parent.page_limit > 0 req..limit = @parent.page_limit 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.
4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 |
# File 'lib/svc.rb', line 4205 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 |
#healthcheck(id, deadline: nil) ⇒ Object
Healthcheck triggers a remote healthcheck. It may take minutes to propagate across a large network of Nodes. The call will return immediately, and the updated health of the Resource can be retrieved via Get or List.
4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 |
# File 'lib/svc.rb', line 4339 def healthcheck( id, deadline: nil ) req = V1::ResourceHealthcheckRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.healthcheck(req, metadata: @parent.("Resources.Healthcheck", 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 = ResourceHealthcheckResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Resources matching a given set of criteria.
4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 |
# File 'lib/svc.rb', line 4298 def list( filter, *args, deadline: nil ) req = V1::ResourceListRequest.new() req. = V1::ListRequestMetadata.new() if @parent.page_limit > 0 req..limit = @parent.page_limit 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.
4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 |
# File 'lib/svc.rb', line 4239 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 |