The IBM® Cloud Object Storage SDK for Java how-to get a client sourcing credentials from a credentials file?
up vote
0
down vote
favorite
I'm trying to use The IBM® Cloud Object Storage SDK for Java and following this explanations https://console.bluemix.net/docs/services/cloud-object-storage/libraries/java.html#client-credentials where it says:
After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation
So I settled the referenced ~/.bluemix/cos_credentials in place (got it from my IBM cos instance credentials) and i expect to use this file to configure the client instead of coding the values. So now, how can a client be instantiated? Which classes of the sdk are to be used to get a working client configured to work with the bucket?
Here my cos_credentials file
{
"apikey": "xxxxxxxxx",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxx:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::",
"iam_apikey_name": "auto-generated-apikey-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/xxxxxxxxxxxxxxxxxx::serviceid:ServiceId-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::"
}
ibm-cloud object-storage
add a comment |
up vote
0
down vote
favorite
I'm trying to use The IBM® Cloud Object Storage SDK for Java and following this explanations https://console.bluemix.net/docs/services/cloud-object-storage/libraries/java.html#client-credentials where it says:
After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation
So I settled the referenced ~/.bluemix/cos_credentials in place (got it from my IBM cos instance credentials) and i expect to use this file to configure the client instead of coding the values. So now, how can a client be instantiated? Which classes of the sdk are to be used to get a working client configured to work with the bucket?
Here my cos_credentials file
{
"apikey": "xxxxxxxxx",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxx:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::",
"iam_apikey_name": "auto-generated-apikey-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/xxxxxxxxxxxxxxxxxx::serviceid:ServiceId-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::"
}
ibm-cloud object-storage
have a look at Minimal, Complete, and Verifiable example
– LuckyLikey
Nov 14 at 14:58
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to use The IBM® Cloud Object Storage SDK for Java and following this explanations https://console.bluemix.net/docs/services/cloud-object-storage/libraries/java.html#client-credentials where it says:
After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation
So I settled the referenced ~/.bluemix/cos_credentials in place (got it from my IBM cos instance credentials) and i expect to use this file to configure the client instead of coding the values. So now, how can a client be instantiated? Which classes of the sdk are to be used to get a working client configured to work with the bucket?
Here my cos_credentials file
{
"apikey": "xxxxxxxxx",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxx:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::",
"iam_apikey_name": "auto-generated-apikey-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/xxxxxxxxxxxxxxxxxx::serviceid:ServiceId-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::"
}
ibm-cloud object-storage
I'm trying to use The IBM® Cloud Object Storage SDK for Java and following this explanations https://console.bluemix.net/docs/services/cloud-object-storage/libraries/java.html#client-credentials where it says:
After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation
So I settled the referenced ~/.bluemix/cos_credentials in place (got it from my IBM cos instance credentials) and i expect to use this file to configure the client instead of coding the values. So now, how can a client be instantiated? Which classes of the sdk are to be used to get a working client configured to work with the bucket?
Here my cos_credentials file
{
"apikey": "xxxxxxxxx",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxx:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::",
"iam_apikey_name": "auto-generated-apikey-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/xxxxxxxxxxxxxxxxxx::serviceid:ServiceId-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/xxxxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx::"
}
ibm-cloud object-storage
ibm-cloud object-storage
edited Nov 15 at 17:30
asked Nov 14 at 13:55
drakeRxx
11
11
have a look at Minimal, Complete, and Verifiable example
– LuckyLikey
Nov 14 at 14:58
add a comment |
have a look at Minimal, Complete, and Verifiable example
– LuckyLikey
Nov 14 at 14:58
have a look at Minimal, Complete, and Verifiable example
– LuckyLikey
Nov 14 at 14:58
have a look at Minimal, Complete, and Verifiable example
– LuckyLikey
Nov 14 at 14:58
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You should need just a few of the client classes, and none of the credential classes. Here's an example that might help get you started:
import java.sql.Timestamp;
import java.io.File;
import com.ibm.cloud.objectstorage.ClientConfiguration;
import com.ibm.cloud.objectstorage.SDKGlobalConfiguration;
import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3ClientBuilder;
import com.ibm.cloud.objectstorage.services.s3.model.ListObjectsRequest;
import com.ibm.cloud.objectstorage.services.s3.model.ObjectListing;
import com.ibm.cloud.objectstorage.services.s3.model.S3ObjectSummary;
public class CredentialsFile
{
private static AmazonS3 _s3Client;
/**
* @param args
*/
public static void main(String args)
{
SDKGlobalConfiguration.IAM_ENDPOINT = "https://iam.bluemix.net/oidc/token";
String bucketName = "<bucket-name.";
String objectKey = "<object-key";
String filePath = "/absolute/path/to/file";
String endpoint_url = "https://s3-api.us-geo.objectstorage.softlayer.net";
String location = "us";
System.out.println("Current time: " + new Timestamp(System.currentTimeMillis()).toString());
_s3Client = createClient(endpoint_url, location);
newObject(bucketName, objectKey, filePath, _s3Client);
listObjects(bucketName, _s3Client);
}
/**
* @param bucketName
* @param clientNum
* @param endpoint_url
* @param location
* @return AmazonS3
*/
public static AmazonS3 createClient(String endpoint_url, String location)
{
ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(5000);
clientConfig.setUseTcpKeepAlive(true);
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration(endpoint_url, location)).withPathStyleAccessEnabled(true)
.withClientConfiguration(clientConfig).build();
return s3Client;
}
/**
* @param bucketName
* @param keyName
* @param filePath
* @param s3Client
*/
public static void newObject(String bucketName, String keyName, String filePath, AmazonS3 s3Client)
{
System.out.println("Uploading new object " + keyName + " from " + filePath + "...");
s3Client.putObject(bucketName, keyName, new File(filePath));
System.out.println(keyName +" uploaded successfully.");
}
/**
* @param bucketName
* @param s3Client
*/
public static void listObjects(String bucketName, AmazonS3 s3Client)
{
System.out.println("Listing objects in bucket " + bucketName);
ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName(bucketName));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")");
}
System.out.println();
}
}
thanks Nick, I already managed to connect with this method, I paste what the Ibm docs says 'After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation' [link] console.bluemix.net/docs/services/cloud-object-storage/… So I'm wondering how do the SDK instantiate and auto configure a client reading from the configuraion file.
– drakeRxx
Nov 15 at 17:26
The example I posted is doing that - there's no declaration of credentials anywhere, they're sourced automatically from the credentials file.
– Nick Lange
Nov 26 at 15:55
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You should need just a few of the client classes, and none of the credential classes. Here's an example that might help get you started:
import java.sql.Timestamp;
import java.io.File;
import com.ibm.cloud.objectstorage.ClientConfiguration;
import com.ibm.cloud.objectstorage.SDKGlobalConfiguration;
import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3ClientBuilder;
import com.ibm.cloud.objectstorage.services.s3.model.ListObjectsRequest;
import com.ibm.cloud.objectstorage.services.s3.model.ObjectListing;
import com.ibm.cloud.objectstorage.services.s3.model.S3ObjectSummary;
public class CredentialsFile
{
private static AmazonS3 _s3Client;
/**
* @param args
*/
public static void main(String args)
{
SDKGlobalConfiguration.IAM_ENDPOINT = "https://iam.bluemix.net/oidc/token";
String bucketName = "<bucket-name.";
String objectKey = "<object-key";
String filePath = "/absolute/path/to/file";
String endpoint_url = "https://s3-api.us-geo.objectstorage.softlayer.net";
String location = "us";
System.out.println("Current time: " + new Timestamp(System.currentTimeMillis()).toString());
_s3Client = createClient(endpoint_url, location);
newObject(bucketName, objectKey, filePath, _s3Client);
listObjects(bucketName, _s3Client);
}
/**
* @param bucketName
* @param clientNum
* @param endpoint_url
* @param location
* @return AmazonS3
*/
public static AmazonS3 createClient(String endpoint_url, String location)
{
ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(5000);
clientConfig.setUseTcpKeepAlive(true);
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration(endpoint_url, location)).withPathStyleAccessEnabled(true)
.withClientConfiguration(clientConfig).build();
return s3Client;
}
/**
* @param bucketName
* @param keyName
* @param filePath
* @param s3Client
*/
public static void newObject(String bucketName, String keyName, String filePath, AmazonS3 s3Client)
{
System.out.println("Uploading new object " + keyName + " from " + filePath + "...");
s3Client.putObject(bucketName, keyName, new File(filePath));
System.out.println(keyName +" uploaded successfully.");
}
/**
* @param bucketName
* @param s3Client
*/
public static void listObjects(String bucketName, AmazonS3 s3Client)
{
System.out.println("Listing objects in bucket " + bucketName);
ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName(bucketName));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")");
}
System.out.println();
}
}
thanks Nick, I already managed to connect with this method, I paste what the Ibm docs says 'After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation' [link] console.bluemix.net/docs/services/cloud-object-storage/… So I'm wondering how do the SDK instantiate and auto configure a client reading from the configuraion file.
– drakeRxx
Nov 15 at 17:26
The example I posted is doing that - there's no declaration of credentials anywhere, they're sourced automatically from the credentials file.
– Nick Lange
Nov 26 at 15:55
add a comment |
up vote
0
down vote
You should need just a few of the client classes, and none of the credential classes. Here's an example that might help get you started:
import java.sql.Timestamp;
import java.io.File;
import com.ibm.cloud.objectstorage.ClientConfiguration;
import com.ibm.cloud.objectstorage.SDKGlobalConfiguration;
import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3ClientBuilder;
import com.ibm.cloud.objectstorage.services.s3.model.ListObjectsRequest;
import com.ibm.cloud.objectstorage.services.s3.model.ObjectListing;
import com.ibm.cloud.objectstorage.services.s3.model.S3ObjectSummary;
public class CredentialsFile
{
private static AmazonS3 _s3Client;
/**
* @param args
*/
public static void main(String args)
{
SDKGlobalConfiguration.IAM_ENDPOINT = "https://iam.bluemix.net/oidc/token";
String bucketName = "<bucket-name.";
String objectKey = "<object-key";
String filePath = "/absolute/path/to/file";
String endpoint_url = "https://s3-api.us-geo.objectstorage.softlayer.net";
String location = "us";
System.out.println("Current time: " + new Timestamp(System.currentTimeMillis()).toString());
_s3Client = createClient(endpoint_url, location);
newObject(bucketName, objectKey, filePath, _s3Client);
listObjects(bucketName, _s3Client);
}
/**
* @param bucketName
* @param clientNum
* @param endpoint_url
* @param location
* @return AmazonS3
*/
public static AmazonS3 createClient(String endpoint_url, String location)
{
ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(5000);
clientConfig.setUseTcpKeepAlive(true);
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration(endpoint_url, location)).withPathStyleAccessEnabled(true)
.withClientConfiguration(clientConfig).build();
return s3Client;
}
/**
* @param bucketName
* @param keyName
* @param filePath
* @param s3Client
*/
public static void newObject(String bucketName, String keyName, String filePath, AmazonS3 s3Client)
{
System.out.println("Uploading new object " + keyName + " from " + filePath + "...");
s3Client.putObject(bucketName, keyName, new File(filePath));
System.out.println(keyName +" uploaded successfully.");
}
/**
* @param bucketName
* @param s3Client
*/
public static void listObjects(String bucketName, AmazonS3 s3Client)
{
System.out.println("Listing objects in bucket " + bucketName);
ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName(bucketName));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")");
}
System.out.println();
}
}
thanks Nick, I already managed to connect with this method, I paste what the Ibm docs says 'After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation' [link] console.bluemix.net/docs/services/cloud-object-storage/… So I'm wondering how do the SDK instantiate and auto configure a client reading from the configuraion file.
– drakeRxx
Nov 15 at 17:26
The example I posted is doing that - there's no declaration of credentials anywhere, they're sourced automatically from the credentials file.
– Nick Lange
Nov 26 at 15:55
add a comment |
up vote
0
down vote
up vote
0
down vote
You should need just a few of the client classes, and none of the credential classes. Here's an example that might help get you started:
import java.sql.Timestamp;
import java.io.File;
import com.ibm.cloud.objectstorage.ClientConfiguration;
import com.ibm.cloud.objectstorage.SDKGlobalConfiguration;
import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3ClientBuilder;
import com.ibm.cloud.objectstorage.services.s3.model.ListObjectsRequest;
import com.ibm.cloud.objectstorage.services.s3.model.ObjectListing;
import com.ibm.cloud.objectstorage.services.s3.model.S3ObjectSummary;
public class CredentialsFile
{
private static AmazonS3 _s3Client;
/**
* @param args
*/
public static void main(String args)
{
SDKGlobalConfiguration.IAM_ENDPOINT = "https://iam.bluemix.net/oidc/token";
String bucketName = "<bucket-name.";
String objectKey = "<object-key";
String filePath = "/absolute/path/to/file";
String endpoint_url = "https://s3-api.us-geo.objectstorage.softlayer.net";
String location = "us";
System.out.println("Current time: " + new Timestamp(System.currentTimeMillis()).toString());
_s3Client = createClient(endpoint_url, location);
newObject(bucketName, objectKey, filePath, _s3Client);
listObjects(bucketName, _s3Client);
}
/**
* @param bucketName
* @param clientNum
* @param endpoint_url
* @param location
* @return AmazonS3
*/
public static AmazonS3 createClient(String endpoint_url, String location)
{
ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(5000);
clientConfig.setUseTcpKeepAlive(true);
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration(endpoint_url, location)).withPathStyleAccessEnabled(true)
.withClientConfiguration(clientConfig).build();
return s3Client;
}
/**
* @param bucketName
* @param keyName
* @param filePath
* @param s3Client
*/
public static void newObject(String bucketName, String keyName, String filePath, AmazonS3 s3Client)
{
System.out.println("Uploading new object " + keyName + " from " + filePath + "...");
s3Client.putObject(bucketName, keyName, new File(filePath));
System.out.println(keyName +" uploaded successfully.");
}
/**
* @param bucketName
* @param s3Client
*/
public static void listObjects(String bucketName, AmazonS3 s3Client)
{
System.out.println("Listing objects in bucket " + bucketName);
ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName(bucketName));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")");
}
System.out.println();
}
}
You should need just a few of the client classes, and none of the credential classes. Here's an example that might help get you started:
import java.sql.Timestamp;
import java.io.File;
import com.ibm.cloud.objectstorage.ClientConfiguration;
import com.ibm.cloud.objectstorage.SDKGlobalConfiguration;
import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder.EndpointConfiguration;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3;
import com.ibm.cloud.objectstorage.services.s3.AmazonS3ClientBuilder;
import com.ibm.cloud.objectstorage.services.s3.model.ListObjectsRequest;
import com.ibm.cloud.objectstorage.services.s3.model.ObjectListing;
import com.ibm.cloud.objectstorage.services.s3.model.S3ObjectSummary;
public class CredentialsFile
{
private static AmazonS3 _s3Client;
/**
* @param args
*/
public static void main(String args)
{
SDKGlobalConfiguration.IAM_ENDPOINT = "https://iam.bluemix.net/oidc/token";
String bucketName = "<bucket-name.";
String objectKey = "<object-key";
String filePath = "/absolute/path/to/file";
String endpoint_url = "https://s3-api.us-geo.objectstorage.softlayer.net";
String location = "us";
System.out.println("Current time: " + new Timestamp(System.currentTimeMillis()).toString());
_s3Client = createClient(endpoint_url, location);
newObject(bucketName, objectKey, filePath, _s3Client);
listObjects(bucketName, _s3Client);
}
/**
* @param bucketName
* @param clientNum
* @param endpoint_url
* @param location
* @return AmazonS3
*/
public static AmazonS3 createClient(String endpoint_url, String location)
{
ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(5000);
clientConfig.setUseTcpKeepAlive(true);
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration(endpoint_url, location)).withPathStyleAccessEnabled(true)
.withClientConfiguration(clientConfig).build();
return s3Client;
}
/**
* @param bucketName
* @param keyName
* @param filePath
* @param s3Client
*/
public static void newObject(String bucketName, String keyName, String filePath, AmazonS3 s3Client)
{
System.out.println("Uploading new object " + keyName + " from " + filePath + "...");
s3Client.putObject(bucketName, keyName, new File(filePath));
System.out.println(keyName +" uploaded successfully.");
}
/**
* @param bucketName
* @param s3Client
*/
public static void listObjects(String bucketName, AmazonS3 s3Client)
{
System.out.println("Listing objects in bucket " + bucketName);
ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName(bucketName));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")");
}
System.out.println();
}
}
answered Nov 14 at 17:09
Nick Lange
51737
51737
thanks Nick, I already managed to connect with this method, I paste what the Ibm docs says 'After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation' [link] console.bluemix.net/docs/services/cloud-object-storage/… So I'm wondering how do the SDK instantiate and auto configure a client reading from the configuraion file.
– drakeRxx
Nov 15 at 17:26
The example I posted is doing that - there's no declaration of credentials anywhere, they're sourced automatically from the credentials file.
– Nick Lange
Nov 26 at 15:55
add a comment |
thanks Nick, I already managed to connect with this method, I paste what the Ibm docs says 'After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation' [link] console.bluemix.net/docs/services/cloud-object-storage/… So I'm wondering how do the SDK instantiate and auto configure a client reading from the configuraion file.
– drakeRxx
Nov 15 at 17:26
The example I posted is doing that - there's no declaration of credentials anywhere, they're sourced automatically from the credentials file.
– Nick Lange
Nov 26 at 15:55
thanks Nick, I already managed to connect with this method, I paste what the Ibm docs says 'After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation' [link] console.bluemix.net/docs/services/cloud-object-storage/… So I'm wondering how do the SDK instantiate and auto configure a client reading from the configuraion file.
– drakeRxx
Nov 15 at 17:26
thanks Nick, I already managed to connect with this method, I paste what the Ibm docs says 'After generating a Service Credential, the resulting JSON document can be saved to ~/.bluemix/cos_credentials. The SDK will automatically source credentials from this file unless other credentials are explicitly set during client creation' [link] console.bluemix.net/docs/services/cloud-object-storage/… So I'm wondering how do the SDK instantiate and auto configure a client reading from the configuraion file.
– drakeRxx
Nov 15 at 17:26
The example I posted is doing that - there's no declaration of credentials anywhere, they're sourced automatically from the credentials file.
– Nick Lange
Nov 26 at 15:55
The example I posted is doing that - there's no declaration of credentials anywhere, they're sourced automatically from the credentials file.
– Nick Lange
Nov 26 at 15:55
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53301901%2fthe-ibm-cloud-object-storage-sdk-for-java-how-to-get-a-client-sourcing-credenti%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
have a look at Minimal, Complete, and Verifiable example
– LuckyLikey
Nov 14 at 14:58