@@ -5215,6 +5215,187 @@ def ci_list_media_jobs(self, Bucket, QueueId, Tag, StartCreationTime=None, EndCr
52155215 format_dict (data , ['JobsDetail' ])
52165216 return data
52175217
5218+ def ci_trigger_workflow (self , Bucket , WorkflowId , Key , ** kwargs ):
5219+ """ 触发工作流接口 https://cloud.tencent.com/document/product/436/54641
5220+
5221+ :param Bucket(string): 存储桶名称.
5222+ :param WorkflowId(string):工作流ID.
5223+ :param Key(string): 对象key.
5224+ :param kwargs(dict): 设置请求的headers.
5225+ :return(dict): 查询成功返回的结果,dict类型.
5226+
5227+ .. code-block:: python
5228+
5229+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
5230+ client = CosS3Client(config)
5231+ # 触发工作流接口
5232+ response = client.ci_trigger_workflow(
5233+ Bucket='bucket'
5234+ WorkflowId='',
5235+ Key='a.mp4'
5236+ )
5237+ print response
5238+ """
5239+ headers = mapped (kwargs )
5240+ final_headers = {}
5241+ params = {}
5242+ for key in headers :
5243+ if key .startswith ("response" ):
5244+ params [key ] = headers [key ]
5245+ else :
5246+ final_headers [key ] = headers [key ]
5247+ headers = final_headers
5248+
5249+ params = format_values (params )
5250+ path = "/triggerworkflow"
5251+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
5252+ url = u"{url}?{WorkflowId}&{Key}" .format (
5253+ url = to_unicode (url ),
5254+ WorkflowId = to_unicode ('workflowId=' + WorkflowId ),
5255+ Key = to_unicode ('object=' + Key )
5256+ )
5257+
5258+ logger .info ("ci_trigger_workflow result, url=:{url} ,headers=:{headers}, params=:{params}" .format (
5259+ url = url ,
5260+ headers = headers ,
5261+ params = params ))
5262+ rt = self .send_request (
5263+ method = 'POST' ,
5264+ url = url ,
5265+ bucket = Bucket ,
5266+ auth = CosS3Auth (self ._conf , path , params = params ),
5267+ params = params ,
5268+ headers = headers )
5269+ logger .debug ("ci_trigger_workflow result, url=:{url} ,content=:{content}" .format (
5270+ url = url ,
5271+ content = rt .content ))
5272+ data = xml_to_dict (rt .content )
5273+ return data
5274+
5275+ def ci_get_workflowexecution (self , Bucket , RunId , ** kwargs ):
5276+ """ 获取工作流实例详情 https://cloud.tencent.com/document/product/436/53992
5277+
5278+ :param Bucket(string): 存储桶名称.
5279+ :param RunId(string): 工作流实例ID.
5280+ :param kwargs(dict): 设置请求的headers.
5281+ :return(dict): 查询成功返回的结果,dict类型.
5282+
5283+ .. code-block:: python
5284+
5285+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
5286+ client = CosS3Client(config)
5287+ # 获取工作流实例详情
5288+ response = client.ci_get_workflowexecution(
5289+ Bucket='bucket'
5290+ RunId=''
5291+ )
5292+ print response
5293+ """
5294+ headers = mapped (kwargs )
5295+ final_headers = {}
5296+ params = {}
5297+ for key in headers :
5298+ if key .startswith ("response" ):
5299+ params [key ] = headers [key ]
5300+ else :
5301+ final_headers [key ] = headers [key ]
5302+ headers = final_headers
5303+
5304+ params = format_values (params )
5305+ path = "/workflowexecution/" + RunId
5306+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
5307+ logger .info ("ci_get_workflowexecution result, url=:{url} ,headers=:{headers}, params=:{params}" .format (
5308+ url = url ,
5309+ headers = headers ,
5310+ params = params ))
5311+ rt = self .send_request (
5312+ method = 'GET' ,
5313+ url = url ,
5314+ bucket = Bucket ,
5315+ auth = CosS3Auth (self ._conf , path , params = params ),
5316+ params = params ,
5317+ headers = headers )
5318+ logger .debug ("ci_get_workflowexecution result, url=:{url} ,content=:{content}" .format (
5319+ url = url ,
5320+ content = rt .content ))
5321+
5322+ data = xml_to_dict (rt .content )
5323+ # 单个元素时将dict转为list
5324+ format_dict (data , ['WorkflowExecution' ])
5325+ return data
5326+
5327+ def ci_list_workflowexecution (self , Bucket , WorkflowId , Name = '' , StartCreationTime = None , EndCreationTime = None , OrderByTime = 'Desc' , States = 'All' , Size = 10 , NextToken = '' , ** kwargs ):
5328+ """ 获取工作流实例列表 https://cloud.tencent.com/document/product/436/53993
5329+
5330+ :param Bucket(string): 存储桶名称.
5331+ :param WorkflowId(string): 工作流实例ID.
5332+ :param Name(string): 触发对象.
5333+ :param StartCreationTime(string): 开始时间.
5334+ :param EndCreationTime(string): 结束时间.
5335+ :param OrderByTime(string): 排序方式.
5336+ :param States(string): 任务状态.
5337+ :param Size(string): 任务个数.
5338+ :param NextToken(string): 请求的上下文,用于翻页.
5339+ :param kwargs(dict): 设置请求的headers.
5340+ :return(dict): 查询成功返回的结果,dict类型.
5341+
5342+ .. code-block:: python
5343+
5344+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
5345+ client = CosS3Client(config)
5346+ # 创建任务接口
5347+ response = client.ci_list_workflowexecution(
5348+ Bucket='bucket'
5349+ WorkflowId='',
5350+ Name='a.mp4'
5351+ )
5352+ print response
5353+ """
5354+ headers = mapped (kwargs )
5355+ final_headers = {}
5356+ params = {}
5357+ for key in headers :
5358+ if key .startswith ("response" ):
5359+ params [key ] = headers [key ]
5360+ else :
5361+ final_headers [key ] = headers [key ]
5362+ headers = final_headers
5363+
5364+ params = format_values (params )
5365+ path = "/workflowexecution"
5366+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
5367+ url = u"{url}?{WorkflowId}&{Name}&{OrderByTime}&{States}&{Size}&{NextToken}" .format (
5368+ url = to_unicode (url ),
5369+ WorkflowId = to_unicode ('workflowId=' + WorkflowId ),
5370+ Name = to_unicode ('name=' + Name ),
5371+ OrderByTime = to_unicode ('orderByTime=' + OrderByTime ),
5372+ States = to_unicode ('states=' + States ),
5373+ Size = to_unicode ('size=' + str (Size )),
5374+ NextToken = to_unicode ('nextToken=' + NextToken )
5375+ )
5376+ if StartCreationTime is not None :
5377+ url = u"{url}&{StartCreationTime}" .format (StartCreationTime = to_unicode ('startCreationTime=' + StartCreationTime ))
5378+ if EndCreationTime is not None :
5379+ url = u"{url}&{EndCreationTime}" .format (EndCreationTime = to_unicode ('endCreationTime=' + EndCreationTime ))
5380+ logger .info ("ci_list_workflowexecution result, url=:{url} ,headers=:{headers}, params=:{params}" .format (
5381+ url = url ,
5382+ headers = headers ,
5383+ params = params ))
5384+ rt = self .send_request (
5385+ method = 'GET' ,
5386+ url = url ,
5387+ bucket = Bucket ,
5388+ auth = CosS3Auth (self ._conf , path , params = params ),
5389+ params = params ,
5390+ headers = headers )
5391+ logger .debug ("ci_list_workflowexecution result, url=:{url} ,content=:{content}" .format (
5392+ url = url ,
5393+ content = rt .content ))
5394+ data = xml_to_dict (rt .content )
5395+ # 单个元素时将dict转为list
5396+ format_dict (data , ['WorkflowExecution' ])
5397+ return data
5398+
52185399 def get_media_info (self , Bucket , Key , ** kwargs ):
52195400 """用于查询媒体文件的信息 https://cloud.tencent.com/document/product/436/55672
52205401
0 commit comments