pigx-common-oss

This commit is contained in:
sxu 2025-03-14 14:44:19 +08:00
parent 6b16897c70
commit eb85bcc8c2
3 changed files with 1175 additions and 72 deletions

View File

@ -1,7 +1,7 @@
package com.pig4cloud.pigx.common.oss; package com.pig4cloud.pigx.common.oss;
import com.pig4cloud.pigx.common.oss.http.OssEndpoint;
import com.pig4cloud.pigx.common.oss.service.OssTemplate; import com.pig4cloud.pigx.common.oss.service.OssTemplate;
import lombok.Generated;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -24,15 +24,7 @@ public class OssAutoConfiguration {
return new OssTemplate(this.properties); return new OssTemplate(this.properties);
} }
@Bean @Generated
@ConditionalOnProperty(
name = {"oss.info"},
havingValue = "true"
)
public OssEndpoint ossEndpoint(OssTemplate template) {
return new OssEndpoint(template);
}
public OssAutoConfiguration(final OssProperties properties) { public OssAutoConfiguration(final OssProperties properties) {
this.properties = properties; this.properties = properties;
} }

View File

@ -1,5 +1,6 @@
package com.pig4cloud.pigx.common.oss; package com.pig4cloud.pigx.common.oss;
import lombok.Generated;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties( @ConfigurationProperties(
@ -18,94 +19,117 @@ public class OssProperties {
private Integer expiresTime = 604800; private Integer expiresTime = 604800;
private Boolean useToken = false; private Boolean useToken = false;
@Generated
public String getEndpoint() { public String getEndpoint() {
return this.endpoint; return this.endpoint;
} }
@Generated
public String getCustomDomain() { public String getCustomDomain() {
return this.customDomain; return this.customDomain;
} }
@Generated
public Boolean getPathStyleAccess() { public Boolean getPathStyleAccess() {
return this.pathStyleAccess; return this.pathStyleAccess;
} }
@Generated
public String getAppId() { public String getAppId() {
return this.appId; return this.appId;
} }
@Generated
public String getRegion() { public String getRegion() {
return this.region; return this.region;
} }
@Generated
public String getAccessKey() { public String getAccessKey() {
return this.accessKey; return this.accessKey;
} }
@Generated
public String getSecretKey() { public String getSecretKey() {
return this.secretKey; return this.secretKey;
} }
@Generated
public String getBucketName() { public String getBucketName() {
return this.bucketName; return this.bucketName;
} }
@Generated
public Boolean getUseHttp() { public Boolean getUseHttp() {
return this.useHttp; return this.useHttp;
} }
@Generated
public Integer getExpiresTime() { public Integer getExpiresTime() {
return this.expiresTime; return this.expiresTime;
} }
@Generated
public Boolean getUseToken() { public Boolean getUseToken() {
return this.useToken; return this.useToken;
} }
@Generated
public void setEndpoint(final String endpoint) { public void setEndpoint(final String endpoint) {
this.endpoint = endpoint; this.endpoint = endpoint;
} }
@Generated
public void setCustomDomain(final String customDomain) { public void setCustomDomain(final String customDomain) {
this.customDomain = customDomain; this.customDomain = customDomain;
} }
@Generated
public void setPathStyleAccess(final Boolean pathStyleAccess) { public void setPathStyleAccess(final Boolean pathStyleAccess) {
this.pathStyleAccess = pathStyleAccess; this.pathStyleAccess = pathStyleAccess;
} }
@Generated
public void setAppId(final String appId) { public void setAppId(final String appId) {
this.appId = appId; this.appId = appId;
} }
@Generated
public void setRegion(final String region) { public void setRegion(final String region) {
this.region = region; this.region = region;
} }
@Generated
public void setAccessKey(final String accessKey) { public void setAccessKey(final String accessKey) {
this.accessKey = accessKey; this.accessKey = accessKey;
} }
@Generated
public void setSecretKey(final String secretKey) { public void setSecretKey(final String secretKey) {
this.secretKey = secretKey; this.secretKey = secretKey;
} }
@Generated
public void setBucketName(final String bucketName) { public void setBucketName(final String bucketName) {
this.bucketName = bucketName; this.bucketName = bucketName;
} }
@Generated
public void setUseHttp(final Boolean useHttp) { public void setUseHttp(final Boolean useHttp) {
this.useHttp = useHttp; this.useHttp = useHttp;
} }
@Generated
public void setExpiresTime(final Integer expiresTime) { public void setExpiresTime(final Integer expiresTime) {
this.expiresTime = expiresTime; this.expiresTime = expiresTime;
} }
@Generated
public void setUseToken(final Boolean useToken) { public void setUseToken(final Boolean useToken) {
this.useToken = useToken; this.useToken = useToken;
} }
@Generated
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (o == this) {
return true; return true;
@ -251,10 +275,12 @@ public class OssProperties {
} }
} }
@Generated
protected boolean canEqual(final Object other) { protected boolean canEqual(final Object other) {
return other instanceof OssProperties; return other instanceof OssProperties;
} }
@Generated
public int hashCode() { public int hashCode() {
int PRIME = true; int PRIME = true;
int result = 1; int result = 1;
@ -283,6 +309,7 @@ public class OssProperties {
return result; return result;
} }
@Generated
public String toString() { public String toString() {
String var10000 = this.getEndpoint(); String var10000 = this.getEndpoint();
return "OssProperties(endpoint=" + var10000 + ", customDomain=" + this.getCustomDomain() + ", pathStyleAccess=" + this.getPathStyleAccess() + ", appId=" + this.getAppId() + ", region=" + this.getRegion() + ", accessKey=" + this.getAccessKey() + ", secretKey=" + this.getSecretKey() + ", bucketName=" + this.getBucketName() + ", useHttp=" + this.getUseHttp() + ", expiresTime=" + this.getExpiresTime() + ", useToken=" + this.getUseToken() + ")"; return "OssProperties(endpoint=" + var10000 + ", customDomain=" + this.getCustomDomain() + ", pathStyleAccess=" + this.getPathStyleAccess() + ", appId=" + this.getAppId() + ", region=" + this.getRegion() + ", accessKey=" + this.getAccessKey() + ", secretKey=" + this.getSecretKey() + ", bucketName=" + this.getBucketName() + ", useHttp=" + this.getUseHttp() + ", expiresTime=" + this.getExpiresTime() + ", useToken=" + this.getUseToken() + ")";