
                             S r SSKJr  SSKJr  SSKJr  SSKJrJr  SSKJ	r	  SSS	S
.SSS.SS/S.S.r
\\\\S4   4   rS\\\4   S\\\4   4S jrS\	R                  S\\\4   S\4S jrS rS\4S jrg)z'Utilities for working with update mask.    )absolute_import)division)unicode_literals)DictUnion)parser_extensionsz--display-namez--security-posturez!--workload-vulnerability-scanning)modevulnerability_modez--binauthz-evaluation-modez--binauthz-policy-bindings)evaluation_modepolicy_bindingsz--compliancez--compliance-standards)security_posture_configbinary_authorization_configcompliance_posture_config)display_namedefault_cluster_configLevelmessage_to_flagsreturnc                 V   ^ S[         S[        [        [        4   4U4S jjmT" U 5      $ )a}  Construct flag to update mask paths during runtime.

From top level field, combine the string up to the leaf dict.

Flag fields are unique.

Args:
  message_to_flags: Receive value from MESSAGE_TO_FLAGS.

Returns:
  A dictionary that maps each flag to the corresponding field update path.

Given the below message to flag structure,

  {
    parent: {
      child1: {
        foo: '--flag-for-foo',
        child2: {
          bar: '--flag-for-bar'
        }
      }
    }
  }

It should produce the following flag to update path mapping:

  {
    '--flag-for-foo': parent.child1.foo,
    '--flag-for-bar': parent.child1.child2.bar,
  }
levelr   c                   > 0 nU R                  5        Hm  u  p#[        U[        5      (       a  X!U'   M   [        U[        5      (       a  U H  nX!U'   M	     MD  T" U5      R                  5        H  u  pVUS-   U-   X'   M     Mo     U$ )N.)items
isinstancestrlist)r   ret	curr_pathflag_or_levelflagkeyremain_path	Recursives          =lib/googlecloudsdk/command_lib/container/fleet/update_mask.pyr#   (FlagToUpdateMaskPaths.<locals>.RecursiveU   s    
C$)KKM 		M3	'	'&MmT**!Dd) " !*- 8 > > @C_{2#( !A %2 j    )r   r   r   )r   r#   s    @r$   FlagToUpdateMaskPathsr'   1   s-    Hu c3h  
#	$$r&   argsflag_to_update_mask_pathsc                     / nUR                  5        H+  u  p4X0R                  5       ;   d  M  UR                  U5        M-     SR                  [	        [        U5      5      5      $ )a  Maps specified flags to API field paths of mutable fields.

args.GetSpecifiedArgNames() returns a list of specified flags.

For example, `gcloud alpha container fleet create --display-name my-fleet
--format 'yaml(displayName)'`
args.GetSpecifiedArgNames() = ['--display-name', '--format']

Args:
  args: All arguments passed from CLI.
  flag_to_update_mask_paths: Mapping for a specific resource, such as user
    cluster, or node pool.

Returns:
  A string that contains yaml field paths to be used in the API update
  request.
,)r   GetSpecifiedArgNamesappendjoinsortedset)r(   r)   r   r    update_masks        r$   GetUpdateMaskr2   f   sT    ( 	#4::<d((**	jj = 88F3s8$%%r&   c                 6    [        [        5      n[        X5      $ )N)r'   FLEET_MESSAGE_TO_FLAGSr2   )r(   fleet_flag_to_update_mask_pathss     r$   GetFleetUpdateMaskr6      s    $9%! 
t	==r&   c                 T    U R                  S5      =(       d    U R                  S5      $ )Nbinauthz_evaluation_modebinauthz_policy_bindings)IsKnownAndSpecified)r(   s    r$   HasBinauthzConfigr;      s,    		!	! 
 
< :;<r&   N)__doc__
__future__r   r   r   typingr   r   googlecloudsdk.callioper   r4   r   r   r'   	Namespacer2   r6   boolr;    r&   r$   <module>rC      s    . &  '  5 % )"E$

  <;(
 '56N%O
 " 	S%W%%&2%3:&2%	#s(^2%j&

%
%&BFsCx.&&8><t <r&   