
    Vhz                     t    d dl mZmZmZ eZdZdZd dlm	Z	 d dl
mZ d dlmZ dZdd	Zd
 Zedk(  r e        yy)    )absolute_importdivisionprint_functiona  
module: grove
short_description: Sends a notification to a grove.io channel
description:
  - The C(grove) module sends a message for a service to a Grove.io channel.
extends_documentation_fragment:
  - community.general.attributes
attributes:
  check_mode:
    support: none
  diff_mode:
    support: none
options:
  channel_token:
    type: str
    description:
      - Token of the channel to post to.
    required: true
  service:
    type: str
    description:
      - Name of the service (displayed as the "user" in the message).
    required: false
    default: ansible
  message_content:
    type: str
    description:
      - Message content.
      - The alias O(ignore:message) has been removed in community.general 4.0.0.
    required: true
  url:
    type: str
    description:
      - Service URL for the web client.
    required: false
  icon_url:
    type: str
    description:
      - Icon for the service.
    required: false
  validate_certs:
    description:
      - If V(false), SSL certificates will not be validated. This should only be used on personally controlled sites using
        self-signed certificates.
    default: true
    type: bool
author: "Jonas Pfenniger (@zimbatm)"
z
- name: Sends a notification to a grove.io channel
  community.general.grove:
    channel_token: 6Ph62VBBJOccmtTPZbubiPzdrhipZXtg
    service: my-app
    message: 'deployed {{ target }}'
)AnsibleModule)	urlencode)	fetch_urlzhttps://grove.io/api/notice/%s/Nc                     t         |fz  }t        ||      }|||d<   |||d<   t        |      }t        | ||      \  }	}
|
d   dk7  r| j	                  d|
d   z  	       y y )
N)servicemessageurlicon_url)datastatus   zfailed to send notification: %smsgr   )BASE_URLdictr   r   	fail_json)modulechannel_tokenr
   r   r   r   my_urlmy_datar   responseinfos              k/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/grove.pydo_notify_grover   P   s    ((F7G4G
&
WDvvD9NHdH~>eLM     c                     t        t        t        ddd      t        dd      t        dd      t        dd       t        dd       t        dd      	      
      } | j                  d   }| j                  d   }| j                  d   }| j                  d   }| j                  d   }t        | |||||       | j	                  d       y )NstrT)typerequiredno_log)r!   r"   ansible)r!   defaultbool)r%   r!   )r   message_contentr
   r   r   validate_certs)argument_specr   r
   r'   r   r   OKr   )r   r   paramsr   	exit_json)r   r   r
   r   r   r   s         r   mainr-   b   s    EDF ed;eY7%.ud36:
	F MM/2MmmI&Gmm-.G
--
C}}Z(HFM7GS(K r   __main__)NN)
__future__r   r   r   r!   __metaclass__DOCUMENTATIONEXAMPLESansible.module_utils.basicr   +ansible.module_utils.six.moves.urllib.parser   ansible.module_utils.urlsr   r   r   r-   __name__ r   r   <module>r8      sS    A @/b 5 A / -N$0 zF r   