
    k                         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 create a fleet namespace.    )absolute_import)division)unicode_literals)client)util)base)	resources)labels_utilc                   &    e Zd ZdZed        Zd Zy)Createa   Create a fleet namespace.

  This command can fail for the following reasons:
  * The project specified does not exist.
  * The project has a fleet namespace with the same name.
  * The caller does not have permission to access the given project.

  ## EXAMPLES

  To create a fleet namespace with name `NAMESPACE` in the active project, run:

    $ {command} NAMESPACE

  To create a fleet namespace in fleet scope `SCOPE` in project `PROJECT_ID`
  with name
  `NAMESPACE`, run:

    $ {command} NAMESPACE --scope=SCOPE --project=PROJECT_ID
  c                     t        j                  |t        j                  | j	                            dd       t        j                  |       t        j                  |       y )NzpName of the fleet namespace to be created. Must comply with RFC 1123 (up to 63 characters, alphanumeric and '-')T)api_versionnamespace_helprequired)r	   AddScopeNamespaceResourceArgr   VERSION_MAPReleaseTrackr
   AddCreateLabelsFlagsAddCreateNamespaceLabelsFlags)clsparsers     7lib/surface/container/fleet/scopes/namespaces/create.pyArgszCreate.Args1   sS    **$$S%5%5%78D  $$V,++F3    c                    |j                   j                  j                         }|j                         }|j	                         }|j                         j	                         }t        j                  | j                               }t        j                  |j                        }|j                  |j                  j                  j                  d       j!                         }t        j                  |j"                        }	|	j                  |j                  j                  j$                  d       j!                         }
|j'                  |||||
      S )N)release_track)	additions)labelsnamespace_labels)CONCEPTS	namespaceParseNameRelativeNameParentr   FleetClientr   r
   Diffr   Applymessages	NamespaceLabelsValue	GetOrNoner   NamespaceLabelsValueCreateScopeNamespace)selfargsnamespace_argnamenamespace_pathparent_pathfleetclientlabels_diffr   ns_labels_diff	ns_labelss              r   Runz
Create.Run?   s   MM++113MD"//1N&&(557K$$43D3D3FGK""T[[9K&&22Dik  !%%0E0EFN$$&&;;Tik  ++" ,  r   N)__name__
__module____qualname____doc__classmethodr   r9    r   r   r   r      s     ( 4 4r   r   N)r=   
__future__r   r   r   &googlecloudsdk.api_lib.container.fleetr   r   googlecloudsdk.callioper   *googlecloudsdk.command_lib.container.fleetr	   $googlecloudsdk.command_lib.util.argsr
   CreateCommandr   r?   r   r   <module>rF      s4    + &  ' 9 7 ( @ <7T 7r   