Granting OBS Operation Rights to CS
Sample Code
You can use the API to grant operation rights on OBS buckets to CS to save checkpoint setting and run logs of users' jobs. Sample code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | // Import classes:
import com.huaweicloud.cs.java.v1.client.ApiException;
import com.huaweicloud.cs.java.v1.AuthorizeApi;
AuthorizeApi apiInstance = new AuthorizeApi(apiClient);//apiClient is created when initializing a CS API client.
String xProjectId = "xProjectId_example"; // String | Project ID used for obtaining the token for the project.
List<String> body = new ArrayList<String>();// List<String> | Grant operation rights on one or more OBS buckets. The request parameter is in JSON format.
body.add("obs_bucket");
try {
GlobalResponse result = apiInstance.authorizeBucket(xProjectId, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthorizeApi#authorizeBucket");
System.err.println(e.getResponseBody());
e.printStackTrace();
}
|
Parameter Description
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| xProjectId | Yes | String | Project ID. This parameter is used to obtain the token for the project. |
| body | Yes | List<String> | Grants operation rights on one or more OBS buckets to CS. The request parameter is in JSON format. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| messageId | No | String | Message type ID. |
| message | No | String | Message content. |
| currentTime | No | Long | Current time, expressed by milliseconds. |
Last Article: Registering to Use CS
Next Article: Querying the Current Release Version of CS
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.