Skip to content

Commit

Permalink
Merge pull request #50 from ZakiFan/master
Browse files Browse the repository at this point in the history
feat: add s3 api.
  • Loading branch information
kevinten10 committed Jul 1, 2022
2 parents b78750c + 1ad895c commit 53aa974
Show file tree
Hide file tree
Showing 16 changed files with 443 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ For a Maven project, add the following to your `pom.xml` file:
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>cloud-runtimes-api</artifactId>
<version>1.15.RELEASE</version>
<version>1.16-SNAPSHOT</version>
</dependency>
...
</dependencies>
Expand All @@ -69,6 +69,6 @@ For a Gradle project, add the following to your `build.gradle` file:
dependencies {
// ...
// https://mvnrepository.com/artifact/group.rxcloud/cloud-runtimes-api
implementation group: 'group.rxcloud', name: 'cloud-runtimes-api', version: '1.15.RELEASE'
implementation group: 'group.rxcloud', name: 'cloud-runtimes-api', version: '1.16-SNAPSHOT'
}
```
2 changes: 1 addition & 1 deletion cloud-runtimes-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>group.rxcloud</groupId>
<artifactId>cloud-runtimes</artifactId>
<version>1.15.RELEASE</version>
<version>1.16.RELEASE</version>
</parent>

<artifactId>cloud-runtimes-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
import group.rxcloud.cloudruntimes.domain.nativeproto.NativeAwsS3Runtimes;
import group.rxcloud.cloudruntimes.domain.nativeproto.NativeRedisRuntimes;
import group.rxcloud.cloudruntimes.domain.nativeproto.NativeSqlRuntimes;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectInput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectOutput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectInput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectOutput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.InitRequest;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectInput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectOutput;
import group.rxcloud.cloudruntimes.domain.nativeproto.redis.geo.GeoRadiusResponse;
import group.rxcloud.cloudruntimes.domain.nativeproto.redis.geo.GeoUnit;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -584,4 +591,24 @@ default Boolean msetnx(String... keysvalues) {
default List<String> mget(String... keys) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default void initClient(InitRequest initRequest) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Mono<PutObjectOutput> putObject(PutObjectInput putObjectInput) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Mono<GetObjectOutput> getObject(GetObjectInput getObjectInput) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Mono<DeleteObjectOutput> deleteObject(DeleteObjectInput deleteObjectInput) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,46 @@
*/
package group.rxcloud.cloudruntimes.domain.nativeproto;

import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectInput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectOutput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectInput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectOutput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.InitRequest;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectInput;
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectOutput;
import reactor.core.publisher.Mono;

/**
* Native OSS AWS S3 API defined.
*/
public interface NativeAwsS3Runtimes {

/**
* Initialize the s3 client.
* @param initRequest
*/
void initClient(InitRequest initRequest);

/**
* Put a object to oss。
* @param putObjectInput
* @return
*/
Mono<PutObjectOutput> putObject(PutObjectInput putObjectInput);

/**
* Get a object from oss.
* @param getObjectInput
* @return
*/
Mono<GetObjectOutput> getObject(GetObjectInput getObjectInput);

/**
* Delete the object from oss。
* @param deleteObjectInput
* @return
*/
Mono<DeleteObjectOutput> deleteObject(DeleteObjectInput deleteObjectInput);
/*
syntax = "proto3";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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 group.rxcloud.cloudruntimes.domain.nativeproto.awss3;

/**
* Delete object from oss by bucket name and object key name。
*/
public class DeleteObjectInput {
/**
* Required. The bucket name containing the object.
*/
private String bucket;
/**
* Required. Key of the object to delete.
*/
private String key;

public String getBucket() {
return bucket;
}

public void setBucket(String bucket) {
this.bucket = bucket;
}

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* 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 group.rxcloud.cloudruntimes.domain.nativeproto.awss3;

/**
* Delete object from oss by bucket name and object key name。
*/
public class DeleteObjectOutput {
/**
* Specifies whether the object retrieved was (true) or was not (false) a Delete Marker.
*/
private boolean deleteMarker;
/**
* The value of the RequestCharged property for this object.
*/
private String requestCharged;
/**
* Version of the object.
*/
private String versionId;

public boolean isDeleteMarker() {
return deleteMarker;
}

public void setDeleteMarker(boolean deleteMarker) {
this.deleteMarker = deleteMarker;
}

public String getRequestCharged() {
return requestCharged;
}

public void setRequestCharged(String requestCharged) {
this.requestCharged = requestCharged;
}

public String getVersionId() {
return versionId;
}

public void setVersionId(String versionId) {
this.versionId = versionId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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 group.rxcloud.cloudruntimes.domain.nativeproto.awss3;

/**
* Get object from oss by bucket name and object key name。
*/
public class GetObjectInput {
/**
* Required. The bucket name containing the object.
*/
private String bucket;
/**
* Required. Key of the object to get.
*/
private String key;

public String getBucket() {
return bucket;
}

public void setBucket(String bucket) {
this.bucket = bucket;
}

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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 group.rxcloud.cloudruntimes.domain.nativeproto.awss3;

/**
* Get object from oss by bucket name and object key name。
*/
public class GetObjectOutput {

/**
* Byte stream for the specified object.
*/
private byte[] data;

public byte[] getData() {
return data;
}

public void setData(byte[] data) {
this.data = data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 group.rxcloud.cloudruntimes.domain.nativeproto.awss3;

import java.util.Map;

/**
* Initialize the client's request entity.
*/
public class InitRequest {
/**
* The name of oss.
*/
private String storeName;
/**
* Initialize the metadata required by the client
*/
private Map<String, String> metadata;

public String getStoreName() {
return storeName;
}

public void setStoreName(String storeName) {
this.storeName = storeName;
}

public Map<String, String> getMetadata() {
return metadata;
}

public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
}

0 comments on commit 53aa974

Please sign in to comment.