Updating a Security Report
Function
This API is used to update a security report.
Calling Method
For details, see Calling APIs.
URI
PUT /v1/{project_id}/workspaces/{workspace_id}/sa/reports/{report_id}
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID Constraints N/A Range N/A Default Value N/A |
|
workspace_id |
Yes |
String |
Definition Workspace ID. Constraints N/A Range N/A Default Value N/A |
|
report_id |
Yes |
String |
Report ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. You can obtain it by calling the IAM API for obtaining a user token. The user token is the value of X-Subject-Token in the response header. Obtaining a User Token Constraints N/A Range N/A Default Value N/A |
|
content-type |
Yes |
String |
Definition Content type. Constraints N/A Range Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
status |
No |
String |
Report status. enable; disable. |
|
report_name |
Yes |
String |
Report name. |
|
report_period |
No |
String |
Report period. The options are weekly, daily, annual, and monthly. |
|
report_range |
No |
report_range object |
Data scope. |
|
language |
No |
String |
Language. |
|
notification_task |
No |
String |
Notification task ID. |
|
layout_id |
No |
String |
Layout ID. |
|
report_id |
No |
String |
Report ID. |
|
report_rule_infos |
No |
Array of ReportRuleRequest objects |
Report sending rule. |
|
title |
No |
String |
Email subject. |
|
to |
No |
String |
Recipient. |
|
cc |
No |
String |
Cc recipient. |
|
subject |
No |
String |
Remarks. |
|
content |
No |
String |
Email content. |
|
report_file_type |
No |
String |
Report type. Image, PDF, and HTML are supported. |
|
frequency |
No |
String |
Report sending frequency. The options are daily, monthly, and weekly. |
|
binding_wizard |
Yes |
String |
Report content. |
|
timezone |
No |
String |
Information. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
start |
Yes |
String |
Start time. |
|
end |
Yes |
String |
End time. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
rule |
No |
String |
Cron expression of the report sending task. |
|
rule_end |
No |
String |
End time for starting the report sending task. |
|
start_time |
No |
start_time object |
Start time of the report statistical period. |
|
end_time |
No |
end_time object |
End time of the report statistical period. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
day |
No |
Integer |
Date of the report statistical period. -1: the previous day; 0: the current day. |
|
week |
No |
Integer |
Date of the report statistical period. -1: the previous week; 0: the current week. |
|
month |
No |
Integer |
Date of the report statistical period. -1: the previous month; 0: the current month. |
|
time |
No |
String |
Start time of the report statistical period. The time is in the format of hour:minute:second. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
day |
No |
Integer |
Date of the report statistical period. -1: the previous day; 0: the current day. |
|
week |
No |
Integer |
Date of the report statistical period. -1: the previous week; 0: the current week. |
|
month |
No |
Integer |
Date of the report statistical period. -1: the previous month; 0: the current month. |
|
time |
No |
String |
End time of the report statistical period. The time is in the format of hour:minute:second. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
X-request-id |
String |
Request ID. Format: request_uuid-timestamp-hostname. |
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
String |
Response Example |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
X-request-id |
String |
Request ID. Format: request_uuid-timestamp-hostname. |
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition Error code. Range N/A |
|
message |
String |
Definition Error description. Range N/A |
Example Requests
Request body for sending a report.
{
"layout_id" : "aa7b6b904d794e228e6b65b19af4bcbd",
"report_period" : "weekly",
"report_id" : "aa7b6b904d794e228e6b65b19af4bcbd",
"notification_task" : "b6940c3beee4413381be3f257ab6fb2d",
"language" : "zh-CN",
"report_name" : "report_name",
"binding_wizard" : "{\"binding_buttons\":[],\"boa_version\":\"v4\",\"create_time\":\"2025-11-20T10:51:40Z+0800\",\"creator_id\":\"b40b54b1f27a4224aa0c95ede5b5a46a\",\"creator_name\":\"l00644738\",\"workspace_id\":\"75645d0a-93b8-4a7f-a77c-e97009389445\"}",
"report_range" : {
"start" : 1662900,
"end" : 1662900
}
}
Example Responses
Status code: 200
Request succeeded.
"success"
SDK Sample Code
The SDK sample code is as follows.
Request body for sending a report.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
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.secmaster.v1.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v1.*; import com.huaweicloud.sdk.secmaster.v1.model.*; public class UpdateReportSolution { 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"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("<YOUR REGION>")) .build(); UpdateReportRequest request = new UpdateReportRequest(); request.withWorkspaceId("{workspace_id}"); request.withReportId("{report_id}"); UpdateReportRequestBody body = new UpdateReportRequestBody(); UpdateReportRequestBodyReportRange reportRangebody = new UpdateReportRequestBodyReportRange(); reportRangebody.withStart("1662900") .withEnd("1662900"); body.withBindingWizard("{"binding_buttons":[],"boa_version":"v4","create_time":"2025-11-20T10:51:40Z+0800","creator_id":"b40b54b1f27a4224aa0c95ede5b5a46a","creator_name":"l00644738","workspace_id":"75645d0a-93b8-4a7f-a77c-e97009389445"}"); body.withReportId("aa7b6b904d794e228e6b65b19af4bcbd"); body.withLayoutId("aa7b6b904d794e228e6b65b19af4bcbd"); body.withNotificationTask("b6940c3beee4413381be3f257ab6fb2d"); body.withLanguage("zh-CN"); body.withReportRange(reportRangebody); body.withReportPeriod(UpdateReportRequestBody.ReportPeriodEnum.fromValue("weekly")); body.withReportName("report_name"); request.withBody(body); try { UpdateReportResponse response = client.updateReport(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()); } } } |
Request body for sending a report.
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 46 47 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v1 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"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateReportRequest() request.workspace_id = "{workspace_id}" request.report_id = "{report_id}" reportRangebody = UpdateReportRequestBodyReportRange( start="1662900", end="1662900" ) request.body = UpdateReportRequestBody( binding_wizard="{"binding_buttons":[],"boa_version":"v4","create_time":"2025-11-20T10:51:40Z+0800","creator_id":"b40b54b1f27a4224aa0c95ede5b5a46a","creator_name":"l00644738","workspace_id":"75645d0a-93b8-4a7f-a77c-e97009389445"}", report_id="aa7b6b904d794e228e6b65b19af4bcbd", layout_id="aa7b6b904d794e228e6b65b19af4bcbd", notification_task="b6940c3beee4413381be3f257ab6fb2d", language="zh-CN", report_range=reportRangebody, report_period="weekly", report_name="report_name" ) response = client.update_report(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Request body for sending a report.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/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") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateReportRequest{} request.WorkspaceId = "{workspace_id}" request.ReportId = "{report_id}" reportRangebody := &model.UpdateReportRequestBodyReportRange{ Start: "1662900", End: "1662900", } reportIdUpdateReportRequestBody:= "aa7b6b904d794e228e6b65b19af4bcbd" layoutIdUpdateReportRequestBody:= "aa7b6b904d794e228e6b65b19af4bcbd" notificationTaskUpdateReportRequestBody:= "b6940c3beee4413381be3f257ab6fb2d" languageUpdateReportRequestBody:= "zh-CN" reportPeriodUpdateReportRequestBody:= model.GetUpdateReportRequestBodyReportPeriodEnum().WEEKLY request.Body = &model.UpdateReportRequestBody{ BindingWizard: "{"binding_buttons":[],"boa_version":"v4","create_time":"2025-11-20T10:51:40Z+0800","creator_id":"b40b54b1f27a4224aa0c95ede5b5a46a","creator_name":"l00644738","workspace_id":"75645d0a-93b8-4a7f-a77c-e97009389445"}", ReportId: &reportIdUpdateReportRequestBody, LayoutId: &layoutIdUpdateReportRequestBody, NotificationTask: ¬ificationTaskUpdateReportRequestBody, Language: &languageUpdateReportRequestBody, ReportRange: reportRangebody, ReportPeriod: &reportPeriodUpdateReportRequestBody, ReportName: "report_name", } response, err := client.UpdateReport(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 |
Request succeeded. |
|
400 |
Request failed. |
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