Skip to content

[modelarmor] Expose Template filter version selector (filterVersionSelector) in the Java client #14546

Description

@bxie-box

Issue Details

The Model Armor documentation describes pinning a template's filter version by setting
templateMetadata.filterVersionSelector (for example, alias FILTER_VERSION_ALIAS_STABLE):
https://docs.cloud.google.com/model-armor/set-filter-version

The Java client library doesn't expose this field, so there's no typed way to set or update the
filter version selector when creating (CreateTemplate) or updating (UpdateTemplate) a template.

What I checked in google-cloud-modelarmor 0.39.0 (latest on Maven Central as of this filing):

  • proto-google-cloud-modelarmor-v1 and proto-google-cloud-modelarmor-v1beta contain no
    FilterVersionSelector message and no FILTER_VERSION_ALIAS_* enum.
  • Template.TemplateMetadata.Builder has no filter version getter or setter in either v1 or
    v1beta.
  • The field is also missing from the published protos in googleapis/googleapis
    (google/cloud/modelarmor/v1/service.proto and v1beta/service.proto), so the gap appears to be
    in the upstream API definition rather than in client generation.

I opened a Google Cloud support case first, and support directed me to file an issue here.

Requested change: expose the filter version selector in the Model Armor protos and Java client
so it can be set on template create and update, including through an update_mask path such as
template_metadata.filter_version_selector.

Environment

  • OS Type and Version: macOS 26 (development)
  • Java Version and JDK Vendor: Java 25 (Azul Zulu 25.0.3+9-LTS)
  • (If using GraalVM) GraalVM Version: N/A, not using GraalVM

GCP deployment details: N/A. This is a missing API field in the client library, not an
environment-specific runtime failure.

Dependencies

Provide the versions of the relevant libraries:

  • Libraries-Bom: not used
    • Client Libraries: com.google.cloud:google-cloud-modelarmor:0.39.0
      (proto-google-cloud-modelarmor-v1:0.39.0, proto-google-cloud-modelarmor-v1beta:0.39.0)
  • Gax (gax / gax-grpc / gax-httpjson): 2.86.0
  • Auth (google-auth-library-oauth2-http / google-auth-library-credentials): 1.53.0
  • Any other relevant Java SDK dependencies:
    • Google-Http-Java-Client: 2.2.0
    • protobuf-java: 4.33.6
    • grpc-api: 1.83.0

Reproducer

Steps to reproduce:

  1. Add com.google.cloud:google-cloud-modelarmor:0.39.0 to a Java project.
  2. Try to set a filter version selector on a template's metadata, as described in the
    documentation linked above.
  3. There's no corresponding type or builder method to call, so the code doesn't compile.

Code snippet showing what I'd expect to be able to write (these types and methods don't exist in
0.39.0):

Template template =
    Template.newBuilder()
        .setFilterConfig(filterConfig)
        .setTemplateMetadata(
            Template.TemplateMetadata.newBuilder()
                // Not available in v1 or v1beta as of 0.39.0:
                .setFilterVersionSelector(
                    FilterVersionSelector.newBuilder()
                        .setAlias(FilterVersionAlias.FILTER_VERSION_ALIAS_STABLE)))
        .build();

try (ModelArmorClient client = ModelArmorClient.create()) {
  client.createTemplate(
      CreateTemplateRequest.newBuilder()
          .setParent(LocationName.of(projectId, location).toString())
          .setTemplateId(templateId)
          .setTemplate(template)
          .build());
}

To confirm the field is absent from the generated classes:

javap -cp proto-google-cloud-modelarmor-v1-0.39.0.jar \
  'com.google.cloud.modelarmor.v1.Template$TemplateMetadata$Builder' | grep -i filterversion
# (no output)

Logs and Stack Trace

N/A.

Behavior

  • When did the issue begin? The field has been missing in every version
  • Is this behavior flaky? No, it's consistent: the API surface isn't there.
  • Is this behavior related to the volume of data? No.

No workaround to setting this for us since we cannot call REST API directly in the deployed system

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions