
    Vh4                     D   d dl mZmZmZ eZd dlmZ 	 d dlm	Z	 dZ
d dlmZ d dlmZmZ  e       Zej%                   e ed	       ed	       edd
       ed	       ed	       ed	       ed	                   g Zg Zg Zg Z G d de      Zy# e$ r dZ
Y w xY w)    )absolute_importdivisionprint_function)
ActionBase)AnsibleArgSpecValidatorTF)AnsibleActionFail)ISESDKise_argument_specstr)type)r   no_logdictbool)certTemplateNameformatpasswordcertificateRequestdirPathsaveFilefilenamec                   6     e Zd Z fdZd Zd Zd fd	Z xZS )ActionModulec                 x    t         st        d      t        t        |   |i | d| _        d| _        d | _        y )NzYansible.utils is not installed. Execute 'ansible-galaxy collection install ansible.utils'F)ANSIBLE_UTILS_IS_INSTALLEDr   superr   __init___supports_async_supports_check_mode_result)selfargskwargs	__class__s      q/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/ise/plugins/action/endpoint_certificate.pyr   zActionModule.__init__0   sC    )#k  	lD*D;F;$$)!    c                 *   t        | j                  j                  t        t              dt        t
        t        t        t              | j                  j                        }|j                         \  }}| j                  _        |st        |      y )N)argument_specargspec)required_ifrequired_one_ofmutually_exclusiverequired_together)dataschemaschema_formatschema_conditionalsname)r   _taskr!   r   r'   r)   r*   r+   r,   actionvalidater   )r    aavvaliderrorss       r$   _check_argspeczActionModule._check_argspec;   sr    %m4# $' /#5"3	! ""
 *-&vtzz#F++ r%   c                     t        |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d      |j                  d            }|S )	Nr   r   r   r   r   r   r   )cert_template_namer   r   certificate_requestdirpath	save_filer   )r   get)r    params
new_objects      r$   
get_objectzActionModule.get_objectL   sj    %zz*<=::h'ZZ
+ &

+? @JJy)jj,ZZ
+

 r%   c                    d| j                   _        t        t        |   ||      | _        d| j
                  d<   | j                          t        | j                   j                        }|j                  dd| j                  | j                   j                              }t        |j                  j                  d      |j                  |j                  |j                   	      }| j
                  j#                  t        |
             | j
                  j#                  |j%                                | j
                  S )NFchanged)r?   endpoint_certificatecreate_endpoint_certificate)familyfunctionr?   zutf-8)encoding)r-   r   r<   path)ise_response)r2   diffr   r   runr   r8   r	   r!   execrA   r   r-   decoder   r<   rI   update	exit_json)r    tmp	task_varsisedownload_responseresponser#   s         r$   rL   zActionModule.runX   s    

\44S)D"'YDJJOO,HH)2??4::??3 % 

 "''...@&//%--"''	
 	Dh78CMMO,||r%   )NN)__name__
__module____qualname__r   r8   rA   rL   __classcell__)r#   s   @r$   r   r   /   s    ,"
 r%   r   N)
__future__r   r   r   r   __metaclass__ansible.plugins.actionr   Nansible_collections.ansible.utils.plugins.module_utils.common.argspec_validater   r   ImportErroransible.errorsr   6ansible_collections.cisco.ise.plugins.plugin_utils.iser	   r
   r'   rO   r   r)   r*   r+   r,   r    r%   r$   <module>rb      s    A @ -& "& , "#   5)5.V,% 6"5!
   ?: ??  '!&'s   B BB