--9--10
parent
7ade61b99c
commit
c5c2482227
|
@ -19,18 +19,14 @@ import java.io.IOException;
|
|||
@Component
|
||||
public class DownloadOssSynchronization implements ApplicationRunner {
|
||||
|
||||
private static final String bucketName = "011811";
|
||||
// OSS文件路径
|
||||
|
||||
|
||||
private static final String endPoint = "oss-cn-beijing.aliyuncs.com";
|
||||
|
||||
private static final String endpoint = "https://oss-cn-shanghai.aliyuncs.com";
|
||||
|
||||
private static final String accessKeyId = "LTAI5t8LmMHfW8ckPaAZR6oQ";
|
||||
|
||||
|
||||
private static final String accessKeySecret = "pwzEwkpxcTFgurkARyr7sG7V6syc9x";
|
||||
|
||||
private static final String bucketName = "011811";
|
||||
|
||||
/**
|
||||
* 服务器项目路径放文件
|
||||
*/
|
||||
|
@ -40,7 +36,7 @@ public class DownloadOssSynchronization implements ApplicationRunner {
|
|||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
log.info("开始从Oss下载规则引擎");
|
||||
OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret);
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
// 获取存储桶信息
|
||||
ObjectListing objectListing = ossClient.listObjects(bucketName);
|
||||
|
|
|
@ -19,19 +19,18 @@ import java.nio.charset.StandardCharsets;
|
|||
public class OssUpload {
|
||||
|
||||
// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写
|
||||
private static final String endPoint = "oss-cn-beijing.aliyuncs.com";
|
||||
|
||||
private static final String endpoint = "https://oss-cn-shanghai.aliyuncs.com";
|
||||
|
||||
private static final String accessKeyId = "LTAI5t8LmMHfW8ckPaAZR6oQ";
|
||||
|
||||
|
||||
private static final String accessKeySecret = "pwzEwkpxcTFgurkARyr7sG7V6syc9x";
|
||||
// Bucket名称
|
||||
|
||||
private static final String bucketName = "011811";
|
||||
// Bucket名称
|
||||
|
||||
public static Result<Object> uploadFiles(String content, String fileName) {
|
||||
|
||||
OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret);
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
// 上传到OSS后文件保存的目录,例如:folder/subfolder/,最后以斜杠结尾
|
||||
String objectName = "build/rule/version/" + fileName + ".java";
|
||||
|
@ -63,7 +62,7 @@ public class OssUpload {
|
|||
|
||||
public static Result<Object> uploadClassFiles(String versionClass) {
|
||||
// 创建OSSClient实例。
|
||||
OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret);
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
try {
|
||||
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。
|
||||
|
|
Loading…
Reference in New Issue