public Task <TriggerResponse> ReplaceTriggerAsync( CosmosDiagnosticsContext diagnosticsContext, TriggerProperties triggerProperties, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { if (triggerProperties == null) { throw new ArgumentNullException(nameof(triggerProperties)); } if (string.IsNullOrEmpty(triggerProperties.Id)) { throw new ArgumentNullException(nameof(triggerProperties.Id)); } if (string.IsNullOrEmpty(triggerProperties.Body)) { throw new ArgumentNullException(nameof(triggerProperties.Body)); } return(this.ProcessTriggerOperationAsync( diagnosticsContext: diagnosticsContext, id: triggerProperties.Id, operationType: OperationType.Replace, streamPayload: this.ClientContext.SerializerCore.ToStream(triggerProperties), requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken)); }
public override Task <TriggerResponse> ReplaceTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { if (triggerProperties == null) { throw new ArgumentNullException(nameof(triggerProperties)); } if (string.IsNullOrEmpty(triggerProperties.Id)) { throw new ArgumentNullException(nameof(triggerProperties.Id)); } if (string.IsNullOrEmpty(triggerProperties.Body)) { throw new ArgumentNullException(nameof(triggerProperties.Body)); } return(this.ProcessTriggerOperationAsync( id: triggerProperties.Id, operationType: OperationType.Replace, streamPayload: this.clientContext.SerializerCore.ToStream(triggerProperties), requestOptions: requestOptions, cancellationToken: cancellationToken)); }
public override Task <TriggerResponse> ReplaceTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(TaskHelper.RunInlineIfNeededAsync(() => this.scripts.ReplaceTriggerAsync(triggerProperties, requestOptions, cancellationToken))); }
public Task <TriggerResponse> CreateTriggerAsync( CosmosDiagnosticsContext diagnosticsContext, TriggerProperties triggerProperties, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { if (triggerProperties == null) { throw new ArgumentNullException(nameof(triggerProperties)); } if (string.IsNullOrEmpty(triggerProperties.Id)) { throw new ArgumentNullException(nameof(triggerProperties.Id)); } if (string.IsNullOrEmpty(triggerProperties.Body)) { throw new ArgumentNullException(nameof(triggerProperties.Body)); } return(this.ProcessScriptsCreateOperationAsync( diagnosticsContext: diagnosticsContext, resourceUri: this.container.LinkUri, resourceType: ResourceType.Trigger, operationType: OperationType.Create, streamPayload: this.ClientContext.SerializerCore.ToStream(triggerProperties), requestOptions: requestOptions, responseFunc: this.ClientContext.ResponseFactory.CreateTriggerResponse, trace: trace, cancellationToken: cancellationToken)); }
public override Task <TriggerResponse> CreateTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { if (triggerProperties == null) { throw new ArgumentNullException(nameof(triggerProperties)); } if (string.IsNullOrEmpty(triggerProperties.Id)) { throw new ArgumentNullException(nameof(triggerProperties.Id)); } if (string.IsNullOrEmpty(triggerProperties.Body)) { throw new ArgumentNullException(nameof(triggerProperties.Body)); } return(this.ProcessTriggerOperationAsync( linkUri: this.container.LinkUri, operationType: OperationType.Create, streamPayload: CosmosResource.ToStream(triggerProperties), requestOptions: requestOptions, cancellationToken: cancellationToken)); }
public override Task <TriggerResponse> ReplaceTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(this.ClientContext.OperationHelperAsync( nameof(ReplaceTriggerAsync), requestOptions, (diagnostics) => base.ReplaceTriggerAsync(diagnostics, triggerProperties, requestOptions, cancellationToken))); }
public override Task <TriggerResponse> CreateTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(this.ClientContext.OperationHelperAsync( nameof(CreateTriggerAsync), requestOptions, (trace) => base.CreateTriggerAsync(triggerProperties, requestOptions, trace, cancellationToken))); }
public override Task <TriggerResponse> ReplaceTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(this.ClientContext.OperationHelperAsync( nameof(ReplaceTriggerAsync), requestOptions, (trace) => base.ReplaceTriggerAsync(triggerProperties, requestOptions, trace, cancellationToken), (response) => new OpenTelemetryResponse <TriggerProperties>(response))); }
/// <summary> /// Replaces a <see cref="TriggerProperties"/> in the Azure Cosmos service as an asynchronous operation. /// </summary> /// <param name="triggerProperties">The <see cref="TriggerProperties"/> object.</param> /// <param name="requestOptions">(Optional) The options for the trigger request <see cref="RequestOptions"/></param> /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param> /// <returns> /// A <see cref="Task"/> containing a <see cref="TriggerResponse"/> which wraps a <see cref="TriggerProperties"/> containing the updated resource record. /// </returns> /// <exception cref="ArgumentNullException">If <paramref name="triggerProperties"/> is not set.</exception> /// <example> /// This examples replaces an existing trigger. /// <code language="c#"> /// <![CDATA[ /// TriggerProperties triggerProperties = new TriggerProperties /// { /// Id = "testTriggerId", /// Body = @"function AddTax() { /// var item = getContext().getRequest().getBody(); /// /// // Validate/calculate the tax. /// item.tax = item.cost* .15; /// /// // Update the request -- this is what is going to be inserted. /// getContext().getRequest().setBody(item); /// }", /// TriggerOperation = TriggerOperation.All, /// TriggerType = TriggerType.Post /// }; /// /// Scripts scripts = this.container.GetScripts(); /// TriggerResponse response = await scripts.ReplaceTriggerAsync(triggerSettigs); /// ]]> /// </code> /// </example> public abstract Task <TriggerResponse> ReplaceTriggerAsync( TriggerProperties triggerProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken));