
    !{                        S r SSKJr  SSKJr  SSKJr  SSKJrJrJrJ	r	J
r
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      SFS\S\S\S\	\   S\	\   S\	\   S\	\   S\	\   S\	\   S\\\4   4S jjr    SFS\S\S\S\	\   S\	\   S\	\   S\	\   S\	\   S\	\   S\\\4   4S jjr SGSSSSS\S\	\   S\	\   S\4S jjrS rS r  SHS  jrS!\4S" jr      SISSSSS\S\S\S\	\   S\	\   S\	\   S\	\   S#\	\\\4      S$\	\
\      S\	\   S\\\\4   \4   4S% jjr      SIS\S\	\   S\	\   S\	\   S\	\   S#\	\\\4      S$\	\
\      S\	\   4S& jjr S\S'\S(\S\	\   S\\\4   4
S) jr!S* r"S+ r#SGS, jr$S- r%S. r&S/ r'S0 r(S1 r)S2\" S3S4\	\   4S\	\   4/5      4S5 jr*S6 r+S7 r,S8\S9\S:\S;\S\\\4   4
S< jr-S=\R\                  S\R^                  R`                  S\\\4   4S> jr1S=\R\                  S\R^                  R`                  S\S\SS4
S? jr2S=\R\                  S\R^                  R`                  SS4S@ jr3S=\R\                  S\R^                  R`                  SS4SA jr4SB\R\                  S\R^                  Rj                  SC\SS4SD jr6SB\R\                  S\R^                  Rj                  SS4SE jr7g
)Jz,The BigQuery CLI reservation client library.    )absolute_import)division)print_function)AnyDict
NamedTupleOptionalSetTuple)	discovery)utils)bq_error)bq_id_utilsNapi_versionslotsignore_idle_slotstarget_job_concurrencymulti_region_auxiliaryautoscale_max_slots	max_slotsscaling_modereservation_group_namereturnc
                 2   0 n
XS'   X*S'   Ub  XZS'   Ub  XJS'   Ub  0 U
S'   XjS   S'   Ub  X:S'   [         R                  " Xv5      (       a  [        R                  " S5      eUb  Ub  Uc  Ub  [        R                  " S	5      eUb  XzS'   Ub  XS
'   U	b  XS'   U
$ )aY  Return the request body for CreateReservation.

Arguments:
  api_version: The api version to make the request against.
  slots: Number of slots allocated to this reservation subtree.
  ignore_idle_slots: Specifies whether queries should ignore idle slots from
    other reservations.
  edition: The edition for this reservation.
  target_job_concurrency: Job concurrency target.
  multi_region_auxiliary: Whether this reservation is for the auxiliary
    region.
  autoscale_max_slots: Number of slots to be scaled when needed.
  max_slots: The overall max slots for the reservation.
  scaling_mode: The scaling mode for the reservation.
  reservation_group_name: The reservation group name which the reservation
    belongs to.

Returns:
  Reservation object that was created.

Raises:
  bq_error.BigqueryError: if requirements for parameters are not met.
