
                            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	d
iZe	j                   e	j                  e	j                  j                          G d de	j"                                      Zee_        y)zBImplementation of gcloud Procurement consumer order place command.    )absolute_import)division)unicode_literals)apis)arg_parsers)base)resource_argsEXAMPLESam  
        To purchase a product-based order, you must specify product request. For
        example:

            $ {command} --product-request product-external-name=productId,flavor-external-name=flavorId

        To specify parameters, you must follow the pattern
        "ParameterName=ParameterType:ParameterValue". For example:

            $ {command} --product-request product-external-name=productId,flavor-external-name=flavorId,region=str:us-west-1

        To purchase a quote-based order, you must specify quote external name.
        For example:

            $ {command} --quote-external-name quoteId
        c                   &    e Zd ZdZed        Zd Zy)Createz.Creates the order resource from the Place API.c                 H   t        j                  | d       | j                  ddd       | j                  ddd       | j                  dd	
       | j                  d      }|j                  dt	        j
                  ddg      ddd       |j                  dd
       y)zrRegister flags for this command.

    Args:
      parser: argparse.ArgumentParser to register arguments with.
    z2Parent Cloud Billing account to place order under.z--display-nameTzDisplay name of the order.)requiredhelpz--provider-idz2ID of the provider for which the order is created.z--request-idz+ID of the request for idempotency purposes.)r   )r   z--product-requestzproduct-external-namezflavor-external-name)required_keysz	KEY=VALUEappendz7Request for information about the product in the order.)typemetavaractionr   z--quote-external-namez)External name of the quote for the order.N)r	   AddBillingAccountResourceArgadd_argumentadd_mutually_exclusive_groupr   ArgDict)parserproduct_quote_groups     :lib/surface/commerce_procurement/consumer/orders/create.pyArgszCreate.Args4   s     ..DF
4.J  L
A  C J  L !==t=L$$  24JKMF % H $$8 % :    c                    |j                   j                  j                         }t        j                  j                  |j                         |j                  |j                  |j                  |j                  |j                        S )zRuns the command.

    Args:
      args: The arguments that were provided to this command invocation.

    Returns:
      An Order operation.
    )CONCEPTSbilling_accountParser   OrdersPlaceRelativeNamedisplay_nameprovider_id
request_idproduct_requestquote_external_name)selfargsbilling_account_refs      r   Runz
Create.RunR   si     --77==?;;0==?!..0@0@!__d.B.B!557 7r   N)__name__
__module____qualname____doc__staticmethodr   r-    r   r   r   r   /   s     7: ::7r   r   N)r1   
__future__r   r   r   +googlecloudsdk.api_lib.commerce_procurementr   googlecloudsdk.callioper   r   /googlecloudsdk.command_lib.commerce_procurementr	   DETAILED_HELPHiddenReleaseTracksReleaseTrackALPHACommandr   detailed_helpr3   r   r   <module>r?      s    I &  ' < / ( I 	* D%%++,.7T\\ .7 - .7b % r   