云审计服务 CTS-修改追踪器:Go
时间:2023-12-22 17:31:29
Go
管理类追踪器修改样例。
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" cts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cts/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cts/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cts/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 := cts.NewCtsClient( cts.CtsClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.UpdateTrackerRequest{} bucketNameObsInfo:= "test-data-tracker" filePrefixNameObsInfo:= "11" isObsCreatedObsInfo:= false obsInfobody := &model.TrackerObsInfo{ BucketName: &bucketNameObsInfo, FilePrefixName: &filePrefixNameObsInfo, IsObsCreated: &isObsCreatedObsInfo, } isSupportValidateUpdateTrackerRequestBody:= false kmsIdUpdateTrackerRequestBody:= "" isSupportTraceFilesEncryptionUpdateTrackerRequestBody:= false isLtsEnabledUpdateTrackerRequestBody:= false statusUpdateTrackerRequestBody:= model.GetUpdateTrackerRequestBodyStatusEnum().ENABLED request.Body = &model.UpdateTrackerRequestBody{ IsSupportValidate: &isSupportValidateUpdateTrackerRequestBody, KmsId: &kmsIdUpdateTrackerRequestBody, IsSupportTraceFilesEncryption: &isSupportTraceFilesEncryptionUpdateTrackerRequestBody, ObsInfo: obsInfobody, IsLtsEnabled: &isLtsEnabledUpdateTrackerRequestBody, Status: &statusUpdateTrackerRequestBody, TrackerName: "system", TrackerType: model.GetUpdateTrackerRequestBodyTrackerTypeEnum().SYSTEM, } response, err := client.UpdateTracker(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
数据类追踪器修改样例。
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
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" cts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cts/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cts/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cts/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 := cts.NewCtsClient( cts.CtsClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.UpdateTrackerRequest{} var listDataEventDataBucket = []model.DataBucketDataEvent{ model.GetDataBucketDataEventEnum().READ, model.GetDataBucketDataEventEnum().WRITE, } dataBucketbody := &model.DataBucket{ DataEvent: &listDataEventDataBucket, } bucketNameObsInfo:= "" filePrefixNameObsInfo:= "" isObsCreatedObsInfo:= false bucketLifecycleObsInfo:= int32(60) obsInfobody := &model.TrackerObsInfo{ BucketName: &bucketNameObsInfo, FilePrefixName: &filePrefixNameObsInfo, IsObsCreated: &isObsCreatedObsInfo, BucketLifecycle: &bucketLifecycleObsInfo, } isLtsEnabledUpdateTrackerRequestBody:= true request.Body = &model.UpdateTrackerRequestBody{ DataBucket: dataBucketbody, ObsInfo: obsInfobody, IsLtsEnabled: &isLtsEnabledUpdateTrackerRequestBody, TrackerName: "data-tracker-name", TrackerType: model.GetUpdateTrackerRequestBodyTrackerTypeEnum().DATA, } response, err := client.UpdateTracker(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
support.huaweicloud.com/api-cts/cts_api_0322.html
看了此文的人还看了
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格
推荐文章
- 如何开通云审计服务_开通云审计的使用场景_CTS关联服务-华为云
- 如何配置CTS关键操作通知_关键操作通知的使用场景_CTS关键操作通知的常见问题-华为云
- Go镜像下载
- 云日志服务的使用限制_云日志服务_使用限制说明
- 免费数据库mogodb_文档数据库增强版_GeminiDB Mongo接口_兼容MongoDB
- logo注册流程及费用
- 如何查看CTS操作事件_云审计操作事件_CTS指导视频-华为云
- 分布式缓存服务Redis的安全能力_分布式缓存服务Redis的数据安全性
- 数据库和应用迁移UGO_数据库迁移上云_云数据库
- GaussDB审计_GaussDB数据库审计事件_高斯数据库审计事件_华为云