
    p                         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\R                  5      rg)zcreate command.    )absolute_import)division)unicode_literals)serviceusage)base)common_args)log)
propertiesc                   .    \ rS rSrSr\S 5       rS rSrg)Create   a~  Create a service identity for a consumer.

This command creates a service identity for a consumer. The supported
consumers are projects, folders, and organizations.

## EXAMPLES

To create a service identity for a project, run:

  $ {command} --service=example.googleapis.com --project=helloworld

Using a project number:

  $ {command} --service=example.googleapis.com --project=1234567890

To create a service identity for a folder, run:

  $ {command} --service=example.googleapis.com --folder=1234567890

To create a service identity for an organization, run:

  $ {command} --service=example.googleapis.com --organization=1234567890
c                 4   U R                  SSSS9  U R                  SSS9n[        R                  " SS9R	                  U5        [
        R                  " S	S
[        SS9R	                  U5        [
        R                  " SS
[        SS9R	                  U5        g
)zArgs is called by calliope to gather arguments for this command.

Args:
  parser: An argparse parser that you can use to add arguments that go on
    the command line after this command. Positional arguments are allowed.
z	--serviceTz-The service to create a service identity for.)requiredhelpz;Container resource where the service identity will be used.)mutexr   z0Project where the service identity will be used.)help_text_to_prependz--folderNz/Folder where the service identity will be used.)defaulttyper   z--organizationz5Organization where the service identity will be used.)add_argument	add_groupr   ProjectArgumentAddToParserr   Argumentint)parser	containers     'lib/surface/services/identity/create.pyArgsCreate.Args5   s     <  >   I ! I Ok)MM>	
 k)MMD	
 k)    c                    UR                   (       a'  UR                   n[        R                  R                  nOUR                  (       a'  UR                  n[        R                  R
                  nOiUR                  (       a  UR                  nO1[        R                  R                  R                  R                  SS9n[        R                  R                  n[        R                  " X!R                  U5      nSU;  a!  [        R                  R!                  S5        U$ [        R                  R!                  SR#                  US   5      5        U$ )zRun 'services identity create'.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
    with.

Returns:
  response with service identity email and uniqueId.
T)r   emailzService identity createdzService identity created: {0})folderr   ContainerTypeFOLDER_SERVICE_RESOURCEorganizationORG_SERVICE_RESOURCEprojectr
   VALUEScoreGetPROJECT_SERVICE_RESOURCEGenerateServiceIdentityservicer	   statusPrintformat)selfargsr   container_typeresponses        r   Run
Create.RunW   s     {{++i#11IIn			##i#11FFn	LL	%%**22666E	#11JJn33<<H h 
jj12 O 
jj6==
7
 Or     N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r6   __static_attributes__r8   r    r   r   r      s!    0  B r    r   N)r=   
__future__r   r   r   googlecloudsdk.api_lib.servicesr   googlecloudsdk.callioper   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer	   r
   CreateCommandr   r8   r    r   <module>rF      s6     &  ' 8 ( < # *[T [r    