slot_capacityr   r   concurrency	autoscaler   editionAmax_slots and autoscale_max_slots cannot be set at the same time.z8max_slots and scaling_mode must be set at the same time.r   reservation_group)frontend_utilsValidateAtMostOneSelectedr   BigqueryError)r   r   r   r   r   r   r   r   r   r   reservations              )platform/bq/clients/client_reservation.pyGetBodyForCreateReservationr&      s    F +!&o%6!"',B()'!7$!K,?[)$	--iMM

 
 K   4L4

 
 B  (".''=#$ 
    c                 
   [        UUUUUUUU	U
U5
      nSUR                  < SUR                  < 3nU R                  5       R	                  5       R                  5       R                  XUR                  S9R                  5       $ )a  Create a reservation with the given reservation reference.

Arguments:
  client: The client used to make the request.
  api_version: The api version to make the request against.
  reference: Reservation to create.
  slots: Number of slots allocated to this reservation subtree.
  ignore_idle_slots: Specifies whether queries should ignore idle slots from
    other reservations.
  edition: The edition for this reservation.
  target_job_concurrency: Job concurrency target.
  multi_region_auxiliary: Whether this reservation is for the auxiliary
    region.
  autoscale_max_slots: Number of slots to be scaled when needed.
  max_slots: The overall max slots for the reservation.
  scaling_mode: The scaling mode for the reservation.
  reservation_group_name: The reservation group name which the reservation
    belongs to.

Returns:
  Reservation object that was created.

Raises:
  bq_error.BigqueryError: if autoscale_max_slots is used with other
    version.
	projects//locations/)parentbodyreservationId)	r&   	projectIdlocationprojects	locationsreservationscreater-   execute)clientr   	referencer   r   r   r   r   r   r   r   r   r$   r+   s                 r%   CreateReservationr7   \   s    P ,+ &
 ooy{|~v9P9P   wyr'   r5   .r6   	page_size
page_tokenr    c                 n   SUR                   < SUR                  < 3nUbM  U R                  5       R                  5       R	                  5       R                  UUUSU-  S9R                  5       $ U R                  5       R                  5       R	                  5       R                  XRUS9R                  5       $ )a  List reservations in the project and location for the given reference.

Arguments:
  client: The client used to make the request.
  reference: Reservation reference containing project and location.
  page_size: Number of results to show.
  page_token: Token to retrieve the next page of results.
  reservation_group: When specified, only list reservations in the given
    reservation group.

Returns:
  Reservation object that was created.
r)   r*   zreservation_group=%s)r+   pageSize	pageTokenfilterr+   r;   r<   )r.   r/   r0   r1   r2   listr4   )r5   r6   r8   r9   r    r+   s         r%   ListReservationsr@      s    * & "			 ),==	 
 

 
 ooy{|~t6tDwyr'   c                     SUR                   < SUR                  < S3nU R                  5       R                  5       R	                  US9R                  5       nU$ )a  List BI reservations in the project and location for the given reference.

Arguments:
  client: The client used to make the request.
  reference: Reservation reference containing project and location.

Returns:
  List of BI reservations in the given project/location.
r)   r*   z/biReservationname)r.   r/   r0   r1   getBiReservationr4   )r5   r6   r+   responses       r%   ListBiReservationsrF      sU     &
 oo!!#44&4AIIK  
/r'   c                     U R                  5       R                  5       R                  5       R                  UR	                  5       S9R                  5       $ )zGets a reservation with the given reservation reference.

Arguments:
  client: The client used to make the request.
  reference: Reservation to get.

Returns:
  Reservation object corresponding to the given id.
rB   )r0   r1   r2   getpathr4   r5   r6   s     r%   GetReservationrK      s;     ooy{|~
s	 s!wyr'   c                     U R                  5       R                  5       R                  5       R                  UR	                  5       S9R                  5         g)zDeletes a reservation with the given reservation reference.

Arguments:
  client: The client used to make the request.
  reference: Reservation to delete.
rB   N)r0   r1   r2   deleterI   r4   rJ   s     r%   DeleteReservationrN      sA     	//,,.55>> 6 GIr'   reservation_sizec                 "   UR                  5       R                  S5      (       a  USS R                  5       (       a  USS nOeUR                  5       R                  S5      (       a  USS R                  5       (       a  USS nO#UR                  5       (       a  UnO[        S5      e[	        U5      S-  S-  S-  n0 nSnX$S	'   US
-  nU R                  5       R                  5       R                  UR                  5       XTS9R                  5       $ )a  Updates a BI reservation with the given reservation reference.

Arguments:
  client: The client used to make the request.
  reference: Reservation to update.
  reservation_size: size of reservation in GBs. It may only contain digits,
    optionally followed by 'G', 'g', 'GB, 'gb', 'gB', or 'Gb'.

Returns:
  Reservation object that was updated.
Raises:
  ValueError: if reservation_size is malformed.
GBNGzInvalid reservation size. The unit for BI reservations
    is GB. The specified reservation size may only contain digits, optionally
    followed by G, g, GB, gb, gB, or Gb.i    sizezsize,rC   
updateMaskr,   )
upperendswithisdigit
ValueErrorintr0   r1   updateBiReservationrI   r4   )r5   r6   rO   reservation_digitsbi_reservationupdate_masks         r%   UpdateBiReservationrb     s     ''--
3B

'
'
)
))#2.'',,1A#21F1N1N1P1P)#2.!!)
 , - - +,t3d:TA.+++ooy{~~K   wyr'   labels_to_setlabel_keys_to_removec                 h   0 nSnUb	  X<S'   US-  nUb	  XLS'   US-  nUb	  X\S'   US-  nUb  US:w  a  0 US	'   XlS	   S
'   US-  nOUS-  nU
c  U	b$  [        X5      nSU;   a	  US   US'   O0 US'   US-  nU
b  U
 H  nXS   ;   d  M  US   U	 M     U	b"  U	R                  5        H  u  nnUUS   U'   M     [        R                  " Xv5      (       a  [        R
                  " S5      eUb%  Ub"  US:w  a  US:w  a  [        R
                  " S5      eUb	  X|S
'   US-  nUb	  XS'   US-  nUb	  XS'   US-  nX4$ )a  Return the request body and update mask for UpdateReservation.

Arguments:
  api_version: The api version to make the request against.
  slots: Number of slots allocated to this reservation subtree.
  ignore_idle_slots: Specifies whether queries should ignore idle slots from
    other reservations.
  target_job_concurrency: Job concurrency target.
  autoscale_max_slots: Number of slots to be scaled when needed.
  max_slots: The overall max slots for the reservation.
  scaling_mode: The scaling mode for the reservation.
  reservation_group_name: The reservation group name that the reservation
    belongs to.

Returns:
  Reservation object that was updated.

Raises:
  bq_error.BigqueryError: if parameters are incompatible.
rU   r   zslot_capacity,r   zignore_idle_slots,r   zconcurrency,r   r   r   zautoscale.max_slots,z
autoscale,labelszlabels,r   SCALING_MODE_UNSPECIFIEDzDscaling_mode and autoscale_max_slots cannot be set at the same time.z
max_slots,r   zscaling_mode,r    zreservation_group,)rK   itemsr!   &ValidateAtMostOneSelectedAllowsDefaultr   r#   )r5   r6   r   r   r   r   r   r   r   rc   rd   r   r$   ra   lookup_reservationkeyvalues                    r%   GetParamsForUpdateReservationrm   4  s   D ++
#( ##K"'8#$''K'!7>!K$a!#k+.A+{+++k \!k%)B':%%0:k( k(9K%#	H%	%!#& $ #))+
U#(k(C  , ::  
 
 K  #6#B005HA5M

 
 N  (<K".?"K''=#$''K 
	!!r'   c                     [        U UUUUUUUUU	U
U5      u  pU R                  5       R                  5       R                  5       R	                  UR                  5       XS9R                  5       $ )aB  Updates a reservation with the given reservation reference.

Arguments:
  client: The client used to make the request.
  api_version: The api version to make the request against.
  reference: Reservation to update.
  slots: Number of slots allocated to this reservation subtree.
  ignore_idle_slots: Specifies whether queries should ignore idle slots from
    other reservations.
  target_job_concurrency: Job concurrency target.
  autoscale_max_slots: Number of slots to be scaled when needed.
  max_slots: The overall max slots for the reservation.
  scaling_mode: The scaling mode for the reservation.
  reservation_group_name: The reservation group name that the reservation
    belongs to.

Returns:
  Reservation object that was updated.

Raises:
  bq_error.BigqueryError: if autoscale_max_slots is used with other
    version.
rW   )rm   r0   r1   r2   patchrI   r4   )r5   r   r6   r   r   r   r   r   r   rc   rd   r   r$   ra   s                 r%   UpdateReservationrp     sq    J ;+ ooy{|~u).."{uMwyr'   planrenewal_planc                 j   0 nX7S'   XGS'   XWS'   Ub  XgS'   Ub  X'S'   SUR                   < SUR                  < 3nSn	UR                  (       a  UR                  S	:w  a  UR                  n	U R                  5       R	                  5       R                  5       R                  UUU	S
9n
U
R                  5       $ )a  Create a capacity commitment.

Arguments:
  client: The client used to make the request.
  reference: Project to create a capacity commitment within.
  edition: The edition for this capacity commitment.
  slots: Number of slots in this commitment.
  plan: Commitment plan for this capacity commitment.
  renewal_plan: Renewal plan for this capacity commitment.
  multi_region_auxiliary: Whether this commitment is for the auxiliary region.

Returns:
  Capacity commitment object that was created.

slot_countrq   rr   Nr   r   r)   r*    )r+   r,   capacityCommitmentId)r.   r/   rv   r0   r1   capacityCommitmentsr3   r4   )r5   r6   r   r   rq   rr   r   capacity_commitmentr+   capacity_commitment_idrequests              r%   CreateCapacityCommitmentr{     s    . &+l# $f(4n%'4J01%,	"&  ##	(F(F#(M&;;ooy{v"5  	 
 
	r'   c                     SUR                   < SUR                  < 3nU R                  5       R                  5       R	                  5       R                  XBUS9R                  5       $ )a=  Lists capacity commitments for given project and location.

Arguments:
  client: The client used to make the request.
  reference: Reference to the project and location.
  page_size: Number of results to show.
  page_token: Token to retrieve the next page of results.

Returns:
  list of CapacityCommitments objects.
r)   r*   r>   )r.   r/   r0   r1   rw   r?   r4   )r5   r6   r8   r9   r+   s        r%   ListCapacityCommitmentsr}     sS     &
 ooy{t6tDwyr'   c                     U R                  5       R                  5       R                  5       R                  UR	                  5       S9R                  5       $ )zGets a capacity commitment with the given capacity commitment reference.

Arguments:
  client: The client used to make the request.
  reference: Capacity commitment to get.

Returns:
  Capacity commitment object corresponding to the given id.
rB   )r0   r1   rw   rH   rI   r4   rJ   s     r%   GetCapacityCommitmentr   +  s=     ooy{
s	 s!wyr'   c                     U R                  5       R                  5       R                  5       R                  UR	                  5       US9R                  5         g)zDeletes a capacity commitment with the given capacity commitment reference.

Arguments:
  client: The client used to make the request.
  reference: Capacity commitment to delete.
  force: Force delete capacity commitment, ignoring commitment end time.
)rC   forceN)r0   r1   rw   rM   rI   r4   )r5   r6   r   s      r%   DeleteCapacityCommitmentr   >  sC     	//335<<>>5 = GIr'   c                 n   Uc  Uc  [         R                  " S5      e0 n/ nUb  X$S'   UR                  S5        Ub  X4S'   UR                  S5        U R                  5       R	                  5       R                  5       R                  UR                  5       SR                  U5      US9R                  5       $ )a  Updates a capacity commitment with the given reference.

