Skip to content

Commit b68661c

Browse files
committed
fixups
1 parent 2c49e92 commit b68661c

File tree

6 files changed

+2
-79
lines changed

6 files changed

+2
-79
lines changed

api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,4 @@ DirectDownloadCertificateHostStatusResponse createDirectDownloadCertificateProvi
609609
ApiKeyPairResponse createKeyPairResponse(ApiKeyPair keyPair);
610610

611611
ListResponse<BaseRolePermissionResponse> createKeypairPermissionsResponse(List<ApiKeyPairPermission> permissions);
612-
613-
KMSKeyResponse createKMSKeyResponse(KMSKey kmsKey);
614612
}

api/src/main/java/org/apache/cloudstack/api/command/user/kms/CreateKMSKeyCmd.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ public class CreateKMSKeyCmd extends BaseCmd implements UserCmd {
6363
description = "Description of the KMS key")
6464
private String description;
6565

66-
@Parameter(name = ApiConstants.PURPOSE,
67-
type = CommandType.STRING,
68-
description = "Purpose of the key: volume, tls. (default: volume)")
69-
private String purpose;
70-
7166
@Parameter(name = ApiConstants.ZONE_ID,
7267
required = true,
7368
type = CommandType.UUID,
@@ -112,10 +107,6 @@ public String getDescription() {
112107
return description;
113108
}
114109

115-
public String getPurpose() {
116-
return purpose == null ? "volume" : purpose;
117-
}
118-
119110
public Long getZoneId() {
120111
return zoneId;
121112
}

api/src/main/java/org/apache/cloudstack/api/command/user/kms/ListKMSKeysCmd.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ public class ListKMSKeysCmd extends BaseListProjectAndAccountResourcesCmd implem
5454
description = "List KMS key by UUID")
5555
private Long id;
5656

57-
@Parameter(name = ApiConstants.PURPOSE,
58-
type = CommandType.STRING,
59-
description = "Filter by purpose: volume, tls")
60-
private String purpose;
61-
6257
@Parameter(name = ApiConstants.ZONE_ID,
6358
type = CommandType.UUID,
6459
entityType = ZoneResponse.class,
@@ -80,10 +75,6 @@ public Long getId() {
8075
return id;
8176
}
8277

83-
public String getPurpose() {
84-
return purpose;
85-
}
86-
8778
public Long getZoneId() {
8879
return zoneId;
8980
}

api/src/main/java/org/apache/cloudstack/api/response/KMSKeyResponse.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ public class KMSKeyResponse extends BaseResponse implements ControlledViewEntity
4444
@Param(description = "the description of the key")
4545
private String description;
4646

47-
@SerializedName(ApiConstants.PURPOSE)
48-
@Param(description = "the purpose of the key (VOLUME_ENCRYPTION, TLS_CERT)")
49-
private String purpose;
50-
5147
@SerializedName(ApiConstants.ACCOUNT)
5248
@Param(description = "the account owning the key")
5349
private String accountName;
@@ -140,14 +136,6 @@ public void setDescription(String description) {
140136
this.description = description;
141137
}
142138

143-
public String getPurpose() {
144-
return purpose;
145-
}
146-
147-
public void setPurpose(String purpose) {
148-
this.purpose = purpose;
149-
}
150-
151139
public String getAccountName() {
152140
return accountName;
153141
}

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5802,48 +5802,4 @@ public ListResponse<BaseRolePermissionResponse> createKeypairPermissionsResponse
58025802
response.setResponses(permissionResponses);
58035803
return response;
58045804
}
5805-
5806-
@Override
5807-
public KMSKeyResponse createKMSKeyResponse(KMSKey kmsKey) {
5808-
KMSKeyResponse response = new KMSKeyResponse();
5809-
response.setId(kmsKey.getUuid());
5810-
response.setName(kmsKey.getName());
5811-
response.setDescription(kmsKey.getDescription());
5812-
response.setPurpose(kmsKey.getPurpose().getName());
5813-
response.setAccountId(String.valueOf(kmsKey.getAccountId()));
5814-
response.setDomainId(String.valueOf(kmsKey.getDomainId()));
5815-
response.setZoneId(String.valueOf(kmsKey.getZoneId()));
5816-
response.setProvider(kmsKey.getProviderName());
5817-
response.setAlgorithm(kmsKey.getAlgorithm());
5818-
response.setKeyBits(kmsKey.getKeyBits());
5819-
response.setState(kmsKey.getState().toString());
5820-
response.setCreated(kmsKey.getCreated());
5821-
5822-
// Set account name
5823-
Account account = ApiDBUtils.findAccountById(kmsKey.getAccountId());
5824-
if (account != null) {
5825-
response.setAccountName(account.getAccountName());
5826-
}
5827-
5828-
// Set domain name
5829-
Domain domain = ApiDBUtils.findDomainById(kmsKey.getDomainId());
5830-
if (domain != null) {
5831-
response.setDomainName(domain.getName());
5832-
}
5833-
5834-
// Set zone name
5835-
DataCenter zone = ApiDBUtils.findZoneById(kmsKey.getZoneId());
5836-
if (zone != null) {
5837-
response.setZoneName(zone.getName());
5838-
}
5839-
5840-
// Set KEK label (admin only)
5841-
Account caller = CallContext.current().getCallingAccount();
5842-
if (caller != null && (caller.getType() == Account.Type.ADMIN || caller.getType() == Account.Type.RESOURCE_DOMAIN_ADMIN)) {
5843-
response.setKekLabel(kmsKey.getKekLabel());
5844-
}
5845-
5846-
response.setObjectName("kmskey");
5847-
return response;
5848-
}
58495805
}

server/src/main/java/org/apache/cloudstack/kms/KMSManagerImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public KMSKeyResponse createKMSKey(CreateKMSKeyCmd cmd) throws KMSException {
318318
Account targetAccount = accountManager.finalizeOwner(caller, cmd.getAccountName(), cmd.getDomainId(),
319319
cmd.getProjectId());
320320

321-
KeyPurpose keyPurpose = parseKeyPurpose(cmd.getPurpose());
321+
KeyPurpose keyPurpose = parseKeyPurpose("volume");
322322

323323
int bits = cmd.getKeyBits();
324324
if (bits != 128 && bits != 192 && bits != 256) {
@@ -349,7 +349,6 @@ KMSKeyResponse createKMSKeyResponse(KMSKey kmsKey) {
349349
response.setId(kmsKey.getUuid());
350350
response.setName(kmsKey.getName());
351351
response.setDescription(kmsKey.getDescription());
352-
response.setPurpose(kmsKey.getPurpose().getName());
353352
response.setAlgorithm(kmsKey.getAlgorithm());
354353
response.setKeyBits(kmsKey.getKeyBits());
355354
response.setEnabled(kmsKey.isEnabled());
@@ -482,7 +481,7 @@ SearchCriteria<KMSKeyVO> getSearchCriteriaForKMSKeys(SearchBuilder<KMSKeyVO> sea
482481
SearchCriteria<KMSKeyVO> sc = searchBuilder.create();
483482
accountManager.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts,
484483
listProjectResourcesCriteria);
485-
KeyPurpose keyPurpose = parseKeyPurpose(cmd.getPurpose());
484+
KeyPurpose keyPurpose = parseKeyPurpose("volume");
486485
if (cmd.getId() != null) {
487486
sc.setParameters("id", cmd.getId());
488487
}

0 commit comments

Comments
 (0)