
                            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
 Z ej$                  ej&                  j(                        ej*                   G d dej,                                      Zy)z%Command for creating snapshot groups.    )base_classes)poller)waiter)base)flags)log)
properties)	resourcesc                     | j                  dd       t        j                  j                  |        t        j
                  j                  |        y)z5Add arguments used for parsing in all command tracks.namezThe name of the snapshot group.)helpN)add_argument
snap_flags!SOURCE_INSTANT_SNAPSHOT_GROUP_ARGAddArgumentr   
ASYNC_FLAGAddToParserparsers    -lib/surface/compute/snapshot_groups/create.py_CommonArgsr      s<    f#DE..::6B//f%    c                   ,    e Zd ZdZed        Zd Zd Zy)Createz'Create a Compute Engine snapshot group.c                     t        |        y N)r   r   s    r   ArgszCreate.Args)   s
    r   c                 $    | j                  |      S r   )_Run)selfargss     r   Runz
Create.Run-   s    99T?r   c                 X   t        j                  | j                               }|j                  j                  }|j                  j
                  }|j                  j                  |j                  dt        j                  j                  j                  j                  id      }|j                  |j                               }t         j"                  j%                  ||j                  t'        j(                  |j                              }|j+                         |_        |j/                  ||j                        }|j0                  j3                  |      }	t        j4                  j                  |	j                  d|j                  id      }
|j6                  r8t9        j:                  |
dj=                  |j                               d	d
       |	S t?        j@                  |j0                  |      }tC        jD                  ||
dj=                  |j                                     S )Nprojectzcompute.snapshotGroups)params
collection)r   )scope_lister)snapshotGroupr$   zcompute.globalOperationszgce snapshot group {0}TzWUse [gcloud compute operations describe] command to check the status of this operation.)kindis_asyncdetailszCreating gce snapshot group {0})#r   ComputeApiHolderReleaseTrackclientapitools_clientmessagesr
   Parser   r	   VALUEScorer$   	GetOrFailSnapshotGroupNamer   r   ResolveAsResourcer   GetDefaultScopeListerSelfLinksourceInstantSnapshotGroup"ComputeSnapshotGroupsInsertRequestsnapshotGroupsInsertREGISTRYasync_r   UpdatedResourceformatr   Pollerr   WaitFor)r    r!   holderr.   r0   sg_ref
sg_messageisg_refrequestresultoperation_refoperation_pollers               r   r   zCreate._Run0   s    **4+<+<+>?F]]**F}}%%H##		z((--55??
 , $ F ''[[] ( J ::LL00? M G
 -4,<,<,>J)99 &.. : G ""))'2F&&,,6>>*- - M
 {{	
'..v{{}=7 m}}V%:%:FC>>)00? r   N)__name__
__module____qualname____doc__staticmethodr   r"   r    r   r   r   r   $   s#     0 3r   r   N)rO   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   2googlecloudsdk.command_lib.compute.snapshot_groupsr   googlecloudsdk.corer   r	   r
   r   ReleaseTracksr-   ALPHADefaultUniverseOnlyCommandr   rQ   r   r   <module>r]      sr    , 8 < . ( 4 R # * )& D%%++,=T\\ =  -=r   