
                             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  G d	 d
ej                  e
j                  ej                        Zy)z0The command to update Policy Controller Feature.    )absolute_import)division)unicode_literals)messages)base)command)flagsc                   t    e Zd ZdZdZdZed        Zd Zdde	fdZ
dej                  dej                  fd	Zy
)Updatea2  Updates the configuration of Policy Controller Feature.

  Updates the configuration of the Policy Controller installation
  ## EXAMPLES

  To change the installed version, run:

    $ {command} --version=VERSION

  To modify the audit interval to 120 seconds, run:

    $ {command} --audit-interval=120
  policycontrollerc                 .   |j                  d      }|j                  d      }t        j                  |d      }|j                  d      }t        j                  |d      }|j                          |j	                          |j                          |j                          |j                          |j                          |j                          |j                          |j                          t        j                         j                  |       y )NF)mutexTupdate)add_argument_groupr	   	PocoFlagsadd_membershipsadd_audit_intervaladd_constraint_violation_limitadd_exemptable_namespacesadd_log_denies_enabledadd_monitoringadd_mutationadd_referential_rulesadd_versionorigin_flagAddToParser)clsparsermodal_groupmembership_groupscope_flagsconfig_groupmanual_flagss          6lib/surface/container/fleet/policycontroller/update.pyArgszUpdate.Args.   s    ++%+8K"55D5A//+x8K#66U6CL??<:L ! ##%//1**,'')!&&( 
##$45    c           	         t        j                  || j                        }| j                  |      }|j	                         D ci c]  \  }}|| j                  ||       }}}| j                  ||j                               S c c}}w N)r	   PocoFlagParserr   
path_specsitemsr   update_specsuse_default_cfg)selfargsr   specspathsupdated_specss          r$   Runz
Update.RunF   sv    !!$6FOOD!EAFOgdAT4;;q&11MO]F,B,B,DEE Ps   Brefreshc                 b    t        | dd      }||r| j                         }t        | d|       |S )z4Gets and caches the current feature for this object.__feature_cacheN)getattr
GetFeaturesetattr)r.   r5   caches      r$   feature_cachezUpdate.feature_cacheL   s6    D+T2E}ooed%u-Lr&   specr   c                    |j                         r"|j                  | j                         |       |S |j                  }|j	                  |      }|j
                  }|j                  |      }|j                  |      }|j                  |      }|j                  |      }|j                  |      }|j                  |      }|j                  |      }||_        ||_        |S r(   )r-   set_default_cfgr<   r   update_versionpolicyControllerHubConfigupdate_audit_interval!update_constraint_violation_limitupdate_exemptable_namespacesupdate_log_deniesupdate_mutationupdate_monitoringupdate_referential_rules)r.   r=   r   pchub_cfgs        r$   r   zUpdate.updateT   s    T//148  K   b  $b,,g,,W5g88Ag33G<g((1g&&w/g((1g//8g%,b" dKr&   N)F)__name__
__module____qualname____doc__feature_namemf_nameclassmethodr%   r4   boolr<   r   Messager	   r)   r    r&   r$   r   r      sV     $,'6 6.F4 )) 53G3G r&   r   N)rN   
__future__r   r   r   apitools.base.protorpcliter   3googlecloudsdk.command_lib.container.fleet.featuresr   =googlecloudsdk.command_lib.container.fleet.membershipfeaturesmf_base;googlecloudsdk.command_lib.container.fleet.policycontrollerr   r	   UpdateCommandPocoCommandr   rT   r&   r$   <module>r]      sF    7 &  ' / D Y O MJT!6!68K8K Jr&   