1# -*- coding: utf-8 -*- #
2# Copyright 2020 Google LLC. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#    http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15"""A library for Security Command Center(SCC) settings commands arguments."""
16
17from googlecloudsdk.calliope import base
18
19
20def AddOrganizationFlag(parser, help_text):
21  parser.add_argument(
22      '--organization', metavar='ORGANIZATION_ID', help=help_text)
23
24
25def AddFolderFlag(parser, help_text):
26  parser.add_argument('--folder', metavar='FOLDER_ID', help=help_text)
27
28
29def AddProjectFlag(parser, help_text):
30  parser.add_argument('--project', metavar='PROJECT_ID', help=help_text)
31
32
33def ExtractRequiredFlags(parser):
34  parent_group = parser.add_mutually_exclusive_group()
35  AddOrganizationFlag(parent_group, 'Organization ID')
36  AddFolderFlag(parent_group, 'Folder ID')
37  AddProjectFlag(parent_group, 'Project ID')
38
39
40def AddServiceArgument(parser):
41  base.ChoiceArgument(
42      '--service',
43      required=True,
44      metavar='SERVICE_NAME',
45      choices=[
46          'container-threat-detection',
47          'event-threat-detection',
48          'security-health-analytics',
49          'web-security-scanner',
50      ],
51      default='none',
52      help_str='Service name in Security Command Center').AddToParser(parser)
53
54
55def AddModuleArgument(parser):
56  parser.add_argument(
57      '--module',
58      required=True,
59      metavar='MODULE_NAME',
60      help='Module name in Security Command Center')
61