
                             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  \R                    " S
 S\R"                  5      5       rg)zCreate a key handle.    )absolute_import)division)unicode_literals)base)waiter)flags)log)	resourcesc                   .    \ rS rSrSr\S 5       rS rSrg)Create   af  Create a new KeyHandle.

Creates a new KeyHandle, triggering the provisioning of a new CryptoKey for
CMEK use with the given resource type in the configured key project and the
same location

## EXAMPLES

The following command creates a KeyHandle named `my-key-handle` within the
location `global` for the resource type `compute.googleapis.com/Disk`:

  $ {command} --key-handle-id=my-key-handle --my-key-handle --location=global
  --resource-type=compute.googleapis.com/Disk

In case we want to generate a random KeyHandle id, we can use the
`--generate-key-handle-id` flag instead of the `--key-handle-id` flag.
c                     [         R                  " U 5        U R                  R                  [         R                  5        g )N)r   AddCreateKeyHandleFlagsdisplay_infoAddCacheUpdaterKeyHandleCompleter)parsers    %lib/surface/kms/key_handles/create.pyArgsCreate.Args1   s,     
!!&)
''(@(@A    c                 f   [         R                  " 5       n[         R                  " 5       nUR                  R                  R                  5       nUR                  (       aA  UR                  UR                  5       UR                  UR                  UR                  S9S9nO5UR                  UR                  5       UR                  UR                  S9S9nUR                  R                  U5      n[        R                  R                  UR                   SS9n["        R$                  " ["        R&                  " UR                  UR(                  5      US5      n[*        R,                  " UR                   SS9  [*        R.                  R1                  S	R3                  UR4                  5      5        U$ )
N)resourceTypeSelector)parentkeyHandleId	keyHandle)r   r   z&cloudkms.projects.locations.operations)
collectionz$Waiting for KeyHandle to be created.	KeyHandle)kindz#The corresponding CryptoKey is: {0})cloudkms_baseGetClientInstanceGetMessagesModuleCONCEPTSlocationParsekey_handle_id0CloudkmsProjectsLocationsKeyHandlesCreateRequestRelativeNamer   resource_typeprojects_locations_keyHandlesr   r
   REGISTRYParseRelativeNamenamer   WaitForCloudOperationPollerprojects_locations_operationsr	   CreatedResourcestatusPrintformatkmsKey)	selfargsclientmessageslocation_refreq	operationoperation_refcreated_key_handles	            r   Run
Create.Run7   sz   ,,.F..0H==))//1LEE**,((&&D<N<N&O F c EE**,&&D<N<N&O F c
 44;;C@I&&88#K 9 M  ##0000	
 	. *//kBJJ-445G5N5NO r    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r?   __static_attributes__rA   r   r   r   r      s"    $ B B
#r   r   N)rF   
__future__r   r   r   googlecloudsdk.api_lib.cloudkmsr   r    googlecloudsdk.api_lib.utilr   googlecloudsdk.calliopegooglecloudsdk.command_lib.kmsr   googlecloudsdk.corer	   r
   UniverseCompatibleCreateCommandr   rA   r   r   <module>rQ      sL     &  ' A . ( 0 # ) <T < <r   