
                             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  ej                  ej                  j                          G d	 d
ej"                               Zddde_        y)z@Create VM maintenance resource policy concurrency-limit command.    )absolute_import)division)unicode_literals)base_classes)base)flags)utilc                   &    e Zd ZdZed        Zd Zy) CreateVmMaintenanceConcurrentSetzCreate a Compute Engine VM Maintenance Resource Policy.

  *{command} creates a Resource Policy which can be attached to instances and
  specifies amount of instances in the group that can go to maintenance.
  c                     t        j                         j                  |        t        j                  |        t        j                  |        | j
                  j                  d        y )N)r   MakeResourcePolicyArgAddArgumentAddCommonArgsAddMaxPercentArgdisplay_infoAddCacheUpdater)parsers    Plib/surface/compute/resource_policies/create/vm_maintenance/concurrency_limit.pyArgsz%CreateVmMaintenanceConcurrentSet.Args$   sI    	!--f5		6"
''-    c                    t        j                  | j                               }|j                  }t	        j
                         j                  ||j                  t        j                  |j                              }|j                  j                  }t        j                  |||      }|j                  ||j                  |j                        }|j                  j                   j"                  }|j%                  |d|fg      d   S )N)scope_lister)resourcePolicyprojectregionInsertr   )r   ComputeApiHolderReleaseTrackclientr   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListermessagesr	   !MakeVmMaintenanceConcurrentPolicy$ComputeResourcePoliciesInsertRequestr   r   apitools_clientresourcePoliciesMakeRequests)	selfargsholderr   
policy_refr$   resource_policycreate_requestservices	            r   Runz$CreateVmMaintenanceConcurrentSet.Run+   s    **4+<+<+>?F]]F,,.@@"88G A IJ
 }}%%H<<Z=EGOBB&""   C "N
 mm++<<G(N CDEaHHr   N)__name__
__module____qualname____doc__staticmethodr   r1    r   r   r   r      s!     . .Ir   r   zCreate a Compute Engine VM Maintenance Resource Policy that,
when attached to an instance, recognizes that instance as a part of a group of
instances where only up the configured amount of instances in that group can
undergo simultaneous maintenance.
    zThe following command creates a VM maintenance resource policy with a concurrency maintenance limit set to 1%.

    $ {command} my-resource-policy --region=REGION
)DESCRIPTIONEXAMPLESN)r5   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   r"   4googlecloudsdk.command_lib.compute.resource_policiesr	   ReleaseTracksr   ALPHACreateCommandr   detailed_helpr7   r   r   <module>rC      sv    G &  ' 7 ( E F E D%%++, It'9'9  I - IJ2   .r   