-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a command for deleting containers
- Loading branch information
1 parent
52f3655
commit cec3c4f
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#============================================================================== | ||
# Copyright (C) 2020-present Alces Flight Ltd. | ||
# | ||
# This file is part of Flight Asset. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License 2.0 which is available at | ||
# <https://www.eclipse.org/legal/epl-2.0>, or alternative license | ||
# terms made available by Alces Flight Ltd - please direct inquiries | ||
# about licensing to [email protected]. | ||
# | ||
# Flight Asset is distributed in the hope that it will be useful, but | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR | ||
# IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS | ||
# OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A | ||
# PARTICULAR PURPOSE. See the Eclipse Public License 2.0 for more | ||
# details. | ||
# | ||
# You should have received a copy of the Eclipse Public License 2.0 | ||
# along with Flight Asset. If not, see: | ||
# | ||
# https://opensource.org/licenses/EPL-2.0 | ||
# | ||
# For more information on Flight Asset, please visit: | ||
# https://github.com/alces-flight/alces-flight/flight-asset-cli | ||
#============================================================================== | ||
|
||
module FlightAsset | ||
module Commands | ||
class DeleteContainer < FlightAsset::Command | ||
include Concerns::BeforeConfiguredCheck | ||
|
||
define_args :name | ||
|
||
def run | ||
request_asset_containers_record_by_name(name).delete | ||
rescue SimpleJSONAPIClient::Errors::APIError | ||
raise ClientError, <<~ERROR.chomp | ||
Failed to delete the container! Please ensure it is empty and try again. | ||
ERROR | ||
end | ||
end | ||
end | ||
end |