@BetaApi @Generated(value="by gapic-generator-java") public class ModelGardenServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
PublisherModelName name = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModel response = modelGardenServiceClient.getPublisherModel(name);
}
Note: close() needs to be called on the ModelGardenServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetPublisherModel |
Gets a Model Garden publisher model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPublisherModels |
Lists publisher models in Model Garden. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Deploy |
Deploys a model to a new endpoint. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeployPublisherModel |
Deploys publisher models. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExportPublisherModel |
Exports a publisher model to a user provided Google Cloud Storage bucket. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CheckPublisherModelEulaAcceptance |
Checks the EULA acceptance status of a publisher model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AcceptPublisherModelEula |
Accepts the EULA acceptance status of a publisher model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return 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 ModelGardenServiceSettings 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
ModelGardenServiceSettings modelGardenServiceSettings =
ModelGardenServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ModelGardenServiceClient modelGardenServiceClient =
ModelGardenServiceClient.create(modelGardenServiceSettings);
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
ModelGardenServiceSettings modelGardenServiceSettings =
ModelGardenServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ModelGardenServiceClient modelGardenServiceClient =
ModelGardenServiceClient.create(modelGardenServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ModelGardenServiceClient.ListLocationsFixedSizeCollection |
static class |
ModelGardenServiceClient.ListLocationsPage |
static class |
ModelGardenServiceClient.ListLocationsPagedResponse |
static class |
ModelGardenServiceClient.ListPublisherModelsFixedSizeCollection |
static class |
ModelGardenServiceClient.ListPublisherModelsPage |
static class |
ModelGardenServiceClient.ListPublisherModelsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ModelGardenServiceClient(ModelGardenServiceSettings settings)
Constructs an instance of ModelGardenServiceClient, using the given settings.
|
protected |
ModelGardenServiceClient(ModelGardenServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
PublisherModelEulaAcceptance |
acceptPublisherModelEula(AcceptPublisherModelEulaRequest request)
Accepts the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
acceptPublisherModelEula(ProjectName parent,
PublisherModelName publisherModel)
Accepts the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
acceptPublisherModelEula(ProjectName parent,
String publisherModel)
Accepts the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
acceptPublisherModelEula(String parent,
PublisherModelName publisherModel)
Accepts the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
acceptPublisherModelEula(String parent,
String publisherModel)
Accepts the EULA acceptance status of a publisher model.
|
com.google.api.gax.rpc.UnaryCallable<AcceptPublisherModelEulaRequest,PublisherModelEulaAcceptance> |
acceptPublisherModelEulaCallable()
Accepts the EULA acceptance status of a publisher model.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
PublisherModelEulaAcceptance |
checkPublisherModelEulaAcceptance(CheckPublisherModelEulaAcceptanceRequest request)
Checks the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
checkPublisherModelEulaAcceptance(ProjectName parent,
PublisherModelName publisherModel)
Checks the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
checkPublisherModelEulaAcceptance(ProjectName parent,
String publisherModel)
Checks the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
checkPublisherModelEulaAcceptance(String parent,
PublisherModelName publisherModel)
Checks the EULA acceptance status of a publisher model.
|
PublisherModelEulaAcceptance |
checkPublisherModelEulaAcceptance(String parent,
String publisherModel)
Checks the EULA acceptance status of a publisher model.
|
com.google.api.gax.rpc.UnaryCallable<CheckPublisherModelEulaAcceptanceRequest,PublisherModelEulaAcceptance> |
checkPublisherModelEulaAcceptanceCallable()
Checks the EULA acceptance status of a publisher model.
|
void |
close() |
static ModelGardenServiceClient |
create()
Constructs an instance of ModelGardenServiceClient with default settings.
|
static ModelGardenServiceClient |
create(ModelGardenServiceSettings settings)
Constructs an instance of ModelGardenServiceClient, using the given settings.
|
static ModelGardenServiceClient |
create(ModelGardenServiceStub stub)
Constructs an instance of ModelGardenServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<DeployResponse,DeployOperationMetadata> |
deployAsync(DeployRequest request)
Deploys a model to a new endpoint.
|
com.google.api.gax.rpc.UnaryCallable<DeployRequest,com.google.longrunning.Operation> |
deployCallable()
Deploys a model to a new endpoint.
|
com.google.api.gax.rpc.OperationCallable<DeployRequest,DeployResponse,DeployOperationMetadata> |
deployOperationCallable()
Deploys a model to a new endpoint.
|
com.google.api.gax.longrunning.OperationFuture<DeployPublisherModelResponse,DeployPublisherModelOperationMetadata> |
deployPublisherModelAsync(DeployPublisherModelRequest request)
Deprecated.
This method is deprecated and will be removed in the next major version update.
|
com.google.api.gax.rpc.UnaryCallable<DeployPublisherModelRequest,com.google.longrunning.Operation> |
deployPublisherModelCallable()
Deprecated.
This method is deprecated and will be removed in the next major version update.
|
com.google.api.gax.rpc.OperationCallable<DeployPublisherModelRequest,DeployPublisherModelResponse,DeployPublisherModelOperationMetadata> |
deployPublisherModelOperationCallable()
Deprecated.
This method is deprecated and will be removed in the next major version update.
|
com.google.api.gax.longrunning.OperationFuture<ExportPublisherModelResponse,ExportPublisherModelOperationMetadata> |
exportPublisherModelAsync(ExportPublisherModelRequest request)
Exports a publisher model to a user provided Google Cloud Storage bucket.
|
com.google.api.gax.rpc.UnaryCallable<ExportPublisherModelRequest,com.google.longrunning.Operation> |
exportPublisherModelCallable()
Exports a publisher model to a user provided Google Cloud Storage bucket.
|
com.google.api.gax.rpc.OperationCallable<ExportPublisherModelRequest,ExportPublisherModelResponse,ExportPublisherModelOperationMetadata> |
exportPublisherModelOperationCallable()
Exports a publisher model to a user provided Google Cloud Storage bucket.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
PublisherModel |
getPublisherModel(GetPublisherModelRequest request)
Gets a Model Garden publisher model.
|
PublisherModel |
getPublisherModel(PublisherModelName name)
Gets a Model Garden publisher model.
|
PublisherModel |
getPublisherModel(String name)
Gets a Model Garden publisher model.
|
com.google.api.gax.rpc.UnaryCallable<GetPublisherModelRequest,PublisherModel> |
getPublisherModelCallable()
Gets a Model Garden publisher model.
|
ModelGardenServiceSettings |
getSettings() |
ModelGardenServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ModelGardenServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ModelGardenServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
ModelGardenServiceClient.ListPublisherModelsPagedResponse |
listPublisherModels(ListPublisherModelsRequest request)
Lists publisher models in Model Garden.
|
ModelGardenServiceClient.ListPublisherModelsPagedResponse |
listPublisherModels(String parent)
Lists publisher models in Model Garden.
|
com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ListPublisherModelsResponse> |
listPublisherModelsCallable()
Lists publisher models in Model Garden.
|
com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ModelGardenServiceClient.ListPublisherModelsPagedResponse> |
listPublisherModelsPagedCallable()
Lists publisher models in Model Garden.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
protected ModelGardenServiceClient(ModelGardenServiceSettings settings) throws IOException
IOExceptionprotected ModelGardenServiceClient(ModelGardenServiceStub stub)
public static final ModelGardenServiceClient create() throws IOException
IOExceptionpublic static final ModelGardenServiceClient create(ModelGardenServiceSettings settings) throws IOException
IOExceptionpublic static final ModelGardenServiceClient create(ModelGardenServiceStub stub)
public final ModelGardenServiceSettings getSettings()
public ModelGardenServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final PublisherModel getPublisherModel(PublisherModelName name)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
PublisherModelName name = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModel response = modelGardenServiceClient.getPublisherModel(name);
}
name - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModel getPublisherModel(String name)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String name = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString();
PublisherModel response = modelGardenServiceClient.getPublisherModel(name);
}
name - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModel getPublisherModel(GetPublisherModelRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetPublisherModelRequest request =
GetPublisherModelRequest.newBuilder()
.setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.setLanguageCode("languageCode-2092349083")
.setView(PublisherModelView.forNumber(0))
.setIsHuggingFaceModel(true)
.setHuggingFaceToken("huggingFaceToken74062599")
.setIncludeEquivalentModelGardenModelDeploymentConfigs(true)
.build();
PublisherModel response = modelGardenServiceClient.getPublisherModel(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetPublisherModelRequest,PublisherModel> getPublisherModelCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetPublisherModelRequest request =
GetPublisherModelRequest.newBuilder()
.setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.setLanguageCode("languageCode-2092349083")
.setView(PublisherModelView.forNumber(0))
.setIsHuggingFaceModel(true)
.setHuggingFaceToken("huggingFaceToken74062599")
.setIncludeEquivalentModelGardenModelDeploymentConfigs(true)
.build();
ApiFuture<PublisherModel> future =
modelGardenServiceClient.getPublisherModelCallable().futureCall(request);
// Do something.
PublisherModel response = future.get();
}
public final ModelGardenServiceClient.ListPublisherModelsPagedResponse listPublisherModels(String parent)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String parent = "parent-995424086";
for (PublisherModel element :
modelGardenServiceClient.listPublisherModels(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The name of the Publisher from which to list the PublisherModels.
Format: `publishers/{publisher}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ModelGardenServiceClient.ListPublisherModelsPagedResponse listPublisherModels(ListPublisherModelsRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListPublisherModelsRequest request =
ListPublisherModelsRequest.newBuilder()
.setParent("parent-995424086")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(PublisherModelView.forNumber(0))
.setOrderBy("orderBy-1207110587")
.setLanguageCode("languageCode-2092349083")
.setListAllVersions(true)
.build();
for (PublisherModel element :
modelGardenServiceClient.listPublisherModels(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ModelGardenServiceClient.ListPublisherModelsPagedResponse> listPublisherModelsPagedCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListPublisherModelsRequest request =
ListPublisherModelsRequest.newBuilder()
.setParent("parent-995424086")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(PublisherModelView.forNumber(0))
.setOrderBy("orderBy-1207110587")
.setLanguageCode("languageCode-2092349083")
.setListAllVersions(true)
.build();
ApiFuture<PublisherModel> future =
modelGardenServiceClient.listPublisherModelsPagedCallable().futureCall(request);
// Do something.
for (PublisherModel element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ListPublisherModelsResponse> listPublisherModelsCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListPublisherModelsRequest request =
ListPublisherModelsRequest.newBuilder()
.setParent("parent-995424086")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(PublisherModelView.forNumber(0))
.setOrderBy("orderBy-1207110587")
.setLanguageCode("languageCode-2092349083")
.setListAllVersions(true)
.build();
while (true) {
ListPublisherModelsResponse response =
modelGardenServiceClient.listPublisherModelsCallable().call(request);
for (PublisherModel element : response.getPublisherModelsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.api.gax.longrunning.OperationFuture<DeployResponse,DeployOperationMetadata> deployAsync(DeployRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
DeployRequest request =
DeployRequest.newBuilder()
.setDestination(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModelConfig(DeployRequest.ModelConfig.newBuilder().build())
.setEndpointConfig(DeployRequest.EndpointConfig.newBuilder().build())
.setDeployConfig(DeployRequest.DeployConfig.newBuilder().build())
.build();
DeployResponse response = modelGardenServiceClient.deployAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeployRequest,DeployResponse,DeployOperationMetadata> deployOperationCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
DeployRequest request =
DeployRequest.newBuilder()
.setDestination(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModelConfig(DeployRequest.ModelConfig.newBuilder().build())
.setEndpointConfig(DeployRequest.EndpointConfig.newBuilder().build())
.setDeployConfig(DeployRequest.DeployConfig.newBuilder().build())
.build();
OperationFuture<DeployResponse, DeployOperationMetadata> future =
modelGardenServiceClient.deployOperationCallable().futureCall(request);
// Do something.
DeployResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeployRequest,com.google.longrunning.Operation> deployCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
DeployRequest request =
DeployRequest.newBuilder()
.setDestination(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setModelConfig(DeployRequest.ModelConfig.newBuilder().build())
.setEndpointConfig(DeployRequest.EndpointConfig.newBuilder().build())
.setDeployConfig(DeployRequest.DeployConfig.newBuilder().build())
.build();
ApiFuture<Operation> future = modelGardenServiceClient.deployCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
@Deprecated public final com.google.api.gax.longrunning.OperationFuture<DeployPublisherModelResponse,DeployPublisherModelOperationMetadata> deployPublisherModelAsync(DeployPublisherModelRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
DeployPublisherModelRequest request =
DeployPublisherModelRequest.newBuilder()
.setModel("model104069929")
.setDestination(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setEndpointDisplayName("endpointDisplayName697270680")
.setDedicatedResources(DedicatedResources.newBuilder().build())
.setModelDisplayName("modelDisplayName1578770308")
.setHuggingFaceAccessToken("huggingFaceAccessToken-159927933")
.setAcceptEula(true)
.build();
DeployPublisherModelResponse response =
modelGardenServiceClient.deployPublisherModelAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call fails@Deprecated public final com.google.api.gax.rpc.OperationCallable<DeployPublisherModelRequest,DeployPublisherModelResponse,DeployPublisherModelOperationMetadata> deployPublisherModelOperationCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
DeployPublisherModelRequest request =
DeployPublisherModelRequest.newBuilder()
.setModel("model104069929")
.setDestination(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setEndpointDisplayName("endpointDisplayName697270680")
.setDedicatedResources(DedicatedResources.newBuilder().build())
.setModelDisplayName("modelDisplayName1578770308")
.setHuggingFaceAccessToken("huggingFaceAccessToken-159927933")
.setAcceptEula(true)
.build();
OperationFuture<DeployPublisherModelResponse, DeployPublisherModelOperationMetadata> future =
modelGardenServiceClient.deployPublisherModelOperationCallable().futureCall(request);
// Do something.
DeployPublisherModelResponse response = future.get();
}
@Deprecated public final com.google.api.gax.rpc.UnaryCallable<DeployPublisherModelRequest,com.google.longrunning.Operation> deployPublisherModelCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
DeployPublisherModelRequest request =
DeployPublisherModelRequest.newBuilder()
.setModel("model104069929")
.setDestination(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setEndpointDisplayName("endpointDisplayName697270680")
.setDedicatedResources(DedicatedResources.newBuilder().build())
.setModelDisplayName("modelDisplayName1578770308")
.setHuggingFaceAccessToken("huggingFaceAccessToken-159927933")
.setAcceptEula(true)
.build();
ApiFuture<Operation> future =
modelGardenServiceClient.deployPublisherModelCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<ExportPublisherModelResponse,ExportPublisherModelOperationMetadata> exportPublisherModelAsync(ExportPublisherModelRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ExportPublisherModelRequest request =
ExportPublisherModelRequest.newBuilder()
.setName("name3373707")
.setDestination(GcsDestination.newBuilder().build())
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ExportPublisherModelResponse response =
modelGardenServiceClient.exportPublisherModelAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ExportPublisherModelRequest,ExportPublisherModelResponse,ExportPublisherModelOperationMetadata> exportPublisherModelOperationCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ExportPublisherModelRequest request =
ExportPublisherModelRequest.newBuilder()
.setName("name3373707")
.setDestination(GcsDestination.newBuilder().build())
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
OperationFuture<ExportPublisherModelResponse, ExportPublisherModelOperationMetadata> future =
modelGardenServiceClient.exportPublisherModelOperationCallable().futureCall(request);
// Do something.
ExportPublisherModelResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ExportPublisherModelRequest,com.google.longrunning.Operation> exportPublisherModelCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ExportPublisherModelRequest request =
ExportPublisherModelRequest.newBuilder()
.setName("name3373707")
.setDestination(GcsDestination.newBuilder().build())
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<Operation> future =
modelGardenServiceClient.exportPublisherModelCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final PublisherModelEulaAcceptance checkPublisherModelEulaAcceptance(ProjectName parent, PublisherModelName publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
PublisherModelName publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModelEulaAcceptance response =
modelGardenServiceClient.checkPublisherModelEulaAcceptance(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance checkPublisherModelEulaAcceptance(ProjectName parent, String publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString();
PublisherModelEulaAcceptance response =
modelGardenServiceClient.checkPublisherModelEulaAcceptance(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance checkPublisherModelEulaAcceptance(String parent, PublisherModelName publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
PublisherModelName publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModelEulaAcceptance response =
modelGardenServiceClient.checkPublisherModelEulaAcceptance(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance checkPublisherModelEulaAcceptance(String parent, String publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
String publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString();
PublisherModelEulaAcceptance response =
modelGardenServiceClient.checkPublisherModelEulaAcceptance(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance checkPublisherModelEulaAcceptance(CheckPublisherModelEulaAcceptanceRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
CheckPublisherModelEulaAcceptanceRequest request =
CheckPublisherModelEulaAcceptanceRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPublisherModel(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.build();
PublisherModelEulaAcceptance response =
modelGardenServiceClient.checkPublisherModelEulaAcceptance(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CheckPublisherModelEulaAcceptanceRequest,PublisherModelEulaAcceptance> checkPublisherModelEulaAcceptanceCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
CheckPublisherModelEulaAcceptanceRequest request =
CheckPublisherModelEulaAcceptanceRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPublisherModel(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.build();
ApiFuture<PublisherModelEulaAcceptance> future =
modelGardenServiceClient.checkPublisherModelEulaAcceptanceCallable().futureCall(request);
// Do something.
PublisherModelEulaAcceptance response = future.get();
}
public final PublisherModelEulaAcceptance acceptPublisherModelEula(ProjectName parent, PublisherModelName publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
PublisherModelName publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModelEulaAcceptance response =
modelGardenServiceClient.acceptPublisherModelEula(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance acceptPublisherModelEula(ProjectName parent, String publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString();
PublisherModelEulaAcceptance response =
modelGardenServiceClient.acceptPublisherModelEula(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance acceptPublisherModelEula(String parent, PublisherModelName publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
PublisherModelName publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModelEulaAcceptance response =
modelGardenServiceClient.acceptPublisherModelEula(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance acceptPublisherModelEula(String parent, String publisherModel)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
String publisherModel = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString();
PublisherModelEulaAcceptance response =
modelGardenServiceClient.acceptPublisherModelEula(parent, publisherModel);
}
parent - Required. The project requesting access for named model. The format is
`projects/{project}`.publisherModel - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`, or
`publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModelEulaAcceptance acceptPublisherModelEula(AcceptPublisherModelEulaRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
AcceptPublisherModelEulaRequest request =
AcceptPublisherModelEulaRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPublisherModel(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.build();
PublisherModelEulaAcceptance response =
modelGardenServiceClient.acceptPublisherModelEula(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<AcceptPublisherModelEulaRequest,PublisherModelEulaAcceptance> acceptPublisherModelEulaCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
AcceptPublisherModelEulaRequest request =
AcceptPublisherModelEulaRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPublisherModel(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.build();
ApiFuture<PublisherModelEulaAcceptance> future =
modelGardenServiceClient.acceptPublisherModelEulaCallable().futureCall(request);
// Do something.
PublisherModelEulaAcceptance response = future.get();
}
public final ModelGardenServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : modelGardenServiceClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ModelGardenServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
modelGardenServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
modelGardenServiceClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = modelGardenServiceClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
modelGardenServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = modelGardenServiceClient.setIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future =
modelGardenServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = modelGardenServiceClient.getIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future =
modelGardenServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = modelGardenServiceClient.testIamPermissions(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
modelGardenServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.