Skip to content

Commit 1a5625a

Browse files
author
Daman Arora
committed
display S3 endpoint and bucket in secondary storage details
1 parent 26dc485 commit 1a5625a

3 files changed

Lines changed: 39 additions & 1 deletion

File tree

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ public class ImageStoreResponse extends BaseResponseWithAnnotations {
7171
@Param(description = "The host's currently used disk size")
7272
private Long diskSizeUsed;
7373

74+
@SerializedName(ApiConstants.S3_END_POINT)
75+
@Param(description = "The S3 endpoint URL")
76+
private String s3Endpoint;
77+
78+
@SerializedName(ApiConstants.S3_BUCKET_NAME)
79+
@Param(description = "The S3 bucket name")
80+
private String s3BucketName;
81+
7482
public ImageStoreResponse() {
7583
}
7684

@@ -156,4 +164,20 @@ public void setDiskSizeTotal(Long diskSizeTotal) {
156164
public void setDiskSizeUsed(Long diskSizeUsed) {
157165
this.diskSizeUsed = diskSizeUsed;
158166
}
167+
168+
public String getS3Endpoint() {
169+
return s3Endpoint;
170+
}
171+
172+
public void setS3Endpoint(String s3Endpoint) {
173+
this.s3Endpoint = s3Endpoint;
174+
}
175+
176+
public String getS3BucketName() {
177+
return s3BucketName;
178+
}
179+
180+
public void setS3BucketName(String s3BucketName) {
181+
this.s3BucketName = s3BucketName;
182+
}
159183
}

server/src/main/java/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.ArrayList;
2020
import java.util.List;
21+
import java.util.Map;
2122

2223
import javax.inject.Inject;
2324

@@ -26,7 +27,10 @@
2627
import com.cloud.user.AccountManager;
2728
import org.apache.cloudstack.annotation.AnnotationService;
2829
import org.apache.cloudstack.annotation.dao.AnnotationDao;
30+
import org.apache.cloudstack.api.ApiConstants;
2931
import org.apache.cloudstack.context.CallContext;
32+
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
33+
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
3034
import org.springframework.stereotype.Component;
3135

3236
import org.apache.cloudstack.api.response.ImageStoreResponse;
@@ -48,6 +52,8 @@ public class ImageStoreJoinDaoImpl extends GenericDaoBase<ImageStoreJoinVO, Long
4852
private AnnotationDao annotationDao;
4953
@Inject
5054
private AccountManager accountManager;
55+
@Inject
56+
private ImageStoreDetailsDao imageStoreDetailsDao;
5157

5258
private final SearchBuilder<ImageStoreJoinVO> dsSearch;
5359

@@ -92,6 +98,14 @@ public ImageStoreResponse newImageStoreResponse(ImageStoreJoinVO ids) {
9298
osResponse.setHasAnnotation(annotationDao.hasAnnotations(ids.getUuid(), AnnotationService.EntityType.SECONDARY_STORAGE.name(),
9399
accountManager.isRootAdmin(CallContext.current().getCallingAccount().getId())));
94100

101+
if (DataStoreProvider.S3_IMAGE.equalsIgnoreCase(ids.getProviderName())) {
102+
Map<String, String> s3Details = imageStoreDetailsDao.getDetails(ids.getId());
103+
if (s3Details != null) {
104+
osResponse.setS3Endpoint(s3Details.get(ApiConstants.S3_END_POINT));
105+
osResponse.setS3BucketName(s3Details.get(ApiConstants.S3_BUCKET_NAME));
106+
}
107+
}
108+
95109
osResponse.setObjectName("imagestore");
96110
return osResponse;
97111
}

ui/src/config/section/infra/secondaryStorages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
return fields
3737
},
3838
details: () => {
39-
var fields = ['name', 'id', 'url', 'protocol', 'provider', 'scope', 'zonename']
39+
var fields = ['name', 'id', 'url', 'protocol', 'provider', 'scope', 'zonename', 'endpoint', 'bucket']
4040
if (store.getters.apis.listImageStores.params.filter(x => x.name === 'readonly').length > 0) {
4141
fields.push('readonly')
4242
}

0 commit comments

Comments
 (0)