
    =                         S r SSK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&                  " S5      r " S S\R*                  5      r " S S\R*                  5      rS<S jrS rS=S jrS=S jrS=S jrS=S jr S>S jrS rS r S r!S r"S?S jr#S r$S  r%S! r&S@S" jr'S<S# jr(S<S$ jr)S% r*S& r+S' r,S<S( jr-S) r.S* r/S+ r0S, r1S- r2S. r3S/ r4S0 r5S1 r6S2 r7S3 r8S4 r9S5 r:S6 r;S7 r<S8 r=S9 r>S: r?S; r@g)Az0Common flags for the consumers subcommand group.    N)services_util)arg_parsers)base)concepts)deps)
completers)concept_parsers)presentation_specs)
propertiesz4services list --format=disable --flatten=serviceNamez9beta services list --format=disable --flatten=config.namez)operations/(?P<namespace>\w+)\.(?P<id>.*)c                   (   ^  \ rS rSrU 4S jrSrU =r$ )ConsumerServiceCompleter%   c                 \   > [         [        U ]
  " S[        R                  [
        S/S.UD6  g Nenabled)
collectionlist_commandflags )superr   __init__r   SERVICES_COLLECTION_SERVICES_LIST_COMMANDselfkwargs	__class__s     7lib/googlecloudsdk/command_lib/services/common_flags.pyr   !ConsumerServiceCompleter.__init__'   s3    	
"D2  44+k 	    r   __name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r   s   @r   r   r   %        r    r   c                   (   ^  \ rS rSrU 4S jrSrU =r$ )ConsumerServiceLegacyCompleter/   c                 \   > [         [        U ]
  " S[        R                  [
        S/S.UD6  g r   )r   r+   r   r   r   _SERVICES_LEGACY_LIST_COMMANDr   s     r   r   'ConsumerServiceLegacyCompleter.__init__1   s3    	
