
    ,                         S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSK
Jr  SS	K
Jr  SS
KJr  SrSr\R"                   " S S\R$                  5      5       rg)z.Command for deleting access approval settings.    )absolute_import)division)unicode_literalsN)settings)apis)base)
exceptions)parent)ORGANIZATIONFOLDERPROJECT)transparencystreamlined-supportaccess-approvalinherit-policy-from-parentc                   V    \ rS rSrSrS\R                  " S5      0r\S 5       r	S r
Srg)	Update'   zUpdate Access Approval settings.

Update the Access Approval settings associated with a project, a folder, or
organization. Partial updates are supported (for example, you can update the
notification emails without modifying the enrolled services).
EXAMPLESa      Update notification emails associated with project `p1`, run:

        $ {command} --project=p1 --notification_emails='foo@example.com, bar@example.com'

    Enable Access Approval enforcement for folder `f1`:

        $ {command} --folder=f1 --enrolled_services=all

    Enable Access Approval enforcement for organization `org1` for only Cloud Storage and Compute
    products and set the notification emails at the same time:

        $ {command} --organization=org1 --enrolled_services='storage.googleapis.com,compute.googleapis.com' --notification_emails='security_team@example.com'

    Update active key version for project `p1`:

        $ {command} --project=p1 --active_key_version='projects/p1/locations/global/keyRings/signing-keys/cryptoKeys/signing-key/cryptoKeyVersions/1'

    Update preferred request expiration days for project `p1`:

        $ {command} --project=p1 --preferred_request_expiration_days=5

    Enable prefer no broad approval requests for project `p1`:

        $ {command} --project=p1 --prefer_no_broad_approval_requests=true

    Update notification pubsub topic for project `p1`:

        $ {command} --project=p1 --notification_pubsub_topic='exampleTopic'

    Update request scope max width preference for project `p1`:

        $ {command} --project=p1 --request_scope_max_width_preference=PROJECT

    Update approval policy for project `p1`:

        $ {command} --project=p1 --approval_policy=transparency
        c                    [         R                  " U 5        U R                  SSS9  U R                  SSS9  U R                  SSS9  U R                  S[        S	S
9  U R                  S[        SS
9  U R                  SSS9  U R                  S[
        SS9  U R                  S[        SS
9  U R                  S[        SS9  g)zAdd command-specific args.--notification_emailszComma-separated list of email addresses to which notifications relating to approval requests should be sent or '' to clear all saved notification emails.)help--enrolled_serviceszComma-separated list of services to enroll for Access Approval or 'all' for all supported services. Note for project and folder enrollments, only 'all' is supported. Use '' to clear all enrolled services.--active_key_versionzpThe asymmetric crypto key version to use for signing approval requests. Use '' to remove the custom signing key.#--preferred_request_expiration_dayszThe default expiration time for approval requests. This value must be between 1 and 30. Note that this can be overridden at time of Approval Request creation and modified by the customer at approval time.)typer   #--prefer_no_broad_approval_requestszIf set to true it will communicate the preference to Google personnel to request access with as targeted a resource scope as possible.--notification_pubsub_topiczMThe pubsub topic to publish notifications to when approval requests are made.$--request_scope_max_width_preferencez^The preference for the broadest scope of access for access requests without a specific method.)choicesr   (--require_customer_visible_justificationzThe preference to configure if a customer visible justification (i.e. Vector Case) is required for a Googler to create an Access Ticket to send to the customer when attempting to access customer resources.--approval_policyzDThe preference to configure the approval policy for access requests.N)r
   Argsadd_argumentintbool_PREFERENCES_APPROVAL_POLICY_PREFERENCES)parsers    .lib/surface/access_approval/settings/update.pyr#   Update.ArgsY   s#    KK
*   "   B   -	  	 -	   %"   .3	   2	  	 ,	      c                 d   [         R                  " U5      nUR                  c  UR                  ct  UR                  cg  UR
                  cZ  UR                  cM  UR                  c@  UR                  c3  UR                  c&  UR                  c  [        R                  " / SQS5      e/ n/ nUR                  b\  UR                  S5        UR                  (       a:  UR                  R                  S5      nU Vs/ s H  oUR                  5       PM     nn/ nUR                  b\  UR                  S5        UR                  (       a:  UR                  R                  S5      nU Vs/ s H  oUR                  5       PM     nnUR                  b  UR                  S5        UR
                  b  UR                  S5        UR                  b  UR                  S	5        UR                  b  UR                  S
5        [         R"                  " SS5      nSnUR                  b  UR                  S5        UR                  n	U	S:X  a!  UR$                  R&                  R(                  nOMU	S:X  a!  UR$                  R&                  R*                  nO&U	S:X  a   UR$                  R&                  R,                  nUR                  b  UR                  S5        UR                  b  UR                  S5        UR                  n
U
S:X  a.  UR/                  UR.                  R0                  R2                  S9nOU
S:X  a.  UR/                  UR.                  R0                  R4                  S9nOjU
S:X  a.  UR/                  UR.                  R0                  R6                  S9nO6U
S:X  a-  UR/                  UR.                  R0                  R8                  S9nOSn[:        R<                  " U S3UUUR                  UR
                  UR                  UR                  UUR                  WSR?                  U5      S9$ s  snf s  snf )zThis is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.
N)	r   r   r   r   r   r   r   r!   r"   z(must specify at least one of these flagsnotification_emails,enrolled_servicesactive_key_version!preferred_request_expiration_days!prefer_no_broad_approval_requestsnotification_pubsub_topicaccessapprovalv1"request_scope_max_width_preferencer   r   r   &require_customer_visible_justificationapproval_policyr   ) justificationBasedApprovalPolicyr   r   r   z/accessApprovalSettings)namer.   r0   r1   r2   r3   r4   r7   r8   r9   update_mask) r
   	GetParentr.   r0   r1   r2   r3   r4   r7   r8   r9   r	   MinimumArgumentExceptionappendsplitstripr   GetMessagesModuleAccessApprovalSettings-RequestScopeMaxWidthPreferenceValueValuesEnumr   r   r   CustomerApprovalApprovalPolicy/JustificationBasedApprovalPolicyValueValuesEnum(JUSTIFICATION_BASED_APPROVAL_ENABLED_ALL<JUSTIFICATION_BASED_APPROVAL_ENABLED_EXTERNAL_JUSTIFICATIONS(JUSTIFICATION_BASED_APPROVAL_NOT_ENABLED&JUSTIFICATION_BASED_APPROVAL_INHERITEDr   r   join)selfargspr<   emails_listiservices_listmsgsr7   preference_argapproval_policy_argr9   s               r*   Run
Update.Run   s(    	A 	  (""*##+22:22:**233;77?  (//
 5  KK+./		!	!..44S9*56+Qwwy+6M),-			..44S9,9:MqM:*-.--9<=--9<=%%145!!"2D9D)-&..:=> >>n	>	)''UUbb 	+ X%''UU\\ 	+ Y&''UU]] 	+ 22>AB'*+ 00		.==-1-P-P  .A  .A  .j  .j > 
 "# ==-1-P-P  .A  .A  .~  .~ > 
 "33==-1-P-P  .A  .A  .j  .j > 
 ">>==-1-P-P  .A  .A  .h  .h > 
 o??s)*''22*.*P*P*.*P*P"&"@"@+M/3/Z/Z'HH[) O 7 ;s   7P("P- N)__name__
__module____qualname____firstlineno____doc__textwrapdedentdetailed_helpstaticmethodr#   rU   __static_attributes__rW   r,   r*   r   r   '   sA     (// %# %'-R N N`r,   r   )r\   
__future__r   r   r   r]   &googlecloudsdk.api_lib.access_approvalr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r	   *googlecloudsdk.command_lib.access_approvalr
   r'   r(   UniverseCompatibleCommandr   rW   r,   r*   <module>ri      s\    5 &  '  ; , ( . = 5   AT\\ A Ar,   