
    :                     &   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ZdZdZ ej(                  ej*                  j,                        ej.                   G d dej0                                      Zy)zHImplementation of gcloud managed kafka schema registries update command.    )absolute_import)division)unicode_literals)apis)base)	arguments)util)log)	resources)managedkafka_v1_messagesz	projects/z
locations/zschemaRegistries/c                   &    e Zd ZdZed        Zd Zy)Updatea  Update the mode and compatibility of a schema registry.

  ## EXAMPLES

  Modify the mode of the schema registry to READONLY:

    $ {command} --mode=READONLY

  Modify the compatibility of the schema registry to BACKWARDS:

    $ {command} --compatibility=BACKWARDS
  c                     t        j                  |        | j                  d      }|j                  dt        d       |j                  dt        d       y)	z Register flags for this command.T)requiredz--modez*The mode of the schema registry to update.)typehelpz--compatibilityz3The compatibility of the schema registry to update.N)r   AddSchemaRegistryArgToParseradd_mutually_exclusive_groupadd_argumentstr)parsergroups     5lib/surface/managed_kafka/schema_registries/update.pyArgszUpdate.Args2   s_     **62///>E	9  
 
B      c                 <   t        j                  dd      }|j                  }t        j                  |j
                        }|j                  }t        j                  j                  |j                  d|||j                  d      }|j                         }|j                  r|dz   }|j                         }	t        j                  j                  |j                        |	_        |j!                  ||	      }
|j"                  j%                  |
      }t'        j(                  |j                  d	|j                  z  
       |j*                  r|dz   }|j-                         }t        j,                  j/                  |j*                        |_        |j1                  ||      }
|j2                  j%                  |
      }t'        j(                  |j                  d|j*                  z  
       t&        j4                  j7                  d|j*                  z         yy)zCalled when the user runs gcloud managed-kafka schema-registries update ...

    Args:
      args: all the arguments that were provided to this command invocation.

    Returns:
      The updated schema registry.
    managedkafkav1z0managedkafka.projects.locations.schemaRegistries)
projectsIdlocationsIdschemaRegistriesId)
collectionparamsz/mode)nameupdateSchemaModeRequest)requestz
mode to %s)detailsz/config)r$   updateSchemaConfigRequestzcompatibility to %sz5Current schema registry config: 
 - compatibility: %sN)r   GetClientInstanceMESSAGES_MODULEr	   ParseProjectprojectlocationr   REGISTRYParseschema_registryRelativeNamemodeUpdateSchemaModeRequestr   ModeValueValuesEnumFManagedkafkaProjectsLocationsSchemaRegistriesContextsModeUpdateRequest1projects_locations_schemaRegistries_contexts_moder   r
   UpdatedResourcecompatibilityUpdateSchemaConfigRequestCompatibilityValueValuesEnumHManagedkafkaProjectsLocationsSchemaRegistriesContextsConfigUpdateRequest3projects_locations_schemaRegistries_contexts_configstatusPrint)selfargsclientmessage
project_idr-   schema_registry_resourceschema_registry_pathr$   updatemoderequestr&   responseupdateconfigrequests                r   Runz
Update.RunD   s    ##ND9F$$G""4<<0J}}H(1177E$#"&"6"6
  8   4@@Byy!G+d!99;
"
:
:
N
Nii 
 ^^-> _ g 
B
B
I
I J  
 



x}}(D !I-d#==?*B*\*\*y*y


+' ``/B a g 
D
D
K
K L  
 



'(*@*@@ 
jj
B##%) r   N)__name__
__module____qualname____doc__staticmethodr   rI    r   r   r   r   "   s!      "Er   r   N)rM   
__future__r   r   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   (googlecloudsdk.command_lib.managed_kafkar   r	   googlecloudsdk.corer
   r   5googlecloudsdk.generated_clients.apis.managedkafka.v1r   PROJECTS_RESOURCE_PATHLOCATIONS_RESOURCE_PATHSCHEMA_REGISTRIES_RESOURCE_PATHReleaseTracksReleaseTrackALPHADefaultUniverseOnlyUpdateCommandr   rO   r   r   <module>r^      s    O &  ' , ( > 9 # ) Z$ & "5  D%%++,eT e  -er   