
                             S 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
  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   " S S\R(                  5      rg)z"Import autoscaling policy command.    )absolute_import)division)unicode_literals)
exceptions)dataproc)util)base)flags)
console_ioc                   .    \ rS rSrSr\S 5       rS rSrg)Import   a  Import an autoscaling policy.

If the specified autoscaling policy already exists, it will be overwritten.
Otherwise, a new autoscaling policy will be created.
To edit an existing autoscaling policy, you can export the autoscaling policy
to a file, edit its configuration, and then import the new configuration.

This command does not allow output only fields, such as policy id and resource
name. It populates the id field based on the resource name specified as the
first command line argument.

## EXAMPLES

The following command creates or updates the contents of autoscaling policy
`example-autoscaling-policy` based on a yaml file:

  $ {command} example-autoscaling-policy --source=saved-policy.yaml
c                     [         R                  " U R                  5       5      n[        R                  " USUR
                  5        [        R                  " U5        g )Nimport)dpDataprocReleaseTrackr
   AddAutoscalingPolicyResourceArgapi_versionexport_utilAddImportFlags)clsparserr   s      3lib/surface/dataproc/autoscaling_policies/import.pyArgsImport.Args2   sC    {{3++-.H	))&(*2*>*>@v&    c                 F   [         R                  " U R                  5       5      nUR                  R                  R                  5       n[        R                  " UUR                  5       UR                  S9n [        R                  " X#R                  5       U5      $ ! [        R                   ao  nUR                  S:w  a  Ue[        R                   " SR#                  UR$                  5      SS9  [        R&                  " X#R                  5       U5      s S nA$ S nAff = f)N)r   	policy_idpolicy_file_namei  z-Autoscaling policy [{0}] will be overwritten.T)messagecancel_on_no)r   r   r   CONCEPTSautoscaling_policyParser   ReadAutoscalingPolicyNamesourceCreateAutoscalingPolicyRelativeNameapitools_exceptions	HttpErrorstatus_coder   PromptContinueformatidUpdateAutoscalingPolicy)selfargsr   
policy_refpolicyerrors         r   Run
Import.Run:   s    {{4,,./H11779J''//#&F
2))(4K4K4M*02 2(( 
2			c	!BJJii ))(4K4K4M*02 2
2s   8$B D 1A$DD D  N)	__name__
__module____qualname____firstlineno____doc__classmethodr   r7   __static_attributes__r9   r   r   r   r      s     & ' '2r   r   N)r>   
__future__r   r   r   apitools.base.pyr   r+   googlecloudsdk.api_lib.dataprocr   r   r   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataprocr
   !googlecloudsdk.command_lib.exportr   googlecloudsdk.core.consoler   Commandr   r9   r   r   <module>rI      s8    ) &  ' > : 0 ( 5 A 212T\\ 12r   