
                         ,   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddl	mZ dd	lmZ ej                   ej                  ej                   j"                  ej                   j$                         G d
 dej&                                      Zy)z!Command to update an SCC service.    )absolute_import)division)unicode_literals)clients)base)flags)parsing)
console_ioc                   &    e Zd ZdZed        Zd Zy)Updatea  Update a Security Command Center service.

  Update the enablement state of the Security Center service and its
  corresponding modules for the specified folder, project or organization.

  ## EXAMPLES

  To update a Security Center Service with name `sha` for organization 123, run:

      $ {command} sha
          --organization=organizations/123 --enablement-state="ENABLED"

  To update a Security Center Service with name `sha` and its modules for
  organization 123, run:

      $ {command} sha
          --organization=organizations/123 --enablement-state="ENABLED"
          --module-config-file=module_config.yaml

  To validate an update of Security Center Service with name `sha` and its
  modules for organization 123, run:

      $ {command} sha
          --organization=organizations/123 --enablement-state="ENABLED"
          --module-config-file=module_config.yaml --validate-only
  c                 *   t        j                         j                  |        t        j                  d      j                  |        t        j                  d      j                  |        t        j
                  dd      j                  |        y )NT)requiredFzJSON or YAML)r   	file_type)r   CreateServiceNameArgAddToParserCreateParentFlagCreateValidateOnlyFlagCreateServiceUpdateFlags)parsers    )lib/surface/scc/manage/services/update.pyArgszUpdate.Args:   sk    	 ,,V4	D)55f=	  %0<<VD	""  k&    c                    t        j                  |      }|j                  }t        j                  |j                        }t        j
                  |j                        }t        j                  |      }|s&t        j                  dj                  |      d       t        j                         }|j                  |||||      S )Nz@Are you sure you want to update the Security Center Service {}?
T)messagecancel_on_no)namevalidate_onlymodule_configenablement_stateupdate_mask)r	   GetServiceNameFromArgsr   GetModuleConfigValueFromArgsmodule_config_file!GetServiceEnablementStateFromArgsr   "CreateUpdateMaskFromArgsForServicer
   PromptContinueformatr   SecurityCenterServicesClientr   )selfargsr   r   r   r   r    clients           r   Runz
Update.RunD   s    ))$/D&&M88M @@ <<TBKvd| 113F==##)   r   N)__name__
__module____qualname____doc__staticmethodr   r,    r   r   r   r      s     6  r   r   N)r0   
__future__r   r   r   *googlecloudsdk.api_lib.scc.manage.servicesr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.scc.manager   r	   googlecloudsdk.core.consoler
   DefaultUniverseOnlyReleaseTracksReleaseTrackGAALPHACommandr   r2   r   r   <module>r>      sz    ( &  ' > ( 7 9 2 D%%(($*;*;*A*ABBT\\ B C Br   