Skip to content

Commit b2cad5b

Browse files
committed
CLOUDSTACK-3709: Add the missing file.
1 parent 65f5642 commit b2cad5b

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.command.admin.storage;
18+
19+
import org.apache.cloudstack.api.APICommand;
20+
import org.apache.cloudstack.api.ApiConstants;
21+
import org.apache.cloudstack.api.ApiErrorCode;
22+
import org.apache.cloudstack.api.BaseCmd;
23+
import org.apache.cloudstack.api.Parameter;
24+
import org.apache.cloudstack.api.ServerApiException;
25+
import org.apache.cloudstack.api.response.ImageStoreResponse;
26+
import org.apache.cloudstack.api.response.SuccessResponse;
27+
import org.apache.log4j.Logger;
28+
29+
import com.cloud.user.Account;
30+
31+
@APICommand(name = "deleteCacheStore", description = "Deletes a cache store .", responseObject = SuccessResponse.class, since = "4.2.0")
32+
public class DeleteCacheStoreCmd extends BaseCmd {
33+
public static final Logger s_logger = Logger.getLogger(DeleteCacheStoreCmd.class.getName());
34+
35+
private static final String s_name = "deletecachestoreresponse";
36+
37+
// ///////////////////////////////////////////////////
38+
// ////////////// API parameters /////////////////////
39+
// ///////////////////////////////////////////////////
40+
41+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class,
42+
required = true, description = "the cache store ID")
43+
private Long id;
44+
45+
46+
// ///////////////////////////////////////////////////
47+
// ///////////////// Accessors ///////////////////////
48+
// ///////////////////////////////////////////////////
49+
50+
public Long getId() {
51+
return id;
52+
}
53+
54+
55+
// ///////////////////////////////////////////////////
56+
// ///////////// API Implementation///////////////////
57+
// ///////////////////////////////////////////////////
58+
59+
@Override
60+
public String getCommandName() {
61+
return s_name;
62+
}
63+
64+
@Override
65+
public long getEntityOwnerId() {
66+
return Account.ACCOUNT_ID_SYSTEM;
67+
}
68+
69+
@Override
70+
public void execute() {
71+
boolean result = _storageService.deleteCacheStore(this);
72+
if (result) {
73+
SuccessResponse response = new SuccessResponse(getCommandName());
74+
this.setResponseObject(response);
75+
} else {
76+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete image store");
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)