"domain_type" : "pull",
"vendor" : "uCDN",
"domain_cname" : "play.example.huawei.com.c.cdnhwc3.com",
"region" : "region1",
"status" : "on",
"related_domain" : "publish.example.huawei.com",
"create_time" : "2020-01-19T02:57:00Z"
"domain" : "publish.example.huawei.com",
"domain_type" : "push",
"vendor" : "uCDN",
"domain_cname" : "publish.example.huawei.com.c.cdnhwc3.com",
"region" : "region1",
"status" : "on",
"related_domain" : "",
"create_time" : "2020-01-19T02:58:00Z"
状态码: 404
直播域名查询失败
"error_code" : "LIVE.103011019",
"error_msg" : "Request Illegal"
SDK代码示例
SDK代码示例如下。
Python
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.live.v1.region.LiveRegion
;
import
com.huaweicloud.sdk.live.v1.*
;
import
com.huaweicloud.sdk.live.v1.model.*
;
public
class
ShowDomainSolution
{
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
);
LiveClient
client
=
LiveClient
.
newBuilder
()
.
withCredential
(
auth
)
.
withRegion
(
LiveRegion
.
valueOf
(
"<YOUR REGION>"
))
.
build
();
ShowDomainRequest
request
=
new
ShowDomainRequest
();
request
.
withDomain
(
"<domain>"
);
request
.
withEnterpriseProjectId
(
"<enterprise_project_id>"
);
try
{
ShowDomainResponse
response
=
client
.
showDomain
(
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
());
from
huaweicloudsdkcore.auth.credentials
import
BasicCredentials
from
huaweicloudsdklive.v1.region.live_region
import
LiveRegion
from
huaweicloudsdkcore.exceptions
import
exceptions
from
huaweicloudsdklive.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
=
LiveClient
.
new_builder
()
\
.
with_credentials
(
credentials
)
\
.
with_region
(
LiveRegion
.
value_of
(
"<YOUR REGION>"
))
\
.
build
()
try
:
request
=
ShowDomainRequest
()
request
.
domain
=
"<domain>"
request
.
enterprise_project_id
=
"<enterprise_project_id>"
response
=
client
.
show_domain
(
request
)
print
(
response
)
except
exceptions
.
ClientRequestException
as
e
:
print
(
e
.
status_code
)
print
(
e
.
request_id
)
print
(
e
.
error_code
)
print
(
e
.
error_msg
)
"fmt"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
live
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/live/v1"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/live/v1/model"
region
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/live/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
:=
live
.
NewLiveClient
(
live
.
LiveClientBuilder
().
WithRegion
(
region
.
ValueOf
(
"<YOUR REGION>"
)).
WithCredential
(
auth
).
Build
())
request
:=
&
model
.
ShowDomainRequest
{}
domainRequest
:=
"<domain>"
request
.
Domain
=
&
domainRequest
enterpriseProjectIdRequest
:=
"<enterprise_project_id>"
request
.
EnterpriseProjectId
=
&
enterpriseProjectIdRequest
response
,
err
:=
client
.
ShowDomain
(
request
)
if
err
==
nil
{
fmt
.
Printf
(
"%+v\n"
,
response
)
}
else
{
fmt
.
Println
(
err
)