# Copyright 2019 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.

# Shared flags definitions for multiple commands.

display_name:
  arg_name: display-name
  api_field: scanConfig.displayName
  is_positional: false
  help_text: |
    A human-readable name for the scan config.

starting_urls:
  arg_name: starting-urls
  api_field: scanConfig.startingUrls
  is_positional: false
  help_text: |
    URLs the scan starts scanning from. These URLs must be 'owned' by the project in some way
    (resolve to a reserved IP address, or be the default
    `https://<PROJECT-ID>.<REGION-ID>.r.appspot.com`).

max_qps:
  arg_name: max-qps
  api_field: scanConfig.maxQps
  is_positional: false
  required: false
  help_text: |
    Maximum queries per second (QPS) of the scanners. Defaults to 15, with a maximum of 20.

schedule_interval_days:
  arg_name: schedule-interval-days
  api_field: scanConfig.schedule.intervalDurationDays
  is_positional: false
  required: false
  help_text: |
    How frequently the scan should be run automatically (in days). If not set, there is no automatic
    scheduling of this scan.

schedule_next_start:
  arg_name: schedule-next-start
  api_field: scanConfig.schedule.scheduleTime
  is_positional: false
  required: false
  help_text: |
    When the next automatic scheduled scan should start. Requires `--schedule-interval-days` to be
    set. See $ gcloud topic datetimes for information on time formats.

target_platforms:
  arg_name: target-platforms
  api_field: scanConfig.targetPlatforms
  is_positional: false
  required: false
  default: [app_engine, compute]
  help_text: |
    List of platforms the site is running on. Defaults to 'app_engine,compute'.

user_agent:
  arg_name: user-agent
  api_field: scanConfig.userAgent
  is_positional: false
  required: false
  help_text: |
    List of user agents to use when crawling. Defaults to 'chrome_linux'.

blacklist_patterns:
  arg_name: blacklist-patterns
  api_field: scanConfig.blacklistPatterns
  is_positional: false
  required: false
  help_text: |
    List of blacklist URL patterns as described online:
    https://cloud.google.com/security-scanner/docs/excluded-urls

export_to_security_center:
  arg_name: export-to-security-center
  api_field: scanConfig.exportToSecurityCommandCenter
  is_positional: false
  required: false
  action: store_true
  default: true
  choices:
  - arg_value: true
    enum_value: ENABLED
  - arg_value: false
    enum_value: DISABLED
  help_text: |
    If True, the scanner will export scan results to Cloud Security Command Center. Defaults to
    true.

risk_level:
  arg_name: risk-level
  api_field: scanConfig.riskLevel
  is_positional: false
  required: false
  default: normal
  choices:
  - arg_value: normal
    enum_value: NORMAL
  - arg_value: low
    enum_value: LOW
  help_text: |
    The risk level selected for the scan. Defaults to normal scanning.
