
    Vh
                         d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZ d dlmZ  G d d	e      Zd
 Zedk(  r e        yy)    )absolute_importdivisionprint_functionub  
module: influxdb_write
short_description: Write data points into InfluxDB
description:
  - Write data points into InfluxDB.
author: "René Moser (@resmo)"
requirements:
  - "influxdb >= 0.9"
attributes:
  check_mode:
    support: none
  diff_mode:
    support: none
options:
  data_points:
    description:
      - Data points as dict to write into the database.
    required: true
    type: list
    elements: dict
  database_name:
    description:
      - Name of the database.
    required: true
    type: str
extends_documentation_fragment:
  - community.general.influxdb
  - community.general.attributes
a!  
- name: Write points into database
  community.general.influxdb_write:
    hostname: "{{influxdb_ip_address}}"
    database_name: "{{influxdb_database_name}}"
    data_points:
      - measurement: connections
        tags:
          host: server01
          region: us-west
        time: "{{ ansible_date_time.iso8601 }}"
        fields:
          value: 2000
      - measurement: connections
        tags:
          host: server02
          region: us-east
        time: "{{ ansible_date_time.iso8601 }}"
        fields:
          value: 3000
z
# only defaults
)AnsibleModule)	to_native)InfluxDbc                       e Zd Zd Zy)AnsibleInfluxDBWritec                     | j                         }	 |j                  |       y # t        $ r/}| j                  j	                  t        |             Y d }~y d }~ww xY w)N)msg)connect_to_influxdbwrite_points	Exceptionmodule	fail_jsonr   )selfdata_pointsclientes       t/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/modules/influxdb_write.pywrite_data_pointz%AnsibleInfluxDBWrite.write_data_pointJ   sO    ))+	4, 	4KK!!il!33	4s   $ 	A%AAN)__name__
__module____qualname__r        r   r
   r
   H   s    4r   r
   c                  *   t        j                         } | j                  t        ddd      t        dd             t	        |       }t        |      }|j                  j                  d	      }|j                  |       |j                  d
       y )NTlistdict)requiredtypeelementsstr)r    r!   )r   database_name)argument_specr   )changed)
r   influxdb_argument_specupdater   r   r
   paramsgetr   	exit_json)r%   r   influxr   s       r   mainr-   S   s    335M$VfEDu5   #F "&)F--##M2K
K(
T"r   __main__N)
__future__r   r   r   r!   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   +ansible.module_utils.common.text.convertersr   Cansible_collections.community.general.plugins.module_utils.influxdbr   r
   r-   r   r   r   r   <module>r7      sX    A @<,
 5 A X48 4#  zF r   