
    +                         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
 rS rS rS rS rS rS rS rS rS rS rS rg)zAdvice group command flags.    )absolute_import)division)unicode_literals)utils)arg_parsers)
exceptions)flags)	arg_utilsc                 0    [         R                  " U SSS9  g)zAdd the --region flag.	resourceszget advice on)parserresource_typeoperation_typeN)compute_flagsAddRegionFlagr   s    6lib/googlecloudsdk/command_lib/compute/advice/flags.pyr   r      s    $&    c                 N    U R                  SS[        R                  " 5       SS9  g)zAdd the --location_policy flag.z--location-policyzZONE=POLICYa  
        Policy for which zones to include or exclude when looking for the optimal
        time window and zone for Future Reservations within a region. Policy is
        defined as a list of key-value pairs, with the key being the zone name,
        and value being the applied policy. Available policies are `allow` and
        `deny`. Default for zones if left unspecified is `allow`.

        Example:

          gcloud compute advice calendar-mode --location-policy=us-central1-a=allow,us-central1-b=deny
      )metavartypehelpN)add_argumentr   ArgDictr   s    r   AddLocationPolicyFlagr   %   s,     

	  r   c                     U R                  S[        R                  " [        R                  R                  [        R                  R                  S.SS9SS9  g)z Add the --start-time-range flag.z--start-time-rangefromto   spec
max_lengtha  
        A time range for the start time of the Future Reservation. Defined as
        a list of key-value pairs.

        The key is either "from" or "to", and the value is a datetime.
        See $ gcloud topic datetimes for information on time formats.

        *from*:: The earliest possible start time for the reservation.
        *to*:: The latest possible start time for the reservation.

        Example:

          gcloud compute advice calendar-mode --start-time-range=from=2024-08-01T00:00:00Z,to=2024-08-02T00:00:00Z
      r   r   Nr   r   r   DatetimeParser   s    r   AddStartTimeRangeFlagr(   9   sS    !**00((.. 
  r   c                     U R                  S[        R                  " [        R                  R                  [        R                  R                  S.SS9SS9  g)zAdd the --end-time-range flag.z--end-time-ranger   r    r!   a  
        A time range for the end time of the Future Reservation. Defined as
        a list of key-value pairs.

        The key is either "from" or "to", and the value is a datetime.
        See $ gcloud topic datetimes for information on time formats.

        *from*:: The earliest possible end time for the reservation.
        *to*:: The latest possible end time for the reservation.

        Example:

          gcloud compute advice calendar-mode --end-time-range=from=2024-08-01T00:00:00Z,to=2024-08-02T00:00:00Z
      r$   Nr%   r   s    r   AddEndTimeRangeFlagr*   U   sS    !**00((.. 
  r   c                     U R                  S[        R                  " [        R                  " 5       [        R                  " 5       S.SS9SS9  g)zAdd the --duration-range flag.z--duration-range)minmaxr    r!   a  
        A duration range for the duration of the Future Reservation. Defined as
        a list of key-value pairs.

        The key is either "min" or "max", and the value is a duration in seconds.
        For example, specify `30m` for a duration of 30 minutes or specify
        `1d2h3m4s` for a duration of 1 day, 2 hours, 3 minutes, and 4 seconds.

        See $ gcloud topic datetimes for information on duration formats.

        *min*:: The minimum duration of the Future Reservation.
        *max*:: The maximum duration of the Future Reservation.

        Example:

          gcloud compute advice calendar-mode --duration-range=min=24h,max=72h
      r$   N)r   r   r   Durationr   s    r   AddDurationRangeFlagr/   q   sM     ))+ ))+ 
  r   c                 B   U R                  SS9n[        R                  " S5      R                  U5        [        R                  " S5      nSUR
                  S'   UR                  U5        [        R                  " 5       nSUR
                  S'   UR                  U5        g)zAdd the SKU properties flags.zW
        Define individual instance properties for the specific SKU reservation.
      r   Tz2The number of instances to check for availability.r   a,    Manage the size and the interface of local SSD to use. See
  https://cloud.google.com/compute/docs/disks/local-ssd for more information.
  *interface*::: The kind of disk interface exposed to the VM for this SSD.
  The only valid value is `nvme`.
  *size*::: The size of the local SSD in base-2 GB.N)	add_groupreservation_flagsGetMachineTypeAddToParserGetVmCountFlagkwargsGetLocalSsdFlag)accelerator_properties_groupinstance_properties_groupvm_count_flaglocal_ssd_flags       r   AddSkuPropertiesFlagsr=      s     ;DD K
D 
 ""4(445NO $2248-> v 56 %446.#7. 67r   c                    U R                  SS9n[        R                  " S5      R                  U5        [        R                  " S5      nSUR
                  S'   UR                  U5        [        R                  " S5      nSUR
                  S'   SUR
                  S	   S
'   SUR
                  S	   S'   UR                  U5        g)z#Add the aggregate properties flags.zN
          You must define the version and number of TPUs to reserve.
        r1   Tz.The number of chips to check for availability.r   Fz?Type of the workload that will be running on the reserved TPUs.zReserved resources will be optimized for SERVING workloads that handle concurrent requests and require minimal network latency, such as ML inference.choicesSERVINGzReserved resources will be optimized for BATCH workloads that handle large amounts of data in single or multiple operations, such as ML training workloads.BATCHN)r2   r3   GetTpuVersionr5   GetChipCountr7   GetWorkloadType)r9   aggregate_properties_groupchip_count_flagworkload_type_flags       r   AddAggregatePropertiesFlagsrH      s      <EE LE  
 !!$'334NO &2248/:   89 )88?K F# I&y1( I&w/
   !;<r   c                 R    U R                  SSSS9n[        U5        [        U5        g)z%Add the accelerator properties flags.zb
        Specify the properties of the resources that you want to view the availability of.
      T)r   mutexrequiredN)r2   r=   rH   )r   r9   s     r   AddAcceleratorPropertiesFlagsrL      s9    !'!1!1
  "2 " 45:;r   c                 2    SnU R                  SSS0SUSS9  g)zAdd the --deployment-type flag.z3  The deployment type for the reserved capacity.
  z--deployment-typeDENSEz6DENSE mode is for densely deployed reservation blocks.T)r?   defaultr   hiddenN)r   )r   	help_texts     r   AddDeploymentTypeFlagrR      s7    ) 	
