Skip to content

Commit

Permalink
Merge pull request ManageIQ#1205 from Autosde/implement-cloud_snapsho…
Browse files Browse the repository at this point in the history
…t-collector_list_page_and_dashboard

Implement cloud snapshot collector, list page, create & delete methods
  • Loading branch information
agrare committed Apr 4, 2023
2 parents 978caab + 5409e74 commit f7affb8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app/controllers/api/cloud_volume_snapshots_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Api
class CloudVolumeSnapshotsController < BaseController
def delete_resource_action(type, id = nil, _data = nil)
api_resource(type, id, "Deleting", :supports => :delete) do |snapshot|
{:task_id => snapshot.delete_snapshot_queue(User.current_userid)}
end
end
end
end
18 changes: 17 additions & 1 deletion config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,26 @@
:identifier: cloud_tenant_tag
:cloud_volume_snapshots:
:description: Cloud Volume Snapshots
:identifier: cloud_volume_snapshot
:options:
- :subcollection
- :collection
:verbs: *gpppd
:klass: CloudVolumeSnapshot
:subcollections:
:collection_actions:
:get:
- :name: read
:identifier: cloud_volume_snapshot_view
:post:
- :name: delete
:identifier: cloud_volume_snapshot_delete
:resource_actions:
:get:
- :name: read
:identifier: cloud_volume_snapshot_view
:post:
- :name: delete
:identifier: cloud_volume_snapshot_delete
:cloud_volume_types:
:description: Cloud Volume Types
:identifier: cloud_volume_type
Expand Down
11 changes: 11 additions & 0 deletions spec/requests/cloud_volume_snapshots_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,16 @@
expect_bad_request(/Feature not .*supported/)
end
end

describe "DELETE /api/cloud_volumes/:c_id/cloud_volume_snapshots/:s_id" do
it "create & delete cloud volume snapshot" do
api_basic_authorize('cloud_volume_snapshot_delete')

stub_supports(CloudVolumeSnapshot, :delete)
post(api_cloud_volume_snapshot_url(nil, cloud_volume_snapshot), :params => gen_request(:delete))

expect_single_action_result(:success => true, :message => /Deleting Cloud Volume Snapshot id: #{cloud_volume_snapshot.id} name: '#{cloud_volume_snapshot.name}'/)
end
end
end
end

0 comments on commit f7affb8

Please sign in to comment.