内容分发网络

当前版本:

| 产品详情
  • 配额中心
    • 查询用户配额ShowQuota
  • 日志管理
    • 日志查询ShowLogs
  • 刷新预热
    • 创建预热缓存任务CreatePreheatingTasks
    • 创建刷新缓存任务CreateRefreshTasks
    • 查询刷新预热任务详情ShowHistoryTaskDetails
    • 查询刷新预热任务ShowHistoryTasks
    • 查询刷新预热URL记录ShowUrlTaskInfo
  • 统计分析
    • 按区域运营商查询域名统计数据ShowDomainLocationStats
    • 查询域名统计数据ShowDomainStats
    • 查询TOP100 URL明细ShowTopUrl
  • 域名操作
    • 创建加速域名CreateDomain
    • 删除加速域名DeleteDomain
    • 停用加速域名DisableDomain
    • 启用加速域名EnableDomain
    • 查询加速域名ListDomains
    • 查询加速域名详情ShowDomainDetail
  • 域名配置
    • 删除资源标签配置接口BatchDeleteTags
    • 创建资源标签配置接口CreateTags
    • 查询IP黑白名单ShowBlackWhiteList
    • 查询缓存规则ShowCacheRules
    • 查询所有绑定HTTPS证书的域名信息ShowCertificatesHttpsInfo
    • 查询域名配置接口ShowDomainFullConfig
    • 查询HTTPS配置ShowHttpInfo
    • 查询IP归属信息ShowIpInfo
    • 查询回源HOSTShowOriginHost
    • 查询Referer过滤规则ShowRefer
    • 查询响应头配置ShowResponseHeader
    • 查询资源标签列表配置接口ShowTags
    • 设置IP黑白名单UpdateBlackWhiteList
    • 设置缓存规则UpdateCacheRules
    • 修改域名全量配置接口UpdateDomainFullConfig
    • 一个证书批量设置多个域名UpdateDomainMultiCertificates
    • 修改源站信息。UpdateDomainOrigin
    • 开启/关闭回源跟随UpdateFollow302Switch
    • 配置HTTPSUpdateHttpsInfo
    • 修改回源HOST。UpdateOriginHost
    • 修改私有桶开启关闭状态UpdatePrivateBucketAccess
    • 开启/关闭Range回源UpdateRangeSwitch
    • 设置Referer过滤规则UpdateRefer
    • 新增/修改响应头配置UpdateResponseHeader

ShowQuota (Abandoned)

查询用户配额 (已经废弃)

GET
https://cdn.myhuaweicloud.com/v1.0/cdn/quota
高级设置
只看必填项
填写默认值
密文显示特定参数
*
Region
Headers
*
Authorization

功能介绍

查询当前用户域名、刷新文件、刷新目录和预热的配额

调用方法

请参见如何调用API

URI

GET /v1.0/cdn/quota

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

响应参数

状态码:200

表2 响应Body参数

参数

参数类型

描述

quotas

Array of Quotas objects

配额数组。

表3 Quotas

参数

参数类型

描述

quota_limit

Integer

配额上限。

type

String

配额类型。

used

Integer

已使用配额数。

user_domain_id

String

域名所属用户的domain_id。

请求示例

GET https://cdn.myhuaweicloud.com/v1.0/cdn/quota

响应示例

状态码:200

OK

{
  "quotas" : [ {
    "quota_limit" : 2000,
    "type" : "file_refresh",
    "used" : 0,
    "user_domain_id" : "0b672************************ae0"
  }, {
    "quota_limit" : 2000,
    "type" : "dir_refresh",
    "used" : 0,
    "user_domain_id" : "0b672************************ae0"
  }, {
    "quota_limit" : 1000,
    "type" : "preheat",
    "used" : 0,
    "user_domain_id" : "0b672************************ae0"
  }, {
    "quota_limit" : 100,
    "type" : "domain",
    "used" : 4,
    "user_domain_id" : "0b672************************ae0"
  } ]
}

SDK代码示例

SDK代码示例如下。

 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.GlobalCredentials;
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.cdn.v2.region.CdnRegion;
import com.huaweicloud.sdk.cdn.v2.*;
import com.huaweicloud.sdk.cdn.v2.model.*;


public class ShowQuotaSolution {

    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 GlobalCredentials()
                .withAk(ak)
                .withSk(sk);

        CdnClient client = CdnClient.newBuilder()
                .withCredential(auth)
                .withRegion(CdnRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowQuotaRequest request = new ShowQuotaRequest();
        try {
            ShowQuotaResponse response = client.showQuota(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());
        }
    }
}
 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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import GlobalCredentials
from huaweicloudsdkcdn.v2.region.cdn_region import CdnRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcdn.v2 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"]

    credentials = GlobalCredentials(ak, sk)

    client = CdnClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CdnRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowQuotaRequest()
        response = client.show_quota(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 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/global"
    cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/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 := global.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := cdn.NewCdnClient(
        cdn.CdnClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowQuotaRequest{}
	response, err := client.ShowQuota(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

OK

错误码

请参见错误码

本文导读

功能介绍
调用方法
URI
请求参数
响应参数
请求示例
响应示例
SDK代码示例
状态码
错误码