Class ServiceUsageClient (2.29.0)

publicclass ServiceUsageClientimplementsBackgroundResource

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
GetServiceRequestrequest=GetServiceRequest.newBuilder().setName("name3373707").build();
Serviceresponse=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
ServiceUsageSettingsserviceUsageSettings=
ServiceUsageSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ServiceUsageClientserviceUsageClient=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
ServiceUsageSettingsserviceUsageSettings=
ServiceUsageSettings.newBuilder().setEndpoint(myEndpoint).build();
ServiceUsageClientserviceUsageClient=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
ServiceUsageSettingsserviceUsageSettings=ServiceUsageSettings.newHttpJsonBuilder().build();
ServiceUsageClientserviceUsageClient=ServiceUsageClient.create(serviceUsageSettings);

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

Inheritance

java.lang.Object > ServiceUsageClient

Implements

BackgroundResource

Static Methods

create()

publicstaticfinalServiceUsageClientcreate()

Constructs an instance of ServiceUsageClient with default settings.

Returns
Type Description
ServiceUsageClient
Exceptions
Type Description
IOException

create(ServiceUsageSettings settings)

publicstaticfinalServiceUsageClientcreate(ServiceUsageSettingssettings)

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
Name Description
settings ServiceUsageSettings
Returns
Type Description
ServiceUsageClient
Exceptions
Type Description
IOException

create(ServiceUsageStub stub)

publicstaticfinalServiceUsageClientcreate(ServiceUsageStubstub)

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

Parameter
Name Description
stub ServiceUsageStub
Returns
Type Description
ServiceUsageClient

Constructors

ServiceUsageClient(ServiceUsageSettings settings)

protectedServiceUsageClient(ServiceUsageSettingssettings)

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
Name Description
settings ServiceUsageSettings

ServiceUsageClient(ServiceUsageStub stub)

protectedServiceUsageClient(ServiceUsageStubstub)
Parameter
Name Description
stub ServiceUsageStub

Methods

awaitTermination(long duration, TimeUnit unit)

