
                            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 Z ej&                  ej(                  j*                         G d dej,                               Z ej&                  ej(                  j0                         G d de             Z ej&                  ej(                  j4                         G d de             Zddde_        y)zCreate resource policy command.    )absolute_import)division)unicode_literals)base_classes)utils)apis)base)flags)utilc                    t        j                  d|      }t        j                         j	                  |        t        j
                  |        t        j                  | ||       | j                  j                  d       y)z?A helper function to build args based on different API version.computeN)	r   GetMessagesModuler
   MakeResourcePolicyArgAddArgumentAddCommonArgsAddGroupPlacementArgsdisplay_infoAddCacheUpdater)parserapi_versiontrackmessagess       ?lib/surface/compute/resource_policies/create/group_placement.py_CommonArgsr      s_    ##I{;(++F3ffh6%%d+    c                   &    e Zd ZdZed        Zd Zy)CreateGroupPlacement8Create a Compute Engine group placement resource policy.c                 j    t        | t        j                  t        j                  j
                         y N)r   compute_apiCOMPUTE_ALPHA_API_VERSIONr	   ReleaseTrackALPHAr   s    r   ArgszCreateGroupPlacement.Args+   s#    ==!!'')r   c                 2   t        j                  | j                               }|j                  }t	        j
                         j                  ||j                  t        j                  |j                              }|j                  j                  }t        j                  |||| j                               }|j                  ||j                  |j                        }|j                  j                   j"                  }|j%                  |d|fg      d   S )N)scope_lister)resourcePolicyprojectregionInsertr   )r   ComputeApiHolderr#   clientr
   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   r   MakeGroupPlacementPolicy$ComputeResourcePoliciesInsertRequestr*   r+   apitools_clientresourcePoliciesMakeRequests)	selfargsholderr.   
policy_refr   resource_policycreate_requestservices	            r   RunzCreateGroupPlacement.Run0   s    **4+<+<+>?F]]F,,.@@"88G A IJ
 }}%%H33Jh484E4E4GIOBB&""   C "N
 mm++<<G(N CDEaHHr   N)__name__
__module____qualname____doc__staticmethodr&   r?    r   r   r   r   '   s    @) )Ir   r   c                        e Zd ZdZed        Zy)CreateGroupPlacementBetar   c                 j    t        | t        j                  t        j                  j
                         y r    )r   r!   COMPUTE_BETA_API_VERSIONr	   r#   BETAr%   s    r   r&   zCreateGroupPlacementBeta.ArgsI   s#    <<!!&&(r   Nr@   rA   rB   rC   rD   r&   rE   r   r   rG   rG   E   s    @( (r   rG   c                        e Zd ZdZed        Zy)CreateGroupPlacementGar   c                 j    t        | t        j                  t        j                  j
                         y r    )r   r!   COMPUTE_GA_API_VERSIONr	   r#   GAr%   s    r   r&   zCreateGroupPlacementGa.ArgsS   s#    ::!!$$&r   NrK   rE   r   r   rM   rM   O   s    @& &r   rM   z9Create a Compute Engine Group Placement Resource Policy.
zTo create a Compute Engine group placement policy with two
availability domains, run:
  $ {command} my-resource-policy --region=REGION --availability-domain-count=2
)DESCRIPTIONEXAMPLESN)rC   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r!   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r1   4googlecloudsdk.command_lib.compute.resource_policiesr   r   ReleaseTracksr#   r$   CreateCommandr   rJ   rG   rP   rM   detailed_helprE   r   r   <module>r\      s    & &  ' 7 ? , ( E F E, D%%++,I4-- I -I: D%%**+(3 ( ,( D%%(()&1 & *&		&  "r   