
    O                         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r	S r
S r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rS rS rg)z1Helpers for interacting with the Procurement API.    )
exceptions)apis)
properties cloudcommerceconsumerprocurementv1alpha1c                  @    [         R                  " [        [        5      $ N)r   GetMessagesModule&COMMERCE_PROCUREMENT_CONSUMER_API_NAME)COMMERCE_PROCUREMENT_CONSUMER_API_VERSION     7lib/googlecloudsdk/api_lib/commerce_procurement/apis.pyr
   r
          			 F I
K Kr   c                  @    [         R                  " [        [        5      $ r	   )r   GetClientInstancer   r   r   r   r   r   r       r   r   c                       \ rS rSrSr\" 5       R                  r\" 5       R                  r	\
S 5       r\
S 5       r\
S 5       rSrg)Accounts%   z@The Accounts set of Commerce Procurement Consumer API functions.c                  *    [        5       R                  $ r	   )r   billingAccounts_accountsr   r   r   
GetServiceAccounts.GetService-   s    777r   c                     [        5       R                  U S9n [        R                  5       R	                  U5      $ ! [
        R                   a  n[        R                  " U5      eSnAff = f)zuCalls the Procurement Consumer Accounts.Get method.

Args:
  account_name: Name of an account.

Returns:
  (Account)
nameN)	r
   ACloudcommerceconsumerprocurementBillingAccountsAccountsGetRequestr   r   Getapitools_exceptions	HttpErrorr   HttpException)account_namerequesterrors      r   r   Accounts.Get1   sk       GG H  ,  "&&w//(( ,$$U++,   "< A+A&&A+c                     [        5       R                  XUS9n [        R                  5       R	                  U5      $ ! [
        R                   a  n[        R                  " U5      eSnAff = f)a  Calls the Procurement Consumer Accounts.List method.

Args:
  billing_account_name: Name of a billing account.
  page_size: Max size of records to be retrieved in page.
  page_token: Token to specify page in list.

Returns:
  List of Accounts and next page token if applicable.
parentpageSize	pageTokenN)	r
   BCloudcommerceconsumerprocurementBillingAccountsAccountsListRequestr   r   Listr   r    r   r!   )billing_account_name	page_size
page_tokenr#   r$   s        r   r-   Accounts.ListC   sn       HH#: I O ,  "''00(( ,$$U++,s   "= A,A''A,r   N)__name__
__module____qualname____firstlineno____doc__r
   r   GET_REQUESTr,   LIST_REQUESTstaticmethodr   r   r-   __static_attributes__r   r   r   r   r   %   sg    H! EE " FF  8 8 , ," , ,r   r   c                       \ rS rSrSr\" 5       R                  r\" 5       R                  r	\
S 5       r\
S 5       r\
S 5       rSrg)EntitlementsX   zDThe Entitlements set of Commerce Procurement Consumer API functions.c                  *    [        5       R                  $ r	   )r   projects_entitlementsr   r   r   r   Entitlements.GetService`   s    444r   c                     [        5       R                  U S9n [        R                  5       R	                  U5      $ ! [
        R                   a  n[        R                  " U5      eSnAff = f)zCalls the Procurement Consumer Entitlements.Get method.

Args:
  entitlement_name: Name of an entitlement.

Returns:
  (Entitlement)
r   N)	r
   >CloudcommerceconsumerprocurementProjectsEntitlementsGetRequestr<   r   r   r   r    r   r!   )entitlement_namer#   r$   s      r   r   Entitlements.Getd   sk       DD E  ,$$&**733(( ,$$U++,r&   c                 H   S[         R                  R                  R                  R	                  5       -  n[        5       R                  X US9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zCalls the Procurement Consumer Entitlements.List method.

Args:
  page_size: Max size of records to be retrieved in page.
  page_token: Token to specify page in list.

Returns:
  List of Entitlements and next page token if applicable.
projects/%sr(   N)r   VALUEScoreproject	GetOrFailr
   ?CloudcommerceconsumerprocurementProjectsEntitlementsListRequestr<   r   r-   r   r    r   r!   )r/   r0   project_namer#   r$   s        r   r-   Entitlements.Listv   s     !:#4#4#9#9#A#A#K#K#MML EE: F G ,$$&++G44(( ,$$U++,s   "A2 2B!BB!r   N)r2   r3   r4   r5   r6   r
   rB   r7   rK   r8   r9   r   r   r-   r:   r   r   r   r<   r<   X   sg    L! BB " CC  5 5 , ," , ,r   r<   c                       \ rS rSrSr\" 5       R                  r\" 5       R                  r	\
S 5       r\
S 5       r\
S 5       rSrg)
FreeTrials   zCThe Free Trials set of Commerce Procurement Consumer API functions.c                  *    [        5       R                  $ r	   )r   projects_freeTrialsr   r   r   r   FreeTrials.GetService   s    222r   c                    S[         R                  R                  R                  R	                  5       -  nSU -  n[        5       R                  X1S9n[        5       R                  UUS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zCalls the Procurement Consumer FreeTrials.Create method.

Args:
  provider_id: Id of the provider.
  product_external_name: Name of the product.

Returns:
  (Operation)
rF   providers/%s)providerproductExternalName)r)   7googleCloudCommerceConsumerProcurementV1alpha1FreeTrialN)r   rG   rH   rI   rJ   r
   7GoogleCloudCommerceConsumerProcurementV1alpha1FreeTrial?CloudcommerceconsumerprocurementProjectsFreeTrialsCreateRequestrO   r   Creater   r    r   r!   )provider_idproduct_external_namerL   provider_name
free_trialr#   r$   s          r   r[   FreeTrials.Create   s     !:#4#4#9#9#A#A#K#K#MML"[0M" == > K    EE@J F L ,""$++G44(( ,$$U++,s   +"B B="B88B=c                 L   S[         R                  R                  R                  R	                  5       -  n[        5       R                  UU UUS9n [        R                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)a,  Calls the Procurement Consumer FreeTrials.List method.

Args:
  page_size: Max size of records to be retrieved in page.
  page_token: Token to specify page in list.
  filter_rule: The filter that can be used to limit the the result.

Returns:
  List of Free Trials and next page token if applicable.
rF   r)   r*   r+   filterN)r   rG   rH   rI   rJ   r
   =CloudcommerceconsumerprocurementProjectsFreeTrialsListRequestrO   r   r-   r   r    r   r!   )r/   r0   filter_rulerL   r#   r$   s         r   r-   FreeTrials.List   s     !:#4#4#9#9#A#A#K#K#MML CC	 D  ,""$))'22(( ,$$U++,s   "A4 4B#BB#r   N)r2   r3   r4   r5   r6   r
   rZ   CREATE_REQUESTrd   r8   r9   r   r[   r-   r:   r   r   r   rO   rO      sg    K$ CC " AA  3 3 , ,0 , ,r   rO   c                   "   \ rS rSrSr\" 5       R                  r\" 5       R                  r	\" 5       R                  r\" 5       R                  r\" 5       R                  r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rS	rg
)Orders   z>The Orders set of Commerce Procurement Consumer API functions.c                  *    [        5       R                  $ r	   )r   billingAccounts_ordersr   r   r   r   Orders.GetService   s    555r   c                    [        5       R                  US9n[        5       R                  U US9n [        R	                  5       R                  U5      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zCalls the Procurement Consumer Orders.Cancel method.

Args:
  order_name: Name of an order.
  etag: Weak etag for validation purpose.

Returns:
  (Operation)
)etag)r   @googleCloudCommerceConsumerProcurementV1alpha1CancelOrderRequestN)
r
   @GoogleCloudCommerceConsumerProcurementV1alpha1CancelOrderRequestBCloudcommerceconsumerprocurementBillingAccountsOrdersCancelRequestri   r   Cancelr   r    r   r!   )
