
    .-                     r    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 Zd Z	d	 Z
d
 Zd ZddZddZy)z*Common flags for workforce pools commands.    )absolute_import)division)unicode_literals)arg_parsers)basec                 Z    | j                  ddj                  |dk(  rdnd|      d       y )Nz--organizationz8The parent organization of the workforce pool{0} to {1}.lists Thelprequiredadd_argumentformatparserverbs     ;lib/googlecloudsdk/command_lib/iam/workforce_pools/flags.pyAddParentFlagsr      s8    ELL#R       c                 Z    | j                  ddj                  |dk(  rdnd|      d       y )Nz
--locationz-The location of the workforce pool{0} to {1}.r	   r
   r   Tr   r   r   s     r   AddLocationFlagr   "   s8    :AA#R   r   c                 \    | j                  d      sydj                  | j                        S )Nlocationzlocations/globalzlocations/{})IsSpecifiedr   r   )argss    r   ParseLocationr   ,   s(    			*	%			t}}	--r   c                  z   t        j                  ddddd      } t        j                  ddddd	      }t        j                  d
      }|j                  |        |j                  t	        d             t        j                  d
      }|j                  |       |j                  t        d             ||gS )zCreates an ArgumentGroup for ExtraAttributesOAuth2Client and ExtendedAttributesOAuth2Client Attributes for the update-oidc command.z--clear-extra-attributes-configclear_extra_attributes_config
store_trueFz)Clear the extra attributes configuration.)destactionr   r   z"--clear-extended-attributes-config clear_extended_attributes_configz,Clear the extended attributes configuration.T)mutex)r   )r   ArgumentArgumentGroupAddArgument*ExtraAttributesOAuth2ClientAttributesGroup-ExtendedAttributesOAuth2ClientAttributesGroup)!clear_extra_attributes_config_arg$clear_extended_attributes_config_arg clearable_extra_attributes_group#clearable_extended_attributes_groups       r   2AddClearableExtraAndExtendedAttributesOAuth2Clientr/   2   s    &*mm'*6'# *.*-9*& &*%7%7d%C""..' #..0%@ )-(:(:)% &11* &113UC +,O	PPr   c                  *    t               t               gS )zCreates an ArgumentGroup for ExtraAttributesOAuth2Client and ExtendedAttributesOAuth2Client Attributes for the create-oidc command.)r)   r*    r   r   )AddExtraAndExtendedAttributesOAuth2Clientr2   W   s     1235
 r   c           
      :   t        j                  ddt        | dd      }t        j                  ddt        | dd	      }t        j                  d
dt        | dd      }t        j                  ddt        j                  g ddgdd      | dd      }t        j                  ddt        ddd      }t        j
                         }|j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |S )zDCreates an ArgumentGroup for ExtraAttributesOAuth2Client Attributes.z--extra-attributes-client-idextra_attributes_client_idEXTRA_ATTRIBUTES_CLIENT_IDzThe OAuth 2.0 client ID for retrieving extra attributes from the identity provider. Required to get the access token using client credentials grant flow.r"   typer   metavarr   z&--extra-attributes-client-secret-value$extra_attributes_client_secret_value$EXTRA_ATTRIBUTES_CLIENT_SECRET_VALUEzThe OAuth 2.0 client secret for retrieving extra attributes from the identity provider. Required to get the access token using client credentials grant flow.z--extra-attributes-issuer-uriextra_attributes_issuer_uriEXTRA_ATTRIBUTES_ISSUER_URIOIDC identity provider's issuer URI. Must be a valid URI using the `https` scheme. Required to get the OIDC discovery document.z--extra-attributes-typeextra_attributes_type)zazure-ad-groups-mailazure-ad-groups-idazure-ad-groups-display-namer@      )choiceshidden_choices
max_length
min_lengthEXTRA_ATTRIBUTES_TYPEKRepresents the identity provider and type of claims that should be fetched.z--extra-attributes-filterextra_attributes_filterFEXTRA_ATTRIBUTES_FILTERa  The filter used to request specific records from the IdP. By default, all of the groups that are associated with a user are fetched. For Microsoft Entra ID, you can add `$search` query parameters using [Keyword Query Language] (https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference). To learn more about `$search` querying in Microsoft Entra ID, see [Use the `$search` query parameter] (https://learn.microsoft.com/en-us/graph/search-query-parameter). 

Additionally, Workforce Identity Federation automatically adds the following [`$filter` query parameters] (https://learn.microsoft.com/en-us/graph/filter-query-parameter), based on the value of `attributes_type`. Values passed to `filter` are converted to `$search` query parameters. Additional `$filter` query parameters cannot be added using this field. 

* `AZURE_AD_GROUPS_MAIL`: `mailEnabled` and `securityEnabled` filters are applied. 
* `AZURE_AD_GROUPS_ID`: `securityEnabled` filter is applied.r   r&   strr   ArgListr'   r(   )r   extra_attributes_client_id_arg(extra_attributes_client_secret_value_argextra_attributes_issuer_uri_argextra_attributes_type_argextra_attributes_filter_argcreate_extra_attributes_groups          r   r)   r)   _   s?   #'==$'*%$  .2]].14,.* %)MM%(+%! #mm"
 99	 %!( !%!$'!6 #'"4"4"6++,JK++.  ++,KL++,EF++,GH	&&r   c           	      4   t        j                  ddt        | dd      }t        j                  ddt        | dd	      }t        j                  d
dt        | dd      }t        j                  ddt        j                  dgdd      | dd      }t        j                  ddt        ddd      }t        j
                         }|j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |S )zGCreates an ArgumentGroup for ExtendedAttributesOAuth2Client Attributes.z--extended-attributes-client-idextended_attributes_client_idEXTENDED_ATTRIBUTES_CLIENT_IDzThe OAuth 2.0 client ID for retrieving extended attributes from the identity provider. Required to get extended group memberships for a subset of Google Cloud products.r6   z)--extended-attributes-client-secret-value'extended_attributes_client_secret_value'EXTENDED_ATTRIBUTES_CLIENT_SECRET_VALUEzThe OAuth 2.0 client secret for retrieving extended attributes from the identity provider. Required to get extended group memberships for a subset of Google Cloud products.z --extended-attributes-issuer-uriextended_attributes_issuer_uriEXTENDED_ATTRIBUTES_ISSUER_URIr=   z--extended-attributes-typeextended_attributes_typer?   rA   )rB   rD   rE   EXTENDED_ATTRIBUTES_TYPErG   z--extended-attributes-filterextended_attributes_filterFEXTENDED_ATTRIBUTES_FILTERa  The filter used to request specific records from the IdP. By default, all of the groups that are associated with a user are fetched. For Microsoft Entra ID, you can add `$search` query parameters using [Keyword Query Language] (https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference). To learn more about `$search` querying in Microsoft Entra ID, see [Use the `$search` query parameter] (https://learn.microsoft.com/en-us/graph/search-query-parameter). 

Additionally, Workforce Identity Federation automatically adds the following [`$filter` query parameters] (https://learn.microsoft.com/en-us/graph/filter-query-parameter), based on the value of `attributes_type`. Values passed to `filter` are converted to `$search` query parameters. Additional `$filter` query parameters cannot be added using this field. 

* `AZURE_AD_GROUPS_ID`: `securityEnabled` filter is applied.rJ   )r   !extended_attributes_client_id_arg+extended_attributes_client_secret_value_arg"extended_attributes_issuer_uri_argextended_attributes_type_argextended_attributes_filter_arg create_extended_attributes_groups          r   r*   r*      sE   &*mm'*-0'# 1514741- (,}}(+.($ "&"%"  ("" $(==$'*H$ 0 &*%7%7%9""..' #..1 #..( #../KL"../MN	))r   N)T)__doc__
__future__r   r   r   googlecloudsdk.callioper   r   r   r   r   r/   r2   r)   r*   r1   r   r   <module>rg      sA    1 &  ' / (."QJa'H_*r   