
    #                        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  \R&                  " \R(                  R*                  5      \R,                   " S S\R.                  5      5       5       r\R&                  " \R(                  R2                  5       " S S\5      5       r\R&                  " \R(                  R6                  5       " S S\5      5       rS rg)zUpdate worker pool command.    )cloudbuild_exceptions)cloudbuild_util)workerpool_config)utils)waiter)base)
exceptions)workerpool_flags)log)
properties)	resourcesc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Update   )Update a worker pool used by Cloud Build.z{description}z          To change the machine type and disk size of workers in a worker pool named wp1, run:

            $ {command} wp1 --region=us-central1                 --worker-machine-type=e2-standard-2                 --worker-disk-size=64GB
          )DESCRIPTIONEXAMPLESc                     [         R                  " U [        R                  R                  5      n U R
                  R                  S5        g)Register flags for this command.

Args:
  parser: An argparse.ArgumentParser-like object. It is mocked out in order
    to capture some information, but behaves like an ArgumentParser.

          table(
            name.segment(-1),
            createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            state
          )
        N)r
   AddWorkerpoolUpdateArgsr   ReleaseTrackGAdisplay_info	AddFormatparsers    )lib/surface/builds/worker_pools/update.pyArgsUpdate.Args1   s?     55f6:6G6G6J6JLF
!! #     c                 4    [        XR                  5       5      $ )This is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.
)_UpdateWorkerPoolFirstGenr   selfargss     r   Run
Update.RunC   s     %T+<+<+>??r!    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r(   __static_attributes__r*   r!   r   r   r      s2     2 	-  "@r!   r   c                   .    \ rS rSrSr\S 5       rS rSrg)
UpdateBetaQ   r   c                     [         R                  " U [        R                  R                  5      n U R                  SS[        SS9  U R                  R                  S5        gr   --generation   zGeneration of the worker pool.)defaulttypehelpr   N)	r
   r   r   r   BETAadd_argumentintr   r   r   s    r   r   UpdateBeta.ArgsU   s`     55f6:6G6G6L6LNF
.	   !! # r!   c                     UR                   S:X  a  [        XR                  5       5      $ UR                   S:X  a  [        R                  " SS5      e[        R                  " SS5      er#   r9      r8   zifor generation=2 please use the gcloud command "gcloud builds worker-pools apply" to update a worker poolz=please use one of the following valid generation values: 1, 2
generationr$   r   r	   InvalidArgumentExceptionr%   s     r   r(   UpdateBeta.Runm   f     !&t->->-@AA!//
9  
-
-G r!   r*   N	r+   r,   r-   r.   r/   r1   r   r(   r2   r*   r!   r   r4   r4   Q   s    1 .r!   r4   c                   .    \ rS rSrSr\S 5       rS rSrg)UpdateAlpha   z*Update a private pool used by Cloud Build.c                     [         R                  " U [        R                  R                  5      n U R                  SS[        SS9  U R                  R                  S5        gr7   )	r
   r   r   r   ALPHAr>   r?   r   r   r   s    r   r   UpdateAlpha.Args   s`     55f6:6G6G6M6MOF
.	   !! # r!   c                     UR                   S:X  a  [        XR                  5       5      $ UR                   S:X  a  [        R                  " SS5      e[        R                  " SS5      erB   rD   r%   s     r   r(   UpdateAlpha.Run   rH   r!   r*   NrI   r*   r!   r   rK   rK      s    2 .r!   rK   c           	      R   U R                   nU R                  nU(       d2  [        R                  R                  R                  R                  5       n[        R                  " U5      n[        R                  " U5      n[        R                  R                  R                  R                  SS9nUR                  5       nU R                  b.   [        R                  " U R                  UR                  5      nGO]UR+                  5       Ul        UR/                  5       n	U R0                  b  U R0                  U	l        U R4                  b%  [6        R8                  " U R4                  5      U	l        XR,                  l        UR?                  5       n
U R@                  b  U R@                  (       a/  U[B        RD                  RF                  :X  aF  U RH                  (       a5  UR>                  RJ                  RL                  U
l'        XR,                  l(        U R@                  (       a5  UR>                  RJ                  RR                  U
l'        XR,                  l(        [T        RV                  RY                  SS[        RZ                  U   UUUS.S9n[        R\                  " U5      nUR_                  URa                  5       USRc                  U5      S	9nURd                  Rg                  U5      n[T        RV                  Ri                  URj                  S
S9n[l        Rn                  " [l        Rp                  " URd                  URr                  5      US5      n[$        Rt                  " U5        U$ ! [         R"                   a&  n[$        R&                  R)                  S5        UeSnAff = f)a.  Updates a Worker Pool First Generation.

Args:
  args: an argparse namespace. All the arguments that were provided to the
      update command invocation.
  release_track: The desired value of the enum
    googlecloudsdk.calliope.base.ReleaseTrack.

Returns:
  A Worker Pool First Generation resource.
T)requiredNz*
Failed to parse configuration from file.
z)cloudbuild.projects.locations.workerPools)
projectsIdlocationsIdworkerPoolsId)
collectionapi_versionparams,)name
workerPool
updateMaskz(cloudbuild.projects.locations.operations)rW   zUpdating worker pool);WORKER_POOLregionr   VALUESbuilds	GetOrFailr   GetClientInstanceGetMessagesModulecoreprojectGet
WorkerPoolconfig_from_filer   LoadWorkerpoolConfigFromPathr   ParseProtoExceptionr   errPrintPrivatePoolV1ConfigprivatePoolV1ConfigWorkerConfigworker_machine_typemachineTypeworker_disk_sizecompute_utils	BytesToGb
diskSizeGbworkerConfigNetworkConfigpublic_egressr   r   r   no_external_ipEgressOptionValueValuesEnumNO_PUBLIC_EGRESSegressOptionnetworkConfigPUBLIC_EGRESSr   REGISTRYParseRELEASE_TRACK_TO_API_VERSIONMessageToFieldPaths2CloudbuildProjectsLocationsWorkerPoolsPatchRequestRelativeNamejoinprojects_locations_workerPoolsPatchParseRelativeNamer[   r   WaitForCloudOperationPollerprojects_locations_operationsUpdatedResource)r'   release_trackwp_name	wp_regionclientmessagesparentwprl   worker_configncwp_resourceupdate_maskreq
updated_opop_resource
updated_wps                    r   r$   r$      s	    'kk)	!!((//99;I,,];&..}=(!!))--t-<& "	&99


!4!46b &99;B))+M+"&":":m(!.!8!8


"m +8'				!B&t/A/A**---$2E2E 
 
 
<
<
M
M 	o .0*

 
 
<
<
J
J 	o .0* ""((
<!>>}M""	 ) 	+  33B7+CC##%+& 	D 	(#
 44::3?*""44oo"L 5 N+~~!!&"G"G"("F"FH)+*
 k"	s !44 	ggmmBCis   +M, ,N& !N!!N&N)r/   !googlecloudsdk.api_lib.cloudbuildr   r   r   googlecloudsdk.api_lib.computer   rt   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r	   %googlecloudsdk.command_lib.cloudbuildr
   googlecloudsdk.corer   r   r   ReleaseTracksr   r   UniverseCompatibleUpdateCommandr   r=   r4   rN   rK   r$   r*   r!   r   <module>r      s    " D = ? A . ( . B # * ) D%%(()-@T -@  *-@` D%%**+2 2 ,2j D%%++,2& 2 -2jUr!   