Tous les produits
Search
Centre de documentation

Object Storage Service:Gérer la QoS du pool de ressources

Dernière mise à jour :Aug 18, 2026

Cette rubrique explique comment gérer la qualité de service (QoS) d'un pool de ressources à l'aide du SDK Object Storage Service (OSS) pour Python 2.0.

Remarques d'utilisation

  • Les exemples de code de cette rubrique utilisent l'ID de région cn-hangzhou correspondant à la région Chine (Hangzhou). Par défaut, l'endpoint public permet d'accéder aux ressources d'un bucket. Pour accéder aux ressources du bucket via d'autres services Alibaba Cloud situés dans la même région, utilisez l'endpoint interne. Pour plus d'informations sur les régions et les endpoints, consultez Régions et endpoints.

Gestion de la bande passante au niveau du bucket

Configurer des règles de limitation pour un bucket dans un pool de ressources

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()

Interroger les configurations de limitation d'un 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()

Supprimer les configurations de limitation d'un bucket dans un pool de ressources

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()
    

Gestion de la bande passante au niveau du bucket pour différents requérants

Configurer des règles de limitation pour un requérant accédant à un 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()

Interroger les configurations de limitation d'un requérant accédant à un 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()

Interroger les configurations de limitation de tous les requérants accédant à un 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()

Supprimer les configurations de limitation d'un requérant accédant à un 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()

Gestion de la bande passante au niveau du pool de ressources pour différents requérants

Répertorier tous les pools de ressources du compte Alibaba Cloud actuel

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()

Interroger les informations d'un pool de ressources

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()

Répertorier les buckets d'un pool de ressources

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()

Configurer des règles de limitation pour un requérant dans un pool de ressources

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()

Interroger les configurations de limitation d'un requérant dans un pool de ressources

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()

Interroger les configurations de limitation de tous les requérants d'un pool de ressources

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()

Supprimer les configurations de limitation d'un requérant dans un pool de ressources

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()

Gestion de la bande passante pour un groupe de buckets

Ajouter des buckets d'un pool de ressources à un groupe 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()

Répertorier les groupes de buckets d'un pool de ressources

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()

Modifier les configurations de limitation d'un groupe de buckets dans un pool de ressources

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()

Interroger les configurations de limitation d'un groupe de buckets dans un pool de ressources

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()

Répertorier les configurations de limitation des groupes de buckets d'un pool de ressources

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()

Supprimer les configurations de limitation d'un groupe de buckets dans un pool de ressources

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()

Références