示例#1
0
        /// <inheritdoc />
        public override BigqueryDataset CreateDataset(DatasetReference datasetReference, CreateDatasetOptions options = null)
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            var dataset = new Dataset {
                DatasetReference = datasetReference
            };
            var request = Service.Datasets.Insert(dataset, datasetReference.ProjectId);

            options?.ModifyRequest(dataset, request);
            return(new BigqueryDataset(this, request.Execute()));
        }
示例#2
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));
     }
 }
示例#3
0
        /// <inheritdoc />
        public override async Task <BigqueryDataset> CreateDatasetAsync(DatasetReference datasetReference, CreateDatasetOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            var dataset = new Dataset {
                DatasetReference = datasetReference
            };
            var request = Service.Datasets.Insert(dataset, datasetReference.ProjectId);

            options?.ModifyRequest(dataset, request);
            return(new BigqueryDataset(this, await request.ExecuteAsync(cancellationToken).ConfigureAwait(false)));
        }
示例#4
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));;
     }
 }
 /// <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>
 /// Creates a dataset with the specified ID in this client's project.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="CreateDataset(DatasetReference,CreateDatasetOptions)"/>.
 /// </summary>
 /// <param name="datasetId">The new 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 created dataset.</returns>
 public virtual BigqueryDataset CreateDataset(string datasetId, CreateDatasetOptions options = null) =>
 CreateDataset(GetDatasetReference(datasetId), options);
 /// <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 creates a dataset with the specified ID in this client's project.
 /// This method just creates a <see cref="DatasetReference"/> and delegates to <see cref="CreateDatasetAsync(DatasetReference,CreateDatasetOptions,CancellationToken)"/>.
 /// </summary>
 /// <param name="datasetId">The new 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 created dataset.</returns>
 public virtual Task <BigqueryDataset> CreateDatasetAsync(string datasetId,
                                                          CreateDatasetOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 CreateDatasetAsync(GetDatasetReference(datasetId), options, cancellationToken);
 /// <summary>
 /// 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>
 /// <returns>The existing or new dataset.</returns>
 public virtual BigqueryDataset GetOrCreateDataset(DatasetReference datasetReference, GetDatasetOptions getOptions = null, CreateDatasetOptions createOptions = null)
 {
     throw new NotImplementedException();
 }
 /// <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);
 /// <summary>
 /// Creates the specified 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 created dataset.</returns>
 public virtual BigqueryDataset CreateDataset(DatasetReference datasetReference, CreateDatasetOptions options = null)
 {
     throw new NotImplementedException();
 }