diff --git a/lib/puppet/type/grafana_datasource.rb b/lib/puppet/type/grafana_datasource.rb index c63c66f..35cffc2 100644 --- a/lib/puppet/type/grafana_datasource.rb +++ b/lib/puppet/type/grafana_datasource.rb @@ -1,134 +1,136 @@ # Copyright 2015 Mirantis, Inc. # Puppet::Type.newtype(:grafana_datasource) do @doc = 'Manage datasources in Grafana' ensurable newparam(:name, namevar: true) do desc 'The name of the datasource.' end newparam(:grafana_api_path) do desc 'The absolute path to the API endpoint' defaultto '/api' validate do |value| unless value =~ %r{^/.*/?api$} raise ArgumentError, format('%s is not a valid API path', value) end end end newparam(:grafana_url) do desc 'The URL of the Grafana server' defaultto '' validate do |value| unless value =~ %r{^https?://} raise ArgumentError, format('%s is not a valid URL', value) end end end newparam(:grafana_user) do desc 'The username for the Grafana server' end newparam(:grafana_password) do desc 'The password for the Grafana server' end newproperty(:url) do desc 'The URL/Endpoint of the datasource' end newproperty(:type) do desc 'The datasource type' end newparam(:organization) do desc 'The organization name to create the datasource on' defaultto 1 end newproperty(:user) do desc 'The username for the datasource (optional)' end newproperty(:password) do desc 'The password for the datasource (optional)' + sensitive true end newproperty(:database) do desc 'The name of the database (optional)' end newproperty(:access_mode) do desc 'Whether the datasource is accessed directly or not by the clients' newvalues(:direct, :proxy) defaultto :direct end newproperty(:is_default) do desc 'Whether the datasource is the default one' newvalues(:true, :false) defaultto :false end newproperty(:basic_auth) do desc 'Whether basic auth is enabled or not' newvalues(:true, :false) defaultto :false end newproperty(:basic_auth_user) do desc 'The username for basic auth if enabled' defaultto '' end newproperty(:basic_auth_password) do desc 'The password for basic auth if enabled' defaultto '' end newproperty(:with_credentials) do desc 'Whether credentials such as cookies or auth headers should be sent with cross-site requests' newvalues(:true, :false) defaultto :false end newproperty(:json_data) do desc 'Additional JSON data to configure the datasource (optional)' validate do |value| unless value.nil? || value.is_a?(Hash) raise ArgumentError, 'json_data should be a Hash!' end end end newproperty(:secure_json_data) do desc 'Additional secure JSON data to configure the datasource (optional)' + sensitive true validate do |value| unless value.nil? || value.is_a?(Hash) raise ArgumentError, 'secure_json_data should be a Hash!' end end end def set_sensitive_parameters(sensitive_parameters) # rubocop:disable Style/AccessorMethodName parameter(:password).sensitive = true if parameter(:password) parameter(:basic_auth_password).sensitive = true if parameter(:basic_auth_password) super(sensitive_parameters) end autorequire(:service) do 'grafana-server' end autorequire(:grafana_conn_validator) do 'grafana' end end diff --git a/metadata.json b/metadata.json index 0360118..b7cddd2 100644 --- a/metadata.json +++ b/metadata.json @@ -1,75 +1,75 @@ { "name": "puppet-grafana", "version": "7.0.1-rc0", "author": "Vox Pupuli", "summary": "This module provides Grafana, a dashboard and graph editor for Graphite and InfluxDB.", "license": "Apache-2.0", "source": "https://github.com/voxpupuli/puppet-grafana.git", "project_page": "https://github.com/voxpupuli/puppet-grafana", "issue_url": "https://github.com/voxpupuli/puppet-grafana/issues", "dependencies": [ { "name": "puppet/archive", "version_requirement": ">= 1.0.1 < 5.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.20.0 < 7.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "Debian", "operatingsystemrelease": [ "9", "10" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "16.04", "18.04" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "7" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "7" ] }, { "operatingsystem": "Archlinux" }, { "operatingsystem": "FreeBSD", "operatingsystemrelease": [ "12" ] }, { "operatingsystem": "SLES", "operatingsystemrelease": [ "12" ] } ], "requirements": [ { "name": "puppet", - "version_requirement": ">= 5.5.8 < 7.0.0" + "version_requirement": ">= 6.1.0 < 7.0.0" } ], "tags": [ "grafana", "graphite", "influxdb", "monitoring" ] }