Commit 5a30f855 authored by 33's avatar 33

更新OBS配置

parent 6f4a6554
......@@ -107,10 +107,10 @@ copyright:
huaweiyun:
obs:
app-key: HIULSHJZJOTWB72Z38ZB
app-secret: GI0oWEGRJuMKmPXJq2fCmuMpFPIITLmjeCQxo2tA
end-point: obs.cn-east-3.myhuaweicloud.com
bucket: filmchain-file
app-key: CYEVMBJZJA1EXTNOOIGQ
app-secret: L4jnRHdXINzcOpUhxkrLSfHrOgOBGk10xRoPPple
end-point: obs.ap-southeast-1.myhuaweicloud.com
bucket: joy-file
wx-pay:
app-id: wxbdddd81913c795e9
......
......@@ -5,7 +5,6 @@ import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException;
import com.fzm.common.properties.ObsProperties;
import com.obs.services.ObsClient;
import com.obs.services.model.DeleteObjectResult;
import com.obs.services.model.ObsObject;
import com.obs.services.model.PutObjectResult;
import lombok.RequiredArgsConstructor;
......@@ -97,17 +96,18 @@ public class ObsUtil {
* @return
*/
public boolean delete(String fileUrl) {
String objectName = fileUrl.substring(String.format("https://%s.%s/", obsProperties.getBucket(), obsProperties.getEndPoint()).length());
DeleteObjectResult result = obsClient.deleteObject(obsProperties.getBucket(), objectName);
return !result.isDeleteMarker();
return true;
// String objectName = fileUrl.substring(String.format("https://%s.%s/", obsProperties.getBucket(), obsProperties.getEndPoint()).length());
// DeleteObjectResult result = obsClient.deleteObject(obsProperties.getBucket(), objectName);
// return !result.isDeleteMarker();
}
public static void main(String[] args) {
String endPoint = "obs.cn-east-3.myhuaweicloud.com";
String ak = "HIULSHJZJOTWB72Z38ZB";
String sk = "GI0oWEGRJuMKmPXJq2fCmuMpFPIITLmjeCQxo2tA";
String bucketName = "filmchain-file";
public static void main(String[] args) throws Exception{
String endPoint = "obs.ap-southeast-1.myhuaweicloud.com";
String ak = "CYEVMBJZJA1EXTNOOIGQ";
String sk = "L4jnRHdXINzcOpUhxkrLSfHrOgOBGk10xRoPPple";
String bucketName = "joy-file";
// 创建ObsClient实例
ObsClient obsClient = new ObsClient(ak, sk, endPoint);
// String url = "https://filmchain-file.obs.cn-east-3.myhuaweicloud.com/8792bab6a7fe4bb58e64b2c4f54ab220/kubernetes(k8s)课程.pdf";
......@@ -115,10 +115,12 @@ public class ObsUtil {
// System.out.println(objectName);
// DeleteObjectResult deleteObjectResult = obsClient.deleteObject(bucketName, objectName);
// System.out.println(deleteObjectResult);
String objectName = IdUtil.simpleUUID().concat("/").concat("kubernetes(k8s)课程.pdf");
PutObjectResult putObjectResult = obsClient.putObject(bucketName, objectName, new File("D:\\资料\\k8s\\课程笔记\\kubernetes(k8s)课程.pdf"));
String objectName = IdUtil.simpleUUID().concat("/").concat("123.jpg");
File file = new File("C:\\Users\\33\\Downloads\\QQ图片20220810152256.jpg");
PutObjectResult putObjectResult = obsClient.putObject(bucketName, objectName, file);
System.out.println(putObjectResult);
System.out.println(String.format("https://%s.%s/%s", bucketName, endPoint, objectName));
System.out.printf("https://%s.%s/%s%n", bucketName, endPoint, objectName);
}
......
......@@ -124,10 +124,10 @@ chain:
huaweiyun:
obs:
app-key: HIULSHJZJOTWB72Z38ZB
app-secret: GI0oWEGRJuMKmPXJq2fCmuMpFPIITLmjeCQxo2tA
end-point: obs.cn-east-3.myhuaweicloud.com
bucket: filmchain-file
app-key: CYEVMBJZJA1EXTNOOIGQ
app-secret: L4jnRHdXINzcOpUhxkrLSfHrOgOBGk10xRoPPple
end-point: obs.ap-southeast-1.myhuaweicloud.com
bucket: joy-file
wx-pay:
app-id: wxbdddd81913c795e9
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment