
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z
 ddlmZ ddlmZ d	Zd
ZdZd Zd Zd Zd Zd Zy)zrecommender API utlities.    )absolute_import)division)unicode_literals)service)messages)base)yamlv1alpha2v1beta1v1c                 4    | d   j                         | dd z   S )z Converts CamelCase to camelCase.r      N)lower)ss    4lib/googlecloudsdk/api_lib/recommender/flag_utils.pyToCamelCaser      s    	
1!"	    c                 d    d}t        j                  |       }|rt        j                  ||      }|S )zParses json config file.

  Args:
    config_file: file path of the config file.
    message_type: The protorpc Message type.

  Returns:
    A message of type "message_type".
  N)r	   	load_pathmessages_utilDictToMessageWithErrorCheck)config_filemessage_typeconfigdatas       r   
ReadConfigr   $   s1     &		$$	66t\JF	-r   c                 Z    |rt        j                  |       S t        j                  |       S )zReturns the config api service from the user-specified arguments.

  Args:
    api_version: API version string.
    is_insight_api: boolean value sepcify whether this is a insight api,
      otherwise will return a recommendation service api.
  )recommender_service!ProjectsInsightTypeConfigsService!ProjectsRecommenderConfigsService)api_versionis_insight_apis     r   GetConfigServiceFromArgsr#   6   s)     @@MM		>	>{	KKr   c                     t        j                  |      }|r|j                  |       }|S |j                  |       }|S )a  Returns the describe request from the user-specified arguments.

  Args:
    parent_resource: resource url string, the flags are already defined in
      argparse namespace.
    is_insight_api: boolean value specifying whether this is a insight api,
      otherwise treat as a recommender service api and return related describe
      request message.
    api_version: API version string.
  )name)r   RecommenderMessages8RecommenderProjectsLocationsInsightTypesGetConfigRequest8RecommenderProjectsLocationsRecommendersGetConfigRequest)parent_resourcer"   r!   r   requests        r    GetDescribeConfigRequestFromArgsr+   C   sW     !44[A(OO P G
 
. OO P G	.r   c                     t         j                  j                  t        t         j                  j                  t
        t         j                  j                  t        i}|j                  | t              S )zGet API version string.

  Converts API version string from release track value.

  Args:
    release_track: release_track value, can be ALPHA, BETA, GA

  Returns:
    API version string.
  )	r   ReleaseTrackALPHARECOMMENDER_API_ALPHA_VERSIONBETARECOMMENDER_API_BETA_VERSIONGARECOMMENDER_API_GA_VERSIONget)release_trackswitchers     r   GetApiVersionr7   Z   sU     <
:
6(
 
m%B	CCr   N)__doc__
__future__r   r   r   "googlecloudsdk.api_lib.recommenderr   r   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper   googlecloudsdk.corer	   r/   r1   r3   r   r   r#   r+   r7    r   r   <module>r?      sL      &  ' M A ( $ * ( ! 
$
L.Dr   