Arguments:
  client: The client used to make the request.
  reference: Capacity commitment to update.
  plan: Commitment plan for this capacity commitment.
  renewal_plan: Renewal plan for this capacity commitment.

Returns:
  Capacity commitment object that was updated.

Raises:
  bq_error.BigqueryError: if capacity commitment cannot be updated.
z$Please specify fields to be updated.rq   rr   ,rW   )
r   r#   appendr0   r1   rw   ro   rI   joinr4   )r5   r6   rq   rr   rx   ra   s         r%   UpdateCapacityCommitmentr   K  s     
\l*

 
 !G
HH+	"&v*6'~& ooy{u~~XXk*"  
 wy
r'   c                 @   Uc  [         R                  " S5      eSU0nU R                  5       R                  5       R	                  5       R                  UR                  5       US9R                  5       nSU;  d  SU;  a  [         R                  " S5      eUS   US   /$ )a  Splits a capacity commitment with the given reference into two.

Arguments:
  client: The client used to make the request.
  reference: Capacity commitment to split.
  slots: Number of slots in the first capacity commitment after the split.

Returns:
  List of capacity commitment objects after the split.

Raises:
  bq_error.BigqueryError: if capacity commitment cannot be updated.
z#Please specify slots for the split.	slotCountrC   r,   firstsecondzinternal error)r   r#   r0   r1   rw   splitrI   r4   )r5   r6   r   r,   rE   s        r%   SplitCapacityCommitmentr   r  s    $ ]

 
 !F
GG
u	$ooy{u).."u.wy  H 8

 
 !1
22
7
Xh/	00r'   c                 p   U(       d  [         R                  " S5      eU(       d  [         R                  " S5      eUb  [        U5      S:  a  [         R                  " S5      eSU< SU< 3nSU0nU R                  5       R	                  5       R                  5       R                  XES9R                  5       $ )	au  Merges capacity commitments into one.

Arguments:
  client: The client used to make the request.
  project_id: The project ID of the resources to update.
  location: Capacity commitments location.
  capacity_commitment_ids: List of capacity commitment ids.

Returns:
  Merged capacity commitment.

Raises:
  bq_error.BigqueryError: if capacity commitment cannot be merged.
zproject id must be specified.zlocation must be specified.   z2at least 2 capacity commitments must be specified.r)   r*   capacityCommitmentIdsr+   r,   )r   r#   lenr0   r1   rw   merger4   )r5   
project_idr/   capacity_commitment_idsr+   r,   s         r%   MergeCapacityCommitmentsr     s    " 


 
 !@
AA	

 
 !>
??$,C(Dq(H

 
 <  )I *4X>&
!#:	;$ooy{uFu&wyr'   c                    0 nU(       d  [         R                  " S5      eX&S'   U(       a  X6S'   U(       d  [         R                  " S5      eU(       d  [         R                  " S5      eUR                  5       < SU< 3US'   U R                  5       R	                  5       R                  5       R                  5       R                  UR                  5       US9R                  5       $ )	a~  Creates a reservation assignment for a given project/folder/organization.

Arguments:
  client: The client used to make the request.
  reference: Reference to the project reservation is assigned. Location must
    be the same location as the reservation.
  job_type: Type of jobs for this assignment.
  priority: Default job priority for this assignment.
  assignee_type: Type of assignees for the reservation assignment.
  assignee_id: Project/folder/organization ID, to which the reservation is
    assigned.

Returns:
  ReservationAssignment object that was created.

Raises:
  bq_error.BigqueryError: if assignment cannot be created.
job_type not specified.job_typepriorityassignee_type not specified.assignee_id not specified.s/assigneer   )
r   r#   lowerr0   r1   r2   assignmentsr3   rI   r4   )r5   r6   r   r   assignee_typeassignee_idreservation_assignments          r%   CreateReservationAssignmentr     s    * 	

 
 !:
;;'/$)1:&	

 
 !?
@@	

 
 !=