order_namero   cancel_detail_requestr#   r$   s        r   rs   Orders.Cancel   s     . FF G     HHI^ I  
, ''00(( ,$$U++,s   "A B(A>>Bc                     [        5       R                  U S9n [        R                  5       R	                  U5      $ ! [
        R                   a  n[        R                  " U5      eSnAff = f)zmCalls the Procurement Consumer Orders.Get method.

Args:
  order_name: Name of an order.

Returns:
  (Order)
r   N)	r
   ?CloudcommerceconsumerprocurementBillingAccountsOrdersGetRequestri   r   r   r   r    r   r!   )rt   r#   r$   s      r   r   
Orders.Get   sk       EE F  , $$W--(( ,$$U++,r&   c                     [        5       R                  U UUUS9n [        R                  5       R	                  U5      $ ! [
        R                   a  n[        R                  " U5      eSnAff = f)aV  Calls the Procurement Consumer Orders.List method.

Args:
  billing_account_name: Name of a billing account.
  page_size: Max size of records to be retrieved in page.
  page_token: Token to specify page in list.
  filter_rule: The filter that can be used to limit the the result.

Returns:
  List of orders and next page token if applicable.
rb   N)	r
   @CloudcommerceconsumerprocurementBillingAccountsOrdersListRequestri   r   r-   r   r    r   r!   )r.   r/   r0   re   r#   r$   s         r   r-   Orders.List  st       FF#	 G  , %%g..(( ,$$U++,s   "? A.A))A.c           
         U(       Ga  / nU GH  nSnSn/ n	UR                  5        GH(  u  pU
S:X  d  U
S:X  a  M  U
S:X  a  US   nM!  U
S:X  a  US   nM.  UR                  SS5      n[        U5      S:  a  [        5       R	                  US	9nOUS
   S:X  a  [        5       R	                  US   S	9nOwUS
   S:X  a$  [        5       R	                  [        US   5      S9nOJUS
   S:X  a$  [        5       R	                  [        US   5      S9nO[        SR                  US
   5      5      eU	R                  [        5       R                  XS95        GM+     U(       a!  U(       a  [        5       R                  UUU	S9nOSnUR                  [        5       R                  US   [        US   5      US95        GM     [        5       R                  U[        5       R                  US9S9nO7[        5       R                  U[        5       R!                  [#        U5      US9S9n[        5       R%                  U US9n [&        R)                  5       R+                  U5      $ ! [,        R.                   a  n[0        R2                  " U5      eSnAff = f)a  Calls the Procurement Consumer Orders.Cancel method.

Args:
  order_name: Name of an order.
  etag: Weak etag for validation purpose.
  product_requests: Modification details if order modification is based on
                    product plans.
  quote_change_type: Change type if order modification is based on quote.
  new_quote_external_name: External name of new quote.

Returns:
  (Operation)
 zline-item-idzline-item-change-typeproduct-external-nameflavor-external-name:      stringValuer   strint
int64ValuedoubledoubleValuezUnrecognized value type {}r   valuerW   flavorExternalName
parametersN)
lineItemId
changeTypenewLineItemInfo)modifications)ro   modifyProductsOrderRequest)r   newQuoteExternalName)ro   modifyQuoteOrderRequest)r   @googleCloudCommerceConsumerProcurementV1alpha1ModifyOrderRequest)itemssplitlenr
   <GoogleCloudCommerceConsumerProcurementV1alpha1ParameterValuer   float
ValueErrorformatappend7GoogleCloudCommerceConsumerProcurementV1alpha1Parameter:GoogleCloudCommerceConsumerProcurementV1alpha1LineItemInfoTGoogleCloudCommerceConsumerProcurementV1alpha1ModifyProductsOrderRequestModificationGetLineItemChangeTypeEnum@GoogleCloudCommerceConsumerProcurementV1alpha1ModifyOrderRequestHGoogleCloudCommerceConsumerProcurementV1alpha1ModifyProductsOrderRequestEGoogleCloudCommerceConsumerProcurementV1alpha1ModifyQuoteOrderRequestGetQuoteChangeTypeEnumBCloudcommerceconsumerprocurementBillingAccountsOrdersModifyRequestri   r   Modifyr   r    r   r!   )rt   ro   product_requestsquote_change_typenew_quote_external_namemodificationproduct_requestr]   flavor_external_namer   keyr   value_splitvalue_argumentnew_line_item_infomodify_detail_requestr#   r$   s                     r   r   Orders.Modify  s     l-/ "!
+113LSN"c-D&D++$34K$L!**#23I#J C++!. JJ! K #  1~&. JJ'N K ,  1~&. JJ{1~. K 0  1~). JJ!+a.1 K 3  9@@A  ! ! 

- CC D ./= 4D !%90  FF"7!5# G %   $
- 

^
^&~60 78:.	 _ 0	1a .n 0 HH%6%8
R
R( S * 	I 	+  0 HH"3"5
O
O/0AB#: P < 	I 	=    HHI^ I  , ''00(( ,$$U++,s   8"I J
/JJ
c           	      v   SU-  nU(       Ga  / nU GHW  n/ n	UR                  5        GH  u  pU
S:X  d  U
S:X  a  M  UR                  SS5      n[        U5      S:  a  [        5       R	                  US9nOUS   S	:X  a  [        5       R	                  US   S9nOwUS   S
:X  a$  [        5       R	                  [        US   5      S9nOJUS   S:X  a$  [        5       R	                  [        US   5      S9nO[        SR                  US   5      5      eU	R                  [        5       R                  XS95        GM     UR                  [        5       R                  US   US   U	S95        GMZ     [        5       R                  UUU[        5       R                  US9S9nO/[        5       R                  UUU[        5       R                  US9S9n[        5       R                  U US9n [         R#                  5       R%                  U5      $ ! [&        R(                   a  n[*        R,                  " U5      eSnAff = f)a  Calls the Procurement Consumer Orders.Cancel method.

Args:
  billing_account_name: Name of parent billing account.
  display_name: Display name of the order.
  provider_id: Id of the provider for which the order is created.
  request_id: Id of the request for idempotency purpose.
  product_requests: Request about product info to place order against.
  quote_external_name: External name of the quote to place order against.

Returns:
  (Operation)
rU   r   r   r   r   r   r   r   r   r   r   r   r   zUnrecognized value type {}.r   r   )lineItemInfo)displayNamerV   	requestIdplaceProductsOrderRequest)quoteExternalName)r   rV   r   placeQuoteOrderRequest)r)   ?googleCloudCommerceConsumerProcurementV1alpha1PlaceOrderRequestN)r   r   r   r
   r   r   r   r   r   r   r   r   ?GoogleCloudCommerceConsumerProcurementV1alpha1PlaceOrderRequestGGoogleCloudCommerceConsumerProcurementV1alpha1PlaceProductsOrderRequestDGoogleCloudCommerceConsumerProcurementV1alpha1PlaceQuoteOrderRequestACloudcommerceconsumerprocurementBillingAccountsOrdersPlaceRequestri   r   Placer   r    r   r!   )r.   display_namer\   
request_idr   quote_external_namer^   line_item_infor   r   r   r   r   r   place_detail_requestr#   r$   s                    r   r   Orders.Place  s     #[0Mn-/
+113LS++s6L/LC++!. JJ! K #  1~&. JJ'N K ,  1~&. JJ{1~. K 0  1~). JJ!+a.1 K 3  :AAA  ! ! 

- CC D ./1 48 	/ 

D
D /0G H./EF! E #	$= .H / GG" $5$7
Q
Q) R + 	H 	,  / GG" !2!4OO 3 P 5 	H 	6    GG#H\ H  , &&w//(( ,$$U++,s   &"H	 	H8H33H8r   N)r2   r3   r4   r5   r6   r
   rr   CANCEL_REQUESTrx   r7   r{   r8   r   MODIFY_REQUESTr   PLACE_REQUESTr9   r   rs   r   r-   r   r   r:   r   r   r   ri   ri      s    F$ FF ! CC " DD $ FF # EE  6 6 , ,. , ," , ,. `, `,D R, R,r   ri   c                   Z    \ rS rSrSr\" 5       R                  r\S 5       r	\S 5       r
Srg)
Operationsi  zBThe Operations set of Commerce Procurement Consumer API functions.c                  *    [        5       R                  $ r	   )r   !billingAccounts_orders_operationsr   r   r   GetOrderOperationService#Operations.GetOrderOperationService  s    @@@r   c                     [        5       R                  U S9n [        R                  5       R	                  U5      $ ! [
        R                   a  n[        R                  " U5      eSnAff = f)zCalls the Procurement Consumer Orders.Operations.Get method.

Args:
  operation_name: Name of the order operation.

Returns:
  Order operation.
r   N)	r
   ICloudcommerceconsumerprocurementBillingAccountsOrdersOperationsGetRequestr   r   r   r   r    r   r!   )operation_namer#   r$   s      r   GetOrderOperationOperations.GetOrderOperation  sk       OO P  ,00266w??(( ,$$U++,r&   r   N)r2   r3   r4   r5   r6   r
   r   GET_ORDER_OPERATION_REQUESTr9   r   r   r:   r   r   r   r   r     sB    J 1 !MM  A A , ,r   r   c                 b   U S:X  a,  [        5       R                  5       R                  R                  $ U S:X  a,  [        5       R                  5       R                  R                  $ U S:X  a,  [        5       R                  5       R                  R
                  $ [        SR                  U 5      5      e)zConverts raw input to line item change type.

Args:
  raw_input: Raw input of the line item change type.

Returns:
  Converted line item change type.
Raises:
  ValueError: The raw input is not recognized as a valid change type.
UPDATECANCELREVERT_CANCELLATIONz&Unrecognized line item change type {}.)r
   r   ChangeTypeValueValuesEnumLINE_ITEM_CHANGE_TYPE_UPDATELINE_ITEM_CHANGE_TYPE_CANCEL)LINE_ITEM_CHANGE_TYPE_REVERT_CANCELLATIONr   r   	raw_inputs    r   r   r     s     ( ZZ  < <= H ZZ  < <= )) ZZ  I IJ =DDYO
PPr   c                 b   U S:X  a,  [        5       R                  5       R                  R                  $ U S:X  a,  [        5       R                  5       R                  R                  $ U S:X  a,  [        5       R                  5       R                  R
                  $ [        SR                  U 5      5      e)zConverts raw input to quote change type.

Args:
  raw_input: Raw input of the quote change type.

Returns:
  Converted quote change type.
Raises:
  ValueError: The raw input is not recognized as a valid change type.
r   r   r   z"Unrecognized quote change type {}.)r
   r   r   QUOTE_CHANGE_TYPE_UPDATEQUOTE_CHANGE_TYPE_CANCEL%QUOTE_CHANGE_TYPE_REVERT_CANCELLATIONr   r   r   s    r   r   r     s     ( KK  8 89 H KK  8 89 )) KK  E EF 9@@K
LLr   N)r6   apitools.base.pyr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   r   r   r
   r   objectr   r<   rO   ri   r   r   r   r   r   r   <module>r      s~    8 ? , 2 *)K &,6 )K
K
0,v 0,f0,6 0,f;, ;,|J,V J,Z, ,:Q6Mr   