Initializing an Instance of ObsClient
API Description
ObsClient functions as the Node.js client for accessing OBS. It offers callers a series of APIs for interaction with OBS and is used for managing and operating resources, such as buckets and objects, stored in OBS.
Method Definition
1. Constructor form: ObsClient(parameter) 2. Factory method form: ObsClient.factory(parameter)
Parameter Description
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
access_key_id |
String |
Optional |
AK |
|
secret_access_key |
String |
Optional |
SK |
|
server |
String |
Mandatory |
Endpoint for accessing OBS, which contains the protocol type, domain name (or IP address), and port number. For example, https://your-endpoint:443. You can click here to view the endpoints enabled for OBS. |
|
max_retry_count |
Number |
Optional |
Maximum number of retries when an HTTP/HTTPS connection is abnormal. The default value is 3. |
|
timeout |
Number |
Optional |
Timeout period (in seconds) of an HTTP/HTTPS request. The default value is 60. |
|
ssl_verify |
Boolean or String |
Optional |
Whether to verify the server certificate. Possible values are:
The default value is false. |
|
long_conn_param |
Number |
Optional |
Persistent connection mode (in seconds) If the value is equal to or larger than 0, the persistent connection mode is enabled and this value is used as the initial delay of the TCP Keep-Alive packets. By default, this parameter is left blank, which indicates that persistent connection mode is disabled. |
|
is_cname |
Boolean |
Optional |
Whether to use self-defined domain name to access OBS. The default value is false. |
Sample Code
// Introduce the OBS library.
// Use npm to install the client.
var ObsClient = require('esdk-obs-nodejs');
// Use source codes to install the client.
// var ObsClient = require('./lib/obs');
// Create an ObsClient instance.
var obsClient = new ObsClient({
access_key_id: '*** Provide your Access Key ***', // Configure the AK.
secret_access_key: '*** Provide your Secret Key ***', // Configure the SK.
server : 'https://your-endpoint', // Configure the endpoint.
max_retry_count : 1,
timeout : 20,
ssl_verify : false,
long_conn_param : 0
});
Last Article: Initialization
Next Article: Initializing Logs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.