Class ServiceUsageClient (2.30.0)

GitHub RepositoryProduct Reference

Service Description: Service Usage API

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GetServiceRequest request = GetServiceRequest.newBuilder().setName("name3373707").build();
   Service response = serviceUsageClient.getService(request);
 }
 

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

  1. 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.
  2. 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.
  3. 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 ServiceUsageSettings 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
 ServiceUsageSettings serviceUsageSettings =
     ServiceUsageSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ServiceUsageClient serviceUsageClient = ServiceUsageClient.create(serviceUsageSettings);
 

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
 ServiceUsageSettings serviceUsageSettings =
     ServiceUsageSettings.newBuilder().setEndpoint(myEndpoint).build();
 ServiceUsageClient serviceUsageClient = ServiceUsageClient.create(serviceUsageSettings);
 

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
 ServiceUsageSettings serviceUsageSettings = ServiceUsageSettings.newHttpJsonBuilder().build();
 ServiceUsageClient serviceUsageClient = ServiceUsageClient.create(serviceUsageSettings);
 

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

Inheritance

java.lang.Object > ServiceUsageClient

Static Methods

create()

public static final ServiceUsageClient create()

Constructs an instance of ServiceUsageClient with default settings.

Returns
TypeDescription
ServiceUsageClient
Exceptions
TypeDescription
IOException

create(ServiceUsageSettings settings)

public static final ServiceUsageClient create(ServiceUsageSettings settings)

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

Parameter
NameDescription
settingsServiceUsageSettings
Returns
TypeDescription
ServiceUsageClient
Exceptions
TypeDescription
IOException

create(ServiceUsageStub stub)

public static final ServiceUsageClient create(ServiceUsageStub stub)

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

Parameter
NameDescription
stubServiceUsageStub
Returns
TypeDescription
ServiceUsageClient

Constructors

ServiceUsageClient(ServiceUsageSettings settings)

protected ServiceUsageClient(ServiceUsageSettings settings)

Constructs an instance of ServiceUsageClient, 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
NameDescription
settingsServiceUsageSettings

ServiceUsageClient(ServiceUsageStub stub)

protected ServiceUsageClient(ServiceUsageStub stub)
Parameter
NameDescription
stubServiceUsageStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

batchEnableServicesAsync(BatchEnableServicesRequest request) (deprecated)

public final OperationFuture<Empty,OperationMetadata> batchEnableServicesAsync(BatchEnableServicesRequest request)

Deprecated. This method is deprecated and will be removed in the next major version update.

Enables multiple services on a project. The operation is atomic: if enabling any service fails, then the entire batch fails, and no state changes occur.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   BatchEnableServicesRequest request =
       BatchEnableServicesRequest.newBuilder()
           .setParent("parent-995424086")
           .addAllServiceIds(new ArrayList<String>())
           .build();
   serviceUsageClient.batchEnableServicesAsync(request).get();
 }
 
Parameter
NameDescription
requestBatchEnableServicesRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

batchEnableServicesCallable() (deprecated)

public final UnaryCallable<BatchEnableServicesRequest,Operation> batchEnableServicesCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Enables multiple services on a project. The operation is atomic: if enabling any service fails, then the entire batch fails, and no state changes occur.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   BatchEnableServicesRequest request =
       BatchEnableServicesRequest.newBuilder()
           .setParent("parent-995424086")
           .addAllServiceIds(new ArrayList<String>())
           .build();
   ApiFuture<Operation> future =
       serviceUsageClient.batchEnableServicesCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<BatchEnableServicesRequest,Operation>

batchEnableServicesOperationCallable() (deprecated)

public final OperationCallable<BatchEnableServicesRequest,Empty,OperationMetadata> batchEnableServicesOperationCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Enables multiple services on a project. The operation is atomic: if enabling any service fails, then the entire batch fails, and no state changes occur.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   BatchEnableServicesRequest request =
       BatchEnableServicesRequest.newBuilder()
           .setParent("parent-995424086")
           .addAllServiceIds(new ArrayList<String>())
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       serviceUsageClient.batchEnableServicesOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<BatchEnableServicesRequest,Empty,OperationMetadata>

close()

public final void close()

createAdminOverrideAsync(CreateAdminOverrideRequest request)

public final OperationFuture<QuotaOverride,OperationMetadata> createAdminOverrideAsync(CreateAdminOverrideRequest request)

Creates an admin override. An admin override is applied by an administrator of a parent folder or parent organization of the consumer receiving the override. An admin override is intended to limit the amount of quota the consumer can use out of the total quota pool allocated to all children of the folder or organization.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   CreateAdminOverrideRequest request =
       CreateAdminOverrideRequest.newBuilder()
           .setParent("parent-995424086")
           .setOverride(QuotaOverride.newBuilder().build())
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   QuotaOverride response = serviceUsageClient.createAdminOverrideAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateAdminOverrideRequest

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

