
                         >   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S	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  \R&                  " \R(                  R*                  \R(                  R,                  5       " S S\R.                  5      5       rg)z>Command to create an Immersive Stream for XR service instance.    )absolute_import)division)unicode_literals)api_util)	instances)waiter)base)flags)resource_args)log)
properties)	resourcesc                   H    \ rS rSrSrSSS.r\S 5       r\S 5       rS r	Sr
g	)
Create    z3Create an Immersive Stream for XR service instance.a  
          To create a service instance called `my-instance` serving content
          `my-content` with version `my-version` that has availablilty for 2
          concurent sessions in us-west1 region and 3 concurrent sessions in
          us-east4 region, run:

            $ {command} my-instance --content=my-content --version=my-version --add-region=region=us-west1,capacity=2 --add-region=region=us-east4,capacity=3

          Optionally, a fallback url may be specified. Users will be redirected
          to this fallback url when the service instance is unable to provide
          the streaming experience.
          To create a service instance called `my-instance` serving content
          `my-content` with version `my-version` that has availablilty for 2
          concurent sessions in us-west1 and uses fallback url
          `https://www.google.com` run:

            $ {command} my-instance --content=my-content --version=my-version --add-region=region=us-west1,capacity=2 --fallback-url="https://www.google.com"

           By default, the instance is created with mode=ar, which supports both
           3D and AR experiences. Instances can also be configured to use
           3D-only mode. This configuration cannot be updated later.
           To use 3D-only mode, include:

            --mode=3d

           By default, the instance is created with gpu-class=t4. This uses the
           NVIDIA T4 GPU for the instance. Instances can also be configured to
           use NVIDIA L4 GPUs at creation. Note that only certain regions are
           available for L4, and only 3D-only mode is supported. This
           configuration cannot be updated later.
           To use NVIDIA L4 GPU for the instance, include:

            --gpu-class=l4
      )DESCRIPTIONEXAMPLESc                 D    [         R                  " U R                  S5      $ )Nadd)r
   ValidateRegionConfigArgs
add_region)argss    3lib/surface/immersive_stream/xr/instances/create.py__ValidateArgsCreate.__ValidateArgsJ   s    ))$//5AA    c                 D   [         R                  " U SSS9  U R                  SSS9  U R                  SSS	S
9  U R                  SSSS9  U R                  SSSS9  U R                  SSSS9  [        R                  " SU 5        [
        R                  R                  U 5        g )Nzserved by the instanceF)verb
positionalinstancez"Name of the instance to be created)helpz	--versionTz8Build version tag of the content served by this instance)requiredr!   z--fallback-urlzjFallback url to redirect users to when this service instance is unable to provide the streaming experience)r!   r"   z--modez=The rendering mode that is supported by this service instancez--gpu-classz6The class of GPU that is used by this service instancez--add-region)r   AddContentResourceArgadd_argumentr
   AddRegionConfigArgr	   
ASYNC_FLAGAddToParser)parsers    r   ArgsCreate.ArgsN   s    ''-% 
)MN
G  
 :    L  
 E  
 
^V4OO'r   c                 \   [         R                  U5      (       d  g UR                  nUR                  R                  R                  5       nUR                  5       nUR                  nUR                  nUR                  nUR                  nUR                  n	UR                  n
U(       a  [        R                  " U5      (       d  g U	(       a  [        R                  " U	5      (       d  g U
(       a  [        R                   " X5      (       d  g ["        R$                  " U R'                  5       5      n[(        R*                  " U R'                  5       US S S S9n[(        R                   " U R'                  5       UUUUUUU	U
5	      n[,        R.                  R1                  SR3                  U5      5        UR4                  (       a:  [,        R.                  R1                  SR3                  UR6                  5      5        U$ [8        R:                  R                  UR6                  ["        R<                  " U R'                  5       5      SS9n[>        R@                  " [>        RB                  " URD                  URF                  5      USR3                  UR6                  5      5      n[8        R:                  R                  S S["        R<                  " U R'                  5       5      [H        RJ                  RL                  RN                  RQ                  SS	9S
US.S9n[,        RR                  " U5        U$ )N)add_region_configsupdate_region_configsremove_regionscurrent_instancezCreate request issued for: [{}]z!Check operation [{}] for status.
z$stream.projects.locations.operations)api_version
collectionz&Waiting for operation [{}] to completez)stream.projects.locations.streamInstancesT)r"   global)
projectsIdlocationsIdstreamInstancesId)r1   r0   params)*r   _Create__ValidateArgsr   CONCEPTScontentParseRelativeNamer4   r    versionfallback_urlmode	gpu_classr
   ValidateUrlValidateModeValidateGpuClassr   	GetClientReleaseTrackr   GenerateTargetLocationConfigsr   statusPrintformatasync_namer   REGISTRYGetApiVersionr   WaitForCloudOperationPoller"projects_locations_streamInstancesprojects_locations_operationsr   VALUEScoreprojectGetCreatedResource)selfr   region_configscontent_refcontent_namelocationinstance_namer<   r=   r>   r?   clienttarget_location_configsresult_operationoperation_resourcecreated_instanceinstance_resources                    r   Run
Create.Runn   s     &&__N--''--/K++-L&&HMMMllG$$L99DIE--l;;E&&t,,//	@@ 1 1 34F'EE)" !''
 JJ6==mLM{{	jj
.
5
56F6K6K
L "++11**4+<+<+>?9 2 
 ~~##5500	
 	0778H8M8MN "**00>**4+<+<+>?$++0088<<d<K#!.
	 1 	 )*r    N)__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr7   r)   rb   __static_attributes__rd   r   r   r   r       sH    ; K!
$-L B B ( (>Lr   r   N)ri   
__future__r   r   r   *googlecloudsdk.api_lib.immersive_stream.xrr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   .googlecloudsdk.command_lib.immersive_stream.xrr
   r   googlecloudsdk.corer   r   r   ReleaseTracksrD   ALPHAGACreateCommandr   rd   r   r   <module>rw      sy    E &  ' ? @ . ( @ H # * ) D%%++T->->-A-ABYT Y CYr   