Configuring an Instance of OBSClient
You can use the OBSServiceConfiguration configuration class to configure an instance of OBSClient, including the proxy, connection timeout period, maximum number of retry attempts, and other parameters listed in the following table.
| Parameter | Description | Recommended Value |
|---|---|---|
| OBSServiceConfiguration.credentialProvider | User credential. For details, see Table 2. | N/A |
| OBSServiceConfiguration.proxyConfig | Proxy configuration. The default value is null. For details, see Table 3. | N/A |
| OBSServiceConfiguration.trustUnsafeCert | Whether to trust insecure certificates. The default value is NO. | Default value |
| OBSServiceConfiguration.maxConcurrentCommandRequestCount | Maximum number of concurrent command requests. The default value is 3. | Default value |
| OBSServiceConfiguration.maxConcurrentUploadRequestCount | Maximum number of concurrent upload requests. The default value is 3. | Default value |
| OBSServiceConfiguration.maxConcurrentDownloadRequestCount | Maximum number of concurrent download requests. The default value is 3. | Default value |
| OBSServiceConfiguration.defaultDomainMode | Domain name access mode. You can set this parameter to OBSDomainModeCustom to use a user-defined domain name. By default, the non-user-defined domain name access mode is used. | Default value |
| OBSServiceConfiguration.commandSessionConfiguration.HTTPMaximumConnectionsPerHost | Maximum number of command request connections that can be opened. The default value in iOS is 4. | N/A |
| OBSServiceConfiguration.uploadSessionConfiguration.HTTPMaximumConnectionsPerHost | Maximum number of upload request connections that can be opened. The default value in iOS is 4. | N/A |
| OBSServiceConfiguration.downloadSessionConfiguration.HTTPMaximumConnectionsPerHost | Maximum number of download request connections that can be opened. The default value in iOS is 4. | N/A |
| OBSServiceConfiguration.backgroundUploadSessionConfiguration.HTTPMaximumConnectionsPerHost | Maximum number of background upload request connections that can be opened. The default value in iOS is 4. | N/A |
| OBSServiceConfiguration.backgroundDownloadSessionConfiguration.HTTPMaximumConnectionsPerHost | Maximum number of background download request connections that can be opened. The default value in iOS is 4. | N/A |
Set parameters with N/A as the recommended value based on your needs. For security purposes, you are advised to use HTTPS for endpoints.
The following table describes parameters involved in OBSStaticCredentialProvider:
| Parameter | Description | Method |
|---|---|---|
| accessKey | User's AK | credentialProvider.Access Key = @"Provide your Access Key" |
| secretKey | User's SK | credentialProvider.Secret Key = @"Provide your Secret Key" |
| securityToken | Temporary token | credentialProvider.securityToken = token |
credentialProvider is an instance of OBSStaticCredentialProvider.
For details about how to obtain the securityToken, see Setting Up an OBS Environment.
The following table describes parameters involved in OBSHTTPProxyConfiguration:
| Parameter | Description | Method |
|---|---|---|
| proxyType | Network access type (Possible values are enumerated). | To allow HTTP only: proxyConfig.proxyType=OBSHTTPRroxyTypeHTTP To allow HTTPS only: proxyConfig.proxyType=OBSHTTPRroxyTypeHTTPS To allow both HTTP and HTTPS: proxyConfig.proxyType=OBSHTTPRroxyTypeHTTPAndHTTPS |
| proxyHost | Host address of the proxy server. | proxyConfig.proxyHost = @"host" |
| proxyPort | Port ID of the proxy server. | proxyConfig.proxyPort = @"port" |
| username | Username used for connecting to the proxy server. | proxyConfig.username = @"username" |
| password | Password used for connecting to the proxy server. | proxyConfig.password = @"password" |
proxyConfig is an instance of OBSHTTPProxyConfiguration.
Last Article: Creating an Instance of OBSClient
Next Article: Bucket Management
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.