Returns
TypeDescription
OperationFuture<QuotaOverride,OperationMetadata>

createAdminOverrideCallable()

public final UnaryCallable<CreateAdminOverrideRequest,Operation> createAdminOverrideCallable()

Creates an admin override. An admin override is applied by an administrator of a parent folder or parent organization of the consumer receiving the override. An admin override is intended to limit the amount of quota the consumer can use out of the total quota pool allocated to all children of the folder or organization.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   CreateAdminOverrideRequest request =
       CreateAdminOverrideRequest.newBuilder()
           .setParent("parent-995424086")
           .setOverride(QuotaOverride.newBuilder().build())
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   ApiFuture<Operation> future =
       serviceUsageClient.createAdminOverrideCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateAdminOverrideRequest,Operation>

createAdminOverrideOperationCallable()

public final OperationCallable<CreateAdminOverrideRequest,QuotaOverride,OperationMetadata> createAdminOverrideOperationCallable()

Creates an admin override. An admin override is applied by an administrator of a parent folder or parent organization of the consumer receiving the override. An admin override is intended to limit the amount of quota the consumer can use out of the total quota pool allocated to all children of the folder or organization.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   CreateAdminOverrideRequest request =
       CreateAdminOverrideRequest.newBuilder()
           .setParent("parent-995424086")
           .setOverride(QuotaOverride.newBuilder().build())
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   OperationFuture<QuotaOverride, OperationMetadata> future =
       serviceUsageClient.createAdminOverrideOperationCallable().futureCall(request);
   // Do something.
   QuotaOverride response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateAdminOverrideRequest,QuotaOverride,OperationMetadata>

createConsumerOverrideAsync(CreateConsumerOverrideRequest request)

public final OperationFuture<QuotaOverride,OperationMetadata> createConsumerOverrideAsync(CreateConsumerOverrideRequest request)

Creates a consumer override. A consumer override is applied to the consumer on its own authority to limit its own quota usage. Consumer overrides cannot be used to grant more quota than would be allowed by admin overrides, producer overrides, or the default limit of the service.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   CreateConsumerOverrideRequest request =
       CreateConsumerOverrideRequest.newBuilder()
           .setParent("parent-995424086")
           .setOverride(QuotaOverride.newBuilder().build())
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   QuotaOverride response = serviceUsageClient.createConsumerOverrideAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateConsumerOverrideRequest

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

Returns
TypeDescription
OperationFuture<QuotaOverride,OperationMetadata>

createConsumerOverrideCallable()

public final UnaryCallable<CreateConsumerOverrideRequest,Operation> createConsumerOverrideCallable()

Creates a consumer override. A consumer override is applied to the consumer on its own authority to limit its own quota usage. Consumer overrides cannot be used to grant more quota than would be allowed by admin overrides, producer overrides, or the default limit of the service.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   CreateConsumerOverrideRequest request =
       CreateConsumerOverrideRequest.newBuilder()
           .setParent("parent-995424086")
           .setOverride(QuotaOverride.newBuilder().build())
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   ApiFuture<Operation> future =
       serviceUsageClient.createConsumerOverrideCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateConsumerOverrideRequest,Operation>

createConsumerOverrideOperationCallable()

public final OperationCallable<CreateConsumerOverrideRequest,QuotaOverride,OperationMetadata> createConsumerOverrideOperationCallable()

Creates a consumer override. A consumer override is applied to the consumer on its own authority to limit its own quota usage. Consumer overrides cannot be used to grant more quota than would be allowed by admin overrides, producer overrides, or the default limit of the service.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   CreateConsumerOverrideRequest request =
       CreateConsumerOverrideRequest.newBuilder()
           .setParent("parent-995424086")
           .setOverride(QuotaOverride.newBuilder().build())
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   OperationFuture<QuotaOverride, OperationMetadata> future =
       serviceUsageClient.createConsumerOverrideOperationCallable().futureCall(request);
   // Do something.
   QuotaOverride response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateConsumerOverrideRequest,QuotaOverride,OperationMetadata>

