package com.sikey.wa04.business.infrastructure.configuration;

import com.aliyun.oss.common.auth.DefaultCredentialProvider;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "aliyun.oss")
public class AliyunOssConfig {
    private String accessKeyId;
    private String accessKeySecret;
    private String bucket;
    private String endpoint;

    /**
     * 获取 DefaultCredentialProvider
     *
     * @return DefaultCredentialProvider
     */
    public DefaultCredentialProvider getDefaultCredentialProvider() {
        return new DefaultCredentialProvider(getAccessKeyId(), getAccessKeySecret());
    }
}
