@@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "encoding/json"
56 "encoding/xml"
67 "fmt"
78 "net/http"
@@ -871,6 +872,81 @@ func InvokeSuperResolutionJob() {
871872 fmt .Printf ("%+v\n " , DescribeJobRes .JobsDetail )
872873}
873874
875+ func TriggerWorkflow () {
876+ u , _ := url .Parse ("https://wwj-cq-1253960454.cos.ap-chongqing.myqcloud.com" )
877+ cu , _ := url .Parse ("https://wwj-cq-1253960454.ci.ap-chongqing.myqcloud.com" )
878+ b := & cos.BaseURL {BucketURL : u , CIURL : cu }
879+ c := cos .NewClient (b , & http.Client {
880+ Transport : & cos.AuthorizationTransport {
881+ SecretID : os .Getenv ("COS_SECRETID" ),
882+ SecretKey : os .Getenv ("COS_SECRETKEY" ),
883+ Transport : & debug.DebugRequestTransport {
884+ RequestHeader : true ,
885+ // Notice when put a large file and set need the request body, might happend out of memory error.
886+ RequestBody : true ,
887+ ResponseHeader : true ,
888+ ResponseBody : true ,
889+ },
890+ },
891+ })
892+ triggerWorkflowOpt := & cos.TriggerWorkflowOptions {
893+ WorkflowId : "w18fd791485904afba3ab07ed57d9cf1e" ,
894+ Object : "100986-2999.mp4" ,
895+ }
896+ triggerWorkflowRes , _ , err := c .CI .TriggerWorkflow (context .Background (), triggerWorkflowOpt )
897+ log_status (err )
898+ fmt .Printf ("%+v\n " , triggerWorkflowRes )
899+ }
900+
901+ func DescribeWorkflowExecutions () {
902+ u , _ := url .Parse ("https://wwj-cq-1253960454.cos.ap-chongqing.myqcloud.com" )
903+ cu , _ := url .Parse ("https://wwj-cq-1253960454.ci.ap-chongqing.myqcloud.com" )
904+ b := & cos.BaseURL {BucketURL : u , CIURL : cu }
905+ c := cos .NewClient (b , & http.Client {
906+ Transport : & cos.AuthorizationTransport {
907+ SecretID : os .Getenv ("COS_SECRETID" ),
908+ SecretKey : os .Getenv ("COS_SECRETKEY" ),
909+ Transport : & debug.DebugRequestTransport {
910+ RequestHeader : true ,
911+ // Notice when put a large file and set need the request body, might happend out of memory error.
912+ RequestBody : true ,
913+ ResponseHeader : true ,
914+ ResponseBody : true ,
915+ },
916+ },
917+ })
918+ describeWorkflowExecutionsOpt := & cos.DescribeWorkflowExecutionsOptions {
919+ WorkflowId : "w18fd791485904afba3ab07ed57d9cf1e" ,
920+ }
921+ describeWorkflowExecutionsRes , _ , err := c .CI .DescribeWorkflowExecutions (context .Background (), describeWorkflowExecutionsOpt )
922+ log_status (err )
923+ fmt .Printf ("%+v\n " , describeWorkflowExecutionsRes )
924+ }
925+
926+ func DescribeMultiWorkflowExecution () {
927+ u , _ := url .Parse ("https://wwj-cq-1253960454.cos.ap-chongqing.myqcloud.com" )
928+ cu , _ := url .Parse ("https://wwj-cq-1253960454.ci.ap-chongqing.myqcloud.com" )
929+ b := & cos.BaseURL {BucketURL : u , CIURL : cu }
930+ c := cos .NewClient (b , & http.Client {
931+ Transport : & cos.AuthorizationTransport {
932+ SecretID : os .Getenv ("COS_SECRETID" ),
933+ SecretKey : os .Getenv ("COS_SECRETKEY" ),
934+ Transport : & debug.DebugRequestTransport {
935+ RequestHeader : true ,
936+ // Notice when put a large file and set need the request body, might happend out of memory error.
937+ RequestBody : true ,
938+ ResponseHeader : true ,
939+ ResponseBody : true ,
940+ },
941+ },
942+ })
943+ describeWorkflowExecutionsRes , _ , err := c .CI .DescribeWorkflowExecution (context .Background (), "i00689df860ad11ec9c5952540019ee59" )
944+ log_status (err )
945+ a , _ := json .Marshal (describeWorkflowExecutionsRes )
946+ fmt .Println (string (a ))
947+ fmt .Printf ("%+v\n " , describeWorkflowExecutionsRes )
948+ }
949+
874950func main () {
875951 // InvokeSnapshotJob()
876952 // InvokeConcatJob()
@@ -886,5 +962,8 @@ func main() {
886962 // InvokeVoiceSeparateJob()
887963 // InvokeVideoProcessJob()
888964 // InvokeSDRtoHDRJob()
889- InvokeSuperResolutionJob ()
965+ // InvokeSuperResolutionJob()
966+ // TriggerWorkflow()
967+ // DescribeWorkflowExecutions()
968+ DescribeMultiWorkflowExecution ()
890969}
0 commit comments