deleteAdminOverrideAsync(DeleteAdminOverrideRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteAdminOverrideAsync(DeleteAdminOverrideRequest request)

Deletes an admin override.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DeleteAdminOverrideRequest request =
       DeleteAdminOverrideRequest.newBuilder()
           .setName("name3373707")
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   serviceUsageClient.deleteAdminOverrideAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteAdminOverrideRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteAdminOverrideCallable()

public final UnaryCallable<DeleteAdminOverrideRequest,Operation> deleteAdminOverrideCallable()

Deletes an admin override.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DeleteAdminOverrideRequest request =
       DeleteAdminOverrideRequest.newBuilder()
           .setName("name3373707")
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   ApiFuture<Operation> future =
       serviceUsageClient.deleteAdminOverrideCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteAdminOverrideRequest,Operation>

deleteAdminOverrideOperationCallable()

public final OperationCallable<DeleteAdminOverrideRequest,Empty,OperationMetadata> deleteAdminOverrideOperationCallable()

Deletes an admin override.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DeleteAdminOverrideRequest request =
       DeleteAdminOverrideRequest.newBuilder()
           .setName("name3373707")
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       serviceUsageClient.deleteAdminOverrideOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteAdminOverrideRequest,Empty,OperationMetadata>

deleteConsumerOverrideAsync(DeleteConsumerOverrideRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteConsumerOverrideAsync(DeleteConsumerOverrideRequest request)

Deletes a consumer override.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DeleteConsumerOverrideRequest request =
       DeleteConsumerOverrideRequest.newBuilder()
           .setName("name3373707")
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   serviceUsageClient.deleteConsumerOverrideAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteConsumerOverrideRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

deleteConsumerOverrideCallable()

public final UnaryCallable<DeleteConsumerOverrideRequest,Operation> deleteConsumerOverrideCallable()

Deletes a consumer override.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DeleteConsumerOverrideRequest request =
       DeleteConsumerOverrideRequest.newBuilder()
           .setName("name3373707")
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   ApiFuture<Operation> future =
       serviceUsageClient.deleteConsumerOverrideCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteConsumerOverrideRequest,Operation>

deleteConsumerOverrideOperationCallable()

public final OperationCallable<DeleteConsumerOverrideRequest,Empty,OperationMetadata> deleteConsumerOverrideOperationCallable()

Deletes a consumer override.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DeleteConsumerOverrideRequest request =
       DeleteConsumerOverrideRequest.newBuilder()
           .setName("name3373707")
           .setForce(true)
           .addAllForceOnly(new ArrayList<QuotaSafetyCheck>())
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       serviceUsageClient.deleteConsumerOverrideOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteConsumerOverrideRequest,Empty,OperationMetadata>

disableServiceAsync(DisableServiceRequest request) (deprecated)

public final OperationFuture<Empty,OperationMetadata> disableServiceAsync(DisableServiceRequest request)

Deprecated. This method is deprecated and will be removed in the next major version update.

Disables a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks.

It is not valid to call the disable method on a service that is not currently enabled. Callers will receive a FAILED_PRECONDITION status if the target service is not currently enabled.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DisableServiceRequest request =
       DisableServiceRequest.newBuilder().setName("name3373707").build();
   serviceUsageClient.disableServiceAsync(request).get();
 }
 
Parameter
NameDescription
requestDisableServiceRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

disableServiceCallable() (deprecated)

public final UnaryCallable<DisableServiceRequest,Operation> disableServiceCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Disables a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks.

It is not valid to call the disable method on a service that is not currently enabled. Callers will receive a FAILED_PRECONDITION status if the target service is not currently enabled.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DisableServiceRequest request =
       DisableServiceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future = serviceUsageClient.disableServiceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DisableServiceRequest,Operation>

disableServiceOperationCallable() (deprecated)

public final OperationCallable<DisableServiceRequest,Empty,OperationMetadata> disableServiceOperationCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Disables a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks.

It is not valid to call the disable method on a service that is not currently enabled. Callers will receive a FAILED_PRECONDITION status if the target service is not currently enabled.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   DisableServiceRequest request =
       DisableServiceRequest.newBuilder().setName("name3373707").build();
   OperationFuture<Empty, OperationMetadata> future =
       serviceUsageClient.disableServiceOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DisableServiceRequest,Empty,OperationMetadata>

enableServiceAsync(EnableServiceRequest request) (deprecated)

public final OperationFuture<Empty,OperationMetadata> enableServiceAsync(EnableServiceRequest request)

Deprecated. This method is deprecated and will be removed in the next major version update.

Enables a service so that it can be used with a project.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   EnableServiceRequest request =
       EnableServiceRequest.newBuilder().setName("name3373707").build();
   serviceUsageClient.enableServiceAsync(request).get();
 }
 
Parameter
NameDescription
requestEnableServiceRequest

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

Returns
TypeDescription
OperationFuture<Empty,OperationMetadata>

enableServiceCallable() (deprecated)

public final UnaryCallable<EnableServiceRequest,Operation> enableServiceCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Enables a service so that it can be used with a project.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   EnableServiceRequest request =
       EnableServiceRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Operation> future = serviceUsageClient.enableServiceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<EnableServiceRequest,Operation>

enableServiceOperationCallable() (deprecated)

public final OperationCallable<EnableServiceRequest,Empty,OperationMetadata> enableServiceOperationCallable()

Deprecated. This method is deprecated and will be removed in the next major version update.

Enables a service so that it can be used with a project.

