Querying Files of the Tenant
Function
This API is used to query the list of files in the tenant.
Calling Method
For details, see Calling APIs.
URI
GET /v2/keystore/list
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
page_size |
No |
Integer |
Definition Number of items displayed on each page. Constraints The value of page_size is no more than 100. Range 1–100 |
page |
No |
Integer |
Definition The index of the page to start the query from. Constraints The value of page is at least 1. Range N/A. |
search |
No |
String |
Definition The file name as the search query. Constraints N/A. Range N/A. Default Value N/A. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition User token. (The value of the X-Subject-Token response header is the user token.) It is obtained by calling the IAM API. For details, see Obtaining an IAM User Token. Constraints Global tenant tokens are not supported. Use a region-level token whose scope is project. Range N/A. Default Value N/A. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
result |
result object |
Definition A list of files in the tenant. Range N/A. |
error |
String |
Definition Returned error message. Range N/A. |
status |
String |
Definition Returned status information. Range ● success: The API call is successful. ● fail: The API call failed. |
Parameter |
Type |
Description |
---|---|---|
total |
Number |
Definition Total number. Range N/A. |
keystore_list |
Array of keystore_list objects |
Definition File list. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition File ID. Range N/A. |
permission |
permission object |
Definition Permission. Range N/A. |
create_time_stamp |
String |
Definition Creation timestamp. Range N/A. |
update_time_stamp |
String |
Definition Modification timestamp. Range N/A. |
domain_id |
String |
Definition Tenant ID. Range N/A. |
domain_name |
String |
Definition Tenant name. Range N/A. |
keystore_name |
String |
Definition File name. Range N/A. |
create_user_id |
String |
Definition User ID of the file creator. Range N/A. |
create_user_name |
String |
Definition File creator username. Range N/A. |
update_user_id |
String |
Definition ID of the user who modifies the file. Range N/A. |
update_user_name |
String |
Definition Username of the user who modifies the file. Range N/A. |
share |
Number |
Definition Whether to share the file. Once shared, all members of the tenant can use the file in CodeArts Build. Range N/A. |
create_time |
String |
Definition Update time. Range N/A. |
update_time |
String |
Definition Update time. Range N/A. |
description |
String |
Definition Description. Range N/A. |
Parameter |
Type |
Description |
---|---|---|
keystore_id |
String |
Definition File ID. Range N/A. |
setting |
Boolean |
Definition Whether granted the configuration permission. Range ● true: Granted the configuration permission. ● false: Not granted the configuration permission. |
delete |
Boolean |
Definition Whether granted the delete permission. Range ● true: Granted the delete permission. ● false: Not granted the delete permission. |
modify |
Boolean |
Definition Whether granted the modification permission. Range ● true: Granted the modification permission. ● false: Not granted the modification permission. |
usage |
Boolean |
Definition Whether granted the use permission. Range ● true: Granted the use permission. ● false: Not granted the use permission. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
GET https://{endpoint}/v2/keystore/list
Example Responses
Status code: 200
OK
{ "result" : { "total" : 1, "keystore_list" : [ { "id" : "787dd84682aa4e78947af56277422259", "permission" : { "setting" : true, "delete" : true, "modify" : true, "usage" : true, "keystore_id" : "787dd84682aa4e78947af56277422259" }, "create_time_stamp" : "1727084554", "update_time_stamp" : "1727084565", "domain_id" : "60021bab32fd450aa2cb89226f425e06", "domain_name" : "testUser", "keystore_name" : "settings1111.xml", "create_user_id" : "ae22fd035f354cfa8d82a3f1c8940446", "create_user_name" : "testUser", "update_user_id" : "ae22fd035f354cfa8d82a3f1c8940446", "update_user_name" : "testUser", "share" : 1, "create_time" : "2024-9-23 17:42", "update_time" : "2024-9-23 17:42", "description" : "" } ] }, "error" : null, "status" : "success" }
SDK Sample Code
The SDK sample code is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.codeartsbuild.v3.region.CodeArtsBuildRegion; import com.huaweicloud.sdk.codeartsbuild.v3.*; import com.huaweicloud.sdk.codeartsbuild.v3.model.*; public class ListKeystoreSearchSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); CodeArtsBuildClient client = CodeArtsBuildClient.newBuilder() .withCredential(auth) .withRegion(CodeArtsBuildRegion.valueOf("<YOUR REGION>")) .build(); ListKeystoreSearchRequest request = new ListKeystoreSearchRequest(); try { ListKeystoreSearchResponse response = client.listKeystoreSearch(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcodeartsbuild.v3.region.codeartsbuild_region import CodeArtsBuildRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcodeartsbuild.v3 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = BasicCredentials(ak, sk) client = CodeArtsBuildClient.new_builder() \ .with_credentials(credentials) \ .with_region(CodeArtsBuildRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListKeystoreSearchRequest() response = client.list_keystore_search(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" codeartsbuild "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsbuild/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsbuild/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsbuild/v3/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := codeartsbuild.NewCodeArtsBuildClient( codeartsbuild.CodeArtsBuildClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListKeystoreSearchRequest{} response, err := client.ListKeystoreSearch(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot