
                         h    S r SSKJr  SSKJr  SSKJr  SSKJr  S r " S S\R                  5      r	g	)
zUtilities for Insight.    )encoding)
list_pager)base)
flag_utilsc                 D    [         R                  " U 5      n[        U5      $ )zCreates Client.)r   GetApiVersionInsight)release_trackapi_versions     1lib/googlecloudsdk/api_lib/recommender/insight.pyCreateClientr      s    ((7+		    c                   T   ^  \ rS rSrSrU 4S jrS rS rSS jrS r	S r
S	 rS
rU =r$ )r	      z%Base Insight client for all versions.c                 b   > [         [        U ]  U5        U R                  R                  U l        g )N)superr	   __init___client(projects_locations_insightTypes_insights_service)selfr   	__class__s     r   r   Insight.__init__!   s#    	'4!+.LLIIDMr   c                 `   SR                  U5      nU R                  U5      " US9nU(       a5  [        R                  " UU R                  U5      R                  SS9nXvl        SU[        R                  " U R                  U-   5      U0nU R                  SR                  U5      5      " S0 UD6$ )z-Creates MarkRequest with the specified state.zMarkInsight{}Request)etagT)
sort_itemsnamez=RecommenderProjectsLocationsInsightTypesInsightsMark{}Request )
format_GetVersionedMessager   DictToAdditionalPropertyMessageStateMetadataValuestateMetadatar   ToCamelCase_message_prefix_GetMessage)	r   r   statestate_metadatar   request_namemark_requestmetadatakwargss	            r   _CreateMarkRequestInsight._CreateMarkRequest%   s     *007L,,\:EL99


#
#L
1
D
Dh $,  	t33lBC	F GNN	  r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zoGets an Insight.

Args:
  name: str, the name of the insight being retrieved.

Returns:
  The Insight message.
)r   )	_messages:RecommenderProjectsLocationsInsightTypesInsightsGetRequestr   Get)r   r   requests      r   r2   Insight.Get?   s6     nnWW X G==W%%r   c           	      z    U R                   R                  XS9n[        R                  " U R                  USUUSS9$ )a  List Insights.

Args:
  parent_name: str, the name of the parent.
  page_size: int, The number of items to retrieve per request.
  limit: int, The maximum number of records to yield.
  request_filter: str, Optional request filter

Returns:
  The Insight messages.
)parentfilterpageSizeinsights)batch_size_attribute
batch_sizelimitfield)r0   ;RecommenderProjectsLocationsInsightTypesInsightsListRequestr   YieldFromListr   )r   parent_name	page_sizer<   request_filterr3   s         r   ListInsight.ListM   sL     nnXX Y G ##' r   c                 ^    U R                  USX#5      nU R                  R                  U5      $ )aY  Mark an insight's state as ACCEPTED.

Args:
  name: str, the name of the insight being updated.
  state_metadata: A map of metadata for the state, provided by user or
    automations systems.
  etag: Fingerprint of the Insight. Provides optimistic locking when
    updating states.

Returns:
  The result insights after being marked as accepted
Accepted)r-   r   MarkAccepted)r   r   r(   r   r3   s        r   rG   Insight.MarkAcceptede   s-     %%dJMG==%%g..r   c                 `    U R                  USSU5      nU R                  R                  U5      $ )zMark an insight's state as ACTIVE.

Args:
  name: str, the name of the insight being updated.
  etag: Fingerprint of the Insight. Provides optimistic locking when
    updating states.

Returns:
  The result insights after being marked as active
ActiveN)r-   r   
MarkActiver   r   r   r3   s       r   rK   Insight.MarkActiveu   s/     %%dHdDAG==##G,,r   c                 `    U R                  USSU5      nU R                  R                  U5      $ )zMark an insight's state as DISMISSED.

Args:
  name: str, the name of the insight being updated.
  etag: Fingerprint of the Insight. Provides optimistic locking when
    updating states.

Returns:
  The result insights after being marked as dismissed
	DismissedN)r-   r   MarkDismissedrL   s       r   rP   Insight.MarkDismissed   s/     %%dKtDG==&&w//r   )r   )NN)__name__
__module____qualname____firstlineno____doc__r   r-   r2   rC   rG   rK   rP   __static_attributes____classcell__)r   s   @r   r	   r	      s/    -J4&0/ -0 0r   r	   N)
rV   apitools.base.pyr   r   "googlecloudsdk.api_lib.recommenderr   r   r   
ClientBaser	   r   r   r   <module>r\      s/     & ' 3 9q0doo q0r   