Skip to content

Commit d94aaa8

Browse files
authored
Add Cloudian HyperStore Object Storage (#9748)
1 parent 1c1dad9 commit d94aaa8

File tree

25 files changed

+4164
-466
lines changed

25 files changed

+4164
-466
lines changed

client/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,11 @@
642642
<artifactId>cloud-plugin-storage-object-ceph</artifactId>
643643
<version>${project.version}</version>
644644
</dependency>
645+
<dependency>
646+
<groupId>org.apache.cloudstack</groupId>
647+
<artifactId>cloud-plugin-storage-object-cloudian</artifactId>
648+
<version>${project.version}</version>
649+
</dependency>
645650
<dependency>
646651
<groupId>org.apache.cloudstack</groupId>
647652
<artifactId>cloud-plugin-storage-object-simulator</artifactId>

plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianClient.java

+267-36
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
18+
package org.apache.cloudstack.cloudian.client;
19+
20+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
21+
import java.util.Date;
22+
23+
@JsonIgnoreProperties(ignoreUnknown = true)
24+
public class CloudianCredential {
25+
26+
String accessKey;
27+
Boolean active;
28+
Date createDate;
29+
Date expireDate;
30+
String secretKey;
31+
32+
@Override
33+
public String toString() {
34+
return String.format("Cloudian Credential [ak=%s, sk=***, createDate=%s, expireDate=%s, active=%s]", accessKey, createDate, expireDate, active);
35+
}
36+
37+
public String getAccessKey() {
38+
return accessKey;
39+
}
40+
41+
public void setAccessKey(String accessKey) {
42+
this.accessKey = accessKey;
43+
}
44+
45+
public String getSecretKey() {
46+
return secretKey;
47+
}
48+
49+
public void setSecretKey(String secretKey) {
50+
this.secretKey = secretKey;
51+
}
52+
53+
public Date getCreateDate() {
54+
return createDate;
55+
}
56+
57+
public void setCreateDate(Date createDate) {
58+
this.createDate = createDate;
59+
}
60+
61+
public Date getExpireDate() {
62+
return expireDate;
63+
}
64+
65+
public void setExpireDate(Date expireDate) {
66+
this.expireDate = expireDate;
67+
}
68+
69+
public Boolean getActive() {
70+
return active;
71+
}
72+
73+
public void setActive(Boolean active) {
74+
this.active = active;
75+
}
76+
77+
/**
78+
* Return true if this credential is newer than the other credential.
79+
* @param other the credential to compare against
80+
* @return true only if it is known to be newer, false if anything is null.
81+
*/
82+
public boolean isNewerThan(CloudianCredential other) {
83+
if (this.createDate == null || other == null || other.createDate == null) {
84+
return false;
85+
}
86+
return this.createDate.after(other.createDate);
87+
}
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
18+
package org.apache.cloudstack.cloudian.client;
19+
20+
import java.util.List;
21+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
22+
23+
@JsonIgnoreProperties(ignoreUnknown = true)
24+
public class CloudianUserBucketUsage {
25+
26+
@JsonIgnoreProperties(ignoreUnknown = true)
27+
public static class CloudianBucketUsage {
28+
private String bucketName;
29+
private Long byteCount;
30+
private Long objectCount;
31+
private String policyName;
32+
33+
/**
34+
* Get the name of the bucket the usage stats belong to
35+
* @return the bucket name
36+
*/
37+
public String getBucketName() {
38+
return bucketName;
39+
}
40+
public void setBucketName(String bucketName) {
41+
this.bucketName = bucketName;
42+
}
43+
44+
/**
45+
* Get the number of bytes used by this bucket.
46+
*
47+
* Note: This size includes bucket and object metadata.
48+
*
49+
* @return bytes used by the bucket
50+
*/
51+
public Long getByteCount() {
52+
return byteCount;
53+
}
54+
public void setByteCount(Long byteCount) {
55+
this.byteCount = byteCount;
56+
}
57+
58+
/**
59+
* Get the number of objects stored in the bucket.
60+
*
61+
* @return object count in the bucket
62+
*/
63+
public Long getObjectCount() {
64+
return objectCount;
65+
}
66+
public void setObjectCount(Long objectCount) {
67+
this.objectCount = objectCount;
68+
}
69+
70+
/**
71+
* Get the storage policy this bucket belongs to.
72+
* @return the name of the HyperStore storage policy.
73+
*/
74+
public String getPolicyName() {
75+
return policyName;
76+
}
77+
public void setPolicyName(String policyName) {
78+
this.policyName = policyName;
79+
}
80+
}
81+
82+
private String userId;
83+
private List<CloudianBucketUsage> buckets;
84+
85+
/**
86+
* Get the HyperStore userId this usage info belongs to
87+
* @return the HyperStore userId
88+
*/
89+
public String getUserId() {
90+
return userId;
91+
}
92+
public void setUserId(String userId) {
93+
this.userId = userId;
94+
}
95+
96+
/**
97+
* Get the list of bucket usage objects belonging to this HyperStore userId.
98+
* @return list of bucket usage objects.
99+
*/
100+
public List<CloudianBucketUsage> getBuckets() {
101+
return buckets;
102+
}
103+
public void setBuckets(List<CloudianBucketUsage> buckets) {
104+
this.buckets = buckets;
105+
}
106+
}

0 commit comments

Comments
 (0)