Search in sources :

Example 1 with InstanceMetadataCredentialsEndpointProvider

use of com.qcloud.cos.auth.InstanceMetadataCredentialsEndpointProvider in project cos-java-sdk-v5 by tencentyun.

the class AbstractCOSClientTest method buildCVMInstanceCredentialsCOSClient.

protected static COSClient buildCVMInstanceCredentialsCOSClient() {
    InstanceMetadataCredentialsEndpointProvider endpointProvider = new InstanceMetadataCredentialsEndpointProvider(InstanceMetadataCredentialsEndpointProvider.Instance.CVM);
    InstanceCredentialsFetcher instanceCredentialsFetcher = new InstanceCredentialsFetcher(endpointProvider);
    COSCredentialsProvider cosCredentialsProvider = new InstanceCredentialsProvider(instanceCredentialsFetcher);
    clientConfig = new ClientConfig(new Region(region));
    return new COSClient(cosCredentialsProvider, clientConfig);
}
Also used : InstanceMetadataCredentialsEndpointProvider(com.qcloud.cos.auth.InstanceMetadataCredentialsEndpointProvider) InstanceCredentialsFetcher(com.qcloud.cos.auth.InstanceCredentialsFetcher) COSCredentialsProvider(com.qcloud.cos.auth.COSCredentialsProvider) InstanceCredentialsProvider(com.qcloud.cos.auth.InstanceCredentialsProvider) Region(com.qcloud.cos.region.Region)

Example 2 with InstanceMetadataCredentialsEndpointProvider

use of com.qcloud.cos.auth.InstanceMetadataCredentialsEndpointProvider in project cos-java-sdk-v5 by tencentyun.

the class AbstractCOSClientTest method buildCPMInstanceCredentialsCOSClient.

protected static COSClient buildCPMInstanceCredentialsCOSClient() {
    InstanceMetadataCredentialsEndpointProvider endpointProvider = new InstanceMetadataCredentialsEndpointProvider(InstanceMetadataCredentialsEndpointProvider.Instance.CPM);
    InstanceCredentialsFetcher instanceCredentialsFetcher = new InstanceCredentialsFetcher(endpointProvider);
    COSCredentialsProvider cosCredentialsProvider = new InstanceCredentialsProvider(instanceCredentialsFetcher);
    clientConfig = new ClientConfig(new Region(region));
    return new COSClient(cosCredentialsProvider, clientConfig);
}
Also used : InstanceMetadataCredentialsEndpointProvider(com.qcloud.cos.auth.InstanceMetadataCredentialsEndpointProvider) InstanceCredentialsFetcher(com.qcloud.cos.auth.InstanceCredentialsFetcher) COSCredentialsProvider(com.qcloud.cos.auth.COSCredentialsProvider) InstanceCredentialsProvider(com.qcloud.cos.auth.InstanceCredentialsProvider) Region(com.qcloud.cos.region.Region)

Aggregations

COSCredentialsProvider (com.qcloud.cos.auth.COSCredentialsProvider)2 InstanceCredentialsFetcher (com.qcloud.cos.auth.InstanceCredentialsFetcher)2 InstanceCredentialsProvider (com.qcloud.cos.auth.InstanceCredentialsProvider)2 InstanceMetadataCredentialsEndpointProvider (com.qcloud.cos.auth.InstanceMetadataCredentialsEndpointProvider)2 Region (com.qcloud.cos.region.Region)2