ó
    €Ï¥  ã                   óÂ   • 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KJr  SSKJr   " S S\	R(                  5      rg)z-`gcloud monitoring policies migrate` command.é    )Úabsolute_import)Údivision)Úunicode_literals)Úchannels)Úpolicies)Úbase)Úflags)Úutil)Úlog)Ú
properties)Ú
console_ioc                   ó6   • \ rS rSrSrSS0r\S 5       rS rSr	g)	ÚMigrateé    z<Migrate a Prometheus configuration file to Cloud Monitoring.ÚDESCRIPTIONa            Creates new alerting policies and/or notification channels based on
          provided Prometheus files. The rules YAML file, which holds the alert
          rules, must be specified as a file through the
          `--policies-from-prometheus-alert-rules-yaml` flag.
       c                 ó0   • [         R                  " U 5        g )N)r	   ÚAddMigrateFlags)Úparsers    Ú*lib/surface/monitoring/policies/migrate.pyÚArgsÚMigrate.Args*   s   € ä	×Ò˜&Õ!ó    c                 ó  • [         R                  " 5       n[        R                  " 5       nSS/n[        R
                  " X5        [        R                  " [        R                  R                  R                  R                  5       5      n[        R                  " SSS9(       d  g [        R                  " XR                   5      n/ nU HP  nUR#                  XX5      n	[$        R&                  " U	R(                  S5        UR+                  U	R(                  5        MR     [        R,                  " XR                   U5      n
/ nU
 HF  nUR#                  X\5      n	[$        R&                  " U	R(                  S5        UR+                  U	5        MH     U$ )Nz+--policies-from-prometheus-alert-rules-yamlz,--channels-from-prometheus-alertmanager-yamlzÑEach call of the migration tool will create a new set of alert policies and/or notification channels. Thus, the migration tool should not be used to update existing alert policies and/or notification channels.F)ÚmessageÚdefaultznotification channelzalert policy)r   ÚNotificationChannelsClientr   ÚAlertPolicyClientr
   ÚValidateAtleastOneSpecifiedÚprojects_utilÚParseProjectr   ÚVALUESÚcoreÚprojectÚGetr   ÚPromptContinueÚ"CreateNotificationChannelsFromArgsÚmessagesÚCreater   ÚCreatedResourceÚnameÚappendÚCreatePromQLPoliciesFromArgs)ÚselfÚargsÚnotification_channel_clientÚalert_policy_clientÚpromql_flagsÚproject_refÚnotification_channelsÚcreated_channel_namesÚchannelÚresultÚpromql_policiesÚpolicies_resultsÚpolicys                r   ÚRunÚMigrate.Run.   sY  € Ü"*×"EÒ"EÓ"GÐÜ"×4Ò4Ó6Ðà5Ø6ð€Lô 	×$Ò$ TÔ8Ü×,Ò,Ü×Ñ×Ñ×&Ñ&×*Ñ*Ó,ó€Kô ×$Ò$ð&ð
 ÷ð ä ×CÒCØ×*Ñ*óÐð ÐÛ(ˆØ*×1Ñ1°+ÓG€fÜ	×Ò˜&Ÿ+™+Ð'=Ô>Ø×"Ñ" 6§;¡;Ö/ñ )ô
 ×7Ò7Ø×*Ñ*Ð,Aó€Oð Ðó "ˆØ"×)Ñ)¨+Ó>€fÜ	×Ò˜&Ÿ+™+ ~Ô6Ø×Ñ˜fÖ%ñ "ð Ðr   © N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Údetailed_helpÚstaticmethodr   r:   Ú__static_attributes__r<   r   r   r   r       s-   † ÙDà ð #ð €-ð ñ"ó ð"õ-r   r   N)rA   Ú
__future__r   r   r   Ú!googlecloudsdk.api_lib.monitoringr   r   Úgooglecloudsdk.callioper   Ú%googlecloudsdk.command_lib.monitoringr	   r
   Ú#googlecloudsdk.command_lib.projectsr   Úgooglecloudsdk.corer   r   Úgooglecloudsdk.core.consoler   ÚCreateCommandr   r<   r   r   Ú<module>rM      s@   ðñ 4å &Ý Ý 'å 6Ý 6Ý (Ý 7Ý 6Ý EÝ #Ý *Ý 2ô;ˆd× Ñ õ ;r   