Skip to content

Commit 53aa974

Browse files
authored
Merge pull request #50 from ZakiFan/master
feat: add s3 api.
2 parents b78750c + 1ad895c commit 53aa974

File tree

16 files changed

+443
-7
lines changed

16 files changed

+443
-7
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ For a Maven project, add the following to your `pom.xml` file:
5555
<dependency>
5656
<groupId>group.rxcloud</groupId>
5757
<artifactId>cloud-runtimes-api</artifactId>
58-
<version>1.15.RELEASE</version>
58+
<version>1.16-SNAPSHOT</version>
5959
</dependency>
6060
...
6161
</dependencies>
@@ -69,6 +69,6 @@ For a Gradle project, add the following to your `build.gradle` file:
6969
dependencies {
7070
// ...
7171
// https://mvnrepository.com/artifact/group.rxcloud/cloud-runtimes-api
72-
implementation group: 'group.rxcloud', name: 'cloud-runtimes-api', version: '1.15.RELEASE'
72+
implementation group: 'group.rxcloud', name: 'cloud-runtimes-api', version: '1.16-SNAPSHOT'
7373
}
7474
```

cloud-runtimes-api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>group.rxcloud</groupId>
2525
<artifactId>cloud-runtimes</artifactId>
26-
<version>1.15.RELEASE</version>
26+
<version>1.16.RELEASE</version>
2727
</parent>
2828

2929
<artifactId>cloud-runtimes-api</artifactId>

cloud-runtimes-api/src/main/java/group/rxcloud/cloudruntimes/domain/NativeProtocolCloudRuntimes.java

+27
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
import group.rxcloud.cloudruntimes.domain.nativeproto.NativeAwsS3Runtimes;
2020
import group.rxcloud.cloudruntimes.domain.nativeproto.NativeRedisRuntimes;
2121
import group.rxcloud.cloudruntimes.domain.nativeproto.NativeSqlRuntimes;
22+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectInput;
23+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectOutput;
24+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectInput;
25+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectOutput;
26+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.InitRequest;
27+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectInput;
28+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectOutput;
2229
import group.rxcloud.cloudruntimes.domain.nativeproto.redis.geo.GeoRadiusResponse;
2330
import group.rxcloud.cloudruntimes.domain.nativeproto.redis.geo.GeoUnit;
2431
import reactor.core.publisher.Mono;
@@ -584,4 +591,24 @@ default Boolean msetnx(String... keysvalues) {
584591
default List<String> mget(String... keys) {
585592
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
586593
}
594+
595+
@Override
596+
default void initClient(InitRequest initRequest) {
597+
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
598+
}
599+
600+
@Override
601+
default Mono<PutObjectOutput> putObject(PutObjectInput putObjectInput) {
602+
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
603+
}
604+
605+
@Override
606+
default Mono<GetObjectOutput> getObject(GetObjectInput getObjectInput) {
607+
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
608+
}
609+
610+
@Override
611+
default Mono<DeleteObjectOutput> deleteObject(DeleteObjectInput deleteObjectInput) {
612+
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
613+
}
587614
}

cloud-runtimes-api/src/main/java/group/rxcloud/cloudruntimes/domain/nativeproto/NativeAwsS3Runtimes.java

+35
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,46 @@
1616
*/
1717
package group.rxcloud.cloudruntimes.domain.nativeproto;
1818

19+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectInput;
20+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.DeleteObjectOutput;
21+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectInput;
22+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.GetObjectOutput;
23+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.InitRequest;
24+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectInput;
25+
import group.rxcloud.cloudruntimes.domain.nativeproto.awss3.PutObjectOutput;
26+
import reactor.core.publisher.Mono;
27+
1928
/**
2029
* Native OSS AWS S3 API defined.
2130
*/
2231
public interface NativeAwsS3Runtimes {
2332

33+
/**
34+
* Initialize the s3 client.
35+
* @param initRequest
36+
*/
37+
void initClient(InitRequest initRequest);
38+
39+
/**
40+
* Put a object to oss。
41+
* @param putObjectInput
42+
* @return
43+
*/
44+
Mono<PutObjectOutput> putObject(PutObjectInput putObjectInput);
45+
46+
/**
47+
* Get a object from oss.
48+
* @param getObjectInput
49+
* @return
50+
*/
51+
Mono<GetObjectOutput> getObject(GetObjectInput getObjectInput);
52+
53+
/**
54+
* Delete the object from oss。
55+
* @param deleteObjectInput
56+
* @return
57+
*/
58+
Mono<DeleteObjectOutput> deleteObject(DeleteObjectInput deleteObjectInput);
2459
/*
2560
syntax = "proto3";
2661
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* 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, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.cloudruntimes.domain.nativeproto.awss3;
18+
19+
/**
20+
* Delete object from oss by bucket name and object key name。
21+
*/
22+
public class DeleteObjectInput {
23+
/**
24+
* Required. The bucket name containing the object.
25+
*/
26+
private String bucket;
27+
/**
28+
* Required. Key of the object to delete.
29+
*/
30+
private String key;
31+
32+
public String getBucket() {
33+
return bucket;
34+
}
35+
36+
public void setBucket(String bucket) {
37+
this.bucket = bucket;
38+
}
39+
40+
public String getKey() {
41+
return key;
42+
}
43+
44+
public void setKey(String key) {
45+
this.key = key;
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* 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, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.cloudruntimes.domain.nativeproto.awss3;
18+
19+
/**
20+
* Delete object from oss by bucket name and object key name。
21+
*/
22+
public class DeleteObjectOutput {
23+
/**
24+
* Specifies whether the object retrieved was (true) or was not (false) a Delete Marker.
25+
*/
26+
private boolean deleteMarker;
27+
/**
28+
* The value of the RequestCharged property for this object.
29+
*/
30+
private String requestCharged;
31+
/**
32+
* Version of the object.
33+
*/
34+
private String versionId;
35+
36+
public boolean isDeleteMarker() {
37+
return deleteMarker;
38+
}
39+
40+
public void setDeleteMarker(boolean deleteMarker) {
41+
this.deleteMarker = deleteMarker;
42+
}
43+
44+
public String getRequestCharged() {
45+
return requestCharged;
46+
}
47+
48+
public void setRequestCharged(String requestCharged) {
49+
this.requestCharged = requestCharged;
50+
}
51+
52+
public String getVersionId() {
53+
return versionId;
54+
}
55+
56+
public void setVersionId(String versionId) {
57+
this.versionId = versionId;
58+
}
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* 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, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.cloudruntimes.domain.nativeproto.awss3;
18+
19+
/**
20+
* Get object from oss by bucket name and object key name。
21+
*/
22+
public class GetObjectInput {
23+
/**
24+
* Required. The bucket name containing the object.
25+
*/
26+
private String bucket;
27+
/**
28+
* Required. Key of the object to get.
29+
*/
30+
private String key;
31+
32+
public String getBucket() {
33+
return bucket;
34+
}
35+
36+
public void setBucket(String bucket) {
37+
this.bucket = bucket;
38+
}
39+
40+
public String getKey() {
41+
return key;
42+
}
43+
44+
public void setKey(String key) {
45+
this.key = key;
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* 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, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.cloudruntimes.domain.nativeproto.awss3;
18+
19+
/**
20+
* Get object from oss by bucket name and object key name。
21+
*/
22+
public class GetObjectOutput {
23+
24+
/**
25+
* Byte stream for the specified object.
26+
*/
27+
private byte[] data;
28+
29+
public byte[] getData() {
30+
return data;
31+
}
32+
33+
public void setData(byte[] data) {
34+
this.data = data;
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* 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, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.cloudruntimes.domain.nativeproto.awss3;
18+
19+
import java.util.Map;
20+
21+
/**
22+
* Initialize the client's request entity.
23+
*/
24+
public class InitRequest {
25+
/**
26+
* The name of oss.
27+
*/
28+
private String storeName;
29+
/**
30+
* Initialize the metadata required by the client
31+
*/
32+
private Map<String, String> metadata;
33+
34+
public String getStoreName() {
35+
return storeName;
36+
}
37+
38+
public void setStoreName(String storeName) {
39+
this.storeName = storeName;
40+
}
41+
42+
public Map<String, String> getMetadata() {
43+
return metadata;
44+
}
45+
46+
public void setMetadata(Map<String, String> metadata) {
47+
this.metadata = metadata;
48+
}
49+
}

0 commit comments

Comments
 (0)