>> ($
 ooy{|~{}vY^^%,BvCwyr'   c                     U R                  5       R                  5       R                  5       R                  5       R	                  UR                  5       S9R                  5         g)zDeletes given reservation assignment.

Arguments:
  client: The client used to make the request.
  reference: Reference to the reservation assignment.
rB   N)r0   r1   r2   r   rM   rI   r4   rJ   s     r%   DeleteReservationAssignmentr     sK     	//,,.::<CC>> D GIr'   id_fallbacksIDSr   c                    [         R                  " UUUSS9nSUR                  5       0nU R                  5       R	                  5       R                  5       R                  5       R                  UR                  5       US9R                  5       $ )z=Moves given reservation assignment under another reservation.F)r   
identifierdefault_locationcheck_reservation_projectdestinationIdr   )	bq_client_utilsGetReservationReferencerI   r0   r1   r2   r   mover4   )r5   r   r6   destination_reservation_idr   !destination_reservation_referencer,   s          r%   MoveReservationAssignmentr     sy     '6&M&M+' %	'# <AAC	D$ ooy{|~{}t!t-wyr'   c                     0 nSnUb  U(       d  SnX#S'   US-  nU R                  5       R                  5       R                  5       R                  5       R	                  UR                  5       UUS9R                  5       $ )aG  Updates reservation assignment.

Arguments:
  client: The client used to make the request.
  reference: Reference to the reservation assignment.
  priority: Default job priority for this assignment.

Returns:
  Reservation assignment object that was updated.

Raises:
  bq_error.BigqueryError: if assignment cannot be updated.
rU   JOB_PRIORITY_UNSPECIFIEDr   z	priority,rW   )r0   r1   r2   r   ro   rI   r4   )r5   r6   r   r   ra   s        r%   UpdateReservationAssignmentr     s}     ++h)1:&;K ooy{|~{}u~~ %  
 wyr'   c                     U R                  5       R                  5       R                  5       R                  5       R	                  UR                  5       X#S9R                  5       $ )aI  Lists reservation assignments for given project and location.

Arguments:
  client: The client used to make the request.
  reference: Reservation reference for the parent.
  page_size: Number of results to show.
  page_token: Token to retrieve the next page of results.

Returns:
  ReservationAssignment object that was created.
r>   )r0   r1   r2   r   r?   rI   r4   )r5   r6   r8   r9   s       r%   ListReservationAssignmentsr   6  sD     ooy{|~{}t9>>#itNwyr'   r/   r   r   r   c                    U(       d  [         R                  " S5      eU(       d  [         R                  " S5      eU(       d  [         R                  " S5      eU(       d  [         R                  " S5      eUR                  5       < SU< 3nSU-  nSU-  nU R                  5       R	                  5       R                  XvS9R                  5       nS	U;   a  US	    H  n	U	S
   U:X  d  M  U	s  $    [         R                  " S5      e)a  Searches reservations assignments for given assignee.

Arguments:
  client: The client used to make the request.
  location: location of interest.
  job_type: type of job to be queried.
  assignee_type: Type of assignees for the reservation assignment.
  assignee_id: Project/folder/organization ID, to which the reservation is
    assigned.

Returns:
  ReservationAssignment object if it exists.

Raises:
  bq_error.BigqueryError: If required parameters are not passed in or
    reservation assignment not found.
zlocation not specified.r   r   r   r   zassignee=%szprojects/-/locations/%s)r+   queryr   jobTypez Reservation assignment not found)r   r#   r   r0   r1   searchAllAssignmentsr4   )
r5   r/   r   r   r   r   r   r+   rE   
assignments
             r%   SearchAllReservationAssignmentsr   N  s    ( 


 
 !:
;;	

 
 !:
;;	

 
 !?
@@	

 
 !=
>> ',,.<(
(
"%$x/& ooy{67wy	  h}-
	I	(	* . 	ABBr'   reservation_group_clientc                     SUR                   < SUR                  < 3n0 nU R                  5       R                  5       R	                  5       R                  UUUR                  S9R                  5       $ )aA  Creates a reservation group with the given reservation group reference.

Arguments:
  reservation_group_client: The client used to make the request.
  reference: Reservation group to create.

Returns:
  Reservation group object that was created.

Raises:
  bq_error.BigqueryError: if reservation group cannot be created.
r)   r*   )r+   r,   reservationGroupId)r.   r/   r0   r1   reservationGroupsr3   r   r4   )r   r6   r+   r    s       r%   CreateReservationGroupr   }  sm    $ & '')y{v &99  
 wy
r'   c                     SUR                   < SUR                  < 3nU R                  5       R                  5       R	                  5       R                  XBUS9R                  5       $ )a~  Lists reservation groups in the project and location for the given reference.

Arguments:
  reservation_group_client: The client used to make the request.
  reference: Reservation group reference containing project and location.
  page_size: Number of results to show.
  page_token: Token to retrieve the next page of results.

Returns:
  Reservation group object that was created.
r)   r*   r>   )r.   r/   r0   r1   r   r?   r4   )r   r6   r8   r9   r+   s        r%   ListReservationGroupsr     sU    $ &
 '')y{t6tDwyr'   c                     U R                  5       R                  5       R                  5       R                  UR	                  5       S9R                  5       $ )zGets a reservation group with the given reservation group reference.

Arguments:
  reservation_group_client: The client used to make the request.
  reference: Reservation group to get.

Returns:
  Reservation group object corresponding to the given id.
rB   )r0   r1   r   rH   rI   r4   r   r6   s     r%   GetReservationGroupr     s?     '')y{
s	 s!wyr'   c                     U R                  5       R                  5       R                  5       R                  UR	                  5       S9R                  5         g)zDeletes a reservation group with the given reservation group reference.

Arguments:
  reservation_group_client: The client used to make the request.
  reference: Reservation group to delete.
rB   N)r0   r1   r   rM   rI   r4   r   s     r%   DeleteReservationGroupr     sD     ##%//1CCELL>> M GIr'   	apiclientpolicyc                    [         R                  " U[         R                  R                  SS9  SU0nU R	                  5       R                  5       R                  5       R                  X1R                  5       S9R                  5       $ )a~  Sets IAM policy for the given reservation resource.

