# 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.
- release_tracks: [ALPHA]
  help_text:
    brief: Update a Web Security Scanner ScanConfig.
    description: |
      Updates a Web Security Scanner ScanConfig.
    examples: |
      The following commands update the attributes of the specified scan config:

        $ {command} SCAN_CONFIG --user-agent=CHROME_ANDROID

        $ {command} SCAN_CONFIG --auth-type=google --auth-user=username@gmail.com --auth-password=password

        $ {command} SCAN_CONFIG --auth-type=custom --auth-user=username --auth-password=password --auth-url=http://example.com/login

  request:
    collection: websecurityscanner.projects.scanConfigs
    modify_request_hooks:
    - googlecloudsdk.command_lib.web_security_scanner.auth:SetScanConfigAuth
    - googlecloudsdk.command_lib.web_security_scanner.auth:AddAuthFieldMask

  arguments:
    resource:
      help_text: Scan config to update.
      spec: !REF googlecloudsdk.command_lib.web_security_scanner.resources:scan_config
      is_positional: true
    params:
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:display_name
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:starting_urls
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:max_qps
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:schedule_interval_days
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:schedule_next_start
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:target_platforms
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:user_agent
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:blacklist_patterns
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:export_to_security_center
    - !REF googlecloudsdk.command_lib.web_security_scanner.flags:risk_level
    additional_arguments_hook: googlecloudsdk.command_lib.web_security_scanner.auth:AuthFlags
