
                            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 dd	lmZ dd
lmZ ddlmZ dZdZdZ e
j,                  e
j.                  j0                  e
j.                  j2                  e
j.                  j4                        e
j6                   G d de
j8                                      Zy)z.Create a Google Cloud Platform git repository.    )absolute_import)division)unicode_literals)
exceptions)
sourcerepo)base)flags)log)
properties)	text_typezxResponseError: status=[{status_description}], code=[{status_code}], message=[{message}]. {details.message?
details:
{?}}zf
enable at: https://console.cloud.google.com/apis/library/sourcerepo.googleapis.com/?project={project}z9https://cloud.google.com/source-repositories/docs/pricingc                   &    e Zd ZdZed        Zd Zy)Createay  Create a cloud source repository.

  This command creates a named git repository for the currently
  active Google Cloud Platform project.

  ## EXAMPLES

  To create a named repository in the current project issue the
  following commands:

    $ gcloud init

    $ {command} REPOSITORY_NAME

  Once you push contents to it, they can be browsed in the
  Developers Console.
  c                 *    | j                  dd       y )Nrepository_namez        Name of the repository. May contain between 3 and 63 (inclusive)
        lowercase letters, digits, and hyphens. Must start with a letter, and
        may not end with a hyphen.
        )help)add_argument)parsers    "lib/surface/source/repos/create.pyArgszCreate.Args>   s    
      c                    t        j                  |j                        }t        j                  |j                                t        j                         }	 |j                  |      }|rNt        j                  |j                                t        j                  dj                  t                     |S y# t        j                  $ r}t        j                   |      }t"        |_        dt'        |      v r[t(        j                  t*        j,                  j.                  j0                  j3                               }|xj$                  |z  c_        |d}~ww xY w)a  Create a GCP repository to the current directory.

    Args:
      args: argparse.Namespace, the arguments this command is run with.

    Returns:
      (sourcerepo_v1_messages.Repo) The created respository.

    Raises:
      sourcerepo.RepoResourceError: on resource initialization errors.
      c_exc.HttpException: on missing billing account, and when the repo name is
        already in use.
    z=You may be billed for this repository. See {url} for details.)urlzAPI is not enabled)projectN)r   	ParseRepor   r	   REPO_NAME_VALIDATORNameSource
CreateRepor
   CreatedResourcewarningformat_BILLING_URLr   	HttpErrorc_excHttpException_ERROR_FORMATerror_formatr   _LINK_FORMATr   VALUEScorer   	GetOrFail)selfargsressource_handlerrepoerrorexclinks           r   Runz
Create.RunH   s    

t33
4C 
chhj)&&(N&&s+d	CHHJ' --3VV-E	G	 

  &c&c	3	/""%%**22<<> # @D is   A B: :EB
EEN)__name__
__module____qualname____doc__staticmethodr   r4    r   r   r   r   '   s     
$  #r   r   N)r8   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.sourcer   googlecloudsdk.callioper   r$   !googlecloudsdk.command_lib.sourcer	   googlecloudsdk.corer
   r   sixr   r&   r(   r"   ReleaseTracksReleaseTrackGAALPHABETADefaultUniverseOnlyCreateCommandr   r:   r   r   <module>rI      s    5 &  ' ' 4 ( 7 3 # * 5? K $++1143D3D3I3I @T @ @r   