/// <inheritdoc />
        public async override Task <BigQueryRoutine> UpdateRoutineAsync(RoutineReference routineReference, Routine resource, UpdateRoutineOptions options = null, CancellationToken cancellationToken = default)
        {
            var request = CreateUpdateRoutineRequest(routineReference, resource, options);
            var routine = await request.ExecuteAsync(cancellationToken).ConfigureAwait(false);

            return(new BigQueryRoutine(this, routine));
        }
        private UpdateRequest CreateUpdateRoutineRequest(RoutineReference routineReference, Routine resource, UpdateRoutineOptions options)
        {
            CheckResourceReference(routineReference, resource);
            var request = Service.Routines.Update(resource, routineReference.ProjectId, routineReference.DatasetId, routineReference.RoutineId);

            options?.ModifyRequest(request);
            RetryIfETagPresent(request, resource);
            request.PrettyPrint = PrettyPrint;
            return(request);
        }
 /// <summary>
 /// Asynchronously updates the specified routine to match the specified resource.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="routineReference">A fully-qualified identifier for the routine. Must not be null.</param>
 /// <param name="resource">The routine resource representation to use for the update. All updatable fields will be updated. If this routine's <see cref="Routine.RoutineReference"/> is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation. When complete, the result is
 /// the updated routine.</returns>
 public virtual Task <BigQueryRoutine> UpdateRoutineAsync(RoutineReference routineReference, Routine resource, UpdateRoutineOptions options = null, CancellationToken cancellationToken = default) =>
 throw new NotImplementedException();
        /// <inheritdoc />
        public override BigQueryRoutine UpdateRoutine(RoutineReference routineReference, Routine resource, UpdateRoutineOptions options = null)
        {
            var request = CreateUpdateRoutineRequest(routineReference, resource, options);
            var routine = request.Execute();

            return(new BigQueryRoutine(this, routine));
        }
 /// <summary>
 /// Asynchronously updates the specified routine to match the specified resource.
 /// This method just creates a <see cref="RoutineReference"/> and delegates to <see cref="UpdateRoutineAsync(RoutineReference, Routine, UpdateRoutineOptions, CancellationToken)"/>.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="routineId">The routine ID. Must not be null.</param>
 /// <param name="resource">The routine resource representation to use for the update. All updatable fields will be updated. If this routine's <see cref="Routine.RoutineReference"/> is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation. When complete, the result is
 /// the updated routine.</returns>
 public virtual Task <BigQueryRoutine> UpdateRoutineAsync(string projectId, string datasetId, string routineId, Routine resource, UpdateRoutineOptions options = null, CancellationToken cancellationToken = default) =>
 UpdateRoutineAsync(GetRoutineReference(projectId, datasetId, routineId), resource, options, cancellationToken);
 /// <summary>
 /// Updates the specified routine to match the specified resource.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="routineReference">A fully-qualified identifier for the routine. Must not be null.</param>
 /// <param name="resource">The routine resource representation to use for the update. All updatable fields will be updated. If this routine's <see cref="Routine.RoutineReference"/> is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The updated routine.</returns>
 public virtual BigQueryRoutine UpdateRoutine(RoutineReference routineReference, Routine resource, UpdateRoutineOptions options = null) =>
 throw new NotImplementedException();
 /// <summary>
 /// Updates the specified routine to match the specified resource.
 /// This method just creates a <see cref="RoutineReference"/> and delegates to <see cref="UpdateRoutine(RoutineReference, Routine, UpdateRoutineOptions)"/>.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="routineId">The routine ID. Must not be null.</param>
 /// <param name="resource">The routine resource representation to use for the update. All updatable fields will be updated. If this routine's <see cref="Routine.RoutineReference"/> is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The updated routine.</returns>
 public virtual BigQueryRoutine UpdateRoutine(string projectId, string datasetId, string routineId, Routine resource, UpdateRoutineOptions options = null) =>
 UpdateRoutine(GetRoutineReference(projectId, datasetId, routineId), resource, options);
Example #8
0
 /// <summary>
 /// Asynchronously updates this routine to match the specified resource.
 /// </summary>
 /// <remarks>
 /// This method delegates to <see cref="BigQueryClient.UpdateRoutineAsync(RoutineReference, Routine, UpdateRoutineOptions, CancellationToken)"/>.
 /// A simple way of updating the routine is to modify <see cref="Resource"/> and then call this method with no arguments.
 /// This is convenient, but it's important to understand that modifying <see cref="Resource"/> in this way leaves this object
 /// in an unusual state - it represents "the table as it was when fetched, but then modified locally". For example, the etag
 /// will be the original etag, rather than the one associated with the updated routine. To avoid this causing confusion,
 /// we recommend only taking this approach if the object will not be used afterwards. Use the value returned by this method
 /// as the new, self-consistent representation of the routine.
 /// </remarks>
 /// <param name="resource">The resource to update with. If null, the <see cref="Resource"/> property is
 /// used.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task representing the asynchronous operation. When complete, the result is
 /// the updated routine.</returns>
 public Task <BigQueryRoutine> UpdateAsync(Routine resource = null, UpdateRoutineOptions options = null, CancellationToken cancellationToken = default) =>
 _client.UpdateRoutineAsync(Reference, resource ?? Resource, options, cancellationToken);
Example #9
0
 /// <summary>
 /// Updates this routine to match the specified resource.
 /// </summary>
 /// <remarks>
 /// This method delegates to <see cref="BigQueryClient.UpdateRoutine(RoutineReference, Routine, UpdateRoutineOptions)"/>.
 /// A simple way of updating the routine is to modify <see cref="Resource"/> and then call this method with no arguments.
 /// This is convenient, but it's important to understand that modifying <see cref="Resource"/> in this way leaves this object
 /// in an unusual state - it represents "the table as it was when fetched, but then modified locally". For example, the etag
 /// will be the original etag, rather than the one associated with the updated routine. To avoid this causing confusion,
 /// we recommend only taking this approach if the object will not be used afterwards. Use the value returned by this method
 /// as the new, self-consistent representation of the routine.
 /// </remarks>
 /// <param name="resource">The resource to update with. If null, the <see cref="Resource"/> property is
 /// used.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The updated routine.</returns>
 public BigQueryRoutine Update(Routine resource = null, UpdateRoutineOptions options = null) =>
 _client.UpdateRoutine(Reference, resource ?? Resource, options);