Exemplo n.º 1
0
 /// <summary>
 /// Updates this dataset to match the specified resource.
 /// </summary>
 /// <remarks>
 /// This method delegates to <see cref="BigQueryClient.UpdateDataset(DatasetReference, Dataset, UpdateDatasetOptions)"/>.
 /// A simple way of updating the dataset 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 dataset 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 dataset. 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 dataset.
 /// </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 dataset.</returns>
 public BigQueryDataset Update(Dataset resource = null, UpdateDatasetOptions options = null) =>
 _client.UpdateDataset(Reference, resource ?? Resource, options);
Exemplo n.º 2
0
 /// <summary>
 /// Asynchronously updates this dataset to match the specified resource.
 /// </summary>
 /// <remarks>
 /// This method delegates to <see cref="BigQueryClient.UpdateDatasetAsync(DatasetReference, Dataset, UpdateDatasetOptions, CancellationToken)"/>.
 /// A simple way of updating the dataset 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 dataset 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 dataset. 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 dataset.
 /// </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 dataset.</returns>
 public Task <BigQueryDataset> UpdateAsync(Dataset resource = null, UpdateDatasetOptions options = null, CancellationToken cancellationToken = default) =>
 _client.UpdateDatasetAsync(Reference, resource ?? Resource, options, cancellationToken);
        /// <inheritdoc />
        public override BigQueryDataset UpdateDataset(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options = null)
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            GaxPreconditions.CheckNotNull(resource, nameof(resource));
            var request = Service.Datasets.Update(resource, datasetReference.ProjectId, datasetReference.DatasetId);

            request.ModifyRequest += _versionHeaderAction;
            options?.ModifyRequest(request);
            return(new BigQueryDataset(this, request.Execute()));
        }
        /// <inheritdoc />
        public override async Task <BigQueryDataset> UpdateDatasetAsync(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            GaxPreconditions.CheckNotNull(resource, nameof(resource));
            var request = Service.Datasets.Update(resource, datasetReference.ProjectId, datasetReference.DatasetId);

            request.ModifyRequest += _versionHeaderAction;
            options?.ModifyRequest(request);
            return(new BigQueryDataset(this, await request.ExecuteAsync(cancellationToken).ConfigureAwait(false)));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Asynchronously updates the specified dataset to match the specified resource.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="UpdateDatasetAsync(DatasetReference, Dataset, UpdateDatasetOptions, 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="resource">The dataset resource representation to use for the update. All updatable fields 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 dataset.</returns>
 public virtual Task <BigQueryDataset> UpdateDatasetAsync(string projectId, string datasetId, Dataset resource, UpdateDatasetOptions options = null, CancellationToken cancellationToken = default) =>
 UpdateDatasetAsync(GetDatasetReference(projectId, datasetId), resource, options, cancellationToken);
Exemplo n.º 6
0
 /// <summary>
 /// Asynchronously updates the specified dataset to match the specified resource.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="datasetReference">A fully-qualified identifier for the dataset. Must not be null.</param>
 /// <param name="resource">The dataset resource representation to use for the update. All updatable fields 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 dataset.</returns>
 public virtual Task <BigQueryDataset> UpdateDatasetAsync(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options = null, CancellationToken cancellationToken = default) =>
 throw new NotImplementedException();
Exemplo n.º 7
0
 /// <summary>
 /// Updates the specified dataset to match the specified resource.
 /// </summary>
 /// <remarks>
 /// If the resource contains an ETag, it is used for optimistic concurrency validation.
 /// </remarks>
 /// <param name="datasetReference">A fully-qualified identifier for the dataset. Must not be null.</param>
 /// <param name="resource">The dataset resource representation to use for the update. All updatable fields 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 dataset.</returns>
 public virtual BigQueryDataset UpdateDataset(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options = null) =>
 throw new NotImplementedException();
Exemplo n.º 8
0
 /// <summary>
 /// Updates the specified dataset to match the specified resource.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="UpdateDataset(DatasetReference, Dataset, UpdateDatasetOptions)"/>.
 /// </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="resource">The dataset resource representation to use for the update. All updatable fields 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 dataset.</returns>
 public virtual BigQueryDataset UpdateDataset(string projectId, string datasetId, Dataset resource, UpdateDatasetOptions options = null) =>
 UpdateDataset(GetDatasetReference(projectId, datasetId), resource, options);
        private UpdateRequest CreateUpdateDatasetRequest(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options)
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            GaxPreconditions.CheckNotNull(resource, nameof(resource));
            var request = Service.Datasets.Update(resource, datasetReference.ProjectId, datasetReference.DatasetId);

            options?.ModifyRequest(request);
            RetryIfETagPresent(request, resource);
            return(request);
        }
        /// <inheritdoc />
        public override async Task <BigQueryDataset> UpdateDatasetAsync(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options = null, CancellationToken cancellationToken = default)
        {
            var request = CreateUpdateDatasetRequest(datasetReference, resource, options);

            return(new BigQueryDataset(this, await request.ExecuteAsync(cancellationToken).ConfigureAwait(false)));
        }
        /// <inheritdoc />
        public override BigQueryDataset UpdateDataset(DatasetReference datasetReference, Dataset resource, UpdateDatasetOptions options = null)
        {
            var request = CreateUpdateDatasetRequest(datasetReference, resource, options);

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