GitHub Repository | Product Reference |
Service Description: Service describing handlers for resources
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
TemplateName name = TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]");
Template response = modelArmorClient.getTemplate(name);
}
Note: close() needs to be called on the ModelArmorClient 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 |
---|---|---|
ListTemplates |
Lists Templates in a given project and 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.
|
GetTemplate |
Gets details of a single Template. |
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.
|
CreateTemplate |
Creates a new Template in a given project and 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.
|
UpdateTemplate |
Updates the parameters of a single Template. |
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.
|
DeleteTemplate |
Deletes a single Template. |
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.
|
GetFloorSetting |
Gets details of a single floor setting of a project |
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.
|
UpdateFloorSetting |
Updates the parameters of a single floor setting of a project |
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.
|
SanitizeUserPrompt |
Sanitizes User Prompt. |
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.
|
SanitizeModelResponse |
Sanitizes Model Response. |
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.
|
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 ModelArmorSettings 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
ModelArmorSettings modelArmorSettings =
ModelArmorSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ModelArmorClient modelArmorClient = ModelArmorClient.create(modelArmorSettings);
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
ModelArmorSettings modelArmorSettings =
ModelArmorSettings.newBuilder().setEndpoint(myEndpoint).build();
ModelArmorClient modelArmorClient = ModelArmorClient.create(modelArmorSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ModelArmorSettings modelArmorSettings = ModelArmorSettings.newHttpJsonBuilder().build();
ModelArmorClient modelArmorClient = ModelArmorClient.create(modelArmorSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final ModelArmorClient create()
Constructs an instance of ModelArmorClient with default settings.
Returns | |
---|---|
Type | Description |
ModelArmorClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ModelArmorSettings settings)
public static final ModelArmorClient create(ModelArmorSettings settings)
Constructs an instance of ModelArmorClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings |
ModelArmorSettings |
Returns | |
---|---|
Type | Description |
ModelArmorClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(ModelArmorStub stub)
public static final ModelArmorClient create(ModelArmorStub stub)
Constructs an instance of ModelArmorClient, using the given stub for making calls. This is for advanced usage - prefer using create(ModelArmorSettings).
Parameter | |
---|---|
Name | Description |
stub |
ModelArmorStub |
Returns | |
---|---|
Type | Description |
ModelArmorClient |
Constructors
ModelArmorClient(ModelArmorSettings settings)
protected ModelArmorClient(ModelArmorSettings settings)
Constructs an instance of ModelArmorClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings |
ModelArmorSettings |
ModelArmorClient(ModelArmorStub stub)
protected ModelArmorClient(ModelArmorStub stub)
Parameter | |
---|---|
Name | Description |
stub |
ModelArmorStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration |
long |
unit |
TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createTemplate(CreateTemplateRequest request)
public final Template createTemplate(CreateTemplateRequest request)
Creates a new Template in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
CreateTemplateRequest request =
CreateTemplateRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setTemplateId("templateId1304010549")
.setTemplate(Template.newBuilder().build())
.setRequestId("requestId693933066")
.build();
Template response = modelArmorClient.createTemplate(request);
}
Parameter | |
---|---|
Name | Description |
request |
CreateTemplateRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Template |
createTemplate(LocationName parent, Template template, String templateId)
public final Template createTemplate(LocationName parent, Template template, String templateId)
Creates a new Template in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Template template = Template.newBuilder().build();
String templateId = "templateId1304010549";
Template response = modelArmorClient.createTemplate(parent, template, templateId);
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Value for parent. |
template |
Template Required. The resource being created |
templateId |
String Required. Id of the requesting object If auto-generating Id server-side, remove this field and template_id from the method_signature of Create RPC |
Returns | |
---|---|
Type | Description |
Template |
createTemplate(String parent, Template template, String templateId)
public final Template createTemplate(String parent, Template template, String templateId)
Creates a new Template in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
Template template = Template.newBuilder().build();
String templateId = "templateId1304010549";
Template response = modelArmorClient.createTemplate(parent, template, templateId);
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. Value for parent. |
template |
Template Required. The resource being created |
templateId |
String Required. Id of the requesting object If auto-generating Id server-side, remove this field and template_id from the method_signature of Create RPC |
Returns | |
---|---|
Type | Description |
Template |
createTemplateCallable()
public final UnaryCallable<CreateTemplateRequest,Template> createTemplateCallable()
Creates a new Template in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
CreateTemplateRequest request =
CreateTemplateRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setTemplateId("templateId1304010549")
.setTemplate(Template.newBuilder().build())
.setRequestId("requestId693933066")
.build();
ApiFuture<Template> future = modelArmorClient.createTemplateCallable().futureCall(request);
// Do something.
Template response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateTemplateRequest,Template> |
deleteTemplate(DeleteTemplateRequest request)
public final void deleteTemplate(DeleteTemplateRequest request)
Deletes a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
DeleteTemplateRequest request =
DeleteTemplateRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.setRequestId("requestId693933066")
.build();
modelArmorClient.deleteTemplate(request);
}
Parameter | |
---|---|
Name | Description |
request |
DeleteTemplateRequest The request object containing all of the parameters for the API call. |
deleteTemplate(TemplateName name)
public final void deleteTemplate(TemplateName name)
Deletes a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
TemplateName name = TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]");
modelArmorClient.deleteTemplate(name);
}
Parameter | |
---|---|
Name | Description |
name |
TemplateName Required. Name of the resource |
deleteTemplate(String name)
public final void deleteTemplate(String name)
Deletes a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
String name = TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString();
modelArmorClient.deleteTemplate(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Name of the resource |
deleteTemplateCallable()
public final UnaryCallable<DeleteTemplateRequest,Empty> deleteTemplateCallable()
Deletes a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
DeleteTemplateRequest request =
DeleteTemplateRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.setRequestId("requestId693933066")
.build();
ApiFuture<Empty> future = modelArmorClient.deleteTemplateCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteTemplateRequest,Empty> |
getFloorSetting(FloorSettingName name)
public final FloorSetting getFloorSetting(FloorSettingName name)
Gets details of a single floor setting of a project
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
FloorSettingName name = FloorSettingName.ofProjectLocationName("[PROJECT]", "[LOCATION]");
FloorSetting response = modelArmorClient.getFloorSetting(name);
}
Parameter | |
---|---|
Name | Description |
name |
FloorSettingName Required. The name of the floor setting to get, example projects/123/floorsetting. |
Returns | |
---|---|
Type | Description |
FloorSetting |
getFloorSetting(GetFloorSettingRequest request)
public final FloorSetting getFloorSetting(GetFloorSettingRequest request)
Gets details of a single floor setting of a project
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
GetFloorSettingRequest request =
GetFloorSettingRequest.newBuilder()
.setName(FloorSettingName.ofProjectLocationName("[PROJECT]", "[LOCATION]").toString())
.build();
FloorSetting response = modelArmorClient.getFloorSetting(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetFloorSettingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
FloorSetting |
getFloorSetting(String name)
public final FloorSetting getFloorSetting(String name)
Gets details of a single floor setting of a project
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
String name = FloorSettingName.ofProjectLocationName("[PROJECT]", "[LOCATION]").toString();
FloorSetting response = modelArmorClient.getFloorSetting(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. The name of the floor setting to get, example projects/123/floorsetting. |
Returns | |
---|---|
Type | Description |
FloorSetting |
getFloorSettingCallable()
public final UnaryCallable<GetFloorSettingRequest,FloorSetting> getFloorSettingCallable()
Gets details of a single floor setting of a project
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
GetFloorSettingRequest request =
GetFloorSettingRequest.newBuilder()
.setName(FloorSettingName.ofProjectLocationName("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<FloorSetting> future =
modelArmorClient.getFloorSettingCallable().futureCall(request);
// Do something.
FloorSetting response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetFloorSettingRequest,FloorSetting> |
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = modelArmorClient.getLocation(request);
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.cloud.location.Location |
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = modelArmorClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getSettings()
public final ModelArmorSettings getSettings()
Returns | |
---|---|
Type | Description |
ModelArmorSettings |
getStub()
public ModelArmorStub getStub()
Returns | |
---|---|
Type | Description |
ModelArmorStub |
getTemplate(GetTemplateRequest request)
public final Template getTemplate(GetTemplateRequest request)
Gets details of a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
GetTemplateRequest request =
GetTemplateRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.build();
Template response = modelArmorClient.getTemplate(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetTemplateRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Template |
getTemplate(TemplateName name)
public final Template getTemplate(TemplateName name)
Gets details of a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
TemplateName name = TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]");
Template response = modelArmorClient.getTemplate(name);
}
Parameter | |
---|---|
Name | Description |
name |
TemplateName Required. Name of the resource |
Returns | |
---|---|
Type | Description |
Template |
getTemplate(String name)
public final Template getTemplate(String name)
Gets details of a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
String name = TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString();
Template response = modelArmorClient.getTemplate(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Name of the resource |
Returns | |
---|---|
Type | Description |
Template |
getTemplateCallable()
public final UnaryCallable<GetTemplateRequest,Template> getTemplateCallable()
Gets details of a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
GetTemplateRequest request =
GetTemplateRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.build();
ApiFuture<Template> future = modelArmorClient.getTemplateCallable().futureCall(request);
// Do something.
Template response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetTemplateRequest,Template> |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listLocations(ListLocationsRequest request)
public final ModelArmorClient.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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : modelArmorClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ModelArmorClient.ListLocationsPagedResponse |
listLocationsCallable()
public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = modelArmorClient.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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsPagedCallable()
public final UnaryCallable<ListLocationsRequest,ModelArmorClient.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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
modelArmorClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
listTemplates(ListTemplatesRequest request)
public final ModelArmorClient.ListTemplatesPagedResponse listTemplates(ListTemplatesRequest request)
Lists Templates in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
ListTemplatesRequest request =
ListTemplatesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
for (Template element : modelArmorClient.listTemplates(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListTemplatesRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ModelArmorClient.ListTemplatesPagedResponse |
listTemplates(LocationName parent)
public final ModelArmorClient.ListTemplatesPagedResponse listTemplates(LocationName parent)
Lists Templates in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Template element : modelArmorClient.listTemplates(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
LocationName Required. Parent value for ListTemplatesRequest |
Returns | |
---|---|
Type | Description |
ModelArmorClient.ListTemplatesPagedResponse |
listTemplates(String parent)
public final ModelArmorClient.ListTemplatesPagedResponse listTemplates(String parent)
Lists Templates in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Template element : modelArmorClient.listTemplates(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. Parent value for ListTemplatesRequest |
Returns | |
---|---|
Type | Description |
ModelArmorClient.ListTemplatesPagedResponse |
listTemplatesCallable()
public final UnaryCallable<ListTemplatesRequest,ListTemplatesResponse> listTemplatesCallable()
Lists Templates in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
ListTemplatesRequest request =
ListTemplatesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
while (true) {
ListTemplatesResponse response = modelArmorClient.listTemplatesCallable().call(request);
for (Template element : response.getTemplatesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListTemplatesRequest,ListTemplatesResponse> |
listTemplatesPagedCallable()
public final UnaryCallable<ListTemplatesRequest,ModelArmorClient.ListTemplatesPagedResponse> listTemplatesPagedCallable()
Lists Templates in a given project and 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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
ListTemplatesRequest request =
ListTemplatesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
ApiFuture<Template> future =
modelArmorClient.listTemplatesPagedCallable().futureCall(request);
// Do something.
for (Template element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListTemplatesRequest,ListTemplatesPagedResponse> |
sanitizeModelResponse(SanitizeModelResponseRequest request)
public final SanitizeModelResponseResponse sanitizeModelResponse(SanitizeModelResponseRequest request)
Sanitizes Model Response.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
SanitizeModelResponseRequest request =
SanitizeModelResponseRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.setModelResponseData(DataItem.newBuilder().build())
.setUserPrompt("userPrompt1504308495")
.build();
SanitizeModelResponseResponse response = modelArmorClient.sanitizeModelResponse(request);
}
Parameter | |
---|---|
Name | Description |
request |
SanitizeModelResponseRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
SanitizeModelResponseResponse |
sanitizeModelResponseCallable()
public final UnaryCallable<SanitizeModelResponseRequest,SanitizeModelResponseResponse> sanitizeModelResponseCallable()
Sanitizes Model Response.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
SanitizeModelResponseRequest request =
SanitizeModelResponseRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.setModelResponseData(DataItem.newBuilder().build())
.setUserPrompt("userPrompt1504308495")
.build();
ApiFuture<SanitizeModelResponseResponse> future =
modelArmorClient.sanitizeModelResponseCallable().futureCall(request);
// Do something.
SanitizeModelResponseResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SanitizeModelResponseRequest,SanitizeModelResponseResponse> |
sanitizeUserPrompt(SanitizeUserPromptRequest request)
public final SanitizeUserPromptResponse sanitizeUserPrompt(SanitizeUserPromptRequest request)
Sanitizes User Prompt.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
SanitizeUserPromptRequest request =
SanitizeUserPromptRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.setUserPromptData(DataItem.newBuilder().build())
.build();
SanitizeUserPromptResponse response = modelArmorClient.sanitizeUserPrompt(request);
}
Parameter | |
---|---|
Name | Description |
request |
SanitizeUserPromptRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
SanitizeUserPromptResponse |
sanitizeUserPromptCallable()
public final UnaryCallable<SanitizeUserPromptRequest,SanitizeUserPromptResponse> sanitizeUserPromptCallable()
Sanitizes User Prompt.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
SanitizeUserPromptRequest request =
SanitizeUserPromptRequest.newBuilder()
.setName(TemplateName.of("[PROJECT]", "[LOCATION]", "[TEMPLATE]").toString())
.setUserPromptData(DataItem.newBuilder().build())
.build();
ApiFuture<SanitizeUserPromptResponse> future =
modelArmorClient.sanitizeUserPromptCallable().futureCall(request);
// Do something.
SanitizeUserPromptResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SanitizeUserPromptRequest,SanitizeUserPromptResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateFloorSetting(FloorSetting floorSetting, FieldMask updateMask)
public final FloorSetting updateFloorSetting(FloorSetting floorSetting, FieldMask updateMask)
Updates the parameters of a single floor setting of a project
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
FloorSetting floorSetting = FloorSetting.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
FloorSetting response = modelArmorClient.updateFloorSetting(floorSetting, updateMask);
}
Parameters | |
---|---|
Name | Description |
floorSetting |
FloorSetting Required. The floor setting being updated. |
updateMask |
FieldMask Optional. Field mask is used to specify the fields to be overwritten in the FloorSetting resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
Returns | |
---|---|
Type | Description |
FloorSetting |
updateFloorSetting(UpdateFloorSettingRequest request)
public final FloorSetting updateFloorSetting(UpdateFloorSettingRequest request)
Updates the parameters of a single floor setting of a project
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
UpdateFloorSettingRequest request =
UpdateFloorSettingRequest.newBuilder()
.setFloorSetting(FloorSetting.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
FloorSetting response = modelArmorClient.updateFloorSetting(request);
}
Parameter | |
---|---|
Name | Description |
request |
UpdateFloorSettingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
FloorSetting |
updateFloorSettingCallable()
public final UnaryCallable<UpdateFloorSettingRequest,FloorSetting> updateFloorSettingCallable()
Updates the parameters of a single floor setting of a project
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
UpdateFloorSettingRequest request =
UpdateFloorSettingRequest.newBuilder()
.setFloorSetting(FloorSetting.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<FloorSetting> future =
modelArmorClient.updateFloorSettingCallable().futureCall(request);
// Do something.
FloorSetting response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateFloorSettingRequest,FloorSetting> |
updateTemplate(Template template, FieldMask updateMask)
public final Template updateTemplate(Template template, FieldMask updateMask)
Updates the parameters of a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
Template template = Template.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Template response = modelArmorClient.updateTemplate(template, updateMask);
}
Parameters | |
---|---|
Name | Description |
template |
Template Required. The resource being updated |
updateMask |
FieldMask Required. Field mask is used to specify the fields to be overwritten in the Template resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
Returns | |
---|---|
Type | Description |
Template |
updateTemplate(UpdateTemplateRequest request)
public final Template updateTemplate(UpdateTemplateRequest request)
Updates the parameters of a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
UpdateTemplateRequest request =
UpdateTemplateRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setTemplate(Template.newBuilder().build())
.setRequestId("requestId693933066")
.build();
Template response = modelArmorClient.updateTemplate(request);
}
Parameter | |
---|---|
Name | Description |
request |
UpdateTemplateRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Template |
updateTemplateCallable()
public final UnaryCallable<UpdateTemplateRequest,Template> updateTemplateCallable()
Updates the parameters of a single Template.
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 (ModelArmorClient modelArmorClient = ModelArmorClient.create()) {
UpdateTemplateRequest request =
UpdateTemplateRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setTemplate(Template.newBuilder().build())
.setRequestId("requestId693933066")
.build();
ApiFuture<Template> future = modelArmorClient.updateTemplateCallable().futureCall(request);
// Do something.
Template response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateTemplateRequest,Template> |