publicbooleanawaitTermination(longduration,TimeUnitunit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

batchEnableServicesAsync(BatchEnableServicesRequest request) (deprecated)

publicfinalOperationFuture<Empty,OperationMetadata>batchEnableServicesAsync(BatchEnableServicesRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
BatchEnableServicesRequestrequest=
BatchEnableServicesRequest.newBuilder()
.setParent("parent-995424086")
.addAllServiceIds(newArrayList<String>())
.build();
serviceUsageClient.batchEnableServicesAsync(request).get();
}
Parameter
Name Description
request BatchEnableServicesRequest

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

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

batchEnableServicesCallable() (deprecated)

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

batchEnableServicesOperationCallable() (deprecated)

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

close()

publicfinalvoidclose()

createAdminOverrideAsync(CreateAdminOverrideRequest request)

publicfinalOperationFuture<QuotaOverride,OperationMetadata>createAdminOverrideAsync(CreateAdminOverrideRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
CreateAdminOverrideRequestrequest=
CreateAdminOverrideRequest.newBuilder()
.setParent("parent-995424086")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
QuotaOverrideresponse=serviceUsageClient.createAdminOverrideAsync(request).get();
}
Parameter
Name Description
request CreateAdminOverrideRequest

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

Returns
Type Description
OperationFuture<QuotaOverride,OperationMetadata>

createAdminOverrideCallable()

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

createAdminOverrideOperationCallable()

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

createConsumerOverrideAsync(CreateConsumerOverrideRequest request)

publicfinalOperationFuture<QuotaOverride,OperationMetadata>createConsumerOverrideAsync(CreateConsumerOverrideRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
CreateConsumerOverrideRequestrequest=
CreateConsumerOverrideRequest.newBuilder()
.setParent("parent-995424086")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
QuotaOverrideresponse=serviceUsageClient.createConsumerOverrideAsync(request).get();
}
Parameter
Name Description
request CreateConsumerOverrideRequest

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

Returns
Type Description
OperationFuture<QuotaOverride,OperationMetadata>

createConsumerOverrideCallable()

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

createConsumerOverrideOperationCallable()

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

deleteAdminOverrideAsync(DeleteAdminOverrideRequest request)

publicfinalOperationFuture<Empty,OperationMetadata>deleteAdminOverrideAsync(DeleteAdminOverrideRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
DeleteAdminOverrideRequestrequest=
DeleteAdminOverrideRequest.newBuilder()
.setName("name3373707")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
serviceUsageClient.deleteAdminOverrideAsync(request).get();
}
Parameter
Name Description
request DeleteAdminOverrideRequest

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

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteAdminOverrideCallable()

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

deleteAdminOverrideOperationCallable()

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

deleteConsumerOverrideAsync(DeleteConsumerOverrideRequest request)

publicfinalOperationFuture<Empty,OperationMetadata>deleteConsumerOverrideAsync(DeleteConsumerOverrideRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
DeleteConsumerOverrideRequestrequest=
DeleteConsumerOverrideRequest.newBuilder()
.setName("name3373707")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
serviceUsageClient.deleteConsumerOverrideAsync(request).get();
}
Parameter
Name Description
request DeleteConsumerOverrideRequest

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

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteConsumerOverrideCallable()

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

deleteConsumerOverrideOperationCallable()

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

disableServiceAsync(DisableServiceRequest request) (deprecated)

publicfinalOperationFuture<Empty,OperationMetadata>disableServiceAsync(DisableServiceRequestrequest)

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

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

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

disableServiceCallable() (deprecated)

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

disableServiceOperationCallable() (deprecated)

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

enableServiceAsync(EnableServiceRequest request) (deprecated)

publicfinalOperationFuture<Empty,OperationMetadata>enableServiceAsync(EnableServiceRequestrequest)

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

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

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

enableServiceCallable() (deprecated)

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

enableServiceOperationCallable() (deprecated)

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

generateServiceIdentityAsync(GenerateServiceIdentityRequest request)

publicfinalOperationFuture<ServiceIdentity,Empty>generateServiceIdentityAsync(GenerateServiceIdentityRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
GenerateServiceIdentityRequestrequest=
GenerateServiceIdentityRequest.newBuilder().setParent("parent-995424086").build();
ServiceIdentityresponse=serviceUsageClient.generateServiceIdentityAsync(request).get();
}
Parameter
Name Description
request GenerateServiceIdentityRequest

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

Returns
Type Description
OperationFuture<ServiceIdentity,Empty>

generateServiceIdentityCallable()

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

generateServiceIdentityOperationCallable()

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

getConsumerQuotaLimit(GetConsumerQuotaLimitRequest request)

publicfinalConsumerQuotaLimitgetConsumerQuotaLimit(GetConsumerQuotaLimitRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
GetConsumerQuotaLimitRequestrequest=
GetConsumerQuotaLimitRequest.newBuilder()
.setName("name3373707")
.setView(QuotaView.forNumber(0))
.build();
ConsumerQuotaLimitresponse=serviceUsageClient.getConsumerQuotaLimit(request);
}
Parameter
Name Description
request GetConsumerQuotaLimitRequest

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

Returns
Type Description
ConsumerQuotaLimit

getConsumerQuotaLimitCallable()

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

getConsumerQuotaMetric(GetConsumerQuotaMetricRequest request)

publicfinalConsumerQuotaMetricgetConsumerQuotaMetric(GetConsumerQuotaMetricRequestrequest)

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
GetConsumerQuotaMetricRequestrequest=
GetConsumerQuotaMetricRequest.newBuilder()
.setName("name3373707")
.setView(QuotaView.forNumber(0))
.build();
ConsumerQuotaMetricresponse=serviceUsageClient.getConsumerQuotaMetric(request);
}
Parameter
Name Description
request GetConsumerQuotaMetricRequest

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

Returns
Type Description
ConsumerQuotaMetric

getConsumerQuotaMetricCallable()

publicfinalUnaryCallable<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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
GetConsumerQuotaMetricRequestrequest=
GetConsumerQuotaMetricRequest.newBuilder()
.setName("name3373707")
.setView(QuotaView.forNumber(0))
.build();
ApiFuture<ConsumerQuotaMetric>future=
serviceUsageClient.getConsumerQuotaMetricCallable().futureCall(request);
// Do something.
ConsumerQuotaMetricresponse=future.get();
}
Returns
Type Description
UnaryCallable<GetConsumerQuotaMetricRequest,ConsumerQuotaMetric>

getHttpJsonOperationsClient()

publicfinalOperationsClientgetHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getOperationsClient()

publicfinalOperationsClientgetOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getService(GetServiceRequest request) (deprecated)

