
                            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 rS rS r\	R*                  " \	R,                  R.                  \	R,                  R0                  5       " S S\	R2                  5      5       r\	R*                  " \	R,                  R6                  5       " S S\5      5       rg)z)Command for creating target HTTP proxies.    )absolute_import)division)unicode_literals)base_classes)target_proxies_utils)base)scope)flags)target_http_proxies_utilsc                      SSSS.$ )NCreate a target HTTP proxy.a        *{command}* is used to create target HTTP proxies. A target
      HTTP proxy is referenced by one or more forwarding rules which
      specify the network traffic that the proxy is responsible for
      routing. The target HTTP proxy points to a URL map that defines
      the rules for routing the requests. The URL map's job is to map
      URLs to backend services which handle the actual requests.
      a        If there is an already-created URL map with the name URL_MAP, create a
      global target HTTP proxy pointing to this map by running:

        $ {command} PROXY_NAME --url-map=URL_MAP

      Create a regional target HTTP proxy by running:

        $ {command} PROXY_NAME --url-map=URL_MAP --region=REGION_NAME

      To create a proxy with a textual description, run:

        $ {command} PROXY_NAME --url-map=URL_MAP --description="default proxy"
      )briefDESCRIPTIONEXAMPLES r       1lib/surface/compute/target_http_proxies/create.py_DetailedHelpr      s    ,


 r   c                 0   U R                   R                  [        R                  5        U R	                  SSS9  U R                   R                  [        R                  5        U(       a  [        R                  " U S5        [        R                  " U 5        g)z=Add the target http proxies comamnd line flags to the parser.z--descriptionz;An optional, textual description for the target HTTP proxy.)helpFN)
display_info	AddFormatr
   DEFAULT_LIST_FORMATadd_argumentAddCacheUpdaterTargetHttpProxiesCompleterAddProxyBindr   AddHttpKeepAliveTimeoutSec)parsertraffic_director_securitys     r   _Argsr!   :   sr     9 9:H   	%%e&F&FG	vu%11&9r   c                    UR                   nU(       a^  U R                  (       aM  UR                  R                  U R                  UR                  5       UR                  5       U R                  S9nOAUR                  R                  U R                  UR                  5       UR                  5       S9nU R                  S5      (       a  U R                  Ul	        [        R                  " U5      (       aF  UR                  R                  UR                  UR                  US9nUR                  R                   nO:UR                  R#                  UR                  US9nUR                  R$                  nUR'                  USU4/5      $ ))Issue a Target HTTP Proxy Insert request.)descriptionnameurlMap	proxyBind)r$   r%   r&   http_keep_alive_timeout_sec)projectregiontargetHttpProxy)r)   r+   Insert)client
proxy_bindmessagesTargetHttpProxyr$   NameSelfLinkIsSpecifiedr(   httpKeepAliveTimeoutSecr   IsRegionalTargetHttpProxiesRef+ComputeRegionTargetHttpProxiesInsertRequestr)   r*   apitools_clientregionTargetHttpProxies%ComputeTargetHttpProxiesInsertRequesttargetHttpProxiesMakeRequests)	argsholderurl_map_reftarget_http_proxy_refr    r-   target_http_proxyrequest
collections	            r   _RunrC   H   sf    ==&4??77$$"'')##%//	 8  77$$"'')##% 8  
344040P0P-==  ooII%--$++) J G
 ''??JooCC%--?P D G ''99J			z8W=>	??r   c                   H    \ rS rSrSrSrSrSr\" 5       r	\
S 5       rS rSrg)Createq   r   FNc                     [         R                  " 5       U l        U R                  R                  USS9  [        R
                  " 5       U l        U R                  R                  U5        [        XR                  5        g )Ncreate)operation_type)	r
   TargetHttpProxyArgumentTARGET_HTTP_PROXY_ARGAddArgumenturl_map_flagsUrlMapArgumentForTargetProxyURL_MAP_ARGr!   _traffic_director_security)clsr   s     r   ArgsCreate.Args{   s\     % = = ?C))&)J#@@BCOOO'	&001r   c                 J   [         R                  " U R                  5       5      nU R                  R	                  XR
                  [        R                  R                  S9n[        R                  " XR                  X2R
                  5      n[        UUUUU R                  5      $ )r#   )default_scope)r   ComputeApiHolderReleaseTrackrK   ResolveAsResource	resourcescompute_scope	ScopeEnumGLOBALr   ResolveTargetHttpProxyUrlMaprO   rC   rP   )selfr<   r=   r?   r>   s        r   Run
Create.Run   s    **4+<+<+>?F 66HHm.E.E.L.L I  ,HH 57G7GK '' r   r   )__name__
__module____qualname____firstlineno____doc__rP   rO   rK   r   detailed_helpclassmethodrR   r_   __static_attributes__r   r   r   rE   rE   q   s4    #$+/-2 2r   rE   c                       \ rS rSrSrSrg)CreateAlpha   Tr   N)ra   rb   rc   rd   rP   rh   r   r   r   rj   rj      s    #r   rj   N)re   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   rZ   6googlecloudsdk.command_lib.compute.target_http_proxiesr
   r   +googlecloudsdk.command_lib.compute.url_mapsrM   r   r!   rC   ReleaseTracksrW   BETAGACreateCommandrE   ALPHArj   r   r   r   <module>rw      s    0 &  ' 7 ? ( E H \ N8:&@R D%%**D,=,=,@,@A T   B F D%%++,$& $ -$r   