# -*- coding: utf-8 -*- #
# Copyright 2024 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
  - GA
  auto_generated: true
  help_text:
    brief: Create Model Armor Template.
    description: Creates a new Template in a given project and location.
    examples: |-
      To create a Template, run:
      $ {command} my-template --location=us-central1 --malicious-uri-filter-settings-enforcement=enabled
  arguments:
    params:
    - help_text: |-
        Identifier. name of resource
      is_positional: true
      is_primary_resource: true
      request_id_field: templateId
      resource_spec: !REF googlecloudsdk.command_lib.model_armor.v1_resources:project_location_template
      required: true
    - arg_name: labels
      api_field: template.labels
      required: false
      repeated: true
      help_text: |-
        Labels as key value pairs
      spec:
      - api_field: key
      - api_field: value
    - group:
        api_field: template.filterConfig
        required: true
        help_text: |-
          Filters configuration.
        params:
        - group:
            api_field: template.filterConfig.raiSettings
            required: false
            help_text: |-
              Responsible AI Filter settings.
            params:
            - arg_name: rai-settings-filters
              api_field: template.filterConfig.raiSettings.raiFilters
              required: true
              repeated: true
              help_text: |-
                List of Responsible AI filters enabled for template.
              spec:
              - api_field: filterType
                help_text: |-
                  Type of responsible AI filter.
              - api_field: confidenceLevel
                help_text: |-
                  Confidence level for this RAI filter.
                  During data sanitization, if data is classified under this filter with a
                  confidence level equal to or greater than the specified level, a positive
                  match is reported. If the confidence level is unspecified (i.e., 0), the
                  system will use a reasonable default level based on the `filter_type`.
        - group:
            api_field: template.filterConfig.sdpSettings
            required: false
            help_text: |-
              Sensitive Data Protection settings.
            params:
            - group:
                mutex: true
                help_text: |-
                  Arguments for the sdp configuration.
                params:
                - group:
                    api_field: template.filterConfig.sdpSettings.basicConfig
                    required: false
                    help_text: |-
                      Sensitive Data Protection basic configuration.
                    params:
                    - arg_name: basic-config-filter-enforcement
                      api_field: template.filterConfig.sdpSettings.basicConfig.filterEnforcement
                      required: false
                      help_text: |-
                        Tells whether the Sensitive Data Protection basic config is enabled or
                        disabled.
                      choices:
                      - arg_value: enabled
                        enum_value: ENABLED
                        help_text: |-
                          Enabled
                      - arg_value: disabled
                        enum_value: DISABLED
                        help_text: |-
                          Disabled
                - group:
                    api_field: template.filterConfig.sdpSettings.advancedConfig
                    required: false
                    help_text: |-
                      Sensitive Data Protection Advanced configuration.
                    params:
                    - arg_name: advanced-config-inspect-template
                      api_field: template.filterConfig.sdpSettings.advancedConfig.inspectTemplate
                      required: false
                      repeated: false
                      help_text: |-
                        Sensitive Data Protection inspect template resource name

                        If only inspect template is provided (de-identify template not provided),
                        then Sensitive Data Protection InspectContent action is performed during
                        Sanitization. All Sensitive Data Protection findings identified during
                        inspection will be returned as SdpFinding in SdpInsepctionResult e.g.
                        `organizations/{organization}/inspectTemplates/{inspect_template}`,
                        `projects/{project}/inspectTemplates/{inspect_template}`
                        `organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}`
                        `projects/{project}/locations/{location}/inspectTemplates/{inspect_template}`
                    - arg_name: advanced-config-deidentify-template
                      api_field: template.filterConfig.sdpSettings.advancedConfig.deidentifyTemplate
                      required: false
                      repeated: false
                      help_text: |-
                        Optional Sensitive Data Protection Deidentify template resource name.

                        If provided then DeidentifyContent action is performed during Sanitization
                        using this template and inspect template. The De-identified data will
                        be returned in SdpDeidentifyResult.
                        Note that all info-types present in the deidentify template must be present
                        in inspect template.

                        e.g.
                        `organizations/{organization}/deidentifyTemplates/{deidentify_template}`,
                        `projects/{project}/deidentifyTemplates/{deidentify_template}`
                        `organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}`
                        `projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}`
        - group:
            api_field: template.filterConfig.piAndJailbreakFilterSettings
            required: false
            help_text: |-
              Prompt injection and Jailbreak Filter settings.
            params:
            - arg_name: pi-and-jailbreak-filter-settings-enforcement
              api_field: template.filterConfig.piAndJailbreakFilterSettings.filterEnforcement
              required: false
              help_text: |-
                Tells whether Prompt injection and Jailbreak filter is enabled or
                disabled.
              choices:
              - arg_value: enabled
                enum_value: ENABLED
                help_text: |-
                  Enabled
              - arg_value: disabled
                enum_value: DISABLED
                help_text: |-
                  Enabled
            - arg_name: pi-and-jailbreak-filter-settings-confidence-level
              api_field: template.filterConfig.piAndJailbreakFilterSettings.confidenceLevel
              required: false
              help_text: |-
                Confidence level for this filter.
                Confidence level is used to determine the threshold for the filter. If
                detection confidence is equal to or greater than the specified level, a
                positive match is reported. Confidence level will only be used if the
                filter is enabled.
              choices:
              - arg_value: low-and-above
                enum_value: LOW_AND_ABOVE
                help_text: |-
                  Highest chance of a false positive.
              - arg_value: medium-and-above
                enum_value: MEDIUM_AND_ABOVE
                help_text: |-
                  Some chance of false positives.
              - arg_value: high
                enum_value: HIGH
                help_text: |-
                  Low chance of false positives.
        - group:
            api_field: template.filterConfig.maliciousUriFilterSettings
            required: false
            help_text: |-
              Malicious URI filter settings.
            params:
            - arg_name: malicious-uri-filter-settings-enforcement
              api_field: template.filterConfig.maliciousUriFilterSettings.filterEnforcement
              required: false
              help_text: |-
                Tells whether the Malicious URI filter is enabled or disabled.
              choices:
              - arg_value: enabled
                enum_value: ENABLED
                help_text: |-
                  Enabled
              - arg_value: disabled
                enum_value: DISABLED
                help_text: |-
                  Disabled
    - group:
        api_field: template.templateMetadata
        required: false
        help_text: |-
          Message describing TemplateMetadata
        params:
        - arg_name: template-metadata-ignore-partial-invocation-failures
          api_field: template.templateMetadata.ignorePartialInvocationFailures
          action: store_true
          required: false
          type: bool
          help_text: |-
            If true, partial detector failures should be ignored.
          default: null
        - arg_name: template-metadata-custom-prompt-safety-error-code
          api_field: template.templateMetadata.customPromptSafetyErrorCode
          required: false
          repeated: false
          type: int
          help_text: |-
            Indicates the custom error code set by the user to be returned to the end
            user by the service extension if the prompt trips Model Armor filters.
        - arg_name: template-metadata-custom-prompt-safety-error-message
          api_field: template.templateMetadata.customPromptSafetyErrorMessage
          required: false
          repeated: false
          help_text: |-
            Indicates the custom error message set by the user to be returned to the
            end user if the prompt trips Model Armor filters.
        - arg_name: template-metadata-custom-llm-response-safety-error-code
          api_field: template.templateMetadata.customLlmResponseSafetyErrorCode
          required: false
          repeated: false
          type: int
          help_text: |-
            Indicates the custom error code set by the user to be returned to the end
            user if the LLM response trips Model Armor filters.
        - arg_name: template-metadata-custom-llm-response-safety-error-message
          api_field: template.templateMetadata.customLlmResponseSafetyErrorMessage
          required: false
          repeated: false
          help_text: |-
            Indicates the custom error message set by the user to be returned to the
            end user if the LLM response trips Model Armor filters.
        - arg_name: template-metadata-log-operations
          api_field: template.templateMetadata.logTemplateOperations
          action: store_true
          required: false
          type: bool
          help_text: |-
            If true, log template crud operations.
          default: null
        - arg_name: template-metadata-log-sanitize-operations
          api_field: template.templateMetadata.logSanitizeOperations
          action: store_true
          required: false
          type: bool
          help_text: |-
            If true, log sanitize operations.
          default: null
    - arg_name: request-id
      api_field: requestId
      required: false
      repeated: false
      help_text: |-
        An optional request ID to identify requests. Specify a unique request ID
        so that if you must retry your request, the server will know to ignore
        the request if it has already been completed. The server stores the request
        ID for 60 minutes after the first request.

        For example, consider a situation where you make an initial request and the
        request times out. If you make the request again with the same request
        ID, the server can check if original operation with the same request ID
        was received, and if so, will ignore the second request. This prevents
        clients from accidentally creating duplicate commitments.

        The request ID must be a valid UUID with the exception that zero UUID is
        not supported (00000000-0000-0000-0000-000000000000).
  request:
    api_version: v1
    collection:
    - modelarmor.projects.locations.templates