($8  442k 	r    r   r!   r(   s   @r   r+   r+   /   r)   r    r+   c                 J    [         R                  " SSR                  U 5      S9$ )N	operationzThe name of the operation {0}.helpr   Argumentformat)suffixs    r   operation_flagr8   9   s&    	8??G
I Ir    c                     [         R                  U 5      nU(       d&  [        R                  " SR	                  U S5      5      eUR                  S5      $ )NzInvalid value '{0}': {1}z2Operation format should be operations/namespace.id	namespace)_OPERATION_NAME_REmatchr   ArgumentTypeErrorr6   group)op_namer<   s     r   get_operation_namespacer@   >   sN    

"
"7
+%	

'
'(B(I(IE)G H H	[	!!r    c                 V    [         R                  " US[        SR                  U 5      S9$ )N*The name of the service(s) {0}.)nargs	completerr3   r   r5   r   r6   r7   	flag_names     r   consumer_service_flagrI   F   s*    	(,33F;	
= =r    c                 T    [         R                  " U[        SR                  U 5      S9$ )NThe name of the service {0}.)rE   r3   rF   rG   s     r   single_consumer_service_flagrL   N   s'    	()008
: :r    c                 L    [         R                  " USSR                  U 5      S9$ )NrB   rC   )rD   r3   r4   rG   s     r   available_service_flagrN   U   s)     
,33F;
= =r    c                 J    [         R                  " USR                  U 5      S9$ )NrK   r2   r4   rG   s     r   service_flagrP   ^   s$    	4;;FC
 r    c                 J    [         R                  " USR                  U 5      S9$ )Nz&The MCP content security provider {0}.r2   r4   rG   s     r   "mcp_content_security_provider_flagrR   d   s&     
3::6B
 r    c                  .    [         R                  " SSSS9$ )Nz--consumer-policy-fileTzFPath to the file that contains the consumer policy in the YAML format.)requiredr3   r   r5   r   r    r   consumer_policy_file_flagrV   o   s    		
 r    c                  .    [         R                  " SSSS9$ )Nz--bypass-dependency-check
store_truea   This flag controls dependency management within the consumer policy. If false, dependencies are enforced. When adding a new service, it verifies that all the services dependencies are already present in the policy. When removing a service, the system will ensure that no other services in the policy depend on it. If the policy lacks any required dependencies, the update will not succeed, and an error will be returned.actionr3   rU   r   r    r   bypass_dependency_checkr[   z   s    	!9	
 r    c                  .    [         R                  " SSSS9$ )N--bypass-api-usage-checkrX   z If true, the system will bypass usage checks for services that are being removed. If false, the system will check if the service to be removed was used in the last 30 days or enabled in the last 3 days. If so, an error will be returned.rY   rU   r   r    r   bypass_api_usage_checkr^      s    	 C		
 	r    c                 L    [         R                  " SSSS9R                  U 5      $ )Nz--skip-mcp-endpoint-checkrX   zU If true, the system will bypass the check for MCP endpoint while enabling a service.rY   r   r5   AddToParserparsers    r   skip_mcp_endpoint_check_flagrd      s*    	!!	
 Kr    c                 @    [         R                  " S[        U5      XS9$ )NkeyrT   )r
   ResourcePresentationSpec_get_key_resource_spechelp_txtapi_versionrT   s      r   _create_key_resource_argrm      s"    		4	4#K0(
 r    c           
          U S:X  a8  [         R                  " SU SS[        5       [        5       [         R                  S9$ [         R                  " SU SS[        5       [         R                  S9$ )z,Return the resource specification for a key.v2zapikeys.projects.locations.keysrf   T)rl   resource_namedisable_auto_completerskeysIdlocationsId
projectsIdzapikeys.projects.keys)rl   rp   rq   rr   rt   )r   ResourceSpec_key_attribute_config_location_attribute_config DEFAULT_PROJECT_ATTRIBUTE_CONFIG)rl   s    r   ri   ri      sn    D  ) $$&.0<<> >    $$&<<> >r    c                  ,    [         R                  " SSS9$ )Nrf   zId of the key)name	help_text)r    ResourceParameterAttributeConfigr   r    r   rv   rv      s    		2	2O
- -r    c                  z    [         R                  " SS[        R                  " S SR	                  S5      SSS9/S	9$ )
NlocationzLocation of the key.c                      g)Nglobalr   r   r    r   <lambda>,_location_attribute_config.<locals>.<lambda>   s    xr    zlocation will default to {}r   TF)functionhintactiveplural)rz   r{   fallthroughs)r   r|   r   Fallthroughr6   r   r    r   rw   rw      sE    		2	2&


'077A		
	 		r    c                 ~    [         R                  " [        SR                  U5      UUS9/5      R	                  U 5      $ )NzThe name of the key {0}.rj   )r	   ConceptParserrm   r6   ra   )rc   r7   rl   rT   s       r   key_flagr      sB    		&	&
"188@%
 Kr    c                 j    [         R                  " SSR                  U5      S9R                  U 5        g )Nz--display-namezDisplay name of the key {0}.r2   r   r5   r6   ra   rc   r7   s     r   display_name_flagr      s)    --)008::E+f:Mr    c                 j    [         R                  " SSR                  U5      S9R                  U 5        g )Nz--key-idz!User-specified ID of the key {0}.r2   r   r   s     r   key_id_flagr      s)    --:AA&IKr    c                 L    [         R                  " SSS9R                  U 5        g )Nz--service-accountzThe email of the service account the key is bound to. If this field is specified, the key is a service account bound key and auth enabled.r2   r`   rb   s    r   service_account_flagr      s"    -- Kr    c                 P    U R                  SS9n[        USSSS9  [        U5        g)z(Adds args for api-keys undelete command.Trg   zto undeletero   F)r7   rl   rT   N)add_mutually_exclusive_groupr   _key_string_flag)rc   undelete_set_groups     r   add_key_undelete_argsr      s2    ::D:I
D5 %&r    c                 N    [         R                  " SSSS9R                  U 5        g )Nz--skip-dependencyrX   zJIf set, the dependencies of the service to be enabled will not be enabled.rY   r`   rb   s    r   skip_dependency_flagr      s%    --	 Kr    c                 l    [         R                  " SSSR                  U5      S9R                  U 5        g )Nz--validate-onlyrX   z5Validate the {} action, but don't actually perform itrY   r   r   s     r   validate_only_argsr     s.    --
A
H
H
P	 Kr    c                 N    [         R                  " SSSS9R                  U 5        g )Nz!--bypass-dependency-service-checkrX   zoIf specified, the disable call will bypass the check for dependencies and the dependencies will remain enabled.rY   r`   rb   s    r   %_bypass_dependency_service_check_flagr     s&    --)D	 Kr    c                 N    [         R                  " SSSS9R                  U 5        g )Nr]   rX   zIf specified, the system will bypass usage checks for services that are being removed. Otherwise, the system will check if the service to be removed was used in the last 30 days or enabled in the last 3 days. If so, the system will return an error.rY   r`   rb   s    r   bypass_api_usage_check_flagr     s%    -- ;		 Kr    c                 N    [         R                  " SSSS9R                  U 5        g )Nz--disable-dependency-servicesrX   z If specified, the disable call will proceed disabling the service and all the enabled services depend on the service to be disabledrY   r`   rb   s    r   !_disable_dependency_services_flagr   (  s&    --%O	 Kr    c                 N    U R                  SS9n[        U5        [        U5        gzAdds resource args for command.Frg   N)r   r   r   )rc   dependent_check_groups     r   add_dependency_check_argsr   3  s(     ==u=M#$9:'(=>r    c                 d    U R                  SS9n[        U5        [        U5        [        U5        gr   )r   _project_id_flag_folder_id_flag_orgnaization_id_flag)rc   resource_groups     r   add_resource_argsr   :  s-    666F.>".!'r    c                 0   U R                  SS9n[        U5        UR                  5       nUR                  5       n[        U5        [	        U5        [        U5        [        U5        [        U5        U R                  SS9n[        U5        [        U5        g)z&Adds args for api-keys update command.Frg   N)
r   _add_clear_restrictions_argadd_argument_group_allowed_referrers_arg_allowed_ips_arg_allowed_bundle_ids_allowed_application_api_targets_arg_annotations_add_clear_annotations_arg)rc   update_set_restriction_grouprestriction_groupclient_restriction_groupupdate_set_annotation_groups        r   add_key_update_argsr   B  s    !'!D!D "E " :;2EEG.KKM12+,.//0$% & C C !D ! *+89r    c                     U R                  5       nUR                  5       n[        U5        [        U5        [	        U5        [        U5        [        U5        [        U 5        g)z%Add args for api-keys create command.N)r   r   r   r   r   r   r   r   )rc   r   r   s      r   add_key_create_argsr   V  sU    //1.KKM12+,.//0$%vr    c                 N    [         R                  " SSSS9R                  U 5        g )Nz--clear-restrictionsrX   z*If set, clear all restrictions on the key.rY   r`   rb   s    r   r   r   b  s$    --79 :EV9Lr    c                 N    [         R                  " SSSS9R                  U 5        g )Nz--clear-annotationsrX   z)If set, clear all annotations on the key.rY   r`   rb   s    r   r   r   i  s$    --68 9DF8Kr    c                 x    [         R                  " S/ [        R                  " 5       SSS9R	                  U 5        g )Nz--allowed-referrersALLOWED_REFERRERSzeA list of regular expressions for the referrer URLs that are allowed to make API calls with this key.defaulttypemetavarr3   r   r5   r   ArgListra   rb   s    r   r   r   p  s4    -- !12 3>+f2Er    c                 x    [         R                  " S/ [        R                  " 5       SSS9R	                  U 5        g )Nz--allowed-ipsALLOWED_IPSzSA list of the caller IP addresses that are allowed to make API calls with this key.r   r   rb   s    r   r   r   z  s4    --  *k&1r    c                 x    [         R                  " S/ S[        R                  " 5       SS9R	                  U 5        g )Nz--allowed-bundle-idsALLOWED_BUNDLE_IDSz5iOS app's bundle ids that are allowed to use the key.)r   r   r   r3   r   rb   s    r   r   r     s2    --" C Kr    c           	          [         R                  " S[        R                  " [        [        S.SS/SS9SSS	S
9R                  U 5        g )Nz--allowed-application)sha1_fingerprintpackage_namer   r      )specrequired_keys
max_lengthz;sha1_fingerprint=SHA1_FINGERPRINT,package_name=PACKAGE_NAMEappendzoRepeatable. Specify multiple allowed applications. The accepted keys are `sha1_fingerprint` and `package_name`.r   r   rZ   r3   )r   r5   r   ArgDictstrra   rb   s    r   r   r     sR    --"%! ,^< LK k&!r    c                 x    [         R                  " SS[        R                  " 5       SSS9R	                  U 5        g )Nz--annotationsz	KEY=VALUEFzAnnotations are key resource. Specify annotations as
            a key-value dictionary for small amounts of arbitrary client data.
            )r   r   rT   r3   )r   r5   r   r   ra   rb   s    r   r   r     s4    --  +f%r    c           	          [         R                  " S[        R                  " [        [
        S.S/SS9SSSS	9R                  U 5        g )
Nz--api-target)servicemethodsr      )r   r   
min_lengthzservice=SERVICEr   aW        Repeatable. Specify service and optionally one or multiple specific
      methods. Both fields are case insensitive.
      If you need to specify methods, it should be specified
      with the `--flags-file`. See $ gcloud topic flags-file for details.
      See the examples section for how to use `--api-target` in
      `--flags-file`.r   )r   r5   r   r   r   listra   rb   s    r   r   r     sM    -- #  " &+f-r    c                 L    [         R                  " SSS9R                  U 5        g )Nz--key-stringzKey String of the key.r2   r`   rb   s    r   r   r     s    --%=>JJr    c           	          [         R                  " SSSR                  [        R                  R
                  R                  [        R                  R                  R                  S9S9R                  U 5        g )Nz	--project
PROJECT_IDaQ  The Google Cloud project ID to use for this invocation. If
omitted, then the current project is assumed; the current project can
be listed using `gcloud config list --format='text(core.project)'`
and can be set using `gcloud config set project PROJECTID`.

`--project` and its fallback `{core_project}` property play two roles
in the invocation. It specifies the project of the resource to
operate on. It also specifies the project for API enablement check,
quota, and billing. To specify a different project for quota and
billing, use `--billing-project` or `{billing_project}` property.
    )core_projectbilling_projectr   r3   )
r   r5   r6   r   VALUEScoreprojectbillingquota_projectra   rb   s    r   r   r     s`    -- 	!((--55$++33AA 	 	$ Kr    c                 N    [         R                  " SSSS9R                  U 5        g )Nz--folder	FOLDER_IDz?The Google Cloud Platform folder ID to use for this invocation.r   r`   rb   s    r   r   r     s#    --L Kr    c                 N    [         R                  " SSSS9R                  U 5        g )Nz--organizationORGANIZATION_IDzEThe Google Cloud Platform organization ID to use for this invocation.r   r`   rb   s    r   r   r     s%    --	 Kr    )	to act on)r   r   )r   mcp_content_security_provider)T)r   ro   T)A__doc__regooglecloudsdk.api_lib.servicesr   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   r   googlecloudsdk.command_lib.utilr   (googlecloudsdk.command_lib.util.conceptsr	   r
   googlecloudsdk.corer   r.   r   compiler;   ListCommandCompleterr   r+   r8   r@   rI   rL   rN   rP   rR   rV   r[   r^   rd   rm   ri   rv   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   <module>r      sF   7 	 9 / ( 5 1 6 D G *"9 2  ZZ LM z>> Z%D%D I
"=:= #B 
>*-

		N'
?(:(	MLF2""&.*,r    