/// <summary>
        /// 查询指定触发器
        /// </summary>
        public static void ShowFunctionTrigger(FunctionGraphClient client)
        {
            ShowFunctionTriggerRequest req = new ShowFunctionTriggerRequest
            {
                FunctionUrn     = "urn:fss:cn-north-7:46b6f338fc3445b8846c71dfb1fbd9e8:nction:CsharpSdkTest:csharpSdkTest:latest",
                TriggerTypeCode = ShowFunctionTriggerRequest.TriggerTypeCodeEnum.TIMER,
                TriggerId       = "cec41eba-bd7c-48d9-8644-08948b66f415"
            };

            try
            {
                ShowFunctionTriggerResponse resp = client.ShowFunctionTrigger(req);
                Console.WriteLine("ShowFunctionTrigger Body=" + JsonConvert.SerializeObject(resp));
                Console.WriteLine("id=" + resp.TriggerId);
                Console.WriteLine("trigger_type_code=" + resp.TriggerTypeCode);
                Console.WriteLine("ShowFunctionTrigger StatusCode=" + resp.HttpStatusCode);
            }
            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;
            }
        }
Example #2
0
        /// <summary>
        /// 获取指定触发器的信息。
        /// </summary>
        public async Task <ShowFunctionTriggerResponse> ShowFunctionTriggerAsync(ShowFunctionTriggerRequest showFunctionTriggerRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("function_urn", showFunctionTriggerRequest.FunctionUrn.ToString());
            urlParam.Add("trigger_type_code", showFunctionTriggerRequest.TriggerTypeCode.ToString());
            urlParam.Add("trigger_id", showFunctionTriggerRequest.TriggerId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/v2/{project_id}/fgs/triggers/{function_urn}/{trigger_type_code}/{trigger_id}", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", showFunctionTriggerRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("GET", request);

            return(JsonUtils.DeSerialize <ShowFunctionTriggerResponse>(response));
        }