Class ModelServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
Model response = modelServiceClient.getModel(name);
}
Note: close() needs to be called on the ModelServiceClient 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 |
|---|---|---|
UploadModel |
Uploads a Model artifact into Vertex AI. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetModel |
Gets a 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.
|
ListModels |
Lists Models in a Location. |
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.
|
ListModelVersions |
Lists versions of the specified 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.
|
ListModelVersionCheckpoints |
Lists checkpoints of the specified model version. |
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.
|
UpdateModel |
Updates a 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.
|
UpdateExplanationDataset |
Incrementally update the dataset used for an examples model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteModel |
Deletes a Model. A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteModelVersion |
Deletes a Model version. Model version can only be deleted if there are no [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the only version in the Model is not allowed. Use [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model instead. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
MergeVersionAliases |
Merges a set of aliases for a Model version. |
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.
|
ExportModel |
Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one [supported export format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CopyModel |
Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportModelEvaluation |
Imports an externally generated ModelEvaluation. |
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.
|
BatchImportModelEvaluationSlices |
Imports a list of externally generated ModelEvaluationSlice. |
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.
|
BatchImportEvaluatedAnnotations |
Imports a list of externally generated EvaluatedAnnotations. |
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.
|
GetModelEvaluation |
Gets a ModelEvaluation. |
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.
|
ListModelEvaluations |
Lists ModelEvaluations in a 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.
|
GetModelEvaluationSlice |
Gets a ModelEvaluationSlice. |
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.
|
ListModelEvaluationSlices |
Lists ModelEvaluationSlices in a ModelEvaluation. |
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.
|
RecommendSpec |
Gets a Model's spec recommendations. |
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.
|
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 ModelServiceSettings 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
ModelServiceSettings modelServiceSettings =
ModelServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings);
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
ModelServiceSettings modelServiceSettings =
ModelServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedModelServiceClient(ModelServiceSettings settings) Constructs an instance of ModelServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) Imports a list of externally generated EvaluatedAnnotations.batchImportEvaluatedAnnotations(ModelEvaluationSliceName parent, List<EvaluatedAnnotation> evaluatedAnnotations) Imports a list of externally generated EvaluatedAnnotations.batchImportEvaluatedAnnotations(String parent, List<EvaluatedAnnotation> evaluatedAnnotations) Imports a list of externally generated EvaluatedAnnotations.Imports a list of externally generated EvaluatedAnnotations.Imports a list of externally generated ModelEvaluationSlice.batchImportModelEvaluationSlices(ModelEvaluationName parent, List<ModelEvaluationSlice> modelEvaluationSlices) Imports a list of externally generated ModelEvaluationSlice.batchImportModelEvaluationSlices(String parent, List<ModelEvaluationSlice> modelEvaluationSlices) Imports a list of externally generated ModelEvaluationSlice.final UnaryCallable<BatchImportModelEvaluationSlicesRequest,BatchImportModelEvaluationSlicesResponse> Imports a list of externally generated ModelEvaluationSlice.final voidclose()copyModelAsync(CopyModelRequest request) Copies an already existing Vertex AI Model into the specified Location.copyModelAsync(LocationName parent, ModelName sourceModel) Copies an already existing Vertex AI Model into the specified Location.copyModelAsync(LocationName parent, String sourceModel) Copies an already existing Vertex AI Model into the specified Location.copyModelAsync(String parent, ModelName sourceModel) Copies an already existing Vertex AI Model into the specified Location.copyModelAsync(String parent, String sourceModel) Copies an already existing Vertex AI Model into the specified Location.Copies an already existing Vertex AI Model into the specified Location.Copies an already existing Vertex AI Model into the specified Location.static final ModelServiceClientcreate()Constructs an instance of ModelServiceClient with default settings.static final ModelServiceClientcreate(ModelServiceSettings settings) Constructs an instance of ModelServiceClient, using the given settings.static final ModelServiceClientcreate(ModelServiceStub stub) Constructs an instance of ModelServiceClient, using the given stub for making calls.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelAsync(DeleteModelRequest request) Deletes a Model.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelAsync(ModelName name) Deletes a Model.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelAsync(String name) Deletes a Model.Deletes a Model.final OperationCallable<DeleteModelRequest,com.google.protobuf.Empty, DeleteOperationMetadata> Deletes a Model.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> Deletes a Model version.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> Deletes a Model version.final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> Deletes a Model version.Deletes a Model version.final OperationCallable<DeleteModelVersionRequest,com.google.protobuf.Empty, DeleteOperationMetadata> Deletes a Model version.exportModelAsync(ExportModelRequest request) Exports a trained, exportable Model to a location specified by the user.exportModelAsync(ModelName name, ExportModelRequest.OutputConfig outputConfig) Exports a trained, exportable Model to a location specified by the user.exportModelAsync(String name, ExportModelRequest.OutputConfig outputConfig) Exports a trained, exportable Model to a location specified by the user.Exports a trained, exportable Model to a location specified by the user.Exports a trained, exportable Model to a location specified by the user.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final ModelgetModel(GetModelRequest request) Gets a Model.final ModelGets a Model.final ModelGets a Model.final UnaryCallable<GetModelRequest,Model> Gets a Model.final ModelEvaluationGets a ModelEvaluation.final ModelEvaluationGets a ModelEvaluation.final ModelEvaluationgetModelEvaluation(String name) Gets a ModelEvaluation.Gets a ModelEvaluation.final ModelEvaluationSliceGets a ModelEvaluationSlice.final ModelEvaluationSliceGets a ModelEvaluationSlice.final ModelEvaluationSliceGets a ModelEvaluationSlice.Gets a ModelEvaluationSlice.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final ModelServiceSettingsgetStub()final ModelEvaluationImports an externally generated ModelEvaluation.final ModelEvaluationimportModelEvaluation(ModelName parent, ModelEvaluation modelEvaluation) Imports an externally generated ModelEvaluation.final ModelEvaluationimportModelEvaluation(String parent, ModelEvaluation modelEvaluation) Imports an externally generated ModelEvaluation.Imports an externally generated ModelEvaluation.booleanbooleanlistLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists ModelEvaluations in a Model.listModelEvaluations(ModelName parent) Lists ModelEvaluations in a Model.listModelEvaluations(String parent) Lists ModelEvaluations in a Model.Lists ModelEvaluations in a Model.Lists ModelEvaluationSlices in a ModelEvaluation.Lists ModelEvaluationSlices in a ModelEvaluation.listModelEvaluationSlices(String parent) Lists ModelEvaluationSlices in a ModelEvaluation.Lists ModelEvaluationSlices in a ModelEvaluation.final UnaryCallable<ListModelEvaluationSlicesRequest,ModelServiceClient.ListModelEvaluationSlicesPagedResponse> Lists ModelEvaluationSlices in a ModelEvaluation.final UnaryCallable<ListModelEvaluationsRequest,ModelServiceClient.ListModelEvaluationsPagedResponse> Lists ModelEvaluations in a Model.listModels(ListModelsRequest request) Lists Models in a Location.listModels(LocationName parent) Lists Models in a Location.listModels(String parent) Lists Models in a Location.Lists Models in a Location.Lists Models in a Location.Lists checkpoints of the specified model version.Lists checkpoints of the specified model version.Lists checkpoints of the specified model version.Lists checkpoints of the specified model version.final UnaryCallable<ListModelVersionCheckpointsRequest,ModelServiceClient.ListModelVersionCheckpointsPagedResponse> Lists checkpoints of the specified model version.Lists versions of the specified model.listModelVersions(ModelName name) Lists versions of the specified model.listModelVersions(String name) Lists versions of the specified model.Lists versions of the specified model.Lists versions of the specified model.final ModelMerges a set of aliases for a Model version.final ModelmergeVersionAliases(ModelName name, List<String> versionAliases) Merges a set of aliases for a Model version.final ModelmergeVersionAliases(String name, List<String> versionAliases) Merges a set of aliases for a Model version.Merges a set of aliases for a Model version.final RecommendSpecResponserecommendSpec(RecommendSpecRequest request) Gets a Model's spec recommendations.Gets a Model's spec recommendations.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidReturns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.Incrementally update the dataset used for an examples model.Incrementally update the dataset used for an examples model.Incrementally update the dataset used for an examples model.Incrementally update the dataset used for an examples model.final OperationCallable<UpdateExplanationDatasetRequest,UpdateExplanationDatasetResponse, UpdateExplanationDatasetOperationMetadata> Incrementally update the dataset used for an examples model.final ModelupdateModel(Model model, com.google.protobuf.FieldMask updateMask) Updates a Model.final ModelupdateModel(UpdateModelRequest request) Updates a Model.final UnaryCallable<UpdateModelRequest,Model> Updates a Model.uploadModelAsync(LocationName parent, Model model) Uploads a Model artifact into Vertex AI.uploadModelAsync(UploadModelRequest request) Uploads a Model artifact into Vertex AI.uploadModelAsync(String parent, Model model) Uploads a Model artifact into Vertex AI.Uploads a Model artifact into Vertex AI.Uploads a Model artifact into Vertex AI.
-
Constructor Details
-
ModelServiceClient
Constructs an instance of ModelServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
ModelServiceClient
-
-
Method Details
-
create
Constructs an instance of ModelServiceClient with default settings.- Throws:
IOException
-
create
Constructs an instance of ModelServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of ModelServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ModelServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
uploadModelAsync
public final OperationFuture<UploadModelResponse,UploadModelOperationMetadata> uploadModelAsync(LocationName parent, Model model) Uploads a Model artifact into Vertex AI.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Model model = Model.newBuilder().build(); UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); }- Parameters:
parent- Required. The resource name of the Location into which to upload the Model. Format: `projects/{project}/locations/{location}`model- Required. The Model to create.- Throws:
ApiException- if the remote call fails
-
uploadModelAsync
public final OperationFuture<UploadModelResponse,UploadModelOperationMetadata> uploadModelAsync(String parent, Model model) Uploads a Model artifact into Vertex AI.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Model model = Model.newBuilder().build(); UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get(); }- Parameters:
parent- Required. The resource name of the Location into which to upload the Model. Format: `projects/{project}/locations/{location}`model- Required. The Model to create.- Throws:
ApiException- if the remote call fails
-
uploadModelAsync
public final OperationFuture<UploadModelResponse,UploadModelOperationMetadata> uploadModelAsync(UploadModelRequest request) Uploads a Model artifact into Vertex AI.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UploadModelRequest request = UploadModelRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setParentModel("parentModel998431903") .setModelId("modelId1226956324") .setModel(Model.newBuilder().build()) .setServiceAccount("serviceAccount1079137720") .build(); UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
uploadModelOperationCallable
public final OperationCallable<UploadModelRequest,UploadModelResponse, uploadModelOperationCallable()UploadModelOperationMetadata> Uploads a Model artifact into Vertex AI.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UploadModelRequest request = UploadModelRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setParentModel("parentModel998431903") .setModelId("modelId1226956324") .setModel(Model.newBuilder().build()) .setServiceAccount("serviceAccount1079137720") .build(); OperationFuture<UploadModelResponse, UploadModelOperationMetadata> future = modelServiceClient.uploadModelOperationCallable().futureCall(request); // Do something. UploadModelResponse response = future.get(); } -
uploadModelCallable
Uploads a Model artifact into Vertex AI.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UploadModelRequest request = UploadModelRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setParentModel("parentModel998431903") .setModelId("modelId1226956324") .setModel(Model.newBuilder().build()) .setServiceAccount("serviceAccount1079137720") .build(); ApiFuture<Operation> future = modelServiceClient.uploadModelCallable().futureCall(request); // Do something. Operation response = future.get(); } -
getModel
Gets a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); Model response = modelServiceClient.getModel(name); }- Parameters:
name- Required. The name of the Model resource. Format: `projects/{project}/locations/{location}/models/{model}`In order to retrieve a specific version of the model, also provide the version ID or version alias. Example: `projects/{project}/locations/{location}/models/{model}@2` or `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is specified, the "default" version will be returned. The "default" version alias is created for the first version of the model, and can be moved to other versions later on. There will be exactly one default version.
- Throws:
ApiException- if the remote call fails
-
getModel
Gets a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); Model response = modelServiceClient.getModel(name); }- Parameters:
name- Required. The name of the Model resource. Format: `projects/{project}/locations/{location}/models/{model}`In order to retrieve a specific version of the model, also provide the version ID or version alias. Example: `projects/{project}/locations/{location}/models/{model}@2` or `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is specified, the "default" version will be returned. The "default" version alias is created for the first version of the model, and can be moved to other versions later on. There will be exactly one default version.
- Throws:
ApiException- if the remote call fails
-
getModel
Gets a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetModelRequest request = GetModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); Model response = modelServiceClient.getModel(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getModelCallable
Gets a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetModelRequest request = GetModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); ApiFuture<Model> future = modelServiceClient.getModelCallable().futureCall(request); // Do something. Model response = future.get(); } -
listModels
Lists Models in a Location.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Model element : modelServiceClient.listModels(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Location to list the Models from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
listModels
Lists Models in a Location.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Model element : modelServiceClient.listModels(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Location to list the Models from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
listModels
Lists Models in a Location.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelsRequest request = ListModelsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); for (Model element : modelServiceClient.listModels(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listModelsPagedCallable
public final UnaryCallable<ListModelsRequest,ModelServiceClient.ListModelsPagedResponse> listModelsPagedCallable()Lists Models in a Location.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelsRequest request = ListModelsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Model> future = modelServiceClient.listModelsPagedCallable().futureCall(request); // Do something. for (Model element : future.get().iterateAll()) { // doThingsWith(element); } } -
listModelsCallable
Lists Models in a Location.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelsRequest request = ListModelsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); while (true) { ListModelsResponse response = modelServiceClient.listModelsCallable().call(request); for (Model element : response.getModelsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
listModelVersions
Lists versions of the specified model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the model to list versions for.- Throws:
ApiException- if the remote call fails
-
listModelVersions
Lists versions of the specified model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the model to list versions for.- Throws:
ApiException- if the remote call fails
-
listModelVersions
public final ModelServiceClient.ListModelVersionsPagedResponse listModelVersions(ListModelVersionsRequest request) Lists versions of the specified model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelVersionsRequest request = ListModelVersionsRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setReadMask(FieldMask.newBuilder().build()) .setOrderBy("orderBy-1207110587") .build(); for (Model element : modelServiceClient.listModelVersions(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listModelVersionsPagedCallable
public final UnaryCallable<ListModelVersionsRequest,ModelServiceClient.ListModelVersionsPagedResponse> listModelVersionsPagedCallable()Lists versions of the specified model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelVersionsRequest request = ListModelVersionsRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setReadMask(FieldMask.newBuilder().build()) .setOrderBy("orderBy-1207110587") .build(); ApiFuture<Model> future = modelServiceClient.listModelVersionsPagedCallable().futureCall(request); // Do something. for (Model element : future.get().iterateAll()) { // doThingsWith(element); } } -
listModelVersionsCallable
public final UnaryCallable<ListModelVersionsRequest,ListModelVersionsResponse> listModelVersionsCallable()Lists versions of the specified model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelVersionsRequest request = ListModelVersionsRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setReadMask(FieldMask.newBuilder().build()) .setOrderBy("orderBy-1207110587") .build(); while (true) { ListModelVersionsResponse response = modelServiceClient.listModelVersionsCallable().call(request); for (Model element : response.getModelsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
listModelVersionCheckpoints
public final ModelServiceClient.ListModelVersionCheckpointsPagedResponse listModelVersionCheckpoints(ModelName name) Lists checkpoints of the specified model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); for (ModelVersionCheckpoint element : modelServiceClient.listModelVersionCheckpoints(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the model version to list checkpoints for. `projects/{project}/locations/{location}/models/{model}@{version}` Example: `projects/{project}/locations/{location}/models/{model}@2` or `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is specified, the latest version will be used.- Throws:
ApiException- if the remote call fails
-
listModelVersionCheckpoints
public final ModelServiceClient.ListModelVersionCheckpointsPagedResponse listModelVersionCheckpoints(String name) Lists checkpoints of the specified model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); for (ModelVersionCheckpoint element : modelServiceClient.listModelVersionCheckpoints(name).iterateAll()) { // doThingsWith(element); } }- Parameters:
name- Required. The name of the model version to list checkpoints for. `projects/{project}/locations/{location}/models/{model}@{version}` Example: `projects/{project}/locations/{location}/models/{model}@2` or `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is specified, the latest version will be used.- Throws:
ApiException- if the remote call fails
-
listModelVersionCheckpoints
public final ModelServiceClient.ListModelVersionCheckpointsPagedResponse listModelVersionCheckpoints(ListModelVersionCheckpointsRequest request) Lists checkpoints of the specified model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelVersionCheckpointsRequest request = ListModelVersionCheckpointsRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (ModelVersionCheckpoint element : modelServiceClient.listModelVersionCheckpoints(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listModelVersionCheckpointsPagedCallable
public final UnaryCallable<ListModelVersionCheckpointsRequest,ModelServiceClient.ListModelVersionCheckpointsPagedResponse> listModelVersionCheckpointsPagedCallable()Lists checkpoints of the specified model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelVersionCheckpointsRequest request = ListModelVersionCheckpointsRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<ModelVersionCheckpoint> future = modelServiceClient.listModelVersionCheckpointsPagedCallable().futureCall(request); // Do something. for (ModelVersionCheckpoint element : future.get().iterateAll()) { // doThingsWith(element); } } -
listModelVersionCheckpointsCallable
public final UnaryCallable<ListModelVersionCheckpointsRequest,ListModelVersionCheckpointsResponse> listModelVersionCheckpointsCallable()Lists checkpoints of the specified model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelVersionCheckpointsRequest request = ListModelVersionCheckpointsRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListModelVersionCheckpointsResponse response = modelServiceClient.listModelVersionCheckpointsCallable().call(request); for (ModelVersionCheckpoint element : response.getCheckpointsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
updateModel
Updates a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { Model model = Model.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Model response = modelServiceClient.updateModel(model, updateMask); }- Parameters:
model- Required. The Model which replaces the resource on the server. When Model Versioning is enabled, the model.name will be used to determine whether to update the model or model version. 1. model.name with the @ value, e.g. models/123@1, refers to a version specific update. 2. model.name without the @ value, e.g. models/123, refers to a model update. 3. model.name with @-, e.g. models/123@-, refers to a model update. 4. Supported model fields: display_name, description; supported version-specific fields: version_description. Labels are supported in both scenarios. Both the model labels and the version labels are merged when a model is returned. When updating labels, if the request is for model-specific update, model label gets updated. Otherwise, version labels get updated. 5. A model name or model version name fields update mismatch will cause a precondition error. 6. One request cannot update both the model and the version fields. You must update them separately.updateMask- Required. The update mask applies to the resource. For the `FieldMask` definition, see [google.protobuf.FieldMask][google.protobuf.FieldMask].- Throws:
ApiException- if the remote call fails
-
updateModel
Updates a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UpdateModelRequest request = UpdateModelRequest.newBuilder() .setModel(Model.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Model response = modelServiceClient.updateModel(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateModelCallable
Updates a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UpdateModelRequest request = UpdateModelRequest.newBuilder() .setModel(Model.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Model> future = modelServiceClient.updateModelCallable().futureCall(request); // Do something. Model response = future.get(); } -
updateExplanationDatasetAsync
public final OperationFuture<UpdateExplanationDatasetResponse,UpdateExplanationDatasetOperationMetadata> updateExplanationDatasetAsync(ModelName model) Incrementally update the dataset used for an examples model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); UpdateExplanationDatasetResponse response = modelServiceClient.updateExplanationDatasetAsync(model).get(); }- Parameters:
model- Required. The resource name of the Model to update. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
updateExplanationDatasetAsync
public final OperationFuture<UpdateExplanationDatasetResponse,UpdateExplanationDatasetOperationMetadata> updateExplanationDatasetAsync(String model) Incrementally update the dataset used for an examples model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String model = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); UpdateExplanationDatasetResponse response = modelServiceClient.updateExplanationDatasetAsync(model).get(); }- Parameters:
model- Required. The resource name of the Model to update. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
updateExplanationDatasetAsync
public final OperationFuture<UpdateExplanationDatasetResponse,UpdateExplanationDatasetOperationMetadata> updateExplanationDatasetAsync(UpdateExplanationDatasetRequest request) Incrementally update the dataset used for an examples model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UpdateExplanationDatasetRequest request = UpdateExplanationDatasetRequest.newBuilder() .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setExamples(Examples.newBuilder().build()) .build(); UpdateExplanationDatasetResponse response = modelServiceClient.updateExplanationDatasetAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateExplanationDatasetOperationCallable
public final OperationCallable<UpdateExplanationDatasetRequest,UpdateExplanationDatasetResponse, updateExplanationDatasetOperationCallable()UpdateExplanationDatasetOperationMetadata> Incrementally update the dataset used for an examples model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UpdateExplanationDatasetRequest request = UpdateExplanationDatasetRequest.newBuilder() .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setExamples(Examples.newBuilder().build()) .build(); OperationFuture<UpdateExplanationDatasetResponse, UpdateExplanationDatasetOperationMetadata> future = modelServiceClient.updateExplanationDatasetOperationCallable().futureCall(request); // Do something. UpdateExplanationDatasetResponse response = future.get(); } -
updateExplanationDatasetCallable
public final UnaryCallable<UpdateExplanationDatasetRequest,Operation> updateExplanationDatasetCallable()Incrementally update the dataset used for an examples model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { UpdateExplanationDatasetRequest request = UpdateExplanationDatasetRequest.newBuilder() .setModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setExamples(Examples.newBuilder().build()) .build(); ApiFuture<Operation> future = modelServiceClient.updateExplanationDatasetCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deleteModelAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelAsync(ModelName name) Deletes a Model.A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); modelServiceClient.deleteModelAsync(name).get(); }- Parameters:
name- Required. The name of the Model resource to be deleted. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
deleteModelAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelAsync(String name) Deletes a Model.A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); modelServiceClient.deleteModelAsync(name).get(); }- Parameters:
name- Required. The name of the Model resource to be deleted. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
deleteModelAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelAsync(DeleteModelRequest request) Deletes a Model.A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { DeleteModelRequest request = DeleteModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); modelServiceClient.deleteModelAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteModelOperationCallable
public final OperationCallable<DeleteModelRequest,com.google.protobuf.Empty, deleteModelOperationCallable()DeleteOperationMetadata> Deletes a Model.A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { DeleteModelRequest request = DeleteModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); OperationFuture<Empty, DeleteOperationMetadata> future = modelServiceClient.deleteModelOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteModelCallable
Deletes a Model.A model cannot be deleted if any [Endpoint][google.cloud.aiplatform.v1beta1.Endpoint] resource has a [DeployedModel][google.cloud.aiplatform.v1beta1.DeployedModel] based on the model in its [deployed_models][google.cloud.aiplatform.v1beta1.Endpoint.deployed_models] field.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { DeleteModelRequest request = DeleteModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); ApiFuture<Operation> future = modelServiceClient.deleteModelCallable().futureCall(request); // Do something. future.get(); } -
deleteModelVersionAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelVersionAsync(ModelName name) Deletes a Model version.Model version can only be deleted if there are no [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the only version in the Model is not allowed. Use [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model instead.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); modelServiceClient.deleteModelVersionAsync(name).get(); }- Parameters:
name- Required. The name of the model version to be deleted, with a version ID explicitly included.Example: `projects/{project}/locations/{location}/models/{model}@1234`
- Throws:
ApiException- if the remote call fails
-
deleteModelVersionAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelVersionAsync(String name) Deletes a Model version.Model version can only be deleted if there are no [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the only version in the Model is not allowed. Use [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model instead.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); modelServiceClient.deleteModelVersionAsync(name).get(); }- Parameters:
name- Required. The name of the model version to be deleted, with a version ID explicitly included.Example: `projects/{project}/locations/{location}/models/{model}@1234`
- Throws:
ApiException- if the remote call fails
-
deleteModelVersionAsync
public final OperationFuture<com.google.protobuf.Empty,DeleteOperationMetadata> deleteModelVersionAsync(DeleteModelVersionRequest request) Deletes a Model version.Model version can only be deleted if there are no [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the only version in the Model is not allowed. Use [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model instead.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { DeleteModelVersionRequest request = DeleteModelVersionRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); modelServiceClient.deleteModelVersionAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteModelVersionOperationCallable
public final OperationCallable<DeleteModelVersionRequest,com.google.protobuf.Empty, deleteModelVersionOperationCallable()DeleteOperationMetadata> Deletes a Model version.Model version can only be deleted if there are no [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the only version in the Model is not allowed. Use [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model instead.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { DeleteModelVersionRequest request = DeleteModelVersionRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); OperationFuture<Empty, DeleteOperationMetadata> future = modelServiceClient.deleteModelVersionOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteModelVersionCallable
Deletes a Model version.Model version can only be deleted if there are no [DeployedModels][google.cloud.aiplatform.v1beta1.DeployedModel] created from it. Deleting the only version in the Model is not allowed. Use [DeleteModel][google.cloud.aiplatform.v1beta1.ModelService.DeleteModel] for deleting the Model instead.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { DeleteModelVersionRequest request = DeleteModelVersionRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .build(); ApiFuture<Operation> future = modelServiceClient.deleteModelVersionCallable().futureCall(request); // Do something. future.get(); } -
mergeVersionAliases
Merges a set of aliases for a Model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); List<String> versionAliases = new ArrayList<>(); Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); }- Parameters:
name- Required. The name of the model version to merge aliases, with a version ID explicitly included.Example: `projects/{project}/locations/{location}/models/{model}@1234`
versionAliases- Required. The set of version aliases to merge. The alias should be at most 128 characters, and match `[a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to an alias means removing that alias from the version. `-` is NOT counted in the 128 characters. Example: `-golden` means removing the `golden` alias from the version.There is NO ordering in aliases, which means 1) The aliases returned from GetModel API might not have the exactly same order from this MergeVersionAliases API. 2) Adding and deleting the same alias in the request is not recommended, and the 2 operations will be cancelled out.
- Throws:
ApiException- if the remote call fails
-
mergeVersionAliases
Merges a set of aliases for a Model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); List<String> versionAliases = new ArrayList<>(); Model response = modelServiceClient.mergeVersionAliases(name, versionAliases); }- Parameters:
name- Required. The name of the model version to merge aliases, with a version ID explicitly included.Example: `projects/{project}/locations/{location}/models/{model}@1234`
versionAliases- Required. The set of version aliases to merge. The alias should be at most 128 characters, and match `[a-z][a-zA-Z0-9-]{0,126}[a-z-0-9]`. Add the `-` prefix to an alias means removing that alias from the version. `-` is NOT counted in the 128 characters. Example: `-golden` means removing the `golden` alias from the version.There is NO ordering in aliases, which means 1) The aliases returned from GetModel API might not have the exactly same order from this MergeVersionAliases API. 2) Adding and deleting the same alias in the request is not recommended, and the 2 operations will be cancelled out.
- Throws:
ApiException- if the remote call fails
-
mergeVersionAliases
Merges a set of aliases for a Model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { MergeVersionAliasesRequest request = MergeVersionAliasesRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .addAllVersionAliases(new ArrayList<String>()) .build(); Model response = modelServiceClient.mergeVersionAliases(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
mergeVersionAliasesCallable
Merges a set of aliases for a Model version.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { MergeVersionAliasesRequest request = MergeVersionAliasesRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .addAllVersionAliases(new ArrayList<String>()) .build(); ApiFuture<Model> future = modelServiceClient.mergeVersionAliasesCallable().futureCall(request); // Do something. Model response = future.get(); } -
exportModelAsync
public final OperationFuture<ExportModelResponse,ExportModelOperationMetadata> exportModelAsync(ModelName name, ExportModelRequest.OutputConfig outputConfig) Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one [supported export format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats].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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); ExportModelRequest.OutputConfig outputConfig = ExportModelRequest.OutputConfig.newBuilder().build(); ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); }- Parameters:
name- Required. The resource name of the Model to export. The resource name may contain version id or version alias to specify the version, if no version is specified, the default version will be exported.outputConfig- Required. The desired output location and configuration.- Throws:
ApiException- if the remote call fails
-
exportModelAsync
public final OperationFuture<ExportModelResponse,ExportModelOperationMetadata> exportModelAsync(String name, ExportModelRequest.OutputConfig outputConfig) Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one [supported export format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats].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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); ExportModelRequest.OutputConfig outputConfig = ExportModelRequest.OutputConfig.newBuilder().build(); ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get(); }- Parameters:
name- Required. The resource name of the Model to export. The resource name may contain version id or version alias to specify the version, if no version is specified, the default version will be exported.outputConfig- Required. The desired output location and configuration.- Throws:
ApiException- if the remote call fails
-
exportModelAsync
public final OperationFuture<ExportModelResponse,ExportModelOperationMetadata> exportModelAsync(ExportModelRequest request) Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one [supported export format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats].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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ExportModelRequest request = ExportModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) .build(); ExportModelResponse response = modelServiceClient.exportModelAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
exportModelOperationCallable
public final OperationCallable<ExportModelRequest,ExportModelResponse, exportModelOperationCallable()ExportModelOperationMetadata> Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one [supported export format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats].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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ExportModelRequest request = ExportModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) .build(); OperationFuture<ExportModelResponse, ExportModelOperationMetadata> future = modelServiceClient.exportModelOperationCallable().futureCall(request); // Do something. ExportModelResponse response = future.get(); } -
exportModelCallable
Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one [supported export format][google.cloud.aiplatform.v1beta1.Model.supported_export_formats].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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ExportModelRequest request = ExportModelRequest.newBuilder() .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build()) .build(); ApiFuture<Operation> future = modelServiceClient.exportModelCallable().futureCall(request); // Do something. Operation response = future.get(); } -
copyModelAsync
public final OperationFuture<CopyModelResponse,CopyModelOperationMetadata> copyModelAsync(LocationName parent, ModelName sourceModel) Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); }- Parameters:
parent- Required. The resource name of the Location into which to copy the Model. Format: `projects/{project}/locations/{location}`sourceModel- Required. The resource name of the Model to copy. That Model must be in the same Project. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
copyModelAsync
public final OperationFuture<CopyModelResponse,CopyModelOperationMetadata> copyModelAsync(LocationName parent, String sourceModel) Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); }- Parameters:
parent- Required. The resource name of the Location into which to copy the Model. Format: `projects/{project}/locations/{location}`sourceModel- Required. The resource name of the Model to copy. That Model must be in the same Project. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
copyModelAsync
public final OperationFuture<CopyModelResponse,CopyModelOperationMetadata> copyModelAsync(String parent, ModelName sourceModel) Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); ModelName sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); }- Parameters:
parent- Required. The resource name of the Location into which to copy the Model. Format: `projects/{project}/locations/{location}`sourceModel- Required. The resource name of the Model to copy. That Model must be in the same Project. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
copyModelAsync
public final OperationFuture<CopyModelResponse,CopyModelOperationMetadata> copyModelAsync(String parent, String sourceModel) Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); String sourceModel = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); CopyModelResponse response = modelServiceClient.copyModelAsync(parent, sourceModel).get(); }- Parameters:
parent- Required. The resource name of the Location into which to copy the Model. Format: `projects/{project}/locations/{location}`sourceModel- Required. The resource name of the Model to copy. That Model must be in the same Project. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
copyModelAsync
public final OperationFuture<CopyModelResponse,CopyModelOperationMetadata> copyModelAsync(CopyModelRequest request) Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { CopyModelRequest request = CopyModelRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setEncryptionSpec(EncryptionSpec.newBuilder().build()) .setCustomServiceAccount("customServiceAccount-2110106743") .build(); CopyModelResponse response = modelServiceClient.copyModelAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
copyModelOperationCallable
public final OperationCallable<CopyModelRequest,CopyModelResponse, copyModelOperationCallable()CopyModelOperationMetadata> Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { CopyModelRequest request = CopyModelRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setEncryptionSpec(EncryptionSpec.newBuilder().build()) .setCustomServiceAccount("customServiceAccount-2110106743") .build(); OperationFuture<CopyModelResponse, CopyModelOperationMetadata> future = modelServiceClient.copyModelOperationCallable().futureCall(request); // Do something. CopyModelResponse response = future.get(); } -
copyModelCallable
Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for [Model.metadata][google.cloud.aiplatform.v1beta1.Model.metadata] content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { CopyModelRequest request = CopyModelRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setSourceModel(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setEncryptionSpec(EncryptionSpec.newBuilder().build()) .setCustomServiceAccount("customServiceAccount-2110106743") .build(); ApiFuture<Operation> future = modelServiceClient.copyModelCallable().futureCall(request); // Do something. Operation response = future.get(); } -
importModelEvaluation
public final ModelEvaluation importModelEvaluation(ModelName parent, ModelEvaluation modelEvaluation) Imports an externally generated ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); }- Parameters:
parent- Required. The name of the parent model resource. Format: `projects/{project}/locations/{location}/models/{model}`modelEvaluation- Required. Model evaluation resource to be imported.- Throws:
ApiException- if the remote call fails
-
importModelEvaluation
Imports an externally generated ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build(); ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation); }- Parameters:
parent- Required. The name of the parent model resource. Format: `projects/{project}/locations/{location}/models/{model}`modelEvaluation- Required. Model evaluation resource to be imported.- Throws:
ApiException- if the remote call fails
-
importModelEvaluation
Imports an externally generated ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ImportModelEvaluationRequest request = ImportModelEvaluationRequest.newBuilder() .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setModelEvaluation(ModelEvaluation.newBuilder().build()) .build(); ModelEvaluation response = modelServiceClient.importModelEvaluation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
importModelEvaluationCallable
public final UnaryCallable<ImportModelEvaluationRequest,ModelEvaluation> importModelEvaluationCallable()Imports an externally generated ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ImportModelEvaluationRequest request = ImportModelEvaluationRequest.newBuilder() .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setModelEvaluation(ModelEvaluation.newBuilder().build()) .build(); ApiFuture<ModelEvaluation> future = modelServiceClient.importModelEvaluationCallable().futureCall(request); // Do something. ModelEvaluation response = future.get(); } -
batchImportModelEvaluationSlices
public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices(ModelEvaluationName parent, List<ModelEvaluationSlice> modelEvaluationSlices) Imports a list of externally generated ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelEvaluationName parent = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); List<ModelEvaluationSlice> modelEvaluationSlices = new ArrayList<>(); BatchImportModelEvaluationSlicesResponse response = modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); }- Parameters:
parent- Required. The name of the parent ModelEvaluation resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`modelEvaluationSlices- Required. Model evaluation slice resource to be imported.- Throws:
ApiException- if the remote call fails
-
batchImportModelEvaluationSlices
public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices(String parent, List<ModelEvaluationSlice> modelEvaluationSlices) Imports a list of externally generated ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); List<ModelEvaluationSlice> modelEvaluationSlices = new ArrayList<>(); BatchImportModelEvaluationSlicesResponse response = modelServiceClient.batchImportModelEvaluationSlices(parent, modelEvaluationSlices); }- Parameters:
parent- Required. The name of the parent ModelEvaluation resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`modelEvaluationSlices- Required. Model evaluation slice resource to be imported.- Throws:
ApiException- if the remote call fails
-
batchImportModelEvaluationSlices
public final BatchImportModelEvaluationSlicesResponse batchImportModelEvaluationSlices(BatchImportModelEvaluationSlicesRequest request) Imports a list of externally generated ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { BatchImportModelEvaluationSlicesRequest request = BatchImportModelEvaluationSlicesRequest.newBuilder() .setParent( ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") .toString()) .addAllModelEvaluationSlices(new ArrayList<ModelEvaluationSlice>()) .build(); BatchImportModelEvaluationSlicesResponse response = modelServiceClient.batchImportModelEvaluationSlices(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
batchImportModelEvaluationSlicesCallable
public final UnaryCallable<BatchImportModelEvaluationSlicesRequest,BatchImportModelEvaluationSlicesResponse> batchImportModelEvaluationSlicesCallable()Imports a list of externally generated ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { BatchImportModelEvaluationSlicesRequest request = BatchImportModelEvaluationSlicesRequest.newBuilder() .setParent( ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") .toString()) .addAllModelEvaluationSlices(new ArrayList<ModelEvaluationSlice>()) .build(); ApiFuture<BatchImportModelEvaluationSlicesResponse> future = modelServiceClient.batchImportModelEvaluationSlicesCallable().futureCall(request); // Do something. BatchImportModelEvaluationSlicesResponse response = future.get(); } -
batchImportEvaluatedAnnotations
public final BatchImportEvaluatedAnnotationsResponse batchImportEvaluatedAnnotations(ModelEvaluationSliceName parent, List<EvaluatedAnnotation> evaluatedAnnotations) Imports a list of externally generated EvaluatedAnnotations.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelEvaluationSliceName parent = ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); List<EvaluatedAnnotation> evaluatedAnnotations = new ArrayList<>(); BatchImportEvaluatedAnnotationsResponse response = modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); }- Parameters:
parent- Required. The name of the parent ModelEvaluationSlice resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}`evaluatedAnnotations- Required. Evaluated annotations resource to be imported.- Throws:
ApiException- if the remote call fails
-
batchImportEvaluatedAnnotations
public final BatchImportEvaluatedAnnotationsResponse batchImportEvaluatedAnnotations(String parent, List<EvaluatedAnnotation> evaluatedAnnotations) Imports a list of externally generated EvaluatedAnnotations.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") .toString(); List<EvaluatedAnnotation> evaluatedAnnotations = new ArrayList<>(); BatchImportEvaluatedAnnotationsResponse response = modelServiceClient.batchImportEvaluatedAnnotations(parent, evaluatedAnnotations); }- Parameters:
parent- Required. The name of the parent ModelEvaluationSlice resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}`evaluatedAnnotations- Required. Evaluated annotations resource to be imported.- Throws:
ApiException- if the remote call fails
-
batchImportEvaluatedAnnotations
public final BatchImportEvaluatedAnnotationsResponse batchImportEvaluatedAnnotations(BatchImportEvaluatedAnnotationsRequest request) Imports a list of externally generated EvaluatedAnnotations.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { BatchImportEvaluatedAnnotationsRequest request = BatchImportEvaluatedAnnotationsRequest.newBuilder() .setParent( ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") .toString()) .addAllEvaluatedAnnotations(new ArrayList<EvaluatedAnnotation>()) .build(); BatchImportEvaluatedAnnotationsResponse response = modelServiceClient.batchImportEvaluatedAnnotations(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
batchImportEvaluatedAnnotationsCallable
public final UnaryCallable<BatchImportEvaluatedAnnotationsRequest,BatchImportEvaluatedAnnotationsResponse> batchImportEvaluatedAnnotationsCallable()Imports a list of externally generated EvaluatedAnnotations.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { BatchImportEvaluatedAnnotationsRequest request = BatchImportEvaluatedAnnotationsRequest.newBuilder() .setParent( ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") .toString()) .addAllEvaluatedAnnotations(new ArrayList<EvaluatedAnnotation>()) .build(); ApiFuture<BatchImportEvaluatedAnnotationsResponse> future = modelServiceClient.batchImportEvaluatedAnnotationsCallable().futureCall(request); // Do something. BatchImportEvaluatedAnnotationsResponse response = future.get(); } -
getModelEvaluation
Gets a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelEvaluationName name = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); ModelEvaluation response = modelServiceClient.getModelEvaluation(name); }- Parameters:
name- Required. The name of the ModelEvaluation resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`- Throws:
ApiException- if the remote call fails
-
getModelEvaluation
Gets a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); ModelEvaluation response = modelServiceClient.getModelEvaluation(name); }- Parameters:
name- Required. The name of the ModelEvaluation resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`- Throws:
ApiException- if the remote call fails
-
getModelEvaluation
Gets a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetModelEvaluationRequest request = GetModelEvaluationRequest.newBuilder() .setName( ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") .toString()) .build(); ModelEvaluation response = modelServiceClient.getModelEvaluation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getModelEvaluationCallable
Gets a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetModelEvaluationRequest request = GetModelEvaluationRequest.newBuilder() .setName( ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") .toString()) .build(); ApiFuture<ModelEvaluation> future = modelServiceClient.getModelEvaluationCallable().futureCall(request); // Do something. ModelEvaluation response = future.get(); } -
listModelEvaluations
public final ModelServiceClient.ListModelEvaluationsPagedResponse listModelEvaluations(ModelName parent) Lists ModelEvaluations in a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]"); for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Model to list the ModelEvaluations from. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
listModelEvaluations
public final ModelServiceClient.ListModelEvaluationsPagedResponse listModelEvaluations(String parent) Lists ModelEvaluations in a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString(); for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Model to list the ModelEvaluations from. Format: `projects/{project}/locations/{location}/models/{model}`- Throws:
ApiException- if the remote call fails
-
listModelEvaluations
public final ModelServiceClient.ListModelEvaluationsPagedResponse listModelEvaluations(ListModelEvaluationsRequest request) Lists ModelEvaluations in a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelEvaluationsRequest request = ListModelEvaluationsRequest.newBuilder() .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); for (ModelEvaluation element : modelServiceClient.listModelEvaluations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listModelEvaluationsPagedCallable
public final UnaryCallable<ListModelEvaluationsRequest,ModelServiceClient.ListModelEvaluationsPagedResponse> listModelEvaluationsPagedCallable()Lists ModelEvaluations in a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelEvaluationsRequest request = ListModelEvaluationsRequest.newBuilder() .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); ApiFuture<ModelEvaluation> future = modelServiceClient.listModelEvaluationsPagedCallable().futureCall(request); // Do something. for (ModelEvaluation element : future.get().iterateAll()) { // doThingsWith(element); } } -
listModelEvaluationsCallable
public final UnaryCallable<ListModelEvaluationsRequest,ListModelEvaluationsResponse> listModelEvaluationsCallable()Lists ModelEvaluations in a Model.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelEvaluationsRequest request = ListModelEvaluationsRequest.newBuilder() .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); while (true) { ListModelEvaluationsResponse response = modelServiceClient.listModelEvaluationsCallable().call(request); for (ModelEvaluation element : response.getModelEvaluationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getModelEvaluationSlice
Gets a ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelEvaluationSliceName name = ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]"); ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); }- Parameters:
name- Required. The name of the ModelEvaluationSlice resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}`- Throws:
ApiException- if the remote call fails
-
getModelEvaluationSlice
Gets a ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String name = ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") .toString(); ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name); }- Parameters:
name- Required. The name of the ModelEvaluationSlice resource. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}`- Throws:
ApiException- if the remote call fails
-
getModelEvaluationSlice
Gets a ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetModelEvaluationSliceRequest request = GetModelEvaluationSliceRequest.newBuilder() .setName( ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") .toString()) .build(); ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getModelEvaluationSliceCallable
public final UnaryCallable<GetModelEvaluationSliceRequest,ModelEvaluationSlice> getModelEvaluationSliceCallable()Gets a ModelEvaluationSlice.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetModelEvaluationSliceRequest request = GetModelEvaluationSliceRequest.newBuilder() .setName( ModelEvaluationSliceName.of( "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]") .toString()) .build(); ApiFuture<ModelEvaluationSlice> future = modelServiceClient.getModelEvaluationSliceCallable().futureCall(request); // Do something. ModelEvaluationSlice response = future.get(); } -
listModelEvaluationSlices
public final ModelServiceClient.ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices(ModelEvaluationName parent) Lists ModelEvaluationSlices in a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ModelEvaluationName parent = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]"); for (ModelEvaluationSlice element : modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the ModelEvaluation to list the ModelEvaluationSlices from. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`- Throws:
ApiException- if the remote call fails
-
listModelEvaluationSlices
public final ModelServiceClient.ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices(String parent) Lists ModelEvaluationSlices in a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { String parent = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString(); for (ModelEvaluationSlice element : modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the ModelEvaluation to list the ModelEvaluationSlices from. Format: `projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}`- Throws:
ApiException- if the remote call fails
-
listModelEvaluationSlices
public final ModelServiceClient.ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices(ListModelEvaluationSlicesRequest request) Lists ModelEvaluationSlices in a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelEvaluationSlicesRequest request = ListModelEvaluationSlicesRequest.newBuilder() .setParent( ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") .toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); for (ModelEvaluationSlice element : modelServiceClient.listModelEvaluationSlices(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listModelEvaluationSlicesPagedCallable
public final UnaryCallable<ListModelEvaluationSlicesRequest,ModelServiceClient.ListModelEvaluationSlicesPagedResponse> listModelEvaluationSlicesPagedCallable()Lists ModelEvaluationSlices in a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelEvaluationSlicesRequest request = ListModelEvaluationSlicesRequest.newBuilder() .setParent( ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") .toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); ApiFuture<ModelEvaluationSlice> future = modelServiceClient.listModelEvaluationSlicesPagedCallable().futureCall(request); // Do something. for (ModelEvaluationSlice element : future.get().iterateAll()) { // doThingsWith(element); } } -
listModelEvaluationSlicesCallable
public final UnaryCallable<ListModelEvaluationSlicesRequest,ListModelEvaluationSlicesResponse> listModelEvaluationSlicesCallable()Lists ModelEvaluationSlices in a ModelEvaluation.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListModelEvaluationSlicesRequest request = ListModelEvaluationSlicesRequest.newBuilder() .setParent( ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]") .toString()) .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .setReadMask(FieldMask.newBuilder().build()) .build(); while (true) { ListModelEvaluationSlicesResponse response = modelServiceClient.listModelEvaluationSlicesCallable().call(request); for (ModelEvaluationSlice element : response.getModelEvaluationSlicesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
recommendSpec
Gets a Model's spec recommendations.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { RecommendSpecRequest request = RecommendSpecRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setGcsUri("gcsUri-1251224875") .setCheckMachineAvailability(true) .setCheckUserQuota(true) .build(); RecommendSpecResponse response = modelServiceClient.recommendSpec(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
recommendSpecCallable
Gets a Model's spec recommendations.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { RecommendSpecRequest request = RecommendSpecRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setGcsUri("gcsUri-1251224875") .setCheckMachineAvailability(true) .setCheckUserQuota(true) .build(); ApiFuture<RecommendSpecResponse> future = modelServiceClient.recommendSpecCallable().futureCall(request); // Do something. RecommendSpecResponse response = future.get(); } -
listLocations
public final ModelServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : modelServiceClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,ModelServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = modelServiceClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = modelServiceClient.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; } } } -
getLocation
Gets information about a location.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = modelServiceClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = modelServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
setIamPolicy
Sets the access control policy on the specified resource. Replacesany existing policy.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = modelServiceClient.setIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
setIamPolicyCallable
Sets the access control policy on the specified resource. Replacesany existing policy.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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = modelServiceClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
getIamPolicy
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = modelServiceClient.getIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getIamPolicyCallable
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy 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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = modelServiceClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
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.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = modelServiceClient.testIamPermissions(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
testIamPermissionsCallable
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()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.
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 (ModelServiceClient modelServiceClient = ModelServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = modelServiceClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-