
    Z                        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)zCImplementation of gcloud Procurement consumer order modify command.    )absolute_import)division)unicode_literals)apis)arg_parsers)base)resource_argsEXAMPLESay  
        To modify an order to another product plan or update parameters, you
        must specify product request. To specify parameters, you must follow the
        pattern "ParameterName=ParameterType:ParameterValue". For example:

            $ {command} --product-request line-item-id=lineItemId,line-item-change-type=UPDATE,product-external-name=productId,flavor-external-name=flavorId,region=str:us-west-1

        To cancel a product plan-based order, you must specify the product
        request. For example:

            $ {command} --product-request line-item-id=lineItemId,line-item-change-type=CANCEL

        To revert cancellation on a product plan-based order, you must specify
        the product request. For example:

            $ {command} --product-request line-item-id=lineItemId,line-item-change-type=REVERT_CANCELLATION

        To update an order to another quote, you must specify the fields that
        are related to the quote. For example:

            $ {command} --quote-change-type UPDATE --new-quote-external-name quoteId

        To cancel a quote-based order, you must specify the quote change type.
        For example:

            $ {command} --quote-change-type CANCEL

        To revert cancellation on a quote-based order, you must specify the
        quote change type. For example:

            $ {command} --quote-change-type REVERT_CANCELLATION
        c                   &    e Zd ZdZed        Zd Zy)Modifyz0Modifies the order resource from the Modify API.c                 D   t        j                  | d       | j                  dd       | j                  d      }|j                  dt	        j
                  dd	g
      ddd       |j                  d      }|j                  ddd       |j                  dd       y)zrRegister flags for this command.

    Args:
      parser: argparse.ArgumentParser to register arguments with.
    zOrder to modify.z--etagz1The weak etag for validation check, if specified.)helpT)requiredz--product-requestzline-item-idzline-item-change-type)required_keysz	KEY=VALUEappendz3Request about product info to modify order against.)typemetavaractionr   zQuote-related modification.z--quote-change-typez$Change type on quote based purchase.)r   r   z--new-quote-external-namez2The external name of the quote the order will use.N)r	   AddOrderResourceArgadd_argumentadd_mutually_exclusive_groupr   ArgDict	add_group)parserproduct_quote_groupquote_request_groups      :lib/surface/commerce_procurement/consumer/orders/modify.pyArgszModify.ArgsD   s     %%f.@A
J  L !==t=L$$  )+BCEB % D .77* 8 ,$$3 % 5 $$#A % C    c                     |j                   j                  j                         }t        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orderParser   Ordersr   RelativeNameetagproduct_requestquote_change_typenew_quote_external_name)selfargs	order_refs      r   Runz
Modify.Runa   s^     ##))+I;;i446		"22D4J4J"::< <r   N)__name__
__module____qualname____doc__staticmethodr   r-    r   r   r   r   ?   s      9C C8<r   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    J &  ' < / ( I 	"J D%%++,,<T\\ ,< - ,<^ % r   