
    	                         d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ dd	l
mZ  G d
 dej                        Zy)z-Command for spanner databases set-iam-policy.    )absolute_import)division)unicode_literalsN)base)iam_util)iam)resource_argsc                   N    e Zd ZdZd ej
                  d      iZed        Zd Z	y)SetIamPolicyz0Set the IAM policy for a Cloud Spanner database.EXAMPLESam        The following command reads an IAM policy defined in a JSON file
      `policy.json` and sets it for a spanner database with the ID
      `my-database-id`:

        $ {command} my-database-id --instance=my-instance-id policy.json

      See https://cloud.google.com/iam/docs/managing-policies for details of the
      policy file format and contents.
        c                 V    t        j                  | d       | j                  dd       y)zSee base class.zto set IAM policy binding forpolicy_filez.Name of JSON or YAML file with the IAM policy.)helpN)r	   AddDatabaseResourceArgadd_argument)parsers    /lib/surface/spanner/databases/set_iam_policy.pyArgszSetIamPolicy.Args.   s2     (()HJ
L  N    c                     |j                   j                  j                         }t        j                  ||j
                        }t        j                  |j                         d       |S )zThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    database)	CONCEPTSr   Parser   SetDatabaseIamPolicyr   r   LogSetIamPolicyName)selfargsdatabase_refresults       r   RunzSetIamPolicy.Run6   sR     ==))//1L%%lD4D4DEF\..0*=Mr   N)
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr   r!    r   r   r   r      s?    8 
(// 	 	- N Nr   r   )r%   
__future__r   r   r   r&   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   "googlecloudsdk.command_lib.spannerr   r	   Commandr   r*   r   r   <module>r0      s2    4 &  '  ( 3 2 <&4<< &r   