
                             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	lmZ  G d
 de	j                        Zy)z2Surface for creating an App Engine domain mapping.    )absolute_import)division)unicode_literals)appengine_domains_api_client)base)domains_util)flags)logc                   6    e Zd ZdZdddZed        Zd Zd Zy)	CreatezCreates a domain mapping.z{description}a            To create a new App Engine domain mapping with an automatically
          managed certificate, run:

              $ {command} 'example.com'

          Note: managed certificates do not support wildcard domain mappings.

          To create a domain with a manual certificate, run:

              $ {command} '*.example.com' --certificate-management=manual --certificate-id=1234

          To create a domain with no associated certificate, run:

              $ {command} '*.example.com' --certificate-management=manual
          )DESCRIPTIONEXAMPLESc                     t         j                  j                  |        t        j                  | d       | j                  j                  d       t        j                  |        y )NF)include_no_certzdefault(id, resourceRecords))r	   DOMAIN_FLAGAddToParserAddCertificateIdFlagdisplay_info	AddFormatAddCertificateManagementFlag)parsers    )lib/surface/app/domain_mappings/create.pyArgszCreate.Args5   sI    	!!&)	vu=
!!"@A	&&v.    c                 $    | j                  |      S )N)r   )selfargss     r   Runz
Create.Run<   s    ;;tr   c                    t        j                  | j                               }t        j                  |j
                  |j                         |j                  s|j
                  sd|_        nd|_        t        j                  |j                  |j                        }|j                  |j                  |j
                  |      }t        j                  |j                         t        j                  j                  d       |S )N	automaticmanualzqPlease add the following entries to your domain registrar. DNS changes can require up to 24 hours to take effect.)
api_clientGetApiClientForTrackReleaseTrackr   ValidateCertificateArgscertificate_idcertificate_managementParseCertificateManagementmessagesCreateDomainMappingdomainr
   CreatedResourcestatusPrint)r   r   clientmanagement_typemappings        r   r   zCreate.Create?   s    ,,T->->-@AF(()<)<)-)D)DF &&  &1#&.#"==446O ((d6I6I)8:G $JJ	BC Nr   N)	__name__
__module____qualname____doc__detailed_helpstaticmethodr   r   r    r   r   r   r      s4    ! 	-, / /r   r   N)r5   
__future__r   r   r   googlecloudsdk.api_lib.app.apir   r"   googlecloudsdk.callioper   googlecloudsdk.command_lib.appr   r	   googlecloudsdk.corer
   CreateCommandr   r8   r   r   <module>r?      s4    9 &  ' U ( 7 0 #:T :r   