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

            try
            {
                DeleteFunctionTriggerResponse resp = client.DeleteFunctionTrigger(req);
                Console.WriteLine("DeleteFunctionTrigger 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;
            }
        }
Exemple #2
0
        /// <summary>
        /// 删除触发器。
        /// </summary>
        public async Task <DeleteFunctionTriggerResponse> DeleteFunctionTriggerAsync(DeleteFunctionTriggerRequest deleteFunctionTriggerRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("function_urn", deleteFunctionTriggerRequest.FunctionUrn.ToString());
            urlParam.Add("trigger_type_code", deleteFunctionTriggerRequest.TriggerTypeCode.ToString());
            urlParam.Add("trigger_id", deleteFunctionTriggerRequest.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", deleteFunctionTriggerRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("DELETE", request);

            return(JsonUtils.DeSerializeNull <DeleteFunctionTriggerResponse>(response));
        }