Class DataSourcesServiceClient (0.4.0)

GitHub RepositoryProduct Reference

Service Description: Service to manage primary, supplemental, inventory and other data sources. See more in the Merchant Center help article.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   DataSourceName name = DataSourceName.of("[ACCOUNT]", "[DATASOURCE]");
   DataSource response = dataSourcesServiceClient.getDataSource(name);
 }
 

Note: close() needs to be called on the DataSourcesServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

GetDataSource

Retrieves the data source configuration for the given account.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getDataSource(GetDataSourceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getDataSource(DataSourceName name)

  • getDataSource(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getDataSourceCallable()

ListDataSources

Lists the configurations for data sources for the given account.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listDataSources(ListDataSourcesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listDataSources(AccountName parent)

  • listDataSources(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listDataSourcesPagedCallable()

  • listDataSourcesCallable()

CreateDataSource

Creates the new data source configuration for the given account.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createDataSource(CreateDataSourceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createDataSource(AccountName parent, DataSource dataSource)

  • createDataSource(String parent, DataSource dataSource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createDataSourceCallable()

UpdateDataSource

Updates the existing data source configuration. The fields that are set in the update mask but not provided in the resource will be deleted.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateDataSource(UpdateDataSourceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateDataSource(DataSource dataSource, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateDataSourceCallable()

DeleteDataSource

Deletes a data source from your Merchant Center account.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteDataSource(DeleteDataSourceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteDataSource(DataSourceName name)

  • deleteDataSource(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteDataSourceCallable()

FetchDataSource

Performs the data fetch immediately (even outside fetch schedule) on a data source from your Merchant Center Account. If you need to call this method more than once per day, you should use the Products service to update your product data instead. This method only works on data sources with a file input set.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • fetchDataSource(FetchDataSourceRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • fetchDataSourceCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of DataSourcesServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DataSourcesServiceSettings dataSourcesServiceSettings =
     DataSourcesServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DataSourcesServiceClient dataSourcesServiceClient =
     DataSourcesServiceClient.create(dataSourcesServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DataSourcesServiceSettings dataSourcesServiceSettings =
     DataSourcesServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 DataSourcesServiceClient dataSourcesServiceClient =
     DataSourcesServiceClient.create(dataSourcesServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 DataSourcesServiceSettings dataSourcesServiceSettings =
     DataSourcesServiceSettings.newHttpJsonBuilder().build();
 DataSourcesServiceClient dataSourcesServiceClient =
     DataSourcesServiceClient.create(dataSourcesServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > DataSourcesServiceClient

Static Methods

create()

public static final DataSourcesServiceClient create()

Constructs an instance of DataSourcesServiceClient with default settings.

Returns
Type Description
DataSourcesServiceClient
Exceptions
Type Description
IOException

create(DataSourcesServiceSettings settings)

public static final DataSourcesServiceClient create(DataSourcesServiceSettings settings)

Constructs an instance of DataSourcesServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings DataSourcesServiceSettings
Returns
Type Description
DataSourcesServiceClient
Exceptions
Type Description
IOException

create(DataSourcesServiceStub stub)

public static final DataSourcesServiceClient create(DataSourcesServiceStub stub)

Constructs an instance of DataSourcesServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataSourcesServiceSettings).

Parameter
Name Description
stub DataSourcesServiceStub
Returns
Type Description
DataSourcesServiceClient

Constructors

DataSourcesServiceClient(DataSourcesServiceSettings settings)

protected DataSourcesServiceClient(DataSourcesServiceSettings settings)

Constructs an instance of DataSourcesServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings DataSourcesServiceSettings

DataSourcesServiceClient(DataSourcesServiceStub stub)

protected DataSourcesServiceClient(DataSourcesServiceStub stub)
Parameter
Name Description
stub DataSourcesServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createDataSource(AccountName parent, DataSource dataSource)

public final DataSource createDataSource(AccountName parent, DataSource dataSource)

Creates the new data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   AccountName parent = AccountName.of("[ACCOUNT]");
   DataSource dataSource = DataSource.newBuilder().build();
   DataSource response = dataSourcesServiceClient.createDataSource(parent, dataSource);
 }
 
Parameters
Name Description
parent AccountName

Required. The account where this data source will be created. Format: accounts/{account}

dataSource DataSource

Required. The data source to create.

Returns
Type Description
DataSource

createDataSource(CreateDataSourceRequest request)

public final DataSource createDataSource(CreateDataSourceRequest request)

Creates the new data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   CreateDataSourceRequest request =
       CreateDataSourceRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setDataSource(DataSource.newBuilder().build())
           .build();
   DataSource response = dataSourcesServiceClient.createDataSource(request);
 }
 
Parameter
Name Description
request CreateDataSourceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataSource

createDataSource(String parent, DataSource dataSource)

public final DataSource createDataSource(String parent, DataSource dataSource)

Creates the new data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   String parent = AccountName.of("[ACCOUNT]").toString();
   DataSource dataSource = DataSource.newBuilder().build();
   DataSource response = dataSourcesServiceClient.createDataSource(parent, dataSource);
 }
 
Parameters
Name Description
parent String

Required. The account where this data source will be created. Format: accounts/{account}

dataSource DataSource

Required. The data source to create.

Returns
Type Description
DataSource

createDataSourceCallable()

public final UnaryCallable<CreateDataSourceRequest,DataSource> createDataSourceCallable()

Creates the new data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   CreateDataSourceRequest request =
       CreateDataSourceRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setDataSource(DataSource.newBuilder().build())
           .build();
   ApiFuture<DataSource> future =
       dataSourcesServiceClient.createDataSourceCallable().futureCall(request);
   // Do something.
   DataSource response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateDataSourceRequest,DataSource>

deleteDataSource(DataSourceName name)

public final void deleteDataSource(DataSourceName name)

Deletes a data source from your Merchant Center account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   DataSourceName name = DataSourceName.of("[ACCOUNT]", "[DATASOURCE]");
   dataSourcesServiceClient.deleteDataSource(name);
 }
 
Parameter
Name Description
name DataSourceName

Required. The name of the data source to delete. Format: accounts/{account}/dataSources/{datasource}

deleteDataSource(DeleteDataSourceRequest request)

public final void deleteDataSource(DeleteDataSourceRequest request)

Deletes a data source from your Merchant Center account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   DeleteDataSourceRequest request =
       DeleteDataSourceRequest.newBuilder()
           .setName(DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString())
           .build();
   dataSourcesServiceClient.deleteDataSource(request);
 }
 
Parameter
Name Description
request DeleteDataSourceRequest

The request object containing all of the parameters for the API call.

deleteDataSource(String name)

public final void deleteDataSource(String name)

Deletes a data source from your Merchant Center account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   String name = DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString();
   dataSourcesServiceClient.deleteDataSource(name);
 }
 
Parameter
Name Description
name String

Required. The name of the data source to delete. Format: accounts/{account}/dataSources/{datasource}

deleteDataSourceCallable()

public final UnaryCallable<DeleteDataSourceRequest,Empty> deleteDataSourceCallable()

Deletes a data source from your Merchant Center account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   DeleteDataSourceRequest request =
       DeleteDataSourceRequest.newBuilder()
           .setName(DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString())
           .build();
   ApiFuture<Empty> future =
       dataSourcesServiceClient.deleteDataSourceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteDataSourceRequest,Empty>

fetchDataSource(FetchDataSourceRequest request)

public final void fetchDataSource(FetchDataSourceRequest request)

Performs the data fetch immediately (even outside fetch schedule) on a data source from your Merchant Center Account. If you need to call this method more than once per day, you should use the Products service to update your product data instead. This method only works on data sources with a file input set.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   FetchDataSourceRequest request =
       FetchDataSourceRequest.newBuilder()
           .setName(DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString())
           .build();
   dataSourcesServiceClient.fetchDataSource(request);
 }
 
Parameter
Name Description
request FetchDataSourceRequest

The request object containing all of the parameters for the API call.

fetchDataSourceCallable()

public final UnaryCallable<FetchDataSourceRequest,Empty> fetchDataSourceCallable()

Performs the data fetch immediately (even outside fetch schedule) on a data source from your Merchant Center Account. If you need to call this method more than once per day, you should use the Products service to update your product data instead. This method only works on data sources with a file input set.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   FetchDataSourceRequest request =
       FetchDataSourceRequest.newBuilder()
           .setName(DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString())
           .build();
   ApiFuture<Empty> future =
       dataSourcesServiceClient.fetchDataSourceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<FetchDataSourceRequest,Empty>

getDataSource(DataSourceName name)

public final DataSource getDataSource(DataSourceName name)

Retrieves the data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   DataSourceName name = DataSourceName.of("[ACCOUNT]", "[DATASOURCE]");
   DataSource response = dataSourcesServiceClient.getDataSource(name);
 }
 
Parameter
Name Description
name DataSourceName

Required. The name of the data source to retrieve. Format: accounts/{account}/dataSources/{datasource}

Returns
Type Description
DataSource

getDataSource(GetDataSourceRequest request)

public final DataSource getDataSource(GetDataSourceRequest request)

Retrieves the data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   GetDataSourceRequest request =
       GetDataSourceRequest.newBuilder()
           .setName(DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString())
           .build();
   DataSource response = dataSourcesServiceClient.getDataSource(request);
 }
 
Parameter
Name Description
request GetDataSourceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataSource

getDataSource(String name)

public final DataSource getDataSource(String name)

Retrieves the data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   String name = DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString();
   DataSource response = dataSourcesServiceClient.getDataSource(name);
 }
 
Parameter
Name Description
name String

Required. The name of the data source to retrieve. Format: accounts/{account}/dataSources/{datasource}

Returns
Type Description
DataSource

getDataSourceCallable()

public final UnaryCallable<GetDataSourceRequest,DataSource> getDataSourceCallable()

Retrieves the data source configuration for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   GetDataSourceRequest request =
       GetDataSourceRequest.newBuilder()
           .setName(DataSourceName.of("[ACCOUNT]", "[DATASOURCE]").toString())
           .build();
   ApiFuture<DataSource> future =
       dataSourcesServiceClient.getDataSourceCallable().futureCall(request);
   // Do something.
   DataSource response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetDataSourceRequest,DataSource>

getSettings()

public final DataSourcesServiceSettings getSettings()
Returns
Type Description
DataSourcesServiceSettings

getStub()

public DataSourcesServiceStub getStub()
Returns
Type Description
DataSourcesServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listDataSources(AccountName parent)

public final DataSourcesServiceClient.ListDataSourcesPagedResponse listDataSources(AccountName parent)

Lists the configurations for data sources for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   AccountName parent = AccountName.of("[ACCOUNT]");
   for (DataSource element : dataSourcesServiceClient.listDataSources(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent AccountName

Required. The account to list data sources for. Format: accounts/{account}

Returns
Type Description
DataSourcesServiceClient.ListDataSourcesPagedResponse

listDataSources(ListDataSourcesRequest request)

public final DataSourcesServiceClient.ListDataSourcesPagedResponse listDataSources(ListDataSourcesRequest request)

Lists the configurations for data sources for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   ListDataSourcesRequest request =
       ListDataSourcesRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (DataSource element : dataSourcesServiceClient.listDataSources(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListDataSourcesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataSourcesServiceClient.ListDataSourcesPagedResponse

listDataSources(String parent)

public final DataSourcesServiceClient.ListDataSourcesPagedResponse listDataSources(String parent)

Lists the configurations for data sources for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   String parent = AccountName.of("[ACCOUNT]").toString();
   for (DataSource element : dataSourcesServiceClient.listDataSources(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The account to list data sources for. Format: accounts/{account}

Returns
Type Description
DataSourcesServiceClient.ListDataSourcesPagedResponse

listDataSourcesCallable()

public final UnaryCallable<ListDataSourcesRequest,ListDataSourcesResponse> listDataSourcesCallable()

Lists the configurations for data sources for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   ListDataSourcesRequest request =
       ListDataSourcesRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListDataSourcesResponse response =
         dataSourcesServiceClient.listDataSourcesCallable().call(request);
     for (DataSource element : response.getDataSourcesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListDataSourcesRequest,ListDataSourcesResponse>

listDataSourcesPagedCallable()

public final UnaryCallable<ListDataSourcesRequest,DataSourcesServiceClient.ListDataSourcesPagedResponse> listDataSourcesPagedCallable()

Lists the configurations for data sources for the given account.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   ListDataSourcesRequest request =
       ListDataSourcesRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<DataSource> future =
       dataSourcesServiceClient.listDataSourcesPagedCallable().futureCall(request);
   // Do something.
   for (DataSource element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListDataSourcesRequest,ListDataSourcesPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateDataSource(DataSource dataSource, FieldMask updateMask)

public final DataSource updateDataSource(DataSource dataSource, FieldMask updateMask)

Updates the existing data source configuration. The fields that are set in the update mask but not provided in the resource will be deleted.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   DataSource dataSource = DataSource.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   DataSource response = dataSourcesServiceClient.updateDataSource(dataSource, updateMask);
 }
 
Parameters
Name Description
dataSource DataSource

Required. The data source resource to update.

updateMask FieldMask

Required. The list of data source fields to be updated.

Fields specified in the update mask without a value specified in the body will be deleted from the data source.

Providing special "*" value for full data source replacement is not supported.

Returns
Type Description
DataSource

updateDataSource(UpdateDataSourceRequest request)

public final DataSource updateDataSource(UpdateDataSourceRequest request)

Updates the existing data source configuration. The fields that are set in the update mask but not provided in the resource will be deleted.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   UpdateDataSourceRequest request =
       UpdateDataSourceRequest.newBuilder()
           .setDataSource(DataSource.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   DataSource response = dataSourcesServiceClient.updateDataSource(request);
 }
 
Parameter
Name Description
request UpdateDataSourceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataSource

updateDataSourceCallable()

public final UnaryCallable<UpdateDataSourceRequest,DataSource> updateDataSourceCallable()

Updates the existing data source configuration. The fields that are set in the update mask but not provided in the resource will be deleted.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (DataSourcesServiceClient dataSourcesServiceClient = DataSourcesServiceClient.create()) {
   UpdateDataSourceRequest request =
       UpdateDataSourceRequest.newBuilder()
           .setDataSource(DataSource.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<DataSource> future =
       dataSourcesServiceClient.updateDataSourceCallable().futureCall(request);
   // Do something.
   DataSource response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateDataSourceRequest,DataSource>