
    !                         S 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SKJ	r	  SSK
Jr  S	 rS
 rS rS r " S S\R                   5      rg)zDUtils for Fleet Scopes Cluster Upgrade Feature command preparations.    )absolute_import)division)unicode_literals)arg_parsers)
exceptions)base)logc                     [         R                  " U5      nUR                  5       (       a!  UR                  5       nUR	                  X5      $ U $ )a	  Adds Cluster Upgrade Feature information to describe Scope request.

This is a modify_request_hook for gcloud declarative YAML.

Args:
  response: Scope message.
  args: command line arguments.

Returns:
  response with optional Cluster Upgrade Feature information
)r   DescribeCommandIsClusterUpgradeRequest
GetFeatureGetScopeWithClusterUpgradeInfo)responseargscmdfeatures       Plib/googlecloudsdk/command_lib/container/fleet/scopes/rollout_sequencing/util.pyDescribeClusterUpgrader      sE     	T"#  ""nnG--h@@	/    c                     [         R                  " U5      nUR                  R                  R	                  U R                  5       S9nU$ )N)name)r   UpdateCommand	hubclientmessagesScopeRelativeName)refr   r   r   s       r   HandleUpdateRequestr   /   s=    4 #]]##))s/?/?/A)B(	/r   c                    [         R                  " U5      nUR                  5       (       a  UR                  S5      (       a+  UR                  (       a  Sn[
        R                  " U5        U $ [         R                  " U5      nUR                  5       n[         R                  R                  U R                  5      nUR                  XV5      n[         R                  " U5      nUR                  XU5      $ U $ )zUpdates Cluster Upgrade feature.

Args:
  response: reference to the Scope object.
  args: command line arguments.

Returns:
  response
async_a  Both --async and Rollout Sequencing flag(s) specified. Cannot modify cluster upgrade feature until scope operation has completed. Ignoring Rollout Sequencing flag(s). Use synchronous update command to apply desired cluster upgrade feature changes to the current scope.)r   r   r   IsKnownAndSpecifiedr    r	   warningEnableCommandGetWithForceEnableClusterUpgradeCommandGetScopeNameWithProjectNumberr   Updater   AddClusterUpgradeInfoToScope)	r   r   
update_cmdmsg
enable_cmdr   
scope_nameupdated_featuredescribe_cmds	            r   UpdateClusterUpgrader/   5   s     !!$'*'')) ))dkk%c
 
kk#o##D)J++-G++IIJ ''<O''-L44X5DF F	/r   c                     A [         R                  " U5      nUR                  S5      =(       a    UR                  nUR	                  5       (       a  U(       a  [
        R                  " S5      eU$ )Nr    z9--async cannot be specified with Rollout Sequencing flags)r   r%   r!   r    r   r   ConflictingArgumentsException)r   r   requestr   is_asyncs        r   ValidateAsyncr4   X   s\    	""4(#&&x0@T[[(  ""x

2
2CE E	.r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )UpgradeSelectorc   zGExtends the ArgDict type to properly parse --upgrade-selector argument.c                 F   > [         [        U ]  [        [        S.SS/SS9  g )N)r   versionr   r9      )specrequired_keys
max_length)superr6   __init__str)self	__class__s    r   r?   UpgradeSelector.__init__f   s*    	/4)c*y) * r    )__name__
__module____qualname____firstlineno____doc__r?   __static_attributes____classcell__)rB   s   @r   r6   r6   c   s    O r   r6   N)rI   
__future__r   r   r   googlecloudsdk.callioper   r   Dgooglecloudsdk.command_lib.container.fleet.scopes.rollout_sequencingr   googlecloudsdk.corer	   r   r   r/   r4   ArgDictr6   rD   r   r   <module>rQ      sG    K &  ' / . U #( Fk)) r   