When you activate ApsaraVideo Media Processing (MPS), an MPS queue is automatically created. You can call the following API operations to manage MPS queues: SearchPipeline, QueryPipelineList, and UpdatePipeline.
SearchPipeline
Queries MPS queues in the specified state.
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkcore.auth.credentials import AccessKeyCredential
from aliyunsdkmts.request.v20140618.SearchPipelineRequest import SearchPipelineRequest
# Obtain the AccessKey ID and AccessKey secret from environment variables.
credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'], os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'])
# Set the region_id parameter to the ID of the region in which the service is called. For more information about the supported regions, see "Regions and endpoints" at https://www.alibabacloud.com/help/zh/apsaravideo-for-media-processing/latest/service-regions.
client = AcsClient(region_id = 'cn-shanghai', credential = credentials)
request = SearchPipelineRequest()
request.set_accept_format('json')
response = client.do_action_with_exception(request);
# Display the output.
print(str(response, encoding='utf-8'))
QueryPipelineList
Queries MPS queues based on their IDs.
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkcore.auth.credentials import AccessKeyCredential
from aliyunsdkmts.request.v20140618.QueryPipelineListRequest import QueryPipelineListRequest
# Obtain the AccessKey ID and AccessKey secret from environment variables.
credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'], os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'])
# Set the region_id parameter to the ID of the region in which the service is called. For more information about the supported regions, see "Regions and endpoints" at https://www.alibabacloud.com/help/zh/apsaravideo-for-media-processing/latest/service-regions.
client = AcsClient(region_id = 'cn-shanghai', credential = credentials)
request = QueryPipelineListRequest()
request.set_PipelineIds('9bad3801a2c3d2c4df9c6****')
request.set_accept_format('json')
response = client.do_action_with_exception(request);
# Display the output.
print(str(response, encoding='utf-8'))
UpdatePipeline
Updates the information about an MPS queue such as the name and state of the MPS queue. The states of an MPS queue include Active and Paused.
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkcore.auth.credentials import AccessKeyCredential
from aliyunsdkmts.request.v20140618.UpdatePipelineRequest import UpdatePipelineRequest
# Obtain the AccessKey ID and AccessKey secret from environment variables.
credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'], os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'])
# Set the region_id parameter to the ID of the region in which the service is called. For more information about the supported regions, see "Regions and endpoints" at https://www.alibabacloud.com/help/zh/apsaravideo-for-media-processing/latest/service-regions.
client = AcsClient(region_id = 'cn-shanghai', credential = credentials)
request = UpdatePipelineRequest()
request.set_PipelineId('91c22c4df9c6****')
request.set_Name('update name')
request.set_State('Active')
response = client.do_action_with_exception(request);
# Display the output.
print(str(response, encoding='utf-8'))