Class: Clusters::Agents::ManagedResources::DeleteService
- Inherits:
-
Object
- Object
- Clusters::Agents::ManagedResources::DeleteService
- Defined in:
- app/services/clusters/agents/managed_resources/delete_service.rb
Constant Summary collapse
- CORE_GROUP =
'core'- POLLING_SCHEDULE =
[ 10.seconds, 30.seconds, 5.minutes, 30.minutes, 1.hour ].freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(managed_resource, attempt_count: nil) ⇒ DeleteService
constructor
A new instance of DeleteService.
Constructor Details
#initialize(managed_resource, attempt_count: nil) ⇒ DeleteService
Returns a new instance of DeleteService.
16 17 18 19 |
# File 'app/services/clusters/agents/managed_resources/delete_service.rb', line 16 def initialize(managed_resource, attempt_count: nil) @managed_resource = managed_resource @attempt_count = attempt_count || 0 end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/clusters/agents/managed_resources/delete_service.rb', line 21 def execute return unless managed_resource.deleting? response = kas_client.delete_environment(managed_resource:) if response.errors.any? requeue! response.errors.each do |error| log_error(details: format_error(error)) end return end track_event(managed_resource, response) managed_resource.update!(tracked_objects: tracked_objects(response.in_progress)) if managed_resource.tracked_objects.any? requeue! else update_status!(:deleted) end end |