Class SpacesServiceClient (0.11.0)

GitHub RepositoryProduct Reference

Service Description: REST API for services dealing with spaces.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   Space space = Space.newBuilder().build();
   Space response = spacesServiceClient.createSpace(space);
 }
 

Note: close() needs to be called on the SpacesServiceClient 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

CreateSpace

Developer Preview. Creates a space.

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

  • createSpace(CreateSpaceRequest request)

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

  • createSpace(Space space)

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

  • createSpaceCallable()

GetSpace

Developer Preview. Gets a space by space_id or meeting_code.

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

  • getSpace(GetSpaceRequest request)

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

  • getSpace(SpaceName name)

  • getSpace(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.

  • getSpaceCallable()

UpdateSpace

Developer Preview. Updates a space.

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

  • updateSpace(UpdateSpaceRequest request)

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

  • updateSpace(Space space, 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.

  • updateSpaceCallable()

EndActiveConference

Developer Preview. Ends an active conference (if there is one).

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

  • endActiveConference(EndActiveConferenceRequest request)

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

  • endActiveConference(SpaceName name)

  • endActiveConference(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.

  • endActiveConferenceCallable()

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 SpacesServiceSettings 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
 SpacesServiceSettings spacesServiceSettings =
     SpacesServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 SpacesServiceClient spacesServiceClient = SpacesServiceClient.create(spacesServiceSettings);
 

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
 SpacesServiceSettings spacesServiceSettings =
     SpacesServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 SpacesServiceClient spacesServiceClient = SpacesServiceClient.create(spacesServiceSettings);
 

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
 SpacesServiceSettings spacesServiceSettings =
     SpacesServiceSettings.newHttpJsonBuilder().build();
 SpacesServiceClient spacesServiceClient = SpacesServiceClient.create(spacesServiceSettings);
 

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

Inheritance

java.lang.Object > SpacesServiceClient

Static Methods

create()

public static final SpacesServiceClient create()

Constructs an instance of SpacesServiceClient with default settings.

Returns
Type Description
SpacesServiceClient
Exceptions
Type Description
IOException

create(SpacesServiceSettings settings)

public static final SpacesServiceClient create(SpacesServiceSettings settings)

Constructs an instance of SpacesServiceClient, 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 SpacesServiceSettings
Returns
Type Description
SpacesServiceClient
Exceptions
Type Description
IOException

create(SpacesServiceStub stub)

public static final SpacesServiceClient create(SpacesServiceStub stub)

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

Parameter
Name Description
stub SpacesServiceStub
Returns
Type Description
SpacesServiceClient

Constructors

SpacesServiceClient(SpacesServiceSettings settings)

protected SpacesServiceClient(SpacesServiceSettings settings)

Constructs an instance of SpacesServiceClient, 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 SpacesServiceSettings

SpacesServiceClient(SpacesServiceStub stub)

protected SpacesServiceClient(SpacesServiceStub stub)
Parameter
Name Description
stub SpacesServiceStub

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()

createSpace(CreateSpaceRequest request)

public final Space createSpace(CreateSpaceRequest request)

Developer Preview. Creates a space.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   CreateSpaceRequest request =
       CreateSpaceRequest.newBuilder().setSpace(Space.newBuilder().build()).build();
   Space response = spacesServiceClient.createSpace(request);
 }
 
Parameter
Name Description
request CreateSpaceRequest

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

Returns
Type Description
Space

createSpace(Space space)

public final Space createSpace(Space space)

Developer Preview. Creates a space.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   Space space = Space.newBuilder().build();
   Space response = spacesServiceClient.createSpace(space);
 }
 
Parameter
Name Description
space Space

Space to be created. As of May 2023, the input space can be empty. Later on the input space can be non-empty when space configuration is introduced.

Returns
Type Description
Space

createSpaceCallable()

public final UnaryCallable<CreateSpaceRequest,Space> createSpaceCallable()

Developer Preview. Creates a space.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   CreateSpaceRequest request =
       CreateSpaceRequest.newBuilder().setSpace(Space.newBuilder().build()).build();
   ApiFuture<Space> future = spacesServiceClient.createSpaceCallable().futureCall(request);
   // Do something.
   Space response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateSpaceRequest,Space>

endActiveConference(EndActiveConferenceRequest request)

public final void endActiveConference(EndActiveConferenceRequest request)

Developer Preview. Ends an active conference (if there is one).

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   EndActiveConferenceRequest request =
       EndActiveConferenceRequest.newBuilder()
           .setName(SpaceName.of("[SPACE]").toString())
           .build();
   spacesServiceClient.endActiveConference(request);
 }
 
