Quick Start Guide

User Documentation

More complete user documentation is available on the Oracle Cloud Infrastructure documentation portal.

Configuring the SDK

The SDK services need two types of configuration: credentials and client-side HTTP options.

Configuring Credentials

First, you need to create set up your credentials and config file. For instructions, see SDK and Tool Configuration in the User Guide.

Next you need to set up the client to use the credentials. The credentials are abstracted through an AuthenticationDetailsProvider interface. Clients can implement this however you choose. There are numerous classes provided that help build an implementation for this provider, but for simplicity, assuming you have configured a credentials file under the 'DEFAULT' profile in the default location, you can do:

AuthenticationDetailsProvider provider = new ConfigFileAuthenticationDetailsProvider(null);

Configuring Client-side HTTP Options

Create a client-side configuration through the ClientConfiguration class. If you do not provide your own configuration, the Java SDK uses a default configuration. To provide your own configuration, use the following:

ClientConfiguration clientConfig = ClientConfiguration.builder()
    .connectionTimeoutMillis(3000)
    .readTimeoutMillis(60000)
    .build();

Note that a service instance cannot be used to communicate with different regions. If you need to make requests to different regions, create multiple service instances.

Instantiating Service Clients

Now that you have configured a credentials provider and client configuration, a service client may be instantiated:

ObjectStorage client = ObjectStorageClient.builder()
                                          .region(Region.US_PHOENIX_1)
                                          .configuration(clientConfig)
                                          .build(provider);

Setting the Endpoints

Service endpoints can be set in one of two ways.

For an example, see the code above.