Ejemplo n.º 1
0
        public async Task <CreateTriggerResponse> CreateTriggerWithOptionsAsync(CreateTriggerRequest request, CreateTriggerHeaders headers, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime)
        {
            AlibabaCloud.TeaUtil.Common.ValidateModel(request);
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
            };

            if (!AlibabaCloud.TeaUtil.Common.IsUnset(request.IntegratorFlag))
            {
                body["integratorFlag"] = request.IntegratorFlag;
            }
            if (!AlibabaCloud.TeaUtil.Common.IsUnset(request.TriggerInfo))
            {
                body["triggerInfo"] = request.TriggerInfo;
            }
            Dictionary <string, string> realHeaders = new Dictionary <string, string>()
            {
            };

            if (!AlibabaCloud.TeaUtil.Common.IsUnset(headers.CommonHeaders))
            {
                realHeaders = headers.CommonHeaders;
            }
            if (!AlibabaCloud.TeaUtil.Common.IsUnset(headers.XAcsDingtalkAccessToken))
            {
                realHeaders["x-acs-dingtalk-access-token"] = AlibabaCloud.TeaUtil.Common.ToJSONString(headers.XAcsDingtalkAccessToken);
            }
            AlibabaCloud.OpenApiClient.Models.OpenApiRequest req = new AlibabaCloud.OpenApiClient.Models.OpenApiRequest
            {
                Headers = realHeaders,
                Body    = AlibabaCloud.OpenApiUtil.Client.ParseToMap(body),
            };
            return(TeaModel.ToObject <CreateTriggerResponse>(await DoROARequestAsync("CreateTrigger", "connector_1.0", "HTTP", "POST", "AK", "/v1.0/connector/triggers", "json", req, runtime)));
        }
Ejemplo n.º 2
0
        /// <summary>Snippet for CreateTrigger</summary>
        public void CreateTriggerRequestObject()
        {
            // Snippet: CreateTrigger(CreateTriggerRequest, CallSettings)
            // Create client
            EventarcClient eventarcClient = EventarcClient.Create();
            // Initialize request argument(s)
            CreateTriggerRequest request = new CreateTriggerRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Trigger      = new Trigger(),
                TriggerId    = "",
                ValidateOnly = false,
            };
            // Make the request
            Operation <Trigger, OperationMetadata> response = eventarcClient.CreateTrigger(request);

            // Poll until the returned long-running operation is complete
            Operation <Trigger, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Trigger result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Trigger, OperationMetadata> retrievedResponse = eventarcClient.PollOnceCreateTrigger(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Trigger retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Ejemplo n.º 3
0
        public async Task <CreateTriggerResponse> CreateTriggerAsync(CreateTriggerRequest request)
        {
            AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
            CreateTriggerHeaders headers = new CreateTriggerHeaders();

            return(await CreateTriggerWithOptionsAsync(request, headers, runtime));
        }
Ejemplo n.º 4
0
        public CreateTriggerResponse CreateTrigger(CreateTriggerRequest request)
        {
            AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
            CreateTriggerHeaders headers = new CreateTriggerHeaders();

            return(CreateTriggerWithOptions(request, headers, runtime));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// CreateTrigger接口的同步版本,该接口根据参数输入设置新的触发方式。
        /// </summary>
        /// <param name="req">参考<see cref="CreateTriggerRequest"/></param>
        /// <returns>参考<see cref="CreateTriggerResponse"/>实例</returns>
        public CreateTriggerResponse CreateTriggerSync(CreateTriggerRequest req)
        {
            JsonResponseModel <CreateTriggerResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "CreateTrigger");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <CreateTriggerResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Ejemplo n.º 6
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            CreateTriggerRequest request;

            try
            {
                request = new CreateTriggerRequest
                {
                    CreateTriggerDetails = CreateTriggerDetails,
                    OpcRetryToken        = OpcRetryToken,
                    OpcRequestId         = OpcRequestId
                };

                response = client.CreateTrigger(request).GetAwaiter().GetResult();
                WriteOutput(response, response.TriggerCreateResult);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates the trigger.
 /// </summary>
 /// <returns>The trigger.</returns>
 /// <param name="createTriggerRequest">Create trigger request.</param>
 public CreateTriggerResponse CreateTrigger(CreateTriggerRequest createTriggerRequest)
 {
     return(this.DoRequestCommon <CreateTriggerResponse>(createTriggerRequest.GenHttpRequest(Config)));
 }