
    o2                         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  SSKJr  SSKJr  SSKJr  \R.                  " \R0                  R2                  5      \R4                   " S S\R6                  5      5       5       r\R.                  " \R0                  R:                  5       " S S\5      5       r\R.                  " \R0                  R>                  5       " S S\5      5       r S r!g)zCreate worker pool command.    )absolute_import)division)unicode_literals)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	)
Create"   z3Create a worker pool for use by Google Cloud Build.{description}a            To create a worker pool named `wp1` in region `us-central1`, run:

            $ {command} wp1 --region=us-central1

          To create a worker pool in project `p1` in region `us-central1` where workers are of machine type
          `e2-standard-2` and are peered to the VPC network `projects/123/global/networks/default` within the IP range `192.168.0.0/28`
          and have a disk size of 64GB, run:

            $ {command} wp1 --project=p1 --region=us-central1                 --peered-network=projects/123/global/networks/default                 --peered-network-ip-range=192.168.0.0/28
                --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   AddWorkerpoolCreateArgsr   ReleaseTrackGAdisplay_info	AddFormatparsers    )lib/surface/builds/worker_pools/create.pyArgsCreate.Args:   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.
)_CreateWorkerPoolFirstGenr   selfargss     r"   Run
Create.RunL   s     %T+<+<+>??r%    N
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr#   r,   __static_attributes__r.   r%   r"   r   r   "   s2     < %-&  "@r%   r   c                   .    \ rS rSrSr\S 5       rS rSrg)
CreateBetaZ   z,Create a worker pool for use by Cloud Build.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#   CreateBeta.Args^   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'   r>      r=   zifor generation=2 please use the gcloud command "gcloud builds worker-pools apply" to create a worker poolz=please use one of the following valid generation values: 1, 2
generationr(   r   r   InvalidArgumentExceptionr)   s     r"   r,   CreateBeta.Runv   f     !&t->->-@AA!//
9  
-
-G r%   r.   N)	r0   r1   r2   r3   r4   r6   r#   r,   r7   r.   r%   r"   r9   r9   Z   s    4 .r%   r9   c                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
CreateAlpha   z-Create a private pool for use by Cloud Build.r   a  
        * Private pools

        To create a private pool named `pwp1` in region `us-central1`, run:

          $ {command} pwp1 --region=us-central1

        To create a private pool in project `p1` in region `us-central1` where workers are of machine type
        `e2-standard-2` and are peered to the VPC network `projects/123/global/networks/default` within the IP range `192.168.0.0/28`
        and have a disk size of 64GB, run:

          $ {command} pwp1 --project=p1 --region=us-central1 --peered-network=projects/123/global/networks/default --peered-network-ip-range=192.168.0.0/28 --worker-machine-type=e2-standard-2 --worker-disk-size=64GB

        To create a private pool in project `p1` in region `us-central1` where workers are of machine type
        `e2-standard-2` and are peered to the network attachment
        `projects/p1/regions/us-central1/networkAttachments/na`. The workers don't
        have public IP address and all the traffic is routed to the network attachment.

          $ {command} pwp1 --project=p1 --region=us-central1               --network-attachment=projects/p1/regions/us-central1/networkAttachments/na               --route-all-traffic               --disable-public-ip-address               --worker-machine-type=e2-standard-2
        r   c                     [         R                  " U [        R                  R                  5      n U R                  SS[        SS9  U R                  R                  S5        gr<   )	r   r   r   r   ALPHArC   rD   r   r   r    s    r"   r#   CreateAlpha.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rG   rI   r)   s     r"   r,   CreateAlpha.Run   rM   r%   r.   Nr/   r.   r%   r"   rO   rO      s/    5 %-:  .r%   rO   c           	      	   U R                   nU R                  nU(       d2  [        R                  R                  R                  R                  5       n[        R                  " U5      n[        R                  " U5      nUR                  5       nU R                  b   [        R                  " U R                  UR                  5      nUR                  nU[        R                  R                   :X  aP  UR"                  bC  UR"                  R$                  (       a(  UR"                  R&                  c  SUR"                  l        GO!UR3                  5       Ul        UR5                  5       n	U R6                  b/  U R6                  U	l        U R:                  b  U R:                  U	l        U R>                  (       d/  U[        R                  R@                  :X  a6  U RB                  (       a%  UR4                  RD                  RF                  U	l$        XR                  l%        URM                  5       n
U RN                  b  U RN                  U
l(        U RR                  b%  [T        RV                  " U RR                  5      U
l,        XR                  l-        U[        R                  R                   :X  a  UR]                  5       nU R^                  (       a  U R^                  Ul0        U Rb                  (       a  SUl        U Rd                  (       a  SUl        SUl        U R^                  (       d"  U Rb                  (       d  U Rd                  (       a!  SUR                  l%        XR                  l        [        R                  Rf                  Rh                  Rk                  SS9n[l        Rn                  Rq                  SUUS9nURr                  Rq                  URu                  UURw                  5       US95      n[l        Rn                  Ry                  URz                  SS	9n[|        R~                  " [|        R                  " URr                  UR                  5      US
SS9n[l        Rn                  R                  SS[        R                  U   UUUS.S9n[,        R                  " U5        U$ ! [(        R*                   a&  n[,        R.                  R1                  S5        UeSnAff = f)a.  Creates a Worker Pool First Generation.

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

Returns:
  A Worker Pool First Generation resource.
NTz
Failed to parse configuration from file. If you were a Private Preview user, note that the format for this file has changed slightly for GA.
)requiredzcloudbuild.projects.locations)
collection
projectsIdlocationsId)
workerPoolparentworkerPoolIdz(cloudbuild.projects.locations.operations)rX   zCreating worker pooli6 )max_wait_msz)cloudbuild.projects.locations.workerPools)rY   rZ   workerPoolsId)rX   api_versionparams)EWORKER_POOLregionr   VALUESbuilds	GetOrFailr   GetClientInstanceGetMessagesModule
WorkerPoolconfig_from_filer   LoadWorkerpoolConfigFromPathprivatePoolV1Configr   r   rR   privateServiceConnectrouteAllTrafficpublicIpAddressDisabledr   ParseProtoExceptionr   errPrintPrivatePoolV1ConfigNetworkConfigpeered_networkpeeredNetworkpeered_network_ip_rangepeeredNetworkIpRangeno_public_egressr   no_external_ipEgressOptionValueValuesEnumNO_PUBLIC_EGRESSegressOptionnetworkConfigWorkerConfigworker_machine_typemachineTypeworker_disk_sizecompute_utils	BytesToGb
diskSizeGbworkerConfigPrivateServiceConnectnetwork_attachmentnetworkAttachmentdisable_public_ip_addressroute_all_trafficcoreprojectGetr   REGISTRYr   projects_locations_workerPools3CloudbuildProjectsLocationsWorkerPoolsCreateRequestRelativeNameParseRelativeNamenamer
   WaitForCloudOperationPollerprojects_locations_operationsParseRELEASE_TRACK_TO_API_VERSIONCreatedResource)r+   release_trackwp_name	wp_regionclientmessageswpconfigrq   network_configworker_configprivate_service_connectr\   parent_resource
created_opop_resource
created_wpwp_resources                     r"   r(   r(      s    'kk)	!!((//99;I,,];&..}=( "	&99


!4!4b
 %%f
4,,22
2**6**::**BBJ?C$$< &99;B++-N&%)%8%8n"		%	%	1.2.J.J+**---$2E2E 
 
 
<
<
M
M ! ,:())+M+"&":":m(!.!8!8


"!m*7'))/// ( > > @		 	 484K4K1		'	':>7			 ;?726/

!
!++## 04,7N4!!))--t-<& &&--0 . / 44;;BB --/ C  !* ""44oo"L 5 N+~~!!&"G"G"("F"FH)	* ""((
<!>>}M""	 ) 	+ k"	q !44 	ggmm12 is   B%R! !S5!SSN)"r4   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   r   r   googlecloudsdk.api_lib.computer	   r   googlecloudsdk.api_lib.utilr
   googlecloudsdk.callioper   r   %googlecloudsdk.command_lib.cloudbuildr   googlecloudsdk.corer   r   r   ReleaseTracksr   r   UniverseCompatibleCreateCommandr   rB   r9   rR   rO   r(   r.   r%   r"   <module>r      s    " &  ' C = ? A . ( . B # * ) D%%(()3@T 3@  *3@l D%%**+2 2 ,2j D%%++,O& O -Od}r%   