/// <summary>
        /// 查询指定函数触发器列表
        /// </summary>
        public static void ListFunctionTriggers(FunctionGraphClient client)
        {
            ListFunctionTriggersRequest req = new ListFunctionTriggersRequest
            {
                FunctionUrn = "urn:fss:cn-north-7:46b6f338fc3445b8846c71dfb1fbd9e8:nction:CsharpSdkTest:csharpSdkTest:latest"
            };

            try
            {
                ListFunctionTriggersResponse resp = client.ListFunctionTriggers(req);
                Console.WriteLine("ListFunctionTriggers Body=" + JsonConvert.SerializeObject(resp));
                foreach (var trigger in resp.Body)
                {
                    Console.WriteLine("id=" + trigger.TriggerId);
                    Console.WriteLine("trigger_type_code=" + trigger.TriggerTypeCode);
                }
            }
            catch (ClientRequestException e)
            {
                Console.WriteLine(e.HttpStatusCode);
                Console.WriteLine(e.ErrorCode);
                Console.WriteLine(e.ErrorMsg);
            }
            catch (ConnectionException e)
            {
                Console.WriteLine(e.ErrorMessage);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Пример #2
0
        /// <summary>
        /// 获取指定函数的所有触发器。
        /// </summary>
        public ListFunctionTriggersResponse ListFunctionTriggers(ListFunctionTriggersRequest listFunctionTriggersRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("function_urn", listFunctionTriggersRequest.FunctionUrn.ToString());
            string      urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/fgs/triggers/{function_urn}", urlParam);
            SdkRequest  request  = HttpUtils.InitSdkRequest(urlPath, listFunctionTriggersRequest);
            SdkResponse response = DoHttpRequest("GET", request);
            ListFunctionTriggersResponse listFunctionTriggersResponse = JsonUtils.DeSerializeNull <ListFunctionTriggersResponse>(response);

            listFunctionTriggersResponse.Body = JsonUtils.DeSerializeList <ListFunctionTriggerResult>(response);
            return(listFunctionTriggersResponse);
        }