
                            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KJr  SSKJr  SSKJr  SSKJr  SSKJr  SrSr\R@                  " \RB                  RD                  5      \RF                   " S S\RH                  5      5       5       r%S r&S r'g)z/`gcloud dataproc-gdc instances create` command.    )absolute_import)division)unicode_literals)encoding)apis)waiter)arg_parsers)base)concepts)resource_args)iam_util)	yaml_data)labels_util)concept_parsers)presentation_specs)log)	resourcesdataprocgdcv1alpha1c                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	Create)   a8  Create a Dataproc GDC service instance.

A service instance is a deployment of the Dataproc operator running on a
Kubernetes cluster. Each cluster may have at most one Dataproc service
instance deployed. A service instance manages Application Environments
and Spark Applications that run locally on the cluster.
EXAMPLESa            To create a Dataproc GDC service instance with name `my-instance`
          in location `us-central1` running on a GDCE cluster named
          `my-cluster`, run:

          $ {command} my-instance --location=us-central1 --gdce-cluster=my-cluster

          Note that the GDCE cluster and the Dataproc GDC service instance must
          be in the same project and Cloud location (in this case us-central1).
          c                    [         R                  " [        5       [        5       /SS/0S9R	                  U 5        U R                  SSS9  U R                  SSS9  U R                  S	S
[        R                  " 5       [        R                  SS9  U R                  S[        R                  " 5       SS9  [        R                  " U 5        [        R                  R	                  U 5        g )Nz--gdce-cluster.locationzinstance.location)command_level_fallthroughsz--request-ida  An optional request ID to identify requests. If the service receives two identical
        instance create requests with the same request_id, the second request is
        ignored and the operation that corresponds to the first request is returned for both.

        The request ID must be a valid UUID with the exception that zero UUID is
        not supported (00000000-0000-0000-0000-000000000000).)helpz--display-namezLHuman-readable name for this service instance to be used in user interfaces.z--annotationsz	KEY=VALUEzBList of annotation KEY=VALUE pairs to add to the service instance.)metavartypeactionr   z--service-accountz Requested google cloud service account to associate with the ServiceInstance.

        Service account must be of format my-iam-account@somedomain.com or
        my-iam-account@my-project.iam.gserviceaccount.com)r   r   )r   ConceptParser#GetInstanceResourcePresentationSpec&GetGdceClusterResourcePresentationSpecAddToParseradd_argumentr	   ArgDictUpdateActionr   GetIamAccountFormatValidatorr   AddCreateLabelsFlagsr
   
ASYNC_FLAG)parsers    ,lib/surface/dataproc_gdc/instances/create.pyArgsCreate.Args?   s    !!/124	
 &(;'<$
	 k&
A        "''P   224=   $$V,OO'    c                    [         R                  " [        [        5      n[         R                  " SS5      nUR
                  R                  R                  5       nUR
                  R                  R                  5       nUR                  (       a5  [        R                  " UR                  UR                  R                  SS9nOS nUR                  UR                  5       UR!                  5       R#                  5       UR$                  UR                  UR&                  [(        R*                  " XR                  R,                  5      UUR/                  UR#                  5       S9UR0                  S9S9nUR2                  R5                  U5      n[7        USS	5      n	U	(       d  [8        R:                  R                  UR<                  S
S9n
[>        R@                  " UR2                  URB                  5      n[>        RD                  " UU
SRG                  U
R#                  5       5      5        [H        RJ                  " UR                  5       SRG                  UR!                  5       R#                  5       UR#                  5       5      S9  g [H        RL                  RO                  SRG                  UR                  5       UR<                  5      5        g )Nr   r   T)
sort_items)gdceCluster)displayNamelabelsannotationsr1   serviceAccount)serviceInstanceIdparent	requestIdserviceInstanceasync_Fz)dataprocgdc.projects.locations.operations)
collectionz3Waiting for service instance create operation [{0}]z5- service instance created in [{0}] for cluster [{1}])detailszBCreate request issued for: [{0}]
Check operation [{1}] for status.)(r   GetClientInstanceDATAPROCGDC_API_NAMEDATAPROCGDC_API_VERSIONGetMessagesModuleCONCEPTSinstanceParsegdce_clusterr4   r   DictToAdditionalPropertyMessageServiceInstanceAnnotationsValue9DataprocgdcProjectsLocationsServiceInstancesCreateRequestNameParentRelativeName
request_iddisplay_namer   ParseCreateArgsLabelsValueGdceClusterservice_account#projects_locations_serviceInstancesr   getattrr   REGISTRYnamer   CloudOperationPollerprojects_locations_operationsWaitForformatr   CreatedResourcestatusPrint)selfargsdataprocgdc_clientmessagesinstance_refcluster_refr4   
create_req	create_opr:   operation_refpollers               r+   Run
Create.Runo   sf   //5 %%mZ@H==))//1L--,,224K<<




"
"
3
3k k 	JJ*//1&&(557oo$44 --"2222>> ($00 + 8 8 : 1   $33 5 
	 	K 	
 & #FFMMI T8U+F((..
..%P / m **

@
@

:
:f nn


?
F
F((* 




ELL%%'446**, JJM	!!#Y^^	4r.    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr,   rg   __static_attributes__ri   r.   r+   r   r   )   s3      	  	- -( -(^Gr.   r   c                      [         R                  R                  S5      n [        R                  R                  U R                  5       5      n[        R                  " SUSSSS9$ )Nzdataproc_gdc.instancerB   z'Name of the service instance to create.TF)rU   concept_spec
group_helprequiredprefixes)	r   ResourceYAMLDataFromPathr   ResourceSpecFromYamlGetDatar   ResourcePresentationSpec)instance_dataresource_specs     r+   r!   r!      s^    ,,55- ''001F1F1HI-		4	4 :
 r.   c            	      ^    [         R                  " S[        R                  " 5       SSSSS0S9$ )Nz--gdce-clusterz9The GDCE cluster on which to create the service instance.Tlocation )rU   rs   rt   ru   rv   flag_name_overrides)r   r|   gdce_resource_argsGetClusterResourceSpecri   r.   r+   r"   r"      s7    		4	4%<<>L &r*	
 	r.   N)(rn   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper	   r
    googlecloudsdk.calliope.conceptsr   /googlecloudsdk.command_lib.edge_cloud.containerr   r   googlecloudsdk.command_lib.iamr   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   (googlecloudsdk.command_lib.util.conceptsr   r   googlecloudsdk.corer   r   r>   r?   ReleaseTracksReleaseTrackALPHADefaultUniverseOnlyCreateCommandr   r!   r"   ri   r.   r+   <module>r      s    6 &  ' % , . / ( 5 _ 3 : < D G # ) % $  D%%++,KT K  -K\
r.   