华为云用户手册

  • 权限说明 如果您需要对您所拥有的性能测试服务进行精细的权限管理,您可以使用统一身份认证服务(Identity and Access Management,简称IAM),如果华为云账号已经能满足您的要求,不需要创建独立的IAM用户,您可以跳过本章节,不影响您使用性能测试服务的其它功能。 默认情况下,新建的IAM用户没有任何权限,您需要将其加入用户组,并给用户组授予策略或角色,才能使用户组中的用户获得相应的权限,这一过程称为授权。授权后,用户就可以基于已有权限对云服务进行操作。 权限根据授权的精细程度,分为角色和策略。 角色以服务为粒度,是IAM最初提供的一种根据用户的工作职能定义权限的粗粒度授权机制。 策略以API接口为粒度进行权限拆分,授权更加精细,可以精确到某个操作、资源和条件,能够满足企业对权限最小化的安全管控要求。 如果您要允许或是禁止某个接口的操作权限,请使用策略。 账号具备所有接口的调用权限,如果使用账号下的IAM用户发起API请求时,该IAM用户必须具备调用该接口所需的权限,否则,API请求将调用失败。每个接口所需要的权限,与各个接口所对应的授权项相对应,只有发起请求的用户被授予授权项所对应的策略,该用户才能成功调用该接口。
  • 修订记录 表1 修订记录 发布日期 修订记录 2023-06-16 附录增加获取项目ID、获取账号ID章节。 API增加获取项目ID的指导链接。 请求示例增加描述。 2023-06-06 新增以下接口: 删除任务v3、获取任务关联的用例列表、创建任务v3、批量启停任务。 创建用例v2、修改用例v2、查询用例、删除用例v2。 查询报告汇总数据接口、内外融合获取用例的AW曲线图获取接口、内外融合单个用例的详情数据、内外融合当前任务用例列表接口。 全链路压测管理相关接口。 目录管理相关接口。 2023-04-18 “云性能测试服务 CPTS”改名为“性能测试 CodeArts PerfTest”,更新服务名称。 2021-09-15 新增以下接口: 创建工程、查询工程、修改工程、删除工程、查询导入进度。 修改任务、删除任务、创建任务、更新任务状态。 用例管理相关接口。 创建变量、修改变量。 事务管理相关接口。 查询PerfTest任务离线报告列表。 2021-07-30 第一次正式发布。
  • 分支操作 新建分支 Git新建分支的本质就是创建一个指向最后一次提交的可变指针,所以,Git分支的创建不是复制版本库的内容,仅仅是新建了一个指针,它以40个字符长度SHA-1字串形式保存在文件中。 1 #git branch branchName commitID 基于commitID即某一个版本号拉出新分支,如果没有commitID则基于当前分支的HEAD拉出新分支。 例如,新建feature分支,执行的命令为git branch feature,如下图所示。 切换分支 命令如下。 1 #git checkout branchName 例如,切换到feature分支,执行的命令为git checkout feature,如下图所示。 分支合并 无论哪种工作流都会涉及到分支合并(把一个分支中的修改整合到当前分支),主要有两种方法:三方合并(merge) 和衍合(rebase)。通过对同一种场景进行不同操作体会两种合并方法的区别。 场景:master分支新增了C4节点, hotfix分支新增了C3节点,现将hotfix分支合并到master分支: 三方包括hotfix新增节点C3,master新增节点C4,以及两者的共同祖先节点C2。这种合并操作简单,但新增合并节点C5,形成了环形,版本记录可读性差,如下图所示。 1 2 #git checkout master #git merge hotfix 衍合先将master分支新增节点C4以补丁形式保存在.git/rebase目录中,然后同步hotfix分支最新代码,再应用补丁C4’,如下图所示。 1 2 #git checkout master #git rebase hotfix 冲突解决 场景一:两个合并分支修改了同一行代码 解决方法: 分析哪种修改方法正确,手动合并。 提交修改。 场景二:文件被重命名为不同的名字 解决方法: 确认哪个名字是正确的,删除错误的。 提交修改。
  • 推送架构代码 打开本地框架代码,确保根目录名与云端创建的代码仓库名一致,在根目录下右键打开Git bash终端。 推送本地代码到云端。 在当前Git Bash终端依次输入如下命令: 初始化本地代码仓库,执行该命令后,在“D:/code/repo1/”下多了一个“.git”文件夹。 1 $ git init 关联云端代码仓库。 1 $ git remote add origin repoUrl 仓库地址如下图进入仓库详情页,单击”克隆/下载“,所示单击红色方框处获取。 推送代码到云仓库。 1 2 3 4 5 $ git add . $ git commit -m "init project" $ git branch --set-upstream-to=origin/master master $ git pull --rebase $ git push
  • 检视代码、合并分支 开发人员发起合并请求。 开发人员Chris完成代码开发,确认无误后,即可发起合并请求,将功能分支合并到master中。 进入代码仓库,选择“合并请求”页签,单击“新建”。 源分支选择“Feature-Store”,目标分支选择“master”,单击“下一步”。 参照表3编辑合并请求详情。 表3 合并请求配置 配置项 配置建议 标题 输入“添加门店网络列表”。 合并人 单击,在弹框中勾选“Maggie”,单击“确定”。 审核人 单击,在弹框中勾选“Maggie”,单击“确定”。 单击“新建合并请求”完成合并请求的创建。 项目经理评审并完成代码合入。 本文档中,合并请求的评审人与合并人均是项目经理Maggie。因此Maggie可评审合并请求内容,并在评审通过后完成分支合入。 进入代码仓库后,选择“合并请求”页签,可找到由开发人员Chris创建的合并请求。 单击该请求,查看合并请求详情。 可在页面中留下评审意见。单击审核门禁中“通过”完成审核。 单击“合入”,将分支合入“master”。 若发起分支合并请求时勾选了“合并后删除源分支”,分支“Feature-Store”将在分支合并完成后被删除。
  • 计费示例 以购买一个企业版Hyperledger Fabric增强版实例为例。 假设您通过包年包月方式,购买了一个企业版的Hyperledger Fabric增强版实例,购买时长为2个月,并在该实例上创建节点组织数为5个,节点数量为10Peers(其中有2Peers为免费赠送),则区块链服务的费用计算如下: (版本类型费用+每个节点费用*数量)*购买时长=(10000.00+3000.00*8)*2=¥68000.00
  • 计费说明 区块链服务的计费项由配置费用、底层资源费用组成。具体内容请查看表1。 表1 计费组成表 费用类别 计费项 计费说明 付费方式 配置费用 版本类型 版本类型有专业版、企业版和铂金版。不同版本类型,规格大小不同,详细说明如下: 专业版(满足小规模商用) 最大成员组织数:2 最大成员节点数:2 最大共识节点数:3 最大通道数:2 企业版(满足中等规模商用) 最大成员组织数:5 最大成员节点数:2 最大共识节点数:4 最大通道数:4 铂金版(满足大规模商用) 最大成员组织数:10 最大成员节点数:5 最大共识节点数:10 最大通道数:10 专业版 按需计费:¥8.00/小时 包年包月:¥5000.00/月 企业版 按需计费:¥17.00/小时 包年包月:¥10000.00/月 铂金版 包年包月:¥60000.00/月 节点数量(Peer) 节点组织的数量。 专业版:最大成员组织数2个,每个组织节点数量最大为2Peers,则节点数量最多为4Peers。 企业版:最大成员组织数5个,每个组织节点数量最大为2Peers,则节点数量最多为10Peers。 铂金版:最大成员组织数10个,每个组织节点数量最大为5Peers,则节点数量最多为50Peers。 专业版:¥2000.00/Peer 企业版:¥3000.00/Peer 铂金版:¥10000.00/Peer 节点数量费用=每个节点费用*节点数量 说明: 当前赠送两个节点(Peers),后续增加节点会进行收费。 云主机规格/带宽费用 当集群选择“创建新CCE集群”时,您可以根据自己的实际需求选择云主机规格。不同的云主机规格,收费不同。 开启使用CCE集群节点弹性IP,根据按需计费的方式和弹性IP带宽计算带宽费用。 云主机和带宽费用详情,请参考弹性云服务器ECS《计费说明》计费项章节。 底层资源费用 网络存储 根据实际用量进行计费。 计费详情。 云日志服务 按需计费。 计费详情。 对象存储服务 根据实际用量进行计费。 计费详情。 云备份服务 开启数据备份时,会根据实际用量进行计费。 计费详情。
  • 计费模式概述 区块链服务支持按需付费方式和包年/包月方式。 按需计费是先使用后付费的计费模式,即先使用再付费,按照Hyperledger Fabric增强版实例实际使用版本类型、节点数量结算费用。 按需计费模式允许您根据实际业务需求灵活地调整资源使用,无需提前预置资源,从而降低预置过多或不足的风险。 包年/包月是一种先付费再使用的计费模式,适用于对资源需求稳定且希望降低成本的用户。 父主题: 计费模式
  • 适用场景 包年/包月计费模式需要用户预先支付一定时长的费用,适用于长期、稳定的业务需求。以下是一些适用于包年/包月计费模式的业务场景: 稳定业务需求:对于长期运行且资源需求相对稳定的业务,如企业官网、在线商城、博客等,包年/包月计费模式能提供较高的成本效益。 长期项目:对于周期较长的项目,如科研项目、大型活动策划等,包年/包月计费模式可以确保在整个项目周期内资源的稳定使用。 业务高峰预测:如果能预测到业务高峰期,如电商促销季、节假日等,可提前购买包年/包月资源以应对高峰期的需求,避免资源紧张。 数据安全要求高:对于对数据安全性要求较高的业务,包年/包月计费模式可确保资源的持续使用,降低因资源欠费而导致的数据安全风险。
  • 计费周期 包年/包月Hyperledger Fabric增强版实例的计费周期是根据您购买的时长来确定的(以UTC+8时间为准)。一个计费周期的起点是您开通或续费实例的时间(精确到秒),终点则是到期日的23:59:59。 例如,如果您在2023/03/08 15:50:04购买了一台时长为一个月的Hyperledger Fabric增强版实例,那么其计费周期为:2023/03/08 15:50:04 ~ 2023/04/07 23:59:59。
  • 到期后影响 图1 包年/包月实例生命周期描述了包年/包月Hyperledger Fabric增强版实例各个阶段的状态。购买后,在计费周期内资源正常运行,此阶段为有效期;资源到期而未续费时,将陆续进入宽限期和保留期。 图1 包年/包月实例生命周期 到期预警 包年/包月Hyperledger Fabric增强版实例在到期前第7天内,系统将向用户推送到期预警消息。预警消息将通过邮件、短信和站内信的方式通知到华为云帐号的创建者。 到期后影响 当您的包年/包月Hyperledger Fabric增强版实例到期未续费,首先会进入宽限期,资源状态变为“已过期”。宽限期内您可以正常访问Hyperledger Fabric增强版实例,但以下操作将受到限制: 变更Hyperledger Fabric增强版实例规格 切换操作系统 扩容云硬盘 修改带宽大小 如果您在宽限期内仍未续费包年/包月Hyperledger Fabric增强版实例,那么就会进入保留期,资源状态变为“已冻结”,您将无法对处于保留期的包年/包月资源执行任何操作。 保留期到期后,若包年/包月Hyperledger Fabric增强版实例仍未续费,那么数据无法恢复。 华为云根据客户等级定义了不同客户的宽限期和保留期时长。
  • 成本优化 成本控制 企业可以在成本中心的“预算管理”页面创建精细粒度的预算来管理成本和使用量,在实际或预测超过预算阈值时,自动发送通知给指定消息接收人。企业还可以创建预算报告,定期将指定预算进展通知给指定消息接收人。详细介绍请参见使用预测和预算来跟踪成本和使用量。 资源优化 成本中心可以通过监控区块链服务BCS实例的使用情况,评估当前配置是否过高。您还可以根据成本分析阶段的分析结果识别成本偏高的资源,通过云监控服务监控资源的使用情况,确定成本偏高的原因,然后采取针对性的优化措施。 计费模式优化 不同类型的业务对资源使用周期有不同的要求,为每一类业务确定合适的计费模式,灵活组合以达到最优效果。 针对长期稳定的成熟业务,使用包年/包月计费模式。 针对不能中断的短期、突增或不可预测的业务,使用按需计费模式。
  • 成本分配 成本管理的基础是树立成本责任制,让各部门、各业务团队、各责任人参与进来,为各自消耗云服务产生的成本负责。企业可以通过成本分配的方式,将云上成本分组,归集到特定的团队或项目业务中,让各责任组织及时了解各自的成本情况。 华为云成本中心支持通过多种不同的方式对成本进行归集和重新分配,您可以根据需要选择合适的分配工具。 通过关联账号进行成本分配 企业主客户可以使用关联账号对子客户的成本进行归集,从而对子账号进行财务管理。详细介绍请参见通过关联账号维度查看成本分配。 通过企业项目进行成本分配 在进行成本分配之前,建议开通企业项目并做好企业项目的规划,可以根据企业的组织架构或者业务项目来划分。在购买云资源时选择指定企业项目,新购云资源将按此企业项目进行成本分配。详细介绍请参见通过企业项目维度查看成本分配。 通过成本标签进行成本分配 标签是华为云为了标识云资源,按各种维度(例如用途、所有者或环境)对云资源进行分类的标记。推荐企业使用预定义标签进行成本归集,具体流程如下: 详细介绍请参见通过成本标签维度查看成本分配。 使用成本单元进行成本分配 企业可以使用成本中心的“成本单元”来拆分公共成本。公共成本是指多个部门共享的计算、网络、存储或资源包产生的云成本,或无法直接通过企业项目、成本标签分配的云成本。这些成本不能直接归属于单一所有者,因此不能直接归属到某一类别。使用拆分规则,可以在各团队或业务部门之间公平地分配这些成本。详细介绍请参见使用成本单元查看成本分配。
  • 事件详情 单击事件卡片或列表,进入事件详情页面。在事件详情页面,事件巡检将提供RT、错误率等关键指标的检测图示,在图中展示异常时间段,并标注首个异常点及其上界。 应用服务整体平均响应时间突增:基于应用历史3小时数据,判断最近10分钟平均响应时间是否有异常突增点。 图5 应用服务整体平均响应时间突增 应用服务整体错误率突增:基于应用历史3小时数据,判断最近10分钟应用错误率是否有异常突增点。 图6 应用服务整体错误率突增 TopN接口平均响应时间突增:默认对流量Top 5的接口进行检测,基于接口历史3小时数据,判断最近10分钟平均响应时间是否有异常突增点。 图7 TopN接口平均响应时间突增 TopN接口错误率突增:默认对流量Top 5的接口进行检测,基于接口历史3小时数据,判断最近10分钟错误率是否有异常突增点。 图8 TopN接口错误率突增-事件巡检
  • 功能入口 登录AOM 2.0控制台。 左侧导航栏单击“智能洞察(BETA)”。 在页面右上角设置应用的时间范围。可通过如下两种方式设置时间范围: 方式一:使用AOM预定义好的时间标签,例如,近1小时、近6小时等,您可根据实际需要选择不同的时间粒度。 方式二:通过开始时间和结束时间,自定义时间范围。 在过滤器上方的下拉列表中选择需要查看的应用。 在“智能洞察(BETA)”页面,查看事件总览和详情信息。
  • 过滤器 “过滤器”区域显示了当前时间段被巡检捕获的事件类型和状态,可以通过选择不同的分组查看事件。 图1 过滤器视图 事件类型:事件类型按照事件巡检发现的事件异常类型划分。支持的异常事件类型包括: 应用服务整体平均响应时间突增 TopN接口平均响应时间突增 应用服务整体错误率突增 TopN接口错误率突增。 事件状态:事件状态按照事件巡检发现事件的状态进行划分。若异常事件正在发生则为“进行中”,若异常事件已经结束则为“已结束”。
  • 事件总览 在“智能洞察(BETA)”主页面,默认以柱状图形式展示近30分钟的所有事件。您可以根据需要调整时间范围,查看近1小时、近6小时、近1天、近1周或自定义时间段的事件。 图2 事件统计视图 在事件统计图区域,还可以执行以下操作: 在图表左上角,查看设置的时间段内事件巡检检测到的异常事件总数。 将鼠标悬浮于柱状图上,查看对应时间点各类型的事件数量。 单击柱状图上方的图例,可以隐藏或显示对应事件类型的数据。 在搜索栏根据关键字过滤显示需要查看的事件。
  • Python 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 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmetastudio.v1.region.metastudio_region import MetaStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmetastudio.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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = MetaStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(MetaStudioRegion.value_of("cn-north-4")) \ .build() try: request = ListAssetSummaryRequest() listAssetIdsbody = [ "8cb2f48a2cb006154794741933421100", "e2ba8314ebaab34d368711d118fcecba" ] request.body = ListAssetSummarysReq( asset_ids=listAssetIdsbody ) response = client.list_asset_summary(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 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 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" metastudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := metastudio.NewMetaStudioClient( metastudio.MetaStudioClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.ListAssetSummaryRequest{} var listAssetIdsbody = []string{ "8cb2f48a2cb006154794741933421100", "e2ba8314ebaab34d368711d118fcecba", } request.Body = &model.ListAssetSummarysReq{ AssetIds: listAssetIdsbody, } response, err := client.ListAssetSummary(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" metastudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := metastudio.NewMetaStudioClient( metastudio.MetaStudioClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.Create2DDigitalHumanVideoRequest{} outputAssetConfigbody := &model.OutputAssetConfig{ AssetName: "云玲自我介绍", } positionHumanPosition2d:= model.GetHumanPosition2DPositionEnum().MIDDLE humanPosition2dBackgroundConfig := &model.HumanPosition2D{ Position: &positionHumanPosition2d, } var listBackgroundConfigShootScript = []model.BackgroundConfigInfo{ { BackgroundType: model.GetBackgroundConfigInfoBackgroundTypeEnum().IMAGE, HumanPosition2d: humanPosition2dBackgroundConfig, BackgroundConfig: "https://metastudio-sh1.obs.cn-east-3.myhuaweicloud.com:443/0d697589d98091f12f92c0073501cd79/c7885ffdfb347337a890208ca7fd07e3/34534f0262813a6838bdcfb8bc949af6.jpg?AccessKeyId=WTEZCVDFUF3XHXCTPIJ8&Expires=1686872878&Signature=zXGOEQlrgZ4yAUziwlGcdbXLPIM%3D", }, } textConfigShootScript := &model.TextConfig{ Text: "大家好,我是云玲。", } shootScriptShootScripts := &model.ShootScript{ TextConfig: textConfigShootScript, BackgroundConfig: &listBackgroundConfigShootScript, } sequenceNoShootScripts:= int32(0) var listShootScriptsbody = []model.ShootScriptItem{ { SequenceNo: &sequenceNoShootScripts, ShootScript: shootScriptShootScripts, }, } frameRateVideoConfig:= model.GetVideoConfigFrameRateEnum().E_30 videoConfigbody := &model.VideoConfig{ Codec: model.GetVideoConfigCodecEnum().H264, Bitrate: int32(5000), Width: int32(1920), Height: int32(1080), FrameRate: &frameRateVideoConfig, } speedVoiceConfig:= int32(100) pitchVoiceConfig:= int32(100) volumeVoiceConfig:= int32(140) voiceConfigbody := &model.VoiceConfig{ VoiceAssetId: "394f3a27cd0b3d6164ca75c3db1edf6c", Speed: &speedVoiceConfig, Pitch: &pitchVoiceConfig, Volume: &volumeVoiceConfig, } modelAssetIdCreate2DDigitalHumanVideoReq:= "0c7798664ee7178b3dba3bbef57c32e7" request.Body = &model.Create2DDigitalHumanVideoReq{ OutputAssetConfig: outputAssetConfigbody, ShootScripts: &listShootScriptsbody, VideoConfig: videoConfigbody, VoiceConfig: voiceConfigbody, ModelAssetId: &modelAssetIdCreate2DDigitalHumanVideoReq, } response, err := client.Create2DDigitalHumanVideo(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Python 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 63 64 65 66 67 68 69 70 71 72 73 74 75 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmetastudio.v1.region.metastudio_region import MetaStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmetastudio.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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = MetaStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(MetaStudioRegion.value_of("cn-north-4")) \ .build() try: request = Create2DDigitalHumanVideoRequest() outputAssetConfigbody = OutputAssetConfig( asset_name="云玲自我介绍" ) humanPosition2dBackgroundConfig = HumanPosition2D( position="MIDDLE" ) listBackgroundConfigShootScript = [ BackgroundConfigInfo( background_type="IMAGE", human_position_2d=humanPosition2dBackgroundConfig, background_config="https://metastudio-sh1.obs.cn-east-3.myhuaweicloud.com:443/0d697589d98091f12f92c0073501cd79/c7885ffdfb347337a890208ca7fd07e3/34534f0262813a6838bdcfb8bc949af6.jpg?AccessKeyId=WTEZCVDFUF3XHXCTPIJ8&Expires=1686872878&Signature=zXGOEQlrgZ4yAUziwlGcdbXLPIM%3D" ) ] textConfigShootScript = TextConfig( text="大家好,我是云玲。" ) shootScriptShootScripts = ShootScript( text_config=textConfigShootScript, background_config=listBackgroundConfigShootScript ) listShootScriptsbody = [ ShootScriptItem( sequence_no=0, shoot_script=shootScriptShootScripts ) ] videoConfigbody = VideoConfig( codec="H264", bitrate=5000, width=1920, height=1080, frame_rate="30" ) voiceConfigbody = VoiceConfig( voice_asset_id="394f3a27cd0b3d6164ca75c3db1edf6c", speed=100, pitch=100, volume=140 ) request.body = Create2DDigitalHumanVideoReq( output_asset_config=outputAssetConfigbody, shoot_scripts=listShootScriptsbody, video_config=videoConfigbody, voice_config=voiceConfigbody, model_asset_id="0c7798664ee7178b3dba3bbef57c32e7" ) response = client.create2_d_digital_human_video(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • Python 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 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmetastudio.v1.region.metastudio_region import MetaStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmetastudio.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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = MetaStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(MetaStudioRegion.value_of("cn-north-4")) \ .build() try: request = CreatePhotoDetectionRequest() request.body = CreatePhotoDetectionReq( human_image="/9j/4AAQSkZJRgABAQEAYABgAAD/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAEAAAAAAAD" ) response = client.create_photo_detection(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 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 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" metastudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := metastudio.NewMetaStudioClient( metastudio.MetaStudioClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.CreatePhotoDetectionRequest{} request.Body = &model.CreatePhotoDetectionReq{ HumanImage: "/9j/4AAQSkZJRgABAQEAYABgAAD/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAEAAAAAAAD", } response, err := client.CreatePhotoDetection(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Java 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 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.metastudio.v1.region.MetaStudioRegion; import com.huaweicloud.sdk.metastudio.v1.*; import com.huaweicloud.sdk.metastudio.v1.model.*; public class CreatePhotoDetectionSolution { 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); MetaStudioClient client = MetaStudioClient.newBuilder() .withCredential(auth) .withRegion(MetaStudioRegion.valueOf("cn-north-4")) .build(); CreatePhotoDetectionRequest request = new CreatePhotoDetectionRequest(); CreatePhotoDetectionReq body = new CreatePhotoDetectionReq(); body.withHumanImage("/9j/4AAQSkZJRgABAQEAYABgAAD/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAEAAAAAAAD"); request.withBody(body); try { CreatePhotoDetectionResponse response = client.createPhotoDetection(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()); } } }
  • 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 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" metastudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := metastudio.NewMetaStudioClient( metastudio.MetaStudioClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.ShowVideoMotionCaptureJobRequest{} response, err := client.ShowVideoMotionCaptureJob(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
  • Java 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.metastudio.v1.region.MetaStudioRegion; import com.huaweicloud.sdk.metastudio.v1.*; import com.huaweicloud.sdk.metastudio.v1.model.*; public class ShowVideoMotionCaptureJobSolution { 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); MetaStudioClient client = MetaStudioClient.newBuilder() .withCredential(auth) .withRegion(MetaStudioRegion.valueOf("cn-north-4")) .build(); ShowVideoMotionCaptureJobRequest request = new ShowVideoMotionCaptureJobRequest(); try { ShowVideoMotionCaptureJobResponse response = client.showVideoMotionCaptureJob(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()); } } }
  • Python 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 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmetastudio.v1.region.metastudio_region import MetaStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmetastudio.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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = MetaStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(MetaStudioRegion.value_of("cn-north-4")) \ .build() try: request = ShowVideoMotionCaptureJobRequest() response = client.show_video_motion_capture_job(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • Java 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.metastudio.v1.region.MetaStudioRegion; import com.huaweicloud.sdk.metastudio.v1.*; import com.huaweicloud.sdk.metastudio.v1.model.*; public class StopSmartLiveSolution { 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); MetaStudioClient client = MetaStudioClient.newBuilder() .withCredential(auth) .withRegion(MetaStudioRegion.valueOf("cn-north-4")) .build(); StopSmartLiveRequest request = new StopSmartLiveRequest(); try { StopSmartLiveResponse response = client.stopSmartLive(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()); } } }
  • Python 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 # coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmetastudio.v1.region.metastudio_region import MetaStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmetastudio.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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = MetaStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(MetaStudioRegion.value_of("cn-north-4")) \ .build() try: request = StopSmartLiveRequest() response = client.stop_smart_live(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
  • 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 package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" metastudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/metastudio/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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := metastudio.NewMetaStudioClient( metastudio.MetaStudioClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) request := &model.StopSmartLiveRequest{} response, err := client.StopSmartLive(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
共100000条