Skip to content

Commit

Permalink
Add archive/unarchive actions to ServiceTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Jun 1, 2018
1 parent 9d14322 commit 41617d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/controllers/api/service_templates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ def order_resource(_type, id, data)
order_service_template(id, data)
end

def archive_resource(type, id, _data)
service_template = resource_search(id, type, collection_class(type))
service_template.archive!
action_result(true, "Archived Service Template")
rescue => err
action_result(false, "Could not archive Service Template - #{err}")
end

def unarchive_resource(type, id, _data)
service_template = resource_search(id, type, collection_class(type))
service_template.unarchive!
action_result(true, "Activated Service Template")
rescue => err
action_result(false, "Could not activate Service Template - #{err}")
end

private

def set_additional_attributes
Expand Down
8 changes: 8 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2775,6 +2775,10 @@
:identifier: atomic_catalogitem_new
- :name: order
:identifier: svc_catalog_provision
- :name: archive
:identifier: svc_catalog_archive
- :name: unarchive
:identifier: svc_catalog_unarchive
:subcollection_actions:
:post:
- :name: edit
Expand All @@ -2800,6 +2804,10 @@
:identifier: catalogitem_delete
- :name: order
:identifier: svc_catalog_provision
- :name: archive
:identifier: svc_catalog_archive
- :name: unarchive
:identifier: svc_catalog_unarchive
:options:
- :validate_action
:delete:
Expand Down

0 comments on commit 41617d0

Please sign in to comment.