检测到您已登录华为云国际站账号,为了您更好的体验,建议您访问国际站服务网站 https://www.huaweicloud.com/intl/zh-cn
不再显示此消息
Use the Gradle of Android Studio to download and install the OBS Android SDK. The procedure is as follows: Open Android Studio. Click Start a new Android Studio project to go to the page for creating a project.
ObsClient obsClient = new ObsClient(ak, sk, endPoint); BucketVersioningConfiguration status = obsClient.getBucketVersioning("bucketname"); Log.i("GetBucketVersioning", "\t" + status.getVersioningStatus()); To handle the error codes possibly returned during the operation, see OBS
Each time you want to send an HTTP/HTTPS request to OBS, you must create an instance of ObsClient. Sample code is as follows: // Initialize configuration parameters.
The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
The OBS server will compare this MD5 value with the MD5 value obtained by object data calculation. If the two values are not the same, the upload fails with HTTP status code 400 returned. If the MD5 value is not specified, the OBS server will skip MD5 value verification.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
Range: None Error Responses If the value of maxUploads is a non-integer or smaller than 0, OBS returns 400 Bad Request. Other errors are included in Table 2. Sample Request: Listing Initiated Multipart Uploads 1 2 3 4 5 6 GET /?
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
BucketStorageInfo storageInfo = obsClient.getBucketStorageInfo("bucketname"); Log.i("GetBucketStorageInfo", "\t" + storageInfo.getObjectNumber()); Log.i("GetBucketStorageInfo", "\t" + storageInfo.getSize()); To handle the error codes possibly returned during the operation, see OBS
RestoreObjectRequest("bucketname", "objectname", 1); // Restore a versioned object at an expedited speed. request.setRestoreTier(RestoreTierEnum.EXPEDITED); request.setVersionId("versionid"); obsClient.restoreObject(request); To handle the error codes possibly returned during the operation, see OBS
BucketLoggingConfiguration config = obsClient.getBucketLogging("bucketname"); Log.i("GetBucketLoggingConfiguration","\t" + config.getTargetBucketName()); Log.i("GetBucketLoggingConfiguration","\t" + config.getLogfilePrefix()); To handle the error codes possibly returned during the operation, see OBS
// require 'obs-autoloader.php'; // Declare the namespace. use Obs\ObsClient; // Create an instance of ObsClient. $obsClient = new ObsClient([ //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways.
// require 'obs-autoloader.php'; // Declare the namespace. use Obs\ObsClient; // Create an instance of ObsClient. $obsClient = new ObsClient([ //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways.
// require 'obs-autoloader.php'; // Declare the namespace. use Obs\ObsClient; // Create an instance of ObsClient. $obsClient = new ObsClient ( [ //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways.
Bucket: 'bucketname' }, function (err, result) { if(err){ console.log('Error-->' + err); }else{ console.log('Status-->' + result.CommonMsg.Status); } }); To handle the error codes possibly returned during the operation, see OBS
Sample code is as follows: # Import the module. from obs import ObsClient # Create an instance of ObsClient. obsClient = ObsClient( access_key_id=os.getenv("AccessKeyID"), secret_access_key=os.getenv("SecretAccessKey"), server='https://your-endpoint' ) resp = obsClient.putContent