Arguments:
  apiclient: the apiclient used to make the request.
  reference: the ReservationReference for the reservation resource.
  policy: The policy string in JSON format.

Returns:
  The updated IAM policy attached to the given reservation resource.

Raises:
  BigqueryTypeError: if reference is not a ReservationReference.
SetReservationIAMPolicymethodr   )r,   resource)
r   	typecheckApiClientHelperReservationReferencer0   r1   r2   setIamPolicyrI   r4   )r   r6   r   rz   s       r%   r   r     sl    $ !!66&
 v'y{|~|>>+;|<wyr'   c                    [         R                  " U[         R                  R                  SS9  U R	                  5       R                  5       R                  5       R                  UR                  5       S9R                  5       $ )aJ  Gets IAM policy for the given reservation resource.

Arguments:
  apiclient: the apiclient used to make the request.
  reference: the ReservationReference for the reservation resource.

Returns:
  The IAM policy attached to the given reservation resource.

Raises:
  BigqueryTypeError: if reference is not a ReservationReference.
GetReservationIAMPolicyr   )r   )
r   r   r   r   r0   r1   r2   getIamPolicyrI   r4   )r   r6   s     r%   r   r     sb      !!66& y{|~|Y^^-|.wyr'   )NNNN)N)r6   .)NNNNNN)8__doc__
__future__r   r   r   typingr   r   r   r	   r
   r   googleapiclientr   clientsr   r   frontendr!   r   r   strr]   boolr&   r7   r@   rF   rK   rN   rb   rm   rp   r{   r}   r   r   r   r   r   r   r   r   r   r   r   Resourcer   ReservationGroupReferencer   r   r   r   r   r   r    r'   r%   <module>r      s   2 &  % > > % , ,   *.#"&,0GGG G
 %SMG %TNG "#G }G 3-G %SMG 
#s(^Gf *.#"&,0@@ 	@
 @ %SM@ %TN@ "#@ }@ 3-@ %SM@ 
#s(^@P (,+++ + 	+
  }+ 	+\(&,S ,p *.#"&.2/3,0l"l"l" l" 	l"
 l" %SMl" "#l" }l" 3-l" DcN+l" #3s8,l" %SMl" 4S>3l"l *.#"&.2/3,099 %SM9 "#9 }9 3-9 DcN+9 #3s8,9 %SM9x0 	0
 0 0 %TN0 
#s(^0f2&
$N1B!H,^	8C=)HSM*	
@!H0,C,C%(,C9<,CKN,C	#s(^,C^ '00 **DD  
#s(^ F'00**DD  	
 	<'00**DD 	,'00**DD 	!!**??  		B!!**?? 	r'   