Class DocumentSchemaServiceClient
- java.lang.Object
-
- com.google.cloud.contentwarehouse.v1.DocumentSchemaServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class DocumentSchemaServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: This service lets you manage document schema.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); DocumentSchema documentSchema = DocumentSchema.newBuilder().build(); DocumentSchema response = documentSchemaServiceClient.createDocumentSchema(parent, documentSchema); }
Note: close() needs to be called on the DocumentSchemaServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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 DocumentSchemaServiceSettings 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 DocumentSchemaServiceSettings documentSchemaServiceSettings = DocumentSchemaServiceSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create(documentSchemaServiceSettings);
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 DocumentSchemaServiceSettings documentSchemaServiceSettings = DocumentSchemaServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create(documentSchemaServiceSettings);
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 DocumentSchemaServiceSettings documentSchemaServiceSettings = DocumentSchemaServiceSettings.newHttpJsonBuilder().build(); DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create(documentSchemaServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DocumentSchemaServiceClient.ListDocumentSchemasFixedSizeCollection
static class
DocumentSchemaServiceClient.ListDocumentSchemasPage
static class
DocumentSchemaServiceClient.ListDocumentSchemasPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
DocumentSchemaServiceClient(DocumentSchemaServiceSettings settings)
Constructs an instance of DocumentSchemaServiceClient, using the given settings.protected
DocumentSchemaServiceClient(DocumentSchemaServiceStub stub)
-
Method Summary
-
-
-
Constructor Detail
-
DocumentSchemaServiceClient
protected DocumentSchemaServiceClient(DocumentSchemaServiceSettings settings) throws IOException
Constructs an instance of DocumentSchemaServiceClient, 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.- Throws:
IOException
-
DocumentSchemaServiceClient
protected DocumentSchemaServiceClient(DocumentSchemaServiceStub stub)
-
-
Method Detail
-
create
public static final DocumentSchemaServiceClient create() throws IOException
Constructs an instance of DocumentSchemaServiceClient with default settings.- Throws:
IOException
-
create
public static final DocumentSchemaServiceClient create(DocumentSchemaServiceSettings settings) throws IOException
Constructs an instance of DocumentSchemaServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
public static final DocumentSchemaServiceClient create(DocumentSchemaServiceStub stub)
Constructs an instance of DocumentSchemaServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DocumentSchemaServiceSettings).
-
getSettings
public final DocumentSchemaServiceSettings getSettings()
-
getStub
public DocumentSchemaServiceStub getStub()
-
createDocumentSchema
public final DocumentSchema createDocumentSchema(LocationName parent, DocumentSchema documentSchema)
Creates a document schema.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); DocumentSchema documentSchema = DocumentSchema.newBuilder().build(); DocumentSchema response = documentSchemaServiceClient.createDocumentSchema(parent, documentSchema); }
- Parameters:
parent
- Required. The parent name.documentSchema
- Required. The document schema to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createDocumentSchema
public final DocumentSchema createDocumentSchema(String parent, DocumentSchema documentSchema)
Creates a document schema.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); DocumentSchema documentSchema = DocumentSchema.newBuilder().build(); DocumentSchema response = documentSchemaServiceClient.createDocumentSchema(parent, documentSchema); }
- Parameters:
parent
- Required. The parent name.documentSchema
- Required. The document schema to create.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createDocumentSchema
public final DocumentSchema createDocumentSchema(CreateDocumentSchemaRequest request)
Creates a document schema.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { CreateDocumentSchemaRequest request = CreateDocumentSchemaRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setDocumentSchema(DocumentSchema.newBuilder().build()) .build(); DocumentSchema response = documentSchemaServiceClient.createDocumentSchema(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createDocumentSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateDocumentSchemaRequest,DocumentSchema> createDocumentSchemaCallable()
Creates a document schema.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { CreateDocumentSchemaRequest request = CreateDocumentSchemaRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setDocumentSchema(DocumentSchema.newBuilder().build()) .build(); ApiFuture<DocumentSchema> future = documentSchemaServiceClient.createDocumentSchemaCallable().futureCall(request); // Do something. DocumentSchema response = future.get(); }
-
updateDocumentSchema
public final DocumentSchema updateDocumentSchema(DocumentSchemaName name, DocumentSchema documentSchema)
Updates a Document Schema. Returns INVALID_ARGUMENT if the name of the Document Schema is non-empty and does not equal the existing name. Supports only appending new properties, adding new ENUM possible values, and updating the [EnumTypeOptions.validation_check_disabled][google.cloud.contentwarehouse.v1.EnumTypeOptions.validation_check_disabled] flag for ENUM possible values. Updating existing properties will result into INVALID_ARGUMENT.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { DocumentSchemaName name = DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]"); DocumentSchema documentSchema = DocumentSchema.newBuilder().build(); DocumentSchema response = documentSchemaServiceClient.updateDocumentSchema(name, documentSchema); }
- Parameters:
name
- Required. The name of the document schema to update. Format: projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}.documentSchema
- Required. The document schema to update with.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateDocumentSchema
public final DocumentSchema updateDocumentSchema(String name, DocumentSchema documentSchema)
Updates a Document Schema. Returns INVALID_ARGUMENT if the name of the Document Schema is non-empty and does not equal the existing name. Supports only appending new properties, adding new ENUM possible values, and updating the [EnumTypeOptions.validation_check_disabled][google.cloud.contentwarehouse.v1.EnumTypeOptions.validation_check_disabled] flag for ENUM possible values. Updating existing properties will result into INVALID_ARGUMENT.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { String name = DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString(); DocumentSchema documentSchema = DocumentSchema.newBuilder().build(); DocumentSchema response = documentSchemaServiceClient.updateDocumentSchema(name, documentSchema); }
- Parameters:
name
- Required. The name of the document schema to update. Format: projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}.documentSchema
- Required. The document schema to update with.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateDocumentSchema
public final DocumentSchema updateDocumentSchema(UpdateDocumentSchemaRequest request)
Updates a Document Schema. Returns INVALID_ARGUMENT if the name of the Document Schema is non-empty and does not equal the existing name. Supports only appending new properties, adding new ENUM possible values, and updating the [EnumTypeOptions.validation_check_disabled][google.cloud.contentwarehouse.v1.EnumTypeOptions.validation_check_disabled] flag for ENUM possible values. Updating existing properties will result into INVALID_ARGUMENT.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { UpdateDocumentSchemaRequest request = UpdateDocumentSchemaRequest.newBuilder() .setName( DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString()) .setDocumentSchema(DocumentSchema.newBuilder().build()) .build(); DocumentSchema response = documentSchemaServiceClient.updateDocumentSchema(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateDocumentSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateDocumentSchemaRequest,DocumentSchema> updateDocumentSchemaCallable()
Updates a Document Schema. Returns INVALID_ARGUMENT if the name of the Document Schema is non-empty and does not equal the existing name. Supports only appending new properties, adding new ENUM possible values, and updating the [EnumTypeOptions.validation_check_disabled][google.cloud.contentwarehouse.v1.EnumTypeOptions.validation_check_disabled] flag for ENUM possible values. Updating existing properties will result into INVALID_ARGUMENT.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { UpdateDocumentSchemaRequest request = UpdateDocumentSchemaRequest.newBuilder() .setName( DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString()) .setDocumentSchema(DocumentSchema.newBuilder().build()) .build(); ApiFuture<DocumentSchema> future = documentSchemaServiceClient.updateDocumentSchemaCallable().futureCall(request); // Do something. DocumentSchema response = future.get(); }
-
getDocumentSchema
public final DocumentSchema getDocumentSchema(DocumentSchemaName name)
Gets a document schema. Returns NOT_FOUND if the document schema does not exist.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { DocumentSchemaName name = DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]"); DocumentSchema response = documentSchemaServiceClient.getDocumentSchema(name); }
- Parameters:
name
- Required. The name of the document schema to retrieve.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getDocumentSchema
public final DocumentSchema getDocumentSchema(String name)
Gets a document schema. Returns NOT_FOUND if the document schema does not exist.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { String name = DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString(); DocumentSchema response = documentSchemaServiceClient.getDocumentSchema(name); }
- Parameters:
name
- Required. The name of the document schema to retrieve.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getDocumentSchema
public final DocumentSchema getDocumentSchema(GetDocumentSchemaRequest request)
Gets a document schema. Returns NOT_FOUND if the document schema does not exist.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { GetDocumentSchemaRequest request = GetDocumentSchemaRequest.newBuilder() .setName( DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString()) .build(); DocumentSchema response = documentSchemaServiceClient.getDocumentSchema(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getDocumentSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<GetDocumentSchemaRequest,DocumentSchema> getDocumentSchemaCallable()
Gets a document schema. Returns NOT_FOUND if the document schema does not exist.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { GetDocumentSchemaRequest request = GetDocumentSchemaRequest.newBuilder() .setName( DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString()) .build(); ApiFuture<DocumentSchema> future = documentSchemaServiceClient.getDocumentSchemaCallable().futureCall(request); // Do something. DocumentSchema response = future.get(); }
-
deleteDocumentSchema
public final void deleteDocumentSchema(DocumentSchemaName name)
Deletes a document schema. Returns NOT_FOUND if the document schema does not exist. Returns BAD_REQUEST if the document schema has documents depending on it.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { DocumentSchemaName name = DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]"); documentSchemaServiceClient.deleteDocumentSchema(name); }
- Parameters:
name
- Required. The name of the document schema to delete.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteDocumentSchema
public final void deleteDocumentSchema(String name)
Deletes a document schema. Returns NOT_FOUND if the document schema does not exist. Returns BAD_REQUEST if the document schema has documents depending on it.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { String name = DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString(); documentSchemaServiceClient.deleteDocumentSchema(name); }
- Parameters:
name
- Required. The name of the document schema to delete.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteDocumentSchema
public final void deleteDocumentSchema(DeleteDocumentSchemaRequest request)
Deletes a document schema. Returns NOT_FOUND if the document schema does not exist. Returns BAD_REQUEST if the document schema has documents depending on it.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { DeleteDocumentSchemaRequest request = DeleteDocumentSchemaRequest.newBuilder() .setName( DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString()) .build(); documentSchemaServiceClient.deleteDocumentSchema(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteDocumentSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteDocumentSchemaRequest,com.google.protobuf.Empty> deleteDocumentSchemaCallable()
Deletes a document schema. Returns NOT_FOUND if the document schema does not exist. Returns BAD_REQUEST if the document schema has documents depending on it.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { DeleteDocumentSchemaRequest request = DeleteDocumentSchemaRequest.newBuilder() .setName( DocumentSchemaName.of("[PROJECT]", "[LOCATION]", "[DOCUMENT_SCHEMA]").toString()) .build(); ApiFuture<Empty> future = documentSchemaServiceClient.deleteDocumentSchemaCallable().futureCall(request); // Do something. future.get(); }
-
listDocumentSchemas
public final DocumentSchemaServiceClient.ListDocumentSchemasPagedResponse listDocumentSchemas(LocationName parent)
Lists document schemas.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (DocumentSchema element : documentSchemaServiceClient.listDocumentSchemas(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent, which owns this collection of document schemas. Format: projects/{project_number}/locations/{location}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listDocumentSchemas
public final DocumentSchemaServiceClient.ListDocumentSchemasPagedResponse listDocumentSchemas(String parent)
Lists document schemas.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (DocumentSchema element : documentSchemaServiceClient.listDocumentSchemas(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The parent, which owns this collection of document schemas. Format: projects/{project_number}/locations/{location}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listDocumentSchemas
public final DocumentSchemaServiceClient.ListDocumentSchemasPagedResponse listDocumentSchemas(ListDocumentSchemasRequest request)
Lists document schemas.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { ListDocumentSchemasRequest request = ListDocumentSchemasRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (DocumentSchema element : documentSchemaServiceClient.listDocumentSchemas(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listDocumentSchemasPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListDocumentSchemasRequest,DocumentSchemaServiceClient.ListDocumentSchemasPagedResponse> listDocumentSchemasPagedCallable()
Lists document schemas.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { ListDocumentSchemasRequest request = ListDocumentSchemasRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<DocumentSchema> future = documentSchemaServiceClient.listDocumentSchemasPagedCallable().futureCall(request); // Do something. for (DocumentSchema element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listDocumentSchemasCallable
public final com.google.api.gax.rpc.UnaryCallable<ListDocumentSchemasRequest,ListDocumentSchemasResponse> listDocumentSchemasCallable()
Lists document schemas.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 (DocumentSchemaServiceClient documentSchemaServiceClient = DocumentSchemaServiceClient.create()) { ListDocumentSchemasRequest request = ListDocumentSchemasRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListDocumentSchemasResponse response = documentSchemaServiceClient.listDocumentSchemasCallable().call(request); for (DocumentSchema element : response.getDocumentSchemasList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-