예제 #1
0
 /// <summary>
 /// Patches this table with fields in the specified resource.
 /// </summary>
 /// <remarks>
 /// This method delegates to <see cref="BigQueryClient.PatchTable(TableReference, Table, PatchTableOptions)"/>.
 /// </remarks>
 /// <param name="resource">The resource to patch with. Must not be null.</param>
 /// <param name="matchETag">If true, the etag from <see cref="Resource"/> is propagated into <paramref name="resource"/> for
 /// optimistic concurrency. Otherwise, <paramref name="resource"/> is left unchanged.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The updated table.</returns>
 public BigQueryTable Patch(Table resource, bool matchETag, PatchTableOptions options = null)
 {
     if (matchETag)
     {
         resource.ETag = Resource.ETag;
     }
     return(_client.PatchTable(Reference, resource, options));
 }
예제 #2
0
 /// <summary>
 /// Asynchronously patches this table with fields in the specified resource.
 /// </summary>
 /// <remarks>
 /// This method delegates to <see cref="BigQueryClient.PatchTableAsync(TableReference, Table, PatchTableOptions, CancellationToken)"/>.
 /// </remarks>
 /// <param name="resource">The resource to patch with. Must not be null.</param>
 /// <param name="matchETag">If true, the etag from <see cref="Resource"/> is propagated into <paramref name="resource"/> for
 /// optimistic concurrency. Otherwise, <paramref name="resource"/> is left unchanged.</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 table.</returns>
 public Task <BigQueryTable> PatchAsync(Table resource, bool matchETag, PatchTableOptions options = null, CancellationToken cancellationToken = default)
 {
     if (matchETag)
     {
         resource.ETag = Resource.ETag;
     }
     return(_client.PatchTableAsync(Reference, resource, options, cancellationToken));
 }
 /// <summary>
 /// Asynchronously patches the specified table with fields in the given resource.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="resource">The table resource representation to use for the patch. Only fields present in the resource will be updated.</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 table.</returns>
 public virtual Task <BigQueryTable> PatchTableAsync(TableReference tableReference, Table resource, PatchTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 throw new NotImplementedException();
 /// <summary>
 /// Asynchronously patches the specified table with fields in the given resource.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="PatchTableAsync(TableReference, Table, PatchTableOptions, 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="tableId">The table ID. Must not be null.</param>
 /// <param name="resource">The table resource representation to use for the patch. Only fields present in the resource will be updated.</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 table.</returns>
 public virtual Task <BigQueryTable> PatchTableAsync(string projectId, string datasetId, string tableId, Table resource, PatchTableOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 PatchTableAsync(GetTableReference(projectId, datasetId, tableId), resource, options, cancellationToken);
 /// <summary>
 /// Patches the specified table with fields in the given resource.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="tableReference">A fully-qualified identifier for the table. Must not be null.</param>
 /// <param name="resource">The table resource representation to use for the patch. Only fields present in the resource will be updated.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The updated table.</returns>
 public virtual BigQueryTable PatchTable(TableReference tableReference, Table resource, PatchTableOptions options = null) =>
 throw new NotImplementedException();
 /// <summary>
 /// Patches the specified table with fields in the given resource.
 /// This method just creates a <see cref="TableReference"/> and delegates to <see cref="PatchTable(TableReference, Table, PatchTableOptions)"/>.
 /// </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="tableId">The table ID. Must not be null.</param>
 /// <param name="resource">The table resource representation to use for the patch. Only fields present in the resource will be updated.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The updated table.</returns>
 public virtual BigQueryTable PatchTable(string projectId, string datasetId, string tableId, Table resource, PatchTableOptions options = null) =>
 PatchTable(GetTableReference(projectId, datasetId, tableId), resource, options);
예제 #7
0
        /// <inheritdoc />
        public override async Task <BigQueryTable> PatchTableAsync(TableReference tableReference, Table resource, PatchTableOptions options = null, CancellationToken cancellationToken = default)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            GaxPreconditions.CheckNotNull(resource, nameof(resource));
            var request = Service.Tables.Patch(resource, tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);

            request.ModifyRequest += _versionHeaderAction;
            options?.ModifyRequest(request);
            return(new BigQueryTable(this, await request.ExecuteAsync(cancellationToken).ConfigureAwait(false)));
        }
예제 #8
0
        /// <inheritdoc />
        public override BigQueryTable PatchTable(TableReference tableReference, Table resource, PatchTableOptions options = null)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            GaxPreconditions.CheckNotNull(resource, nameof(resource));
            var request = Service.Tables.Patch(resource, tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);

            request.ModifyRequest += _versionHeaderAction;
            options?.ModifyRequest(request);
            return(new BigQueryTable(this, request.Execute()));
        }
        private PatchRequest CreatePatchTableRequest(TableReference tableReference, Table resource, PatchTableOptions options)
        {
            GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
            GaxPreconditions.CheckNotNull(resource, nameof(resource));
            var request = Service.Tables.Patch(resource, tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);

            request.ModifyRequest += _versionHeaderAction;
            options?.ModifyRequest(request);
            RetryIfETagPresent(request, resource);
            return(request);
        }
        /// <inheritdoc />
        public override async Task <BigQueryTable> PatchTableAsync(TableReference tableReference, Table resource, PatchTableOptions options = null, CancellationToken cancellationToken = default)
        {
            var request = CreatePatchTableRequest(tableReference, resource, options);

            return(new BigQueryTable(this, await request.ExecuteAsync(cancellationToken).ConfigureAwait(false)));
        }
        /// <inheritdoc />
        public override BigQueryTable PatchTable(TableReference tableReference, Table resource, PatchTableOptions options = null)
        {
            var request = CreatePatchTableRequest(tableReference, resource, options);

            return(new BigQueryTable(this, request.Execute()));
        }