Building the API client library requires Maven to be installed.
To install the API client library to your local Maven repository, simply execute:
mvn install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deploy
Refer to the official documentation for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>com.ncloud</groupId>
<artifactId>loadbalancer</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/loadbalancer-1.1.1.jar
- target/lib/*.jar
Please follow the installation instruction and create a credentials properties file.
type=iam
apiKey=your-api-key
accessKey=your-access-key
secretKey=your-secret-key
And execute the following Java code:
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import com.ncloud.ApiClient;
import com.ncloud.ApiResponse;
import com.ncloud.auth.PropertiesFileCredentialsProvider;
import com.ncloud.exception.ApiException;
import com.ncloud.exception.SdkException;
import com.ncloud.marshaller.FormMarshaller;
import com.ncloud.marshaller.JsonMarshaller;
import com.ncloud.marshaller.XmlMarshaller;
import com.ncloud.loadbalancer.model.*;
public class V2ApiExample {
public static void main(String[] args) {
ApiClient apiClient = new ApiClient.ApiClientBuilder()
.addMarshaller(JsonMarshaller.getInstance())
.addMarshaller(XmlMarshaller.getInstance())
.addMarshaller(FormMarshaller.getInstance())
.setCredentialsProvider(new PropertiesFileCredentialsProvider("your-credentials-properties-file"))
.setLogging(true)
.build();
V2Api apiInstance = new V2Api(apiClient);
AddLoadBalancerSslCertificateRequest addLoadBalancerSslCertificateRequest = new AddLoadBalancerSslCertificateRequest(); // AddLoadBalancerSslCertificateRequest | addLoadBalancerSslCertificateRequest
try {
// Handler Successful response
ApiResponse<AddLoadBalancerSslCertificateResponse> result = apiInstance.addLoadBalancerSslCertificatePost(addLoadBalancerSslCertificateRequest);
} catch (ApiException e) {
// Handler Failed response
int statusCode = e.getHttpStatusCode();
Map<String, List<String>> responseHeaders = e.getHttpHeaders();
InputStream byteStream = e.getByteStream();
e.printStackTrace();
} catch (SdkException e) {
// Handle exceptions that occurred before communication with the server
e.printStackTrace();
}
}
}
All URIs are relative to https://ncloud.apigw.ntruss.com/loadbalancer/v2
Class | Method | HTTP request | Description |
---|---|---|---|
V2Api | addLoadBalancerSslCertificatePost | POST /addLoadBalancerSslCertificate | |
V2Api | addServerInstancesToLoadBalancerGet | GET /addServerInstancesToLoadBalancer | |
V2Api | addServerInstancesToLoadBalancerPost | POST /addServerInstancesToLoadBalancer | |
V2Api | changeLoadBalancedServerInstancesGet | GET /changeLoadBalancedServerInstances | |
V2Api | changeLoadBalancedServerInstancesPost | POST /changeLoadBalancedServerInstances | |
V2Api | changeLoadBalancerInstanceConfigurationGet | GET /changeLoadBalancerInstanceConfiguration | |
V2Api | changeLoadBalancerInstanceConfigurationPost | POST /changeLoadBalancerInstanceConfiguration | |
V2Api | createLoadBalancerInstanceGet | GET /createLoadBalancerInstance | |
V2Api | createLoadBalancerInstancePost | POST /createLoadBalancerInstance | |
V2Api | deleteLoadBalancerInstancesGet | GET /deleteLoadBalancerInstances | |
V2Api | deleteLoadBalancerInstancesPost | POST /deleteLoadBalancerInstances | |
V2Api | deleteLoadBalancerSslCertificateGet | GET /deleteLoadBalancerSslCertificate | |
V2Api | deleteLoadBalancerSslCertificatePost | POST /deleteLoadBalancerSslCertificate | |
V2Api | deleteServerInstancesFromLoadBalancerGet | GET /deleteServerInstancesFromLoadBalancer | |
V2Api | deleteServerInstancesFromLoadBalancerPost | POST /deleteServerInstancesFromLoadBalancer | |
V2Api | getLoadBalancedServerInstanceListGet | GET /getLoadBalancedServerInstanceList | |
V2Api | getLoadBalancedServerInstanceListPost | POST /getLoadBalancedServerInstanceList | |
V2Api | getLoadBalancerInstanceListGet | GET /getLoadBalancerInstanceList | |
V2Api | getLoadBalancerInstanceListPost | POST /getLoadBalancerInstanceList | |
V2Api | getLoadBalancerSslCertificateListGet | GET /getLoadBalancerSslCertificateList | |
V2Api | getLoadBalancerSslCertificateListPost | POST /getLoadBalancerSslCertificateList | |
V2Api | getLoadBalancerTargetServerInstanceListGet | GET /getLoadBalancerTargetServerInstanceList | |
V2Api | getLoadBalancerTargetServerInstanceListPost | POST /getLoadBalancerTargetServerInstanceList |
- AccessControlGroup
- AddLoadBalancerSslCertificateRequest
- AddLoadBalancerSslCertificateResponse
- AddServerInstancesToLoadBalancerRequest
- AddServerInstancesToLoadBalancerResponse
- ChangeLoadBalancedServerInstancesRequest
- ChangeLoadBalancedServerInstancesResponse
- ChangeLoadBalancerInstanceConfigurationRequest
- ChangeLoadBalancerInstanceConfigurationResponse
- CommonCode
- CreateLoadBalancerInstanceRequest
- CreateLoadBalancerInstanceResponse
- DeleteLoadBalancerInstancesRequest
- DeleteLoadBalancerInstancesResponse
- DeleteLoadBalancerSslCertificateRequest
- DeleteLoadBalancerSslCertificateResponse
- DeleteServerInstancesFromLoadBalancerRequest
- DeleteServerInstancesFromLoadBalancerResponse
- GetLoadBalancedServerInstanceListRequest
- GetLoadBalancedServerInstanceListResponse
- GetLoadBalancerInstanceListRequest
- GetLoadBalancerInstanceListResponse
- GetLoadBalancerSslCertificateListRequest
- GetLoadBalancerSslCertificateListResponse
- GetLoadBalancerTargetServerInstanceListRequest
- GetLoadBalancerTargetServerInstanceListResponse
- LoadBalancedServerInstance
- LoadBalancerInstance
- LoadBalancerRule
- LoadBalancerRuleParameter
- Region
- ServerHealthCheckStatus
- ServerInstance
- SslCertificate
- Zone
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.