
    *                         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 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 e
j*                   G d de
j,                               Zy)zCommand to create a fleet.    )absolute_import)division)unicode_literals)client)types)util)base)parser_arguments)parser_extensions)flags)labels_util)logc                   r    e Zd ZdZedej                  fd       Zdej                  de
j                  fdZy)Createa  Create a fleet.

  This command can fail for the following reasons:
  * The project specified does not exist.
  * The project specified already has a fleet.
  * The active account does not have permission to access the given project.

  ## EXAMPLES

  To create a fleet in project `example-foo-bar-1` with display name `my-fleet`,
  run:

    $ {command} --display-name=my-fleet --project=example-foo-bar-1
  parserc                     t        j                  |       }|j                          |j                          |j	                          t        j                  |        y )N)fleet_flags
FleetFlagsAddAsyncAddDisplayNameAddDefaultClusterConfigr   AddCreateLabelsFlags)r   r   s     %lib/surface/container/fleet/create.pyArgszCreate.Args3   sB    ""6*E	NN		!!#$$V,    argsreturnc                 J   t        j                  || j                               }d|j                         vr;|j	                         rt
        j                  |_        nt
        j                  |_        |j                         }t        j                  | j                               }t        j                  |j                        }|j                  |j                   j                  j"                  d      j%                         }||_        |j                   j'                  |t)        j*                  |j-                                     }|j/                  |      }t)        j0                  |j-                               }	|j	                         r(t3        j4                  |	d|j	                                |S t        j6                  | j                               }
|
j9                  t)        j:                  |            }t3        j4                  |	d|j	                                |S )a  Runs the fleet create command.

    User specified --format takes the highest priority. If not specified, it
    prints the default format of long-running operation or fleet, depending on
    whether --async is specified.

    $ {command} --async
      The output is in default operation format.

    $ {command} --async --format
      The output is in user specified format.

    $ {command}
      The output is in default fleet format.

    $ {command} --format
      The output is in user specified format.

    Args:
      args: Arguments received from command line.

    Returns:
      A completed create operation; if `--async` is specified, return a
      long-running operation to be polled manually.
    )release_trackz--format)	additionsN)fleetparentzAnthos fleet)kindis_async)r   FleetFlagParserReleaseTrackGetSpecifiedArgNamesAsync
fleet_utilOPERATION_FORMATformatFLEET_FORMATFleetr   FleetClientr   DifflabelsApplymessagesLabelsValue	GetOrNone*GkehubProjectsLocationsFleetsCreateRequestr   FleetParentNameProjectCreateFleetFleetRefr   CreatedResourceOperationClientWaitOperationRef)selfr   flag_parserr!   fleetclientlabels_diffr0   req	operation	fleet_refoperation_clientcompleted_operations               r   Runz
Create.Run;   s   4 --D--/K 2244				 11 --E$$43D3D3FGK""T[[9K""..ik  EL



I
I##K$7$7$9: J C '',Ik1134I	
.;3D3D3F --d.?.?.AB*//0A0A)0LM1B1B1D r   N)__name__
__module____qualname____doc__staticmethodr
   ArgumentInterceptorr   r   	Namespacer   	OperationrG    r   r   r   r   "   sG     -#77 - -='11 =eoo =r   r   N)rK   
__future__r   r   r   &googlecloudsdk.api_lib.container.fleetr   r   r   googlecloudsdk.callioper	   r
   r   *googlecloudsdk.command_lib.container.fleetr   r   r)   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   DefaultUniverseOnlyCreateCommandr   rP   r   r   <module>rY      s[     ! &  ' 9 8 7 ( 4 5 K I < # UT U Ur   