publicfinalServicegetService(GetServiceRequestrequest)

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

Returns the service configuration and enabled state for a given 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
GetServiceRequestrequest=GetServiceRequest.newBuilder().setName("name3373707").build();
Serviceresponse=serviceUsageClient.getService(request);
}
Parameter
Name Description
request GetServiceRequest

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

Returns
Type Description
Service

getServiceCallable() (deprecated)

publicfinalUnaryCallable<GetServiceRequest,Service>getServiceCallable()

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

Returns the service configuration and enabled state for a given 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
GetServiceRequestrequest=GetServiceRequest.newBuilder().setName("name3373707").build();
ApiFuture<Service>future=serviceUsageClient.getServiceCallable().futureCall(request);
// Do something.
Serviceresponse=future.get();
}
Returns
Type Description
UnaryCallable<GetServiceRequest,Service>

getSettings()

publicfinalServiceUsageSettingsgetSettings()
Returns
Type Description
ServiceUsageSettings

getStub()

publicServiceUsageStubgetStub()
Returns
Type Description
ServiceUsageStub

importAdminOverridesAsync(ImportAdminOverridesRequest request)

publicfinalOperationFuture<ImportAdminOverridesResponse,ImportAdminOverridesMetadata>importAdminOverridesAsync(ImportAdminOverridesRequestrequest)

Creates or updates multiple admin overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be set.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ImportAdminOverridesRequestrequest=
ImportAdminOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
ImportAdminOverridesResponseresponse=
serviceUsageClient.importAdminOverridesAsync(request).get();
}
Parameter
Name Description
request ImportAdminOverridesRequest

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

Returns
Type Description
OperationFuture<ImportAdminOverridesResponse,ImportAdminOverridesMetadata>

importAdminOverridesCallable()

publicfinalUnaryCallable<ImportAdminOverridesRequest,Operation>importAdminOverridesCallable()

Creates or updates multiple admin overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be set.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ImportAdminOverridesRequestrequest=
ImportAdminOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
ApiFuture<Operation>future=
serviceUsageClient.importAdminOverridesCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description
UnaryCallable<ImportAdminOverridesRequest,Operation>

importAdminOverridesOperationCallable()

publicfinalOperationCallable<ImportAdminOverridesRequest,ImportAdminOverridesResponse,ImportAdminOverridesMetadata>importAdminOverridesOperationCallable()

Creates or updates multiple admin overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be set.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ImportAdminOverridesRequestrequest=
ImportAdminOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
OperationFuture<ImportAdminOverridesResponse,ImportAdminOverridesMetadata>future=
serviceUsageClient.importAdminOverridesOperationCallable().futureCall(request);
// Do something.
ImportAdminOverridesResponseresponse=future.get();
}
Returns
Type Description
OperationCallable<ImportAdminOverridesRequest,ImportAdminOverridesResponse,ImportAdminOverridesMetadata>

importConsumerOverridesAsync(ImportConsumerOverridesRequest request)

publicfinalOperationFuture<ImportConsumerOverridesResponse,ImportConsumerOverridesMetadata>importConsumerOverridesAsync(ImportConsumerOverridesRequestrequest)

Creates or updates multiple consumer overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be set.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ImportConsumerOverridesRequestrequest=
ImportConsumerOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
ImportConsumerOverridesResponseresponse=
serviceUsageClient.importConsumerOverridesAsync(request).get();
}
Parameter
Name Description
request ImportConsumerOverridesRequest

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

Returns
Type Description
OperationFuture<ImportConsumerOverridesResponse,ImportConsumerOverridesMetadata>

importConsumerOverridesCallable()

publicfinalUnaryCallable<ImportConsumerOverridesRequest,Operation>importConsumerOverridesCallable()

Creates or updates multiple consumer overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be set.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ImportConsumerOverridesRequestrequest=
ImportConsumerOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
ApiFuture<Operation>future=
serviceUsageClient.importConsumerOverridesCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description
UnaryCallable<ImportConsumerOverridesRequest,Operation>

importConsumerOverridesOperationCallable()

publicfinalOperationCallable<ImportConsumerOverridesRequest,ImportConsumerOverridesResponse,ImportConsumerOverridesMetadata>importConsumerOverridesOperationCallable()

Creates or updates multiple consumer overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be set.

Sample code:


// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ImportConsumerOverridesRequestrequest=
ImportConsumerOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setForce(true)
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
OperationFuture<ImportConsumerOverridesResponse,ImportConsumerOverridesMetadata>future=
serviceUsageClient.importConsumerOverridesOperationCallable().futureCall(request);
// Do something.
ImportConsumerOverridesResponseresponse=future.get();
}
Returns
Type Description
OperationCallable<ImportConsumerOverridesRequest,ImportConsumerOverridesResponse,ImportConsumerOverridesMetadata>

isShutdown()

publicbooleanisShutdown()
Returns
Type Description
boolean

isTerminated()

publicbooleanisTerminated()
Returns
Type Description
boolean

listAdminOverrides(ListAdminOverridesRequest request)

publicfinalServiceUsageClient.ListAdminOverridesPagedResponselistAdminOverrides(ListAdminOverridesRequestrequest)

Lists all admin overrides on this 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListAdminOverridesRequestrequest=
ListAdminOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(QuotaOverrideelement:serviceUsageClient.listAdminOverrides(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListAdminOverridesRequest

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

Returns
Type Description
ServiceUsageClient.ListAdminOverridesPagedResponse

listAdminOverridesCallable()

publicfinalUnaryCallable<ListAdminOverridesRequest,ListAdminOverridesResponse>listAdminOverridesCallable()

Lists all admin overrides on this 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListAdminOverridesRequestrequest=
ListAdminOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListAdminOverridesResponseresponse=
serviceUsageClient.listAdminOverridesCallable().call(request);
for(QuotaOverrideelement:response.getOverridesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListAdminOverridesRequest,ListAdminOverridesResponse>

listAdminOverridesPagedCallable()

publicfinalUnaryCallable<ListAdminOverridesRequest,ServiceUsageClient.ListAdminOverridesPagedResponse>listAdminOverridesPagedCallable()

Lists all admin overrides on this 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListAdminOverridesRequestrequest=
ListAdminOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<QuotaOverride>future=
serviceUsageClient.listAdminOverridesPagedCallable().futureCall(request);
// Do something.
for(QuotaOverrideelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListAdminOverridesRequest,ListAdminOverridesPagedResponse>

listConsumerOverrides(ListConsumerOverridesRequest request)

publicfinalServiceUsageClient.ListConsumerOverridesPagedResponselistConsumerOverrides(ListConsumerOverridesRequestrequest)

Lists all consumer overrides on this 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListConsumerOverridesRequestrequest=
ListConsumerOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(QuotaOverrideelement:serviceUsageClient.listConsumerOverrides(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListConsumerOverridesRequest

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

Returns
Type Description
ServiceUsageClient.ListConsumerOverridesPagedResponse

listConsumerOverridesCallable()

publicfinalUnaryCallable<ListConsumerOverridesRequest,ListConsumerOverridesResponse>listConsumerOverridesCallable()

Lists all consumer overrides on this 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListConsumerOverridesRequestrequest=
ListConsumerOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListConsumerOverridesResponseresponse=
serviceUsageClient.listConsumerOverridesCallable().call(request);
for(QuotaOverrideelement:response.getOverridesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListConsumerOverridesRequest,ListConsumerOverridesResponse>

listConsumerOverridesPagedCallable()

publicfinalUnaryCallable<ListConsumerOverridesRequest,ServiceUsageClient.ListConsumerOverridesPagedResponse>listConsumerOverridesPagedCallable()

Lists all consumer overrides on this 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListConsumerOverridesRequestrequest=
ListConsumerOverridesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<QuotaOverride>future=
serviceUsageClient.listConsumerOverridesPagedCallable().futureCall(request);
// Do something.
for(QuotaOverrideelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListConsumerOverridesRequest,ListConsumerOverridesPagedResponse>

listConsumerQuotaMetrics(ListConsumerQuotaMetricsRequest request)

publicfinalServiceUsageClient.ListConsumerQuotaMetricsPagedResponselistConsumerQuotaMetrics(ListConsumerQuotaMetricsRequestrequest)

Retrieves a summary of all quota information visible to the service consumer, organized by service metric. Each metric includes information about all of its defined limits. Each limit includes the limit configuration (quota unit, preciseness, default value), the current effective limit value, and all of the overrides applied to the 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListConsumerQuotaMetricsRequestrequest=
ListConsumerQuotaMetricsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(QuotaView.forNumber(0))
.build();
for(ConsumerQuotaMetricelement:
serviceUsageClient.listConsumerQuotaMetrics(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListConsumerQuotaMetricsRequest

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

Returns
Type Description
ServiceUsageClient.ListConsumerQuotaMetricsPagedResponse

listConsumerQuotaMetricsCallable()

publicfinalUnaryCallable<ListConsumerQuotaMetricsRequest,ListConsumerQuotaMetricsResponse>listConsumerQuotaMetricsCallable()

Retrieves a summary of all quota information visible to the service consumer, organized by service metric. Each metric includes information about all of its defined limits. Each limit includes the limit configuration (quota unit, preciseness, default value), the current effective limit value, and all of the overrides applied to the 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListConsumerQuotaMetricsRequestrequest=
ListConsumerQuotaMetricsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(QuotaView.forNumber(0))
.build();
while(true){
ListConsumerQuotaMetricsResponseresponse=
serviceUsageClient.listConsumerQuotaMetricsCallable().call(request);
for(ConsumerQuotaMetricelement:response.getMetricsList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListConsumerQuotaMetricsRequest,ListConsumerQuotaMetricsResponse>

listConsumerQuotaMetricsPagedCallable()

publicfinalUnaryCallable<ListConsumerQuotaMetricsRequest,ServiceUsageClient.ListConsumerQuotaMetricsPagedResponse>listConsumerQuotaMetricsPagedCallable()

Retrieves a summary of all quota information visible to the service consumer, organized by service metric. Each metric includes information about all of its defined limits. Each limit includes the limit configuration (quota unit, preciseness, default value), the current effective limit value, and all of the overrides applied to the 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListConsumerQuotaMetricsRequestrequest=
ListConsumerQuotaMetricsRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(QuotaView.forNumber(0))
.build();
ApiFuture<ConsumerQuotaMetric>future=
serviceUsageClient.listConsumerQuotaMetricsPagedCallable().futureCall(request);
// Do something.
for(ConsumerQuotaMetricelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListConsumerQuotaMetricsRequest,ListConsumerQuotaMetricsPagedResponse>

listServices(ListServicesRequest request) (deprecated)

publicfinalServiceUsageClient.ListServicesPagedResponselistServices(ListServicesRequestrequest)

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

Lists all services available to the specified project, and the current state of those services with respect to the project. The list includes all public services, all services for which the calling user has the servicemanagement.services.bind permission, and all services that have already been enabled on the project. The list can be filtered to only include services in a specific state, for example to only include services enabled on the project.

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListServicesRequestrequest=
ListServicesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for(Serviceelement:serviceUsageClient.listServices(request).iterateAll()){
// doThingsWith(element);
}
}
Parameter
Name Description
request ListServicesRequest

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

Returns
Type Description
ServiceUsageClient.ListServicesPagedResponse

listServicesCallable() (deprecated)

publicfinalUnaryCallable<ListServicesRequest,ListServicesResponse>listServicesCallable()

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

Lists all services available to the specified project, and the current state of those services with respect to the project. The list includes all public services, all services for which the calling user has the servicemanagement.services.bind permission, and all services that have already been enabled on the project. The list can be filtered to only include services in a specific state, for example to only include services enabled on the project.

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListServicesRequestrequest=
ListServicesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while(true){
ListServicesResponseresponse=serviceUsageClient.listServicesCallable().call(request);
for(Serviceelement:response.getServicesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
Returns
Type Description
UnaryCallable<ListServicesRequest,ListServicesResponse>

listServicesPagedCallable() (deprecated)

publicfinalUnaryCallable<ListServicesRequest,ServiceUsageClient.ListServicesPagedResponse>listServicesPagedCallable()

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

Lists all services available to the specified project, and the current state of those services with respect to the project. The list includes all public services, all services for which the calling user has the servicemanagement.services.bind permission, and all services that have already been enabled on the project. The list can be filtered to only include services in a specific state, for example to only include services enabled on the project.

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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
ListServicesRequestrequest=
ListServicesRequest.newBuilder()
.setParent("parent-995424086")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Service>future=
serviceUsageClient.listServicesPagedCallable().futureCall(request);
// Do something.
for(Serviceelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
Returns
Type Description
UnaryCallable<ListServicesRequest,ListServicesPagedResponse>

shutdown()

publicvoidshutdown()

shutdownNow()

publicvoidshutdownNow()

updateAdminOverrideAsync(UpdateAdminOverrideRequest request)

publicfinalOperationFuture<QuotaOverride,OperationMetadata>updateAdminOverrideAsync(UpdateAdminOverrideRequestrequest)

Updates 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
UpdateAdminOverrideRequestrequest=
UpdateAdminOverrideRequest.newBuilder()
.setName("name3373707")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.setUpdateMask(FieldMask.newBuilder().build())
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
QuotaOverrideresponse=serviceUsageClient.updateAdminOverrideAsync(request).get();
}
Parameter
Name Description
request UpdateAdminOverrideRequest

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

Returns
Type Description
OperationFuture<QuotaOverride,OperationMetadata>

updateAdminOverrideCallable()

publicfinalUnaryCallable<UpdateAdminOverrideRequest,Operation>updateAdminOverrideCallable()

Updates 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
UpdateAdminOverrideRequestrequest=
UpdateAdminOverrideRequest.newBuilder()
.setName("name3373707")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.setUpdateMask(FieldMask.newBuilder().build())
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
ApiFuture<Operation>future=
serviceUsageClient.updateAdminOverrideCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description
UnaryCallable<UpdateAdminOverrideRequest,Operation>

updateAdminOverrideOperationCallable()

publicfinalOperationCallable<UpdateAdminOverrideRequest,QuotaOverride,OperationMetadata>updateAdminOverrideOperationCallable()

Updates 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
UpdateAdminOverrideRequestrequest=
UpdateAdminOverrideRequest.newBuilder()
.setName("name3373707")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.setUpdateMask(FieldMask.newBuilder().build())
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
OperationFuture<QuotaOverride,OperationMetadata>future=
serviceUsageClient.updateAdminOverrideOperationCallable().futureCall(request);
// Do something.
QuotaOverrideresponse=future.get();
}
Returns
Type Description
OperationCallable<UpdateAdminOverrideRequest,QuotaOverride,OperationMetadata>

updateConsumerOverrideAsync(UpdateConsumerOverrideRequest request)

publicfinalOperationFuture<QuotaOverride,OperationMetadata>updateConsumerOverrideAsync(UpdateConsumerOverrideRequestrequest)

Updates 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
UpdateConsumerOverrideRequestrequest=
UpdateConsumerOverrideRequest.newBuilder()
.setName("name3373707")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.setUpdateMask(FieldMask.newBuilder().build())
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
QuotaOverrideresponse=serviceUsageClient.updateConsumerOverrideAsync(request).get();
}
Parameter
Name Description
request UpdateConsumerOverrideRequest

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

Returns
Type Description
OperationFuture<QuotaOverride,OperationMetadata>

updateConsumerOverrideCallable()

publicfinalUnaryCallable<UpdateConsumerOverrideRequest,Operation>updateConsumerOverrideCallable()

Updates 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
UpdateConsumerOverrideRequestrequest=
UpdateConsumerOverrideRequest.newBuilder()
.setName("name3373707")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.setUpdateMask(FieldMask.newBuilder().build())
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
ApiFuture<Operation>future=
serviceUsageClient.updateConsumerOverrideCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
Returns
Type Description
UnaryCallable<UpdateConsumerOverrideRequest,Operation>

updateConsumerOverrideOperationCallable()

publicfinalOperationCallable<UpdateConsumerOverrideRequest,QuotaOverride,OperationMetadata>updateConsumerOverrideOperationCallable()

Updates 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(ServiceUsageClientserviceUsageClient=ServiceUsageClient.create()){
UpdateConsumerOverrideRequestrequest=
UpdateConsumerOverrideRequest.newBuilder()
.setName("name3373707")
.setOverride(QuotaOverride.newBuilder().build())
.setForce(true)
.setUpdateMask(FieldMask.newBuilder().build())
.addAllForceOnly(newArrayList<QuotaSafetyCheck>())
.build();
OperationFuture<QuotaOverride,OperationMetadata>future=
serviceUsageClient.updateConsumerOverrideOperationCallable().futureCall(request);
// Do something.
QuotaOverrideresponse=future.get();
}
Returns
Type Description
OperationCallable<UpdateConsumerOverrideRequest,QuotaOverride,OperationMetadata>

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.