Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cloudian HyperStore Object Storage #9748

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,11 @@
<artifactId>cloud-plugin-storage-object-ceph</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-object-cloudian</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-object-simulator</artifactId>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package org.apache.cloudstack.cloudian.client;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Date;

@JsonIgnoreProperties(ignoreUnknown = true)
public class CloudianCredential {

String accessKey;
Boolean active;
Date createDate;
Date expireDate;
String secretKey;

@Override
public String toString() {
return String.format("Cloudian Credential [ak=%s, sk=***, createDate=%s, expireDate=%s, active=%s]", accessKey, createDate, expireDate, active);
}

Check warning on line 35 in plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java

View check run for this annotation

Codecov / codecov/patch

plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java#L33-L35

Added lines #L33 - L35 were not covered by tests

public String getAccessKey() {
return accessKey;
}

public void setAccessKey(String accessKey) {
this.accessKey = accessKey;
}

public String getSecretKey() {
return secretKey;
}

public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
}

public Date getCreateDate() {
return createDate;
}

public void setCreateDate(Date createDate) {
this.createDate = createDate;
}

public Date getExpireDate() {
return expireDate;
}

public void setExpireDate(Date expireDate) {
this.expireDate = expireDate;
}

public Boolean getActive() {
return active;
}

public void setActive(Boolean active) {
this.active = active;
}

/**
* Return true if this credential is newer than the other credential.
* @param other the credential to compare against
* @return true only if it is known to be newer, false if anything is null.
*/
public boolean isNewerThan(CloudianCredential other) {

Check warning on line 82 in plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java

View check run for this annotation

Codecov / codecov/patch

plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java#L82

Added line #L82 was not covered by tests
if (this.createDate == null || other == null || other.createDate == null) {
return false;

Check warning on line 84 in plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java

View check run for this annotation

Codecov / codecov/patch

plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java#L84

Added line #L84 was not covered by tests
}
return this.createDate.after(other.createDate);
}

Check warning on line 87 in plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java

View check run for this annotation

Codecov / codecov/patch

plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianCredential.java#L87

Added line #L87 was not covered by tests
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package org.apache.cloudstack.cloudian.client;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class CloudianUserBucketUsage {

@JsonIgnoreProperties(ignoreUnknown = true)
public static class CloudianBucketUsage {
private String bucketName;
private Long byteCount;
private Long objectCount;
private String policyName;

/**
* Get the name of the bucket the usage stats belong to
* @return the bucket name
*/
public String getBucketName() {
return bucketName;
}
public void setBucketName(String bucketName) {
this.bucketName = bucketName;
}

/**
* Get the number of bytes used by this bucket.
*
* Note: This size includes bucket and object metadata.
*
* @return bytes used by the bucket
*/
public Long getByteCount() {
return byteCount;
}
public void setByteCount(Long byteCount) {
this.byteCount = byteCount;
}

/**
* Get the number of objects stored in the bucket.
*
* @return object count in the bucket
*/
public Long getObjectCount() {
return objectCount;
}
public void setObjectCount(Long objectCount) {
this.objectCount = objectCount;
}

/**
* Get the storage policy this bucket belongs to.
* @return the name of the HyperStore storage policy.
*/
public String getPolicyName() {
return policyName;
}
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
}

private String userId;
private List<CloudianBucketUsage> buckets;

/**
* Get the HyperStore userId this usage info belongs to
* @return the HyperStore userId
*/
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}

/**
* Get the list of bucket usage objects belonging to this HyperStore userId.
* @return list of bucket usage objects.
*/
public List<CloudianBucketUsage> getBuckets() {
return buckets;
}
public void setBuckets(List<CloudianBucketUsage> buckets) {
this.buckets = buckets;
}
}
Loading
Loading