
    [                         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0r\R                   " S S\R                   5      5       rg)zACommand to create a custom role for a project or an organization.    )absolute_import)division)unicode_literals)util)base)flags)iam_util)logEXAMPLESa            To create a custom role ``ProjectUpdater'' from a YAML file, run:

            $ {command} ProjectUpdater --organization=12345 --file=role_file_path

          To create a custom role ``ProjectUpdater'' with flags, run:

            $ {command} ProjectUpdater --project=myproject --title=ProjectUpdater --description="Have access to get and update the project" --permissions=resourcemanager.projects.get,resourcemanager.projects.update
        c                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)Create+   zzCreate a custom role for a project or an organization.

This command creates a custom role with the provided information.
c                 \   U R                  SS9nUR                  S5      nUR                  SSS9  UR                  SSS9  UR                  S	S
S9  UR                  SSS9  UR                  SSS9  [        R                  " U S5        [        R                  " S5      R                  U 5        g )NT)mutexzRoles Settingsz--titlez)The title of the role you want to create.)helpz--descriptionz/The description of the role you want to create.z--stagezThe state of the role you want to create. This represents a role's lifecycle phase: `ALPHA`, `BETA`, `GA`, `DEPRECATED`, `DISABLED`, `EAP`.z--permissionszLThe permissions of the role you want to create. Use commas to separate them.z--filezuThe JSON or YAML file with the IAM Role to create. See https://cloud.google.com/iam/reference/rest/v1/projects.roles.create)	add_groupadd_argumentr   AddParentFlagsGetCustomRoleFlagAddToParser)parserroles_groupsettings_flags_groups      lib/surface/iam/roles/create.pyArgsCreate.Args4   s    """.K&001AB%%C & E%%O & Q%% + & , %%' & ( N  O 
*	H%11&9    c           	         [         R                  " 5       u  p#[        R                  " UR                  UR
                  5      nUR                  (       a:  [        R                  " UR                  UR                  5      nS Ul	        S Ul
        OUR                  UR                  UR                  S9nUR                  (       a   UR                  R                  S5      Ul        UR                   (       a%  [        R"                  " UR                   5      Ul        UR                  (       d  UR$                  Ul        UR&                  (       d  [         R(                  " X#[        R*                  " UR
                  UR                  5      UR                  5      nUR-                  5       n[        R.                  " U5        UR1                  5       n[        R2                  " U5        UR4                  R7                  UR9                  UR;                  XQR$                  S9US95      n	[<        R>                  " UR$                  SS9  [        R@                  " U	5        U	$ )N)titledescription,)roleroleId)createRoleRequestparentr#   )kind)!r   GetClientAndMessagesr	   GetParentNameorganizationprojectfileParseYamlToRoleRolenameetagr    r!   permissionssplitincludedPermissionsstageStageTypeFromStringr#   quietPermissionsHelperGetResourceReferenceGetApiDisabledPermissonsApiDisabledPermissionsWarningGetTestingPermissionsTestingPermissionsWarningorganizations_rolesr   "IamOrganizationsRolesCreateRequestCreateRoleRequestr
   CreatedResourceSetRoleStageIfAlpha)
selfargsclientmessagesparent_namer#   permissions_helperapi_diabled_permissionstesting_permissionsresults
             r   Run
Create.RunK   s   002F(():):DLLIKyy%%dii?ddidi]]9I9I]Jd			#'#3#3#9#9##> 	11$**=
::99dj::11&2:2O2O6:ll6:6G6G3I 372J2J	L
 !3 K K M,,-DE.DDF(()<=''..33&88)) 9 - 	4 	 !F
 		/  (Mr    N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr   rK   __static_attributes__rM   r   r   r   r   +   s%    
  -: :,#r   r   N)rR   
__future__r   r   r   googlecloudsdk.api_lib.iamr   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   r	   googlecloudsdk.corer
   rS   UniverseCompatibleCommandr   rM   r   r   <module>r^      s\     H &  ' + ( 0 3 # 	 BT\\ B Br   