Пример #1
0
 /// <inheritdoc />
 public override BigqueryDataset GetOrCreateDataset(DatasetReference datasetReference, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null)
 {
     GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
     try
     {
         return(GetDataset(datasetReference, getOptions));
     }
     catch (GoogleApiException ex) when(ex.HttpStatusCode == HttpStatusCode.NotFound)
     {
         return(CreateDataset(datasetReference, createOptions));
     }
 }
Пример #2
0
 /// <inheritdoc />
 public override async Task <BigqueryDataset> GetOrCreateDatasetAsync(DatasetReference datasetReference, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
     try
     {
         return(await GetDatasetAsync(datasetReference, getOptions, cancellationToken).ConfigureAwait(false));
     }
     catch (GoogleApiException ex) when(ex.HttpStatusCode == HttpStatusCode.NotFound)
     {
         return(await CreateDatasetAsync(datasetReference, createOptions, cancellationToken).ConfigureAwait(false));;
     }
 }
Пример #3
0
        /// <inheritdoc />
        public override BigqueryDataset GetDataset(DatasetReference datasetReference, GetDatasetOptions options = null)
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            var request = Service.Datasets.Get(datasetReference.ProjectId, datasetReference.DatasetId);

            options?.ModifyRequest(request);
            return(new BigqueryDataset(this, request.Execute()));
        }
 /// <summary>
 /// Retrieves a dataset.
 /// </summary>
 /// <param name="datasetReference">A fully-qualified identifier for the dataset. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The requested dataset.</returns>
 public virtual BigqueryDataset GetDataset(DatasetReference datasetReference, GetDatasetOptions options = null)
 {
     throw new NotImplementedException();
 }
Пример #5
0
        /// <inheritdoc />
        public override async Task <BigqueryDataset> GetDatasetAsync(DatasetReference datasetReference, GetDatasetOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            var request = Service.Datasets.Get(datasetReference.ProjectId, datasetReference.DatasetId);

            options?.ModifyRequest(request);
            return(new BigqueryDataset(this, await request.ExecuteAsync(cancellationToken).ConfigureAwait(false)));
        }
 /// <summary>
 /// Retrieves a dataset given a project ID and dataset ID.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="GetDataset(DatasetReference,GetDatasetOptions)"/>.
 /// </summary>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The requested dataset.</returns>
 public virtual BigqueryDataset GetDataset(string projectId, string datasetId, GetDatasetOptions options = null) =>
 GetDataset(GetDatasetReference(projectId, datasetId), options);
 /// <summary>
 /// Asynchronously attempts to fetch the specified dataset, creating it if it doesn't exist.
 /// </summary>
 /// <param name="datasetReference">A fully-qualified identifier for the dataset. Must not be null.</param>
 /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="createOptions">The options for the "create" 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 existing or new dataset.</returns>
 public virtual Task <BigqueryDataset> GetOrCreateDatasetAsync(DatasetReference datasetReference, GetDatasetOptions getOptions = null,
                                                               CreateDatasetOptions createOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Asynchronously attempts to fetch the specified dataset within the given project, creating it if it doesn't exist.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="GetOrCreateDatasetAsync(DatasetReference,GetDatasetOptions,CreateDatasetOptions,CancellationToken)"/>.
 /// </summary>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>A task representing the asynchronous operation. When complete, the result is
 /// The existing or new dataset.</returns>
 public virtual Task <BigqueryDataset> GetOrCreateDatasetAsync(string projectId, string datasetId,
                                                               GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 GetOrCreateDatasetAsync(GetDatasetReference(projectId, datasetId), getOptions, createOptions, cancellationToken);
 /// <summary>
 /// Asynchronously retrieves a dataset within this client's project given the dataset ID.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="GetDatasetAsync(DatasetReference,GetDatasetOptions,CancellationToken)"/>.
 /// </summary>
 /// <param name="datasetId">The dataset ID. Must not be null.</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 requested dataset.</returns>
 public virtual Task <BigqueryDataset> GetDatasetAsync(string datasetId, GetDatasetOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 GetDatasetAsync(GetDatasetReference(datasetId), options, cancellationToken);
 /// <summary>
 /// Attempts to fetch the specified dataset within the given project, creating it if it doesn't exist.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="GetOrCreateDataset(DatasetReference,GetDatasetOptions,CreateDatasetOptions)"/>.
 /// </summary>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="datasetId">The dataset ID. Must not be null.</param>
 /// <param name="getOptions">The options for the "get" operation. May be null, in which case defaults will be supplied.</param>
 /// <param name="createOptions">The options for the "create" operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The existing or new dataset.</returns>
 public virtual BigqueryDataset GetOrCreateDataset(string projectId, string datasetId, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null) =>
 GetOrCreateDataset(GetDatasetReference(projectId, datasetId), getOptions, createOptions);