K   r   c                 N    SS0nU R                  SU[        R                  SSS9  g)z"Add the --provisioning-model flag.SPOTzCompute Engine may preempt a Spot VM whenever it needs capacity. Because Spot VMs don't have a guaranteed runtime, they come at a discounted price.z--provisioning-modelTz#
Specifies the provisioning model.
r?   r   rK   r   Nr   r
   ChoiceToEnumName)r   provisioning_model_choicess     r   AddProvisioningModelFlagrY      s@       	(%%  r   c                 T    SnSSS.nU R                  SU[        R                  SUS9  g)	z)Add the --target-distribution-shape flag.z>Defines the distribution requirement for the requested VMs.
  a.  When you specify ANY for VM instance creation across multiple zones, you specify that you want to create your VM instances in one or more zones based on resource availability, and to use any unused, matching reservation in your project. Use ANY for batch workloads that don't require high availability.a  When you specify ANY_SINGLE_ZONE for VM instance creation, you specify that you want to create all VM instances in a single available zone. Compute Engine selects this zone based on resource availability and on any unused, matching reservation in your project. However, zonal resource availability constraints might prevent Compute Engine from creating all your requested VM instances. Use ANY_SINGLE_ZONE when the VM instances in your workloads need to frequently communicate among each other.)ANYANY_SINGLE_ZONEz--target-distribution-shapeTrU   NrV   )r   rQ   r?   s      r   AddTargetDistributionShapeFlagr]     sE    )
=H'& 	#%%  r   c                    U R                   (       d  gSS0n/ nU R                    H3  nUR                  USUS9nUR                  UR                  5       5        M5     [	        U Vs/ s H  n[
        R                  " U5      PM     sn5      n[        U5      S:  a  [        R                  " SS5      e[        U5      S:X  ay  U R                  (       ag  UR                  5       nUR                  U R                  S	US9n	U	R                  5       n
X:w  a&  [        R                  " SS
R                  U
5      5      egggs  snf )z$Validate --zones and --region flags.Nprojectfakezcompute.zones)
collectionparams   z--zonesz%All zones must be in the same region.zcompute.regionsz2Specified zones are not in specified region [{0}].)zonesr'   appendNamesetr   ZoneNameToRegionNamelenr   InvalidArgumentExceptionregionpopformat)argsr   ignored_required_params
zone_nameszonezone_refzzone_regionszone_region
region_refrk   s              r   ValidateZonesAndRegionFlagsrw   &  s5   	
&/*jjd1H  H hmmo&	  ZHZe003ZHI,

-
-:  <A$++""$K$& ! J
 __F//

>
E
Ef
M   #. Is   % D;N)__doc__
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r   /googlecloudsdk.command_lib.compute.reservationsr3   $googlecloudsdk.command_lib.util.apisr
   r   r   r(   r*   r/   r=   rH   rL   rR   rY   r]   rw    r   r   <module>r      sc    " &  ' 0 / . E V :&(88>88 =F<*(@r   