
    ^                         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                        Zy)z$Command to update fleet information.    )absolute_import)division)unicode_literals)client)util)base)	resources)labels_utilc                   &    e Zd ZdZed        Zd Zy)Updatea  Update a fleet namespace.

  This command can fail for the following reasons:
  * The project specified does not exist.
  * The fleet namespace does not exist in the project.
  * The caller does not have permission to access the project or namespace.

  ## EXAMPLES

  To update the namespace `NAMESPACE` in the active project:

    $ {command} NAMESPACE

  To update the namespace `NAMESPACE` in project `PROJECT_ID`:

    $ {command} NAMESPACE --project=PROJECT_ID
  c                     t        j                  |t        j                  | j	                            dd       t        j                  |       t        j                  |       y )Nz*Name of the fleet namespace to be updated.T)api_versionnamespace_helprequired)r	   AddScopeNamespaceResourceArgr   VERSION_MAPReleaseTrackr
   AddUpdateLabelsFlagsAddUpdateNamespaceLabelsFlags)clsparsers     7lib/surface/container/fleet/scopes/namespaces/update.pyArgszUpdate.Args/   sN    **$$S%5%5%78C	 $$V,++F3    c                 :   g }|j                   j                  j                         }|j                         }t	        j
                  | j                               }|j                  |      }t        j                  j                  |      }|j                  |j                  j                  j                  |j                        j!                         }|r|j#                  d       t        j                  |j$                  |j&                  |j(                        }	|	j                  |j                  j                  j*                  |j,                        j!                         }
|
r|j#                  d       |sy |j/                  |||
dj1                  |            S )N)release_tracklabelsnamespace_labels,)mask)CONCEPTS	namespaceParseRelativeNamer   FleetClientr   GetScopeNamespacer
   DiffFromUpdateArgsApplymessages	NamespaceLabelsValuer   	GetOrNoneappendupdate_namespace_labelsremove_namespace_labelsclear_namespace_labelsNamespaceLabelsValuenamespaceLabelsUpdateScopeNamespacejoin)selfargsr    namespace_argnamespace_pathfleetclientcurrent_namespacelabels_diff
new_labelsnamespace_labels_diffnew_namespace_labelss              r   Runz
Update.Run:   sf   DMM++113M"//1N$$43D3D3FGK#55nE ""11$7K""&&224E4L4Lik  
kk( (,,$$$$##
 166&&;;)) ik  
kk$% ++
$8sxx~ ,  r   N)__name__
__module____qualname____doc__classmethodr   r@    r   r   r   r      s     $ 4 4!r   r   N)rD   
__future__r   r   r   &googlecloudsdk.api_lib.container.fleetr   r   googlecloudsdk.callioper   *googlecloudsdk.command_lib.container.fleetr	   $googlecloudsdk.command_lib.util.argsr
   UpdateCommandr   rF   r   r   <module>rM      s4    + &  ' 9 7 ( @ <?T ?r   