简介 -奇异果体育app竞彩官网下载
概述
弹性裸金属服务器bbc(baidu baremetal compute)是用户可以在云环境中独享的高性能物理裸机,用户拥有完全的物理设备管理权限,同时可以结合弹性公网ip eip、负载均衡blb灵活组网,并与云服务器bcc内网互通,灵活应对用户多种复杂场景的业务需求,轻松构建内网混合云。
在您使用api文档前,请确保已了解了bbc的一些基础知识,包括和。
如果您是初次调用百度智能云产品的api,可以观看api入门视频指南,快速掌握调用api的能力。
接口使用规范
规范化字符串
通常一个字符串中可以包含任何unicode字符。在编程中这种灵活性会带来不少困扰。因此引入“规范字符串”的概念。一个规范字符串只包含百分号编码字符以及uri(uniform resource identifier)非保留字符(unreserved characters)。 rfc 3986规定uri非保留字符包括以下字符:字母(a-z,a-z)、数字(0-9)、连字号(-)、点号(.)、下划线(_)、波浪线(~)。 将任意一个字符串转换为规范字符串的方式是:
- 将字符串转换成utf-8编码的字节流。
- 保留所有uri非保留字符原样不变。
- 对其余字节做一次rfc 3986中规定的百分号编码(percent-encoding),即一个%后面跟着两个表示该字节值的十六进制字母。字母一律采用大写形式。示例:
原字符串:
this is an example for 测试
, 对应的规范字符串:this is an example for 测试
。
编码规范
- 可解析内容,所有request/response body内容目前均使用utf-8编码,后续会支持更多encoding类型。
-
在请求时,需要对以下做urlencode:
- objectname,其中,resource做urlencode的时候需要忽略“/”。
- querystring的value。
- x-bce-copy-source(忽略“/”)。
- 自定义meta:meta value只支持可见的ascii字符,如果需要其它的字符,推荐使用urlencode处理。
密码加密传输规范
所有涉及密码的接口参数都需要加密,禁止明文传输。密码一律采用aes 128位加密算法进行加密,用sk的前16位作为密钥,加密后生成的二进制字节流需要转成十六进制,并以字符串的形式传到服务端。具体步骤如下:
- byte[] bciphertext= aes(明文,sk)
- string strhex = hexstr(bciphertext)
日期与时间
日期与时间的表示有多种方式。为统一起见,除非是约定俗成或者有相应规范的,凡是http标准中规定的表示日期和时间字段用gmt,其他日期时间表示的地方一律采用utc时间,遵循iso 8601,并做以下约束:
- 表示日期一律采用
yyyy-mm-dd
方式,例如2014-06-01
表示2014年6月1日。 - 表示时间一律采用
hh:mm:ss
方式,并在最后加一个大写字母z表示utc时间。例如23:00:10z
表示utc时间23点0分10秒。 - 凡涉及日期和时间合并表示时,在两者中间加大写字母t,例如
2014-06-01t23:00:10z
表示utc时间2014年6月1日23点0分10秒。
请求响应格式标准
- http请求,querystring中参数的key,为首字母小写的驼峰方式。如 uploadid,partnumber等。
- 所有用户自定义meta,以
x-bce-meta-*
的形式放header中,自定义meta总大小不得超过2k。x-bce-meta-*
的key会被server端统一按照小写进行处理。
例如:用户使用putobject接口上传了x-bce-meta-demo:value
,server端会统一按照小写x-bce-meta-demo:value
进行处理,用户在使用getobject接口时,sever端的返回值为x-bce-meta-demo:value
。
- 除rfc2616规定的标准header外,其他header以
x-bce-*
的形式定义。 - 所有json中,key均为首字母小写的驼峰方式。
- 每个请求响应中均带有
x-bce-request-id
和x-bce-debug-id
这两个header。 - header中date、content-md5、content-type、content-length等相关字段遵守rfc 2616约束。
-
依据http协议的规定,content-md5既要做md5也要进行base64编码,其计算方法如下:
content-md5 = "content-md5" ":" md5-digest md5-digest =
服务域名
bbc api的服务域名为:
区域 |
服务端点/endpoint |
协议 |
---|---|---|
北京 |
bbc.bj.baidubce.com | http and https |
广州 |
bbc.gz.baidubce.com | http and https |
苏州 |
bbc.su.baidubce.com | http and https |
保定 |
bbc.bd.baidubce.com | http and https |
武汉(未全量开放) |
bbc.fwh.baidubce.com | http and https |
上海(未全量开放) |
bbc.fsh.baidubce.com | http and https |
香港(未全量开放) |
bbc.hkg.baidubce.com | http and https |
公共请求头
头域 | 说明 | 是否必须 |
---|---|---|
authorization | 包含access key与请求签名。 | 必须 |
x-bce-date | 该请求创建的时间,表示日期一律采用yyyy-mm-dd方式,例如2014-06-01表示2014年6月1日。如果用户使用了标准的date域,该头域可以不填。当两者同时存在时,以x-bce-date为准。 | 可选 |
x-bce-content-sha256 | 表示内容部分的sha256签名的十六进制字符串,其中内容指http request payload body,即content部分在被http encode之前的原始数据。 | 可选 |
x-bce-if-match | 同if-match语义。 | 可选 |
x-bce-if-none-match | 同if-none-match语义。 | 可选 |
公共响应头
头域 | 说明 |
---|---|
content-length | rfc2616中定义的http请求内容的类型。 |
x-bce-request-id | 对应请求的requestid。 |
错误码
错误信息除了http状态码以外,应同时在http body中包含下表的参数,内容如下:
参数名 | 类型 | 说明 |
---|---|---|
requestid | string | 导致该错误的requestid。 |
code | string | 表示具体错误类型。 |
message | string | 有关该错误的详细说明。 |
例如:
{
"code":"illegalrequesturl",
"message":"the requested url belongs to domain which is not under acceleration",
"requestid":" 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7"
}
公共错误码
错误码 | 消息 | http状态码 | 语义 |
---|---|---|---|
accessdenied | access denied. | 403 forbidden | 无权限访问对应的资源 |
inappropriatejson | the json you provided was well-formed and valid, but not appropriate for this operation. | 400 bad request | 请求中的json格式正确,但语义上不符合要求。如缺少某个必需项,或者值类型不匹配等。出于兼容性考虑,对于所有无法识别的项应直接忽略,不应该返回这个错误。 |
internalerror | we encountered an internal error. please try again. | 500internal server error | 所有未定义的其他错误。在有明确对应的其他类型的错误时(包括通用的和服务自定义的)不应该使用。 |
invalidaccesskeyid | the access key id you provided does not exist in our records. | 403 forbidden | access key id不存在 |
invalidhttpauthheader | the http authorization header is invalid. consult the service documentation for details. | 400 bad request | authorization头域格式错误 |
invalidhttprequest | there was an error in the body of your http request. | 400 bad request | http body格式错误。例如不符合指定的encoding等 |
invaliduri | could not parse the specified uri. | 400 bad request | uri形式不正确。例如一些服务定义的关键词不匹配等。对于id不匹配等问题,应定义更加具体的错误码,例如nosuchkey。 |
malformedjson | the json you provided was not well-formed. | 400 bad request | json格式不合法 |
invalidversion | the api version specified was invalid. | 404 not found | uri的版本号不合法 |
optinrequired | a subscription for the service is required. | 403 forbidden | 没有开通对应的服务 |
preconditionfailed | the specified if-match header doesn't match the etag header. | 412 precondition failed | 详见etag |
requestexpired | request has expired. timestamp date is xxx. | 400 bad request | 请求超时。xxx要改成x-bce-date的值。如果请求中只有date,则需要将date转换为datetime。 |
idempotentparametermismatch | the request uses the same client token as a previous, but non-identical request. | 403 forbidden | clienttoken对应的api参数不一样。 |
signaturedoesnotmatch | the request signature we calculated does not match the signature you provided. check your secret access key and signing method. consult the service documentation for details. | 400 bad request | authorization头域中附带的签名和服务端验证不一致 |
bbc业务错误码
错误码 | 消息 | http状态码 | 语义 |
---|---|---|---|
instancenotfound | the specified cfs instance does not exist. | 404 | 指定的cfs实例不存在 |
subnettypeinvalid | bbc instance can only use bbc type subnet. | 400 | 指定的子网不是bbc子网类型 |
internalexception | order extra to json failed. | 400 | 订单extra字段json格式有误 |
instancetypeinvalid | only bbc instance is available to renew in this method. | 400 | 续费的主机不是bbc类型 |
producttypeinvalid | only prepay bbc instance is available to create. | 400 | 只能创建预付费的bbc实例 |
instance.bbcquotalimitexceeded | the number of bbc will exceed the limit. | 413 | 创建的bbc实例数量超出了配额数量 |
invalidparameter | invalid parameter. | 400 | 请求参数有误 |
invalidparameter | only postpay or expired bbc can be deleted | 400 | 只能删除到期的或者后付费的bbc实例 |
operation_deny | operation deny for current user | 403 | 当前用户无权进行本次操作 |
internalexception | diskinfo read failed from db | 400 | diskinfo配置有误 |
bbc.userpriceconfigurationnotexist | user's price configuration for postpay does not exist. | 400 | 该bbc配置定价信息不存在 |
instance.bbctagquotalimitexceeded | the number of bbc tag will exceed the limit. | 413 | 创建的tag数量超出了配额 |
instance.raiddonotexist | raid requested do not exist. | 403 | 请求的raid不存在 |
image.imagetypeinvaild | image type is invaild for this instance. | 400 | 无效的镜像类型 |
instance.bbccreatedeny | bbc create deny. | 403 | 无权购买bbc实例 |
instance.passwordinvalid | password format is invalid. | 400 | 密码格式有误 |
instance.nameinvalid | instance name is invalid. | 400 | bbc实例名字不合法 |
instance.balancenotenough | the balance is less than 100, please recharge. | 403 | 余额不足 |
instance.templatequotalimitexceeded | custom image quota exceeds limit. | 413 | 自定义镜像数量超出了配额限制 |
instance.adminpassdecryptionexception | invalid encryption code found for the admin password. | 400 | 解密密码出错 |
flavornotsupport | flavor type is not supported | 400 | 无效的套餐类型 |
raidtypenotsupport | raid type is not supported | 400 | 无效的raid类型 |
sysdisksizesupportinvalid | sys disk size should between [20,100] | 400 | 系统盘大小需要在20g到100g之间 |
imagetypeinvalid | image type invalid | 400 | 无效的镜像类型 |
flavorimageincompatible | the flavor specified is not compatible with the image | 400 | 指定的套餐与镜像不兼容 |
instance.mktimageinstancenotsupportchangeimageexception | instance with mkt image not support change image. | 403 | 云市场镜像不支持更换镜像重装 |
instance.mktimageinstancenotsupportcreatetemplateexception | instance with mkt image not support create template. | 403 | 云市场镜像不支持创建系统镜像 |
instance.keepdatarebuildnotsupportchangeimageexception | bbc instance not support change image when keep data rebuild. | 403 | bbc进行保留数据重装时不支持更换镜像 |
instance.cumulativerenewtimeexception | the cumulative renewal time should not longer than ten years. | 403 | 续费时长不能大于十年 |
instance.subnetdonotexist | subnet requested do not exist. | 403 | 所请求的子网不存在 |
instance.differentzonesubnetexception | new subnet should be same zone. | 400 | 迁移子网,目标子网与原子网必须在同一个可用域 |
instance.instancebindedeipcannotchangesubnetexception | instance with eip can't change to nat subnet. | 400 | eip主机不能变更到nat子网 |
instance.notsupportsubnettypeexception | not support subnet type. | 400 | 子网类型有误 |
instance.instancebatchrebuildoutofmaxsizeexception | target servers size exceeds maximum allowed | 400 | 批量重装bbc,数量超出限制 |
instance.instancebatchrebuildexception | batch rebuild bbc partly failed. the instance ids are as follows. | 400 | 批量重装bbc,部分失败,返回失败实例id |
operationlog.dateinvalid | *** is invalid. | 400 | 无效的日期 |
vpc.networkparamerror | vpcid or subnetid info error | 400 | 请求参数中vpcid或subnetid有误 |
vpc.newfixipnotinsubnet | new private ip is not in the subnet. | 400 | 新旧内网ip不在同一个子网段 |
vpc.ipinsubnetnotenoughexceptions | the ip left in the subnet is not enouth for this create | 400 | 子网中ip数量不足 |