Todos os produtos
Search
Central de documentação

Object Storage Service:Gerenciar QoS de pool de recursos

Última atualização: Jul 06, 2026

Este tópico descreve como gerenciar a qualidade de serviço (QoS) do pool de recursos com o SDK do Object Storage Service (OSS) para Python 2.0.

Observações de uso

  • O código de exemplo deste tópico usa o ID da região cn-hangzhou, correspondente à região China (Hangzhou). Por padrão, o acesso aos recursos em um bucket ocorre pelo endpoint público. Para acessar os recursos do bucket por meio de outros serviços da Alibaba Cloud na mesma região do bucket, use o endpoint interno. Para obter mais informações sobre regiões e endpoints, consulte Regiões e endpoints.

Gerenciamento de largura de banda no nível do bucket

Configurar regras de limitação para um bucket em um pool de recursos

import alibabacloud_oss_v2 as oss

def PutBucketQoSInfo():
   # Obtain access credentials from environment variables for authentication
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Set qos_xml_body to an empty string.
    qos_xml_body = ""

    # Open the file named qos.xml and read its content into the qos_xml_body variable.
    with open('qos.xml', 'r') as qos_file:
        qos_xml_body = qos_file.read()

    # Specify input parameters for the PutBucketQoSInfo operation to specify the QoS rules for the bucket.
    req = oss.OperationInput(
        op_name = 'PutBucketQoSInfo',  # Operation name, specifying the operation to set bucket QoS information
        method = 'PUT',  # The type of the HTTP method. In this example, PUT is used to update resources.
        parameters = {
            'qosInfo': '',  # The QoS-related parameters.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = qos_xml_body,  # The request body, which contains the content read from the qos.xml file.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to run the request and obtain the response or error message.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

if __name__ == "__main__":
    PutBucketQoSInfo()

Consultar as configurações de limitação de um bucket

import alibabacloud_oss_v2 as oss

def GetBucketQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the GetBucketQoSInfo operation to query the QoS configurations of the bucket.
    req = oss.OperationInput(
        op_name = 'GetBucketQoSInfo',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method.
        parameters = {
            'qosInfo': '',  # The QoS-related parameters.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is not required for GET requests.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    GetBucketQoSInfo()

Excluir as configurações de limitação de um bucket em um pool de recursos

import alibabacloud_oss_v2 as oss

def DeleteBucketQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configuration and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the DeleteBucketQoSInfo operation to delete the QoS configurations of the bucket.
    req = oss.OperationInput(
        op_name = 'DeleteBucketQoSInfo',  # The name of the operation.
        method = 'DELETE',  # The type of the HTTP method. In this example, DELETE is used.
        parameters = {
            'qosInfo': '',  # The QoS-related parameters.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is not required for DELETE requests.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)
    
if __name__ == "__main__":
    DeleteBucketQoSInfo()
    

Gerenciamento de largura de banda no nível do bucket para diferentes solicitantes

Configurar regras de limitação para um solicitante que acessa um bucket

import alibabacloud_oss_v2 as oss

def PutBucketRequesterQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Set qos_xml_body to an empty string.
    qos_xml_body = ""

    # Open a file named qos.xml and read its content into the qos_xml_body variable.
    with open('qos.xml', 'r') as qos_file:
        qos_xml_body = qos_file.read()

    # Specify input parameters for the PutBucketRequesterQoSInfo operation to configure throttling rules for a requester accessing a bucket.
    req = oss.OperationInput(
        op_name = 'PutBucketRequesterQoSInfo',  # The name of the operation.
        method = 'PUT',  # The type of the HTTP method. In this example, PUT is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            'qosRequester': '2598732222222xxxx',  # The unique identifier for the requester, which is used to distinguish different requesters.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = qos_xml_body,  # The request body, which contains the content read from the qos.xml file.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    PutBucketRequesterQoSInfo()

Consultar as configurações de limitação de um solicitante que acessa um bucket

import alibabacloud_oss_v2 as oss

def GetBucketRequesterQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the GetBucketRequesterQoSInfo operation to query the throttling configurations of a requester accessing a bucket.
    req = oss.OperationInput(
        op_name = 'GetBucketRequesterQoSInfo',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            'qosRequester': '2598732222222xxxx',  # The unique identifier for the requester, which is used to distinguish different requesters.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    GetBucketRequesterQoSInfo()

Consultar as configurações de limitação de todos os solicitantes que acessam um bucket

import alibabacloud_oss_v2 as oss

def ListBucketRequesterQoSInfos():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the ListBucketRequesterQoSInfos operation to query the throttling configurations of all requesters accessing a bucket.
    req = oss.OperationInput(
        op_name = 'ListBucketRequesterQoSInfos',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            # "continuation-token": "2345",  # Optional. The token used to obtain results in the next page.
            # "max-keys": "1",              # Optional. The maximum number of entries returned each time.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    ListBucketRequesterQoSInfos()

Excluir as configurações de limitação de um solicitante que acessa um bucket

import alibabacloud_oss_v2 as oss

def DeleteBucketRequesterQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the DeleteBucketRequesterQoSInfo operation to delete the throttling configurations of a requester accessing a bucket.
    req = oss.OperationInput(
        op_name = 'DeleteBucketRequesterQoSInfo',  # The name of the operation.
        method = 'DELETE',  # The type of the HTTP method type. In this example, Delete is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            'qosRequester': '2598732222222xxxx',  # The unique identifier for the requester, which is used to distinguish different requesters.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for DELETE requests.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    DeleteBucketRequesterQoSInfo()

Gerenciamento de largura de banda no nível do pool de recursos para diferentes solicitantes

Consultar todos os pools de recursos na conta atual da Alibaba Cloud

import alibabacloud_oss_v2 as oss

def ListResourcePools():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the ListResourcePools operation.
    req = oss.OperationInput(
        op_name = 'ListResourcePools',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'resourcePool': '',  # The resource pool parameters.
            # "continuation-token": "test-rp-",  # Optional. The token used to obtain results in the next page.
            # "max-keys": "1",                 # Optional. The maximum number of entries returned each time.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = None,  # The name of the bucket, which is typically not required for GET requests. This operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == '__main__':
    ListResourcePools()

Consultar as informações de um pool de recursos

import alibabacloud_oss_v2 as oss

def GetResourcePoolInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the GetResourcePoolInfo operation to query information about a resource pool.
    req = oss.OperationInput(
        op_name = 'GetResourcePoolInfo',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'resourcePoolInfo': '',  # The resource pool parameters.
            'resourcePool': 'example-resource-pool',  # The name of the resource pool whose information you want to query.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = None,  # The name of the bucket, which is not required for GET requests. This operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    GetResourcePoolInfo()

Consultar os buckets em um pool de recursos

import alibabacloud_oss_v2 as oss

def ListResourcePoolBucketGroups():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the ListResourcePoolBucketGroups operation.
    req = oss.OperationInput(
        op_name = 'ListResourcePoolBucketGroups',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'resourcePoolBucketGroup': '',  # The parameters.
            'resourcePool': 'example-resource-pool',     # The name of the resource pool.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = None,  # The name of the bucket, which is not required for GET requests. The operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    ListResourcePoolBucketGroups()

Configurar regras de limitação para um solicitante em um pool de recursos

import alibabacloud_oss_v2 as oss

def PutResourcePoolRequesterQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Initialize qos_xml_body as an empty string
    qos_xml_body = ""

    # Open a file named qos.xml and read its content into the qos_xml_body variable.
    with open('qos.xml', 'r') as qos_file:
        qos_xml_body = qos_file.read()

    # Specify input parameters for the PutResourcePoolRequesterQoSInfo operation.
    req = oss.OperationInput(
        op_name = 'PutResourcePoolRequesterQoSInfo',  # The name of the operation.
        method = 'PUT',  # The type of the HTTP method type. In this example, PUT is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            'resourcePool': 'example-resource-pool',  # The name of the resource pool.
            'qosRequester': '2598732222222xxxx',  # The ID of the requester.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = qos_xml_body,  # The request body, which contains the content read from the qos.xml file.
        bucket = None,  # The name of the bucket, which is not required for PUT requests. The operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    PutResourcePoolRequesterQoSInfo()

Consultar as configurações de limitação de um solicitante em um pool de recursos

import alibabacloud_oss_v2 as oss

def GetResourcePoolRequesterQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the GetResourcePoolRequesterQoSInfo operation.
    req = oss.OperationInput(
        op_name = 'GetResourcePoolRequesterQoSInfo',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            'qosRequester': '2598732222222xxxx',  # The unique identifier for the requester, which is used to distinguish different requesters.
            'resourcePool': 'example-resource-pool',  # The unique identifier for the resource pool, which is used to distinguish different resource pools.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = None,  # The name of the bucket, which is not required for GET requests. The operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    GetResourcePoolRequesterQoSInfo()

Consultar as configurações de limitação de todos os solicitantes em um pool de recursos

import alibabacloud_oss_v2 as oss

def ListResourcePoolRequesterQoSInfos():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the ListResourcePoolRequesterQoSInfos operation.
    req = oss.OperationInput(
        op_name = 'ListResourcePoolRequesterQoSInfos',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            'resourcePool': 'example-resource-pool',  # The name of the resource pool.
            # "continuation-token": "2345",  # Optional. The token used to obtain results in the next page.
            # "max-keys": "1",              # Optional. The maximum number of entries returned each time.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is not required for GET requests.
        bucket = None,  # The name of the bucket, which is not required for GET requests. The operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    ListResourcePoolRequesterQoSInfos()

Excluir as configurações de limitação de um solicitante em um pool de recursos

import alibabacloud_oss_v2 as oss

def DeleteResourcePoolRequesterQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configuration and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the DeleteResourcePoolRequesterQoSInfo operation.
    req = oss.OperationInput(
        op_name = 'DeleteResourcePoolRequesterQoSInfo',  # The name of the operation.
        method = 'DELETE',  # The type of the HTTP method. In this example, DELETE is used.
        parameters = {
            'requesterQosInfo': '',  # The QoS-related parameters.
            'resourcePool': 'example-resource-pool',  # The name of the resource pool.
            'qosRequester': '2598732222222xxxx',  # The ID of the requester.
        },
        headers = None,  # he request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for Delete requests.
        bucket = None,  # The name of the bucket, which is not required for DELETE requests. The operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    DeleteResourcePoolRequesterQoSInfo()

Gerenciamento de largura de banda para um grupo de buckets

Adicionar buckets de um pool de recursos a um grupo de buckets

import alibabacloud_oss_v2 as oss

def PutBucketResourcePoolBucketGroup():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the PutBucketResourcePoolBucketGroup operation.
    req = oss.OperationInput(
        op_name = 'PutBucketResourcePoolBucketGroup',  # The name of the operation.
        method = 'PUT',  # The type of the HTTP method type. In this example, PUT is used.
        parameters = {
            'resourcePoolBucketGroup': 'example-group',  # The name of the bucket group in the resource pool.
            'resourcePool': 'example-resource-pool',               # The name of the resource pool.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for PUT requests.
        bucket = 'examplebucket',  # The name of the bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    PutBucketResourcePoolBucketGroup()

Consultar grupos de buckets em um pool de recursos

import alibabacloud_oss_v2 as oss

def ListResourcePoolBucketGroups():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the ListResourcePoolBucketGroups operation.
    req = oss.OperationInput(
        op_name = 'ListResourcePoolBucketGroups',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'resourcePoolBucketGroup': '',  # The parameters. 
            'resourcePool': 'example-resource-pool',     # The name of the resource pool.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # Request body, typically None for GET requests as they don't require a body
        bucket = None,  # The request body, which is typically not required for GET requests.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    ListResourcePoolBucketGroups()

Modificar as configurações de limitação de um grupo de buckets em um pool de recursos

import alibabacloud_oss_v2 as oss

def PutResourcePoolBucketGroupQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Set qos_xml_body to an empty string.
    qos_xml_body = ""

    # Open and read the qos.xml file and write its content into the qos_xml_body variable.
    with open('qos.xml', 'r') as qos_file:
        qos_xml_body = qos_file.read()

    # Specify input parameters for the PutResourcePoolBucketGroupQoSInfo operation.
    req = oss.OperationInput(
        op_name = 'PutResourcePoolBucketGroupQoSInfo',  # The name of the operation.
        method = 'PUT',  # The type of the HTTP method type. In this example, PUT is used.
        parameters = {
            'resourcePoolBucketGroupQosInfo': '',  # The QoS-related parameters.
            'resourcePool': 'example-resource-pool',           #  The name of the resource pool
            'resourcePoolBucketGroup': 'example-group',  # The name of the bucket group.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = qos_xml_body,  # The request body, which contains the content read from the qos.xml file.
        bucket = None,  # The name of the bucket, which is not required for PUT requests. This operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    PutResourcePoolBucketGroupQoSInfo()

Consultar as configurações de limitação de um grupo de buckets em um pool de recursos

import alibabacloud_oss_v2 as oss

def GetResourcePoolBucketGroupQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the GetResourcePoolInfo operation.
    req = oss.OperationInput(
        op_name = 'GetResourcePoolBucketGroupQoSInfo',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'resourcePoolBucketGroupQosInfo': '',  # The parameters.
            'resourcePool': 'example-resource-pool',           # The name of the resource pool.
            'resourcePoolBucketGroup': 'example-group',  # The name of the bucket group.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = None,  # The name of the bucket, which is not required for GET requests. This operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    GetResourcePoolBucketGroupQoSInfo()

Listar as configurações de limitação de grupos de buckets em um pool de recursos

import alibabacloud_oss_v2 as oss

def ListResourcePoolBucketGroupQoSInfos():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the GetResourcePoolInfo operation.
    req = oss.OperationInput(
        op_name = 'ListResourcePoolBucketGroupQoSInfos',  # The name of the operation.
        method = 'GET',  # The type of the HTTP method type. In this example, GET is used.
        parameters = {
            'resourcePoolBucketGroupQosInfo': '',  # The parameters.
            'resourcePool': 'example-resource-pool',           # The name of the resource pool.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for GET requests.
        bucket = None,  # The name of the bucket, which is not required for GET requests. This operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    ListResourcePoolBucketGroupQoSInfos()

Excluir as configurações de limitação de um grupo de buckets em um pool de recursos

import alibabacloud_oss_v2 as oss

def DeleteResourcePoolBucketGroupQoSInfo():
    # Obtain access credentials from environment variables for authentication.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Load default configurations and obtain the configuration file.
    cfg = oss.config.load_default()

    # Specify the credential provider.
    cfg.credentials_provider = credentials_provider

    # Specify the region in which the bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
    cfg.region = "cn-hangzhou"

    # Initialize the OSSClient instance by using the configuration file.
    client = oss.Client(cfg)

    # Specify input parameters for the DeleteResourcePoolBucketGroupQoSInfo operation.
    req = oss.OperationInput(
        op_name = 'DeleteResourcePoolBucketGroupQoSInfo',  # The name of the operation.
        method = 'DELETE',  # The type of the HTTP method type. In this example, Delete is used.
        parameters = {
            'resourcePoolBucketGroupQosInfo': '',  # The parameters.
            'resourcePool': 'example-resource-pool',           # The name of the resource pool.
            'resourcePoolBucketGroup': 'example-group',  # The name of the bucket group.
        },
        headers = None,  # The request headers. If you do not need to specify additional headers, leave the field empty.
        body = None,  # The request body, which is typically not required for DELETE requests.
        bucket = None,  # The name of the bucket, which is not required for DELETE requests. This operation is not performed on a specific bucket.
    )

    # Use the invoke_operation method of the client to execute the request and obtain the response.
    resp = client.invoke_operation(req)

    # Display the returned HTTP status code.
    print(resp.status_code)

    # Display the response headers.
    print(resp.headers)

    # Display the response body, which typically contains the specific data returned by the request.
    print(resp.http_response.content)

if __name__ == "__main__":
    DeleteResourcePoolBucketGroupQoSInfo()

Referências