@BetaApi @Generated(value="by gapic-generator-java") public class ModelGardenServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
PublisherModelName name = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModel response = modelGardenServiceClient.getPublisherModel(name);
}
Note: close() needs to be called on the ModelGardenServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ModelGardenServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ModelGardenServiceSettings modelGardenServiceSettings =
ModelGardenServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ModelGardenServiceClient modelGardenServiceClient =
ModelGardenServiceClient.create(modelGardenServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ModelGardenServiceSettings modelGardenServiceSettings =
ModelGardenServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ModelGardenServiceClient modelGardenServiceClient =
ModelGardenServiceClient.create(modelGardenServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ModelGardenServiceClient.ListLocationsFixedSizeCollection |
static class |
ModelGardenServiceClient.ListLocationsPage |
static class |
ModelGardenServiceClient.ListLocationsPagedResponse |
static class |
ModelGardenServiceClient.ListPublisherModelsFixedSizeCollection |
static class |
ModelGardenServiceClient.ListPublisherModelsPage |
static class |
ModelGardenServiceClient.ListPublisherModelsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ModelGardenServiceClient(ModelGardenServiceSettings settings)
Constructs an instance of ModelGardenServiceClient, using the given settings.
|
protected |
ModelGardenServiceClient(ModelGardenServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ModelGardenServiceClient |
create()
Constructs an instance of ModelGardenServiceClient with default settings.
|
static ModelGardenServiceClient |
create(ModelGardenServiceSettings settings)
Constructs an instance of ModelGardenServiceClient, using the given settings.
|
static ModelGardenServiceClient |
create(ModelGardenServiceStub stub)
Constructs an instance of ModelGardenServiceClient, using the given stub for making calls.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
PublisherModel |
getPublisherModel(GetPublisherModelRequest request)
Gets a Model Garden publisher model.
|
PublisherModel |
getPublisherModel(PublisherModelName name)
Gets a Model Garden publisher model.
|
PublisherModel |
getPublisherModel(String name)
Gets a Model Garden publisher model.
|
com.google.api.gax.rpc.UnaryCallable<GetPublisherModelRequest,PublisherModel> |
getPublisherModelCallable()
Gets a Model Garden publisher model.
|
ModelGardenServiceSettings |
getSettings() |
ModelGardenServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ModelGardenServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ModelGardenServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
ModelGardenServiceClient.ListPublisherModelsPagedResponse |
listPublisherModels(ListPublisherModelsRequest request)
Lists publisher models in Model Garden.
|
ModelGardenServiceClient.ListPublisherModelsPagedResponse |
listPublisherModels(String parent)
Lists publisher models in Model Garden.
|
com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ListPublisherModelsResponse> |
listPublisherModelsCallable()
Lists publisher models in Model Garden.
|
com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ModelGardenServiceClient.ListPublisherModelsPagedResponse> |
listPublisherModelsPagedCallable()
Lists publisher models in Model Garden.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
protected ModelGardenServiceClient(ModelGardenServiceSettings settings) throws IOException
IOExceptionprotected ModelGardenServiceClient(ModelGardenServiceStub stub)
public static final ModelGardenServiceClient create() throws IOException
IOExceptionpublic static final ModelGardenServiceClient create(ModelGardenServiceSettings settings) throws IOException
IOExceptionpublic static final ModelGardenServiceClient create(ModelGardenServiceStub stub)
public final ModelGardenServiceSettings getSettings()
public ModelGardenServiceStub getStub()
public final PublisherModel getPublisherModel(PublisherModelName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
PublisherModelName name = PublisherModelName.of("[PUBLISHER]", "[MODEL]");
PublisherModel response = modelGardenServiceClient.getPublisherModel(name);
}
name - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModel getPublisherModel(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String name = PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString();
PublisherModel response = modelGardenServiceClient.getPublisherModel(name);
}
name - Required. The name of the PublisherModel resource. Format:
`publishers/{publisher}/models/{publisher_model}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final PublisherModel getPublisherModel(GetPublisherModelRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetPublisherModelRequest request =
GetPublisherModelRequest.newBuilder()
.setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.setLanguageCode("languageCode-2092349083")
.setView(PublisherModelView.forNumber(0))
.build();
PublisherModel response = modelGardenServiceClient.getPublisherModel(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetPublisherModelRequest,PublisherModel> getPublisherModelCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetPublisherModelRequest request =
GetPublisherModelRequest.newBuilder()
.setName(PublisherModelName.of("[PUBLISHER]", "[MODEL]").toString())
.setLanguageCode("languageCode-2092349083")
.setView(PublisherModelView.forNumber(0))
.build();
ApiFuture<PublisherModel> future =
modelGardenServiceClient.getPublisherModelCallable().futureCall(request);
// Do something.
PublisherModel response = future.get();
}
public final ModelGardenServiceClient.ListPublisherModelsPagedResponse listPublisherModels(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
String parent = "parent-995424086";
for (PublisherModel element :
modelGardenServiceClient.listPublisherModels(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The name of the Publisher from which to list the PublisherModels.
Format: `publishers/{publisher}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ModelGardenServiceClient.ListPublisherModelsPagedResponse listPublisherModels(ListPublisherModelsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListPublisherModelsRequest request =
ListPublisherModelsRequest.newBuilder()
.setParent("parent-995424086")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(PublisherModelView.forNumber(0))
.setOrderBy("orderBy-1207110587")
.setLanguageCode("languageCode-2092349083")
.build();
for (PublisherModel element :
modelGardenServiceClient.listPublisherModels(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ModelGardenServiceClient.ListPublisherModelsPagedResponse> listPublisherModelsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListPublisherModelsRequest request =
ListPublisherModelsRequest.newBuilder()
.setParent("parent-995424086")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(PublisherModelView.forNumber(0))
.setOrderBy("orderBy-1207110587")
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<PublisherModel> future =
modelGardenServiceClient.listPublisherModelsPagedCallable().futureCall(request);
// Do something.
for (PublisherModel element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPublisherModelsRequest,ListPublisherModelsResponse> listPublisherModelsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListPublisherModelsRequest request =
ListPublisherModelsRequest.newBuilder()
.setParent("parent-995424086")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setView(PublisherModelView.forNumber(0))
.setOrderBy("orderBy-1207110587")
.setLanguageCode("languageCode-2092349083")
.build();
while (true) {
ListPublisherModelsResponse response =
modelGardenServiceClient.listPublisherModelsCallable().call(request);
for (PublisherModel element : response.getPublisherModelsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ModelGardenServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : modelGardenServiceClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ModelGardenServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
modelGardenServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
modelGardenServiceClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = modelGardenServiceClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future =
modelGardenServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = modelGardenServiceClient.setIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future =
modelGardenServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = modelGardenServiceClient.getIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future =
modelGardenServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = modelGardenServiceClient.testIamPermissions(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelGardenServiceClient modelGardenServiceClient = ModelGardenServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
modelGardenServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2023 Google LLC. All rights reserved.