Initializing an Instance of ObsClient
API Description
ObsClient functions as the BrowserJS client for accessing OBS. It offers users a series of APIs for interaction with OBS. These APIs are used for managing and operating resources, such as buckets and objects, stored in OBS.
Method Definition
1. Constructor form: ObsClient(parameter) 2. Factory 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. |
|
timeout |
Number |
Optional |
The total timeout period (in seconds) of an HTTP/HTTPS request. The default value is 300. If the network is unstable or the size of the file to be uploaded is large, you are advised to set a larger value for timeout. |
|
is_cname |
Boolean |
Optional |
Whether to use self-defined domain name to access OBS. The default value is false. |
|
useRawXhr |
Boolean |
Optional |
Whether to use the native XHR to send Ajax requests. The default value is false. |
Sample Code
// Create an instance of ObsClient.
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.
timeout : 300
});
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.