
    a                        S r SSKJr  SSKJr  SSKJr  SSKJr  S\R                  4S jrS\	4S	 jr
S\R                  4S
 jrS\R                  4S jrS\\	   4S jrS\R                  4S jrS\R                  4S jrg)z6Modify request hooks, specifically for health-sources.    )absolute_import)division)unicode_literals)	resourcesresource_refc                 <    U R                   UR                   l        U$ )zModify the request message, carrying resource name into it.

Args:
  resource_ref: the resource reference.
  request_msg: the request message constructed by the framework

Returns:
  the modified request message.
)healthSourcename)r   _request_msgs      Ilib/googlecloudsdk/api_lib/compute/health_sources/modify_request_hooks.pyadd_name_to_payloadr      s     #/";";+	    health_aggregation_policyc                 b   SU;   a  U$ SU;   aE  [         R                  R                  USU R                  5       R                  S9R                  5       $ [         R                  R                  USU R                  5       R                  U R                  U R                  S.S9R                  5       $ )zHelper function for parsing the health aggregation policy string.

Args:
  resource_ref: the resource reference.
  health_aggregation_policy: the health aggregation policy string to parse.

Returns:
  the parsed health aggregation policy self link.
://	projects/z'compute.regionHealthAggregationPolicies
collectionapi_versionprojectregionr   r   params)r   REGISTRYParseGetCollectionInfor   SelfLinkr   r   )r   r   s     r   parse_health_aggregation_policyr    )   s      ''$$ //##!< 224@@ $  hj	 
			!	!:002>>%--9L9LM	 
" 

 HJr   c                 t    UR                   (       d  U$ [        XR                   5      UR                  l        U$ a	  Modify the request message, parsing the health aggregation policy.

Args:
  resource_ref: the resource reference.
  args: the arguments passed to the command.
  request_msg: the request message constructed by the framework

Returns:
  the modified request message.
)r   r    r	   healthAggregationPolicyr   argsr   s      r   &parse_health_aggregation_policy_creater&   N   s<     
	'	' &
66 2
 
r   c                 t    UR                   (       d  U$ [        XR                   5      UR                  l        U$ r"   )r   r    healthSourceResourcer#   r$   s      r   &parse_health_aggregation_policy_updater)   h   s<      
	'	' &
66 "":
 
r   sourcesc                    / nU H  nSU;   a  UR                  U5        M  SU;   aV  UR                  [        R                  R                  USU R	                  5       R
                  S9R                  5       5        Mx  UR                  [        R                  R                  USU R	                  5       R
                  U R                  U R                  S.S9R                  5       5        M     U$ )zHelper function for parsing the sources list.

Args:
  resource_ref: the resource reference.
  sources: the list of sources to parse.

Returns:
  the list of parsed sources self links.
r   r   zcompute.regionBackendServicesr   r   r   )	appendr   r   r   r   r   r   r   r   )r   r*   resultsources       r   parse_sourcesr/      s     &f mmF 
	mm



"
"8&88:FF #  HJ mm



"
"8&88:FF)11(//	 #  HJ
' < 
-r   c                     UR                   (       d  U$ UR                  R                   R                  5         UR                  R                   R                  [	        XR                   5      5        U$ zModify the request message, parsing the sources list.

Args:
  resource_ref: the resource reference.
  args: the arguments passed to the command.
  request_msg: the request message constructed by the framework

Returns:
  the modified request message.
)r*   r	   clearextendr/   r$   s      r   parse_sources_creater4      sW     
""((*""))L,,/ 
r   c                     UR                   (       d  U$ UR                  R                   R                  5         UR                  R                   R                  [	        XR                   5      5        U$ r1   )r*   r(   r2   r3   r/   r$   s      r   parse_sources_updater6      sW      
""**002""**11L,,/ 
r   N)__doc__
__future__r   r   r   googlecloudsdk.corer   Resourcer   strr    r&   r)   listr/   r4   r6    r   r   <module>r>      s    = &  ' )$$$"-0"J$$4$$6*c *Z$$2$$r   