Parameter
Name Description
request EndActiveConferenceRequest

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

endActiveConference(SpaceName name)

public final void endActiveConference(SpaceName name)

Developer Preview. Ends an active conference (if there is one).

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   SpaceName name = SpaceName.of("[SPACE]");
   spacesServiceClient.endActiveConference(name);
 }
 
Parameter
Name Description
name SpaceName

Required. Resource name of the space.

endActiveConference(String name)

public final void endActiveConference(String name)

Developer Preview. Ends an active conference (if there is one).

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   String name = SpaceName.of("[SPACE]").toString();
   spacesServiceClient.endActiveConference(name);
 }
 
Parameter
Name Description
name String

Required. Resource name of the space.

endActiveConferenceCallable()

public final UnaryCallable<EndActiveConferenceRequest,Empty> endActiveConferenceCallable()

Developer Preview. Ends an active conference (if there is one).

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   EndActiveConferenceRequest request =
       EndActiveConferenceRequest.newBuilder()
           .setName(SpaceName.of("[SPACE]").toString())
           .build();
   ApiFuture<Empty> future =
       spacesServiceClient.endActiveConferenceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<EndActiveConferenceRequest,Empty>

getSettings()

public final SpacesServiceSettings getSettings()
Returns
Type Description
SpacesServiceSettings

getSpace(GetSpaceRequest request)

public final Space getSpace(GetSpaceRequest request)

Developer Preview. Gets a space by space_id or meeting_code.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   GetSpaceRequest request =
       GetSpaceRequest.newBuilder().setName(SpaceName.of("[SPACE]").toString()).build();
   Space response = spacesServiceClient.getSpace(request);
 }
 
Parameter
Name Description
request GetSpaceRequest

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

Returns
Type Description
Space

getSpace(SpaceName name)

public final Space getSpace(SpaceName name)

Developer Preview. Gets a space by space_id or meeting_code.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   SpaceName name = SpaceName.of("[SPACE]");
   Space response = spacesServiceClient.getSpace(name);
 }
 
Parameter
Name Description
name SpaceName

Required. Resource name of the space.

Returns
Type Description
Space

getSpace(String name)

public final Space getSpace(String name)

Developer Preview. Gets a space by space_id or meeting_code.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   String name = SpaceName.of("[SPACE]").toString();
   Space response = spacesServiceClient.getSpace(name);
 }
 
Parameter
Name Description
name String

Required. Resource name of the space.

Returns
Type Description
Space

getSpaceCallable()

public final UnaryCallable<GetSpaceRequest,Space> getSpaceCallable()

Developer Preview. Gets a space by space_id or meeting_code.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   GetSpaceRequest request =
       GetSpaceRequest.newBuilder().setName(SpaceName.of("[SPACE]").toString()).build();
   ApiFuture<Space> future = spacesServiceClient.getSpaceCallable().futureCall(request);
   // Do something.
   Space response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetSpaceRequest,Space>

getStub()

public SpacesServiceStub getStub()
Returns
Type Description
SpacesServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateSpace(Space space, FieldMask updateMask)

public final Space updateSpace(Space space, FieldMask updateMask)

Developer Preview. Updates a space.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   Space space = Space.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Space response = spacesServiceClient.updateSpace(space, updateMask);
 }
 
Parameters
Name Description
space Space

Required. Space to be updated.

updateMask FieldMask

Optional. Field mask used to specify the fields to be updated in the space. If update_mask isn't provided, it defaults to '*' and updates all fields provided in the request, including deleting fields not set in the request.

Returns
Type Description
Space

updateSpace(UpdateSpaceRequest request)

public final Space updateSpace(UpdateSpaceRequest request)

Developer Preview. Updates a space.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   UpdateSpaceRequest request =
       UpdateSpaceRequest.newBuilder()
           .setSpace(Space.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Space response = spacesServiceClient.updateSpace(request);
 }
 
Parameter
Name Description
request UpdateSpaceRequest

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

Returns
Type Description
Space

updateSpaceCallable()

public final UnaryCallable<UpdateSpaceRequest,Space> updateSpaceCallable()

Developer Preview. Updates a space.

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 (SpacesServiceClient spacesServiceClient = SpacesServiceClient.create()) {
   UpdateSpaceRequest request =
       UpdateSpaceRequest.newBuilder()
           .setSpace(Space.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Space> future = spacesServiceClient.updateSpaceCallable().futureCall(request);
   // Do something.
   Space response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateSpaceRequest,Space>