Operation response type: google.protobuf.Empty

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   EnableServiceRequest request =
       EnableServiceRequest.newBuilder().setName("name3373707").build();
   OperationFuture<Empty, OperationMetadata> future =
       serviceUsageClient.enableServiceOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<EnableServiceRequest,Empty,OperationMetadata>

generateServiceIdentityAsync(GenerateServiceIdentityRequest request)

public final OperationFuture<ServiceIdentity,Empty> generateServiceIdentityAsync(GenerateServiceIdentityRequest request)

Generates service identity for service.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GenerateServiceIdentityRequest request =
       GenerateServiceIdentityRequest.newBuilder().setParent("parent-995424086").build();
   ServiceIdentity response = serviceUsageClient.generateServiceIdentityAsync(request).get();
 }
 
Parameter
NameDescription
requestGenerateServiceIdentityRequest

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

Returns
TypeDescription
OperationFuture<ServiceIdentity,Empty>

generateServiceIdentityCallable()

public final UnaryCallable<GenerateServiceIdentityRequest,Operation> generateServiceIdentityCallable()

Generates service identity for service.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GenerateServiceIdentityRequest request =
       GenerateServiceIdentityRequest.newBuilder().setParent("parent-995424086").build();
   ApiFuture<Operation> future =
       serviceUsageClient.generateServiceIdentityCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GenerateServiceIdentityRequest,Operation>

generateServiceIdentityOperationCallable()

public final OperationCallable<GenerateServiceIdentityRequest,ServiceIdentity,Empty> generateServiceIdentityOperationCallable()

Generates service identity for service.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GenerateServiceIdentityRequest request =
       GenerateServiceIdentityRequest.newBuilder().setParent("parent-995424086").build();
   OperationFuture<ServiceIdentity, Empty> future =
       serviceUsageClient.generateServiceIdentityOperationCallable().futureCall(request);
   // Do something.
   ServiceIdentity response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<GenerateServiceIdentityRequest,ServiceIdentity,Empty>

getConsumerQuotaLimit(GetConsumerQuotaLimitRequest request)

public final ConsumerQuotaLimit getConsumerQuotaLimit(GetConsumerQuotaLimitRequest request)

Retrieves a summary of quota information for a specific quota limit.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GetConsumerQuotaLimitRequest request =
       GetConsumerQuotaLimitRequest.newBuilder()
           .setName("name3373707")
           .setView(QuotaView.forNumber(0))
           .build();
   ConsumerQuotaLimit response = serviceUsageClient.getConsumerQuotaLimit(request);
 }
 
Parameter
NameDescription
requestGetConsumerQuotaLimitRequest

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

Returns
TypeDescription
ConsumerQuotaLimit

getConsumerQuotaLimitCallable()

public final UnaryCallable<GetConsumerQuotaLimitRequest,ConsumerQuotaLimit> getConsumerQuotaLimitCallable()

Retrieves a summary of quota information for a specific quota limit.

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GetConsumerQuotaLimitRequest request =
       GetConsumerQuotaLimitRequest.newBuilder()
           .setName("name3373707")
           .setView(QuotaView.forNumber(0))
           .build();
   ApiFuture<ConsumerQuotaLimit> future =
       serviceUsageClient.getConsumerQuotaLimitCallable().futureCall(request);
   // Do something.
   ConsumerQuotaLimit response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetConsumerQuotaLimitRequest,ConsumerQuotaLimit>

getConsumerQuotaMetric(GetConsumerQuotaMetricRequest request)

public final ConsumerQuotaMetric getConsumerQuotaMetric(GetConsumerQuotaMetricRequest request)

Retrieves a summary of quota information for a specific quota metric

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GetConsumerQuotaMetricRequest request =
       GetConsumerQuotaMetricRequest.newBuilder()
           .setName("name3373707")
           .setView(QuotaView.forNumber(0))
           .build();
   ConsumerQuotaMetric response = serviceUsageClient.getConsumerQuotaMetric(request);
 }
 
Parameter
NameDescription
requestGetConsumerQuotaMetricRequest

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

Returns
TypeDescription
ConsumerQuotaMetric

getConsumerQuotaMetricCallable()

public final UnaryCallable<GetConsumerQuotaMetricRequest,ConsumerQuotaMetric> getConsumerQuotaMetricCallable()

Retrieves a summary of quota information for a specific quota metric

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 (ServiceUsageClient serviceUsageClient = ServiceUsageClient.create()) {
   GetConsumerQuotaMetricRequest request =
       GetConsumerQuotaMetricRequest.newBuilder()
           .setName("name3373707")
           .setView(QuotaView.forNumber(0))
           .build();
   ApiFuture<ConsumerQuotaMetric> future =
       serviceUsageClient.getConsumerQuotaMetricCallable().futureCall(request);
   // Do something.
   ConsumerQuotaMetric response = future.ge