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 SSHPassword 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.
4481 4482 4483 4484 4485 4486 4487 4488 |
# File 'lib/svc.rb', line 4481 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.
4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 |
# File 'lib/svc.rb', line 4530 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.
4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 |
# File 'lib/svc.rb', line 4624 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.
4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 |
# File 'lib/svc.rb', line 4491 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.
4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 |
# File 'lib/svc.rb', line 4560 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.
4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 |
# File 'lib/svc.rb', line 4694 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.
4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 |
# File 'lib/svc.rb', line 4653 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.
4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 |
# File 'lib/svc.rb', line 4594 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 |