/// <summary>
        /// 更新指定触发器状态
        /// </summary>
        public static void UpdateFunctionTrigger(FunctionGraphClient client)
        {
            UpdateTriggerRequest req = new UpdateTriggerRequest
            {
                FunctionUrn     = "urn:fss:cn-north-7:46b6f338fc3445b8846c71dfb1fbd9e8:function:CsharpSdkTest:csharpSdkTest:latest",
                TriggerTypeCode = UpdateTriggerRequest.TriggerTypeCodeEnum.TIMER,
                TriggerId       = "6e67697f-e880-4616-92b0-1ec6590c38f2"
            };

            try
            {
                UpdateTriggerResponse resp = client.UpdateTrigger(req);
                Console.WriteLine("UpdateTrigger Body=" + JsonConvert.SerializeObject(resp));
                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;
            }
        }
Пример #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateTriggerResponse response = new UpdateTriggerResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Trigger", targetDepth))
                {
                    var unmarshaller = TriggerUnmarshaller.Instance;
                    response.Trigger = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }