
                            d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlZddlm	Z	 ddl
mZ ddlZdZ G d	 d
e      Ze	j                    e	j"                  e	j$                  j&                         G d de	j(                                      Zy)9Unlock secrets and surprises coming soon to Google Cloud.    )absolute_import)division)unicode_literalsN)base)encodingz=https://gcloud-unlock-api-gsaaz6raqa-uc.a.run.app/api/unlock/c                       e Zd Zy)SurpriseErrorN)__name__
__module____qualname__     lib/surface/unlock.pyr
   r
   !   s    r   r
   c                   &    e Zd ZdZed        Zd Zy)EnableAlphar   c                 *    | j                  dd       y )NSURPRISEz"ID of the surprise to be unlocked.)help)add_argument)parsers    r   ArgszEnableAlpha.Args*   s    

)MNr   c                 @   t         j                  j                         }t        j                  d      }|j
                  |j                  }}t        j                  t        j                  dd      }|j                  gi ||||dd}	 t        j                  t        |      }|j                          |j!                         j#                  dd	      }	t%        |	       y # t        j&                  j(                  $ r }
t+        d
j-                  |
            d }
~
ww xY w)N)P      )fallbackTERMunknown)isttywidthheightterm)argsoptionsterminfo)jsoncontent z
{http_err})http_err)sysstdoutisattyshutilget_terminal_sizecolumnslinesr   GetEncodedValueosenvironr   requestspost_UNLOCK_URLraise_for_statusr&   getprint
exceptions	HTTPErrorr
   format)selfr#   r   sizer    r!   terminal_typeunlock_requestresponseresponse_contentr)   s              r   RunzEnableAlpha.Run.   s    JJE##X6DLL$**6E,,RZZKM !	
	N	B{@h! ",,Y;(( B,--x-@AABs   	AC   D=DDN)r   r   r   __doc__staticmethodr   rC   r   r   r   r   r   %   s"     BO OBr   r   )rD   
__future__r   r   r   r2   r-   r*   googlecloudsdk.callioper   googlecloudsdk.core.utilr   r4   r6   	Exceptionr
   HiddenReleaseTracksReleaseTrackGASilentCommandr   r   r   r   <module>rO      s     @ &  ' 	  
 ( - MI  D%%(()"B$$$ "B * "Br   