diff --git a/REFERENCE.md b/REFERENCE.md index d9ce130..c02a3e4 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1,1612 +1,1612 @@ # Reference ## Table of Contents **Classes** _Public Classes_ * [`kafka`](#kafka): This class handles the Kafka requirements. * [`kafka::broker`](#kafkabroker): This class handles the Kafka (broker). * [`kafka::consumer`](#kafkaconsumer): This class handles the Kafka (consumer). * [`kafka::consumer::config`](#kafkaconsumerconfig): This class handles the Kafka (consumer) config. * [`kafka::mirror`](#kafkamirror): This class handles the Kafka (mirror). * [`kafka::params`](#kafkaparams): This class provides default parameters. * [`kafka::producer`](#kafkaproducer): This class handles the Kafka (producer). * [`kafka::producer::config`](#kafkaproducerconfig): This class handles the Kafka (producer) config. _Private Classes_ * `kafka::broker::config`: This class handles the Kafka (broker) config. * `kafka::broker::install`: This class handles the Kafka (broker) package. * `kafka::broker::service`: This class handles the Kafka (broker) service. * `kafka::consumer::install`: This class handles the Kafka (consumer) package. * `kafka::consumer::service`: This class handles the Kafka (consumer) service. * `kafka::mirror::config`: This class handles the Kafka (mirror) config. * `kafka::mirror::install`: This class handles the Kafka (mirror) package. * `kafka::mirror::service`: This class handles the Kafka (mirror) service. * `kafka::producer::install`: This class handles the Kafka (producer) package. * `kafka::producer::service`: This class handles the Kafka (producer) service. **Defined types** * [`kafka::topic`](#kafkatopic): This defined type handles the creation of Kafka topics. ## Classes ### kafka This class handles the Kafka requirements. #### Examples ##### Basic usage ```puppet class { 'kafka': } ``` #### Parameters The following parameters are available in the `kafka` class. ##### `kafka_version` Data type: `String[1]` The version of Kafka that should be installed. Default value: $kafka::params::kafka_version ##### `scala_version` Data type: `String[1]` The scala version what Kafka was built with. Default value: $kafka::params::scala_version ##### `install_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka to. Default value: $kafka::params::install_dir ##### `mirror_url` Data type: `Stdlib::HTTPUrl` The url where the Kafka is downloaded from. Default value: $kafka::params::mirror_url ##### `manage_java` Data type: `Boolean` Install java if it's not already installed. Default value: $kafka::params::manage_java ##### `package_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka. Default value: $kafka::params::package_dir ##### `package_name` Data type: `Optional[String[1]]` Package name, when installing Kafka from a package. Default value: $kafka::params::package_name ##### `mirror_subpath` Data type: `Optional[String[1]]` The sub directory where the source is downloaded from. Default value: $kafka::params::mirror_subpath ##### `proxy_server` Data type: `Optional[String[1]]` Set proxy server, when installing Kafka from source. Default value: $kafka::params::proxy_server ##### `proxy_port` Data type: `Optional[String[1]]` Set proxy port, when installing Kafka from source. Default value: $kafka::params::proxy_port ##### `proxy_host` Data type: `Optional[String[1]]` Set proxy host, when installing Kafka from source. Default value: $kafka::params::proxy_host ##### `proxy_type` Data type: `Optional[String[1]]` Set proxy type, when installing Kafka from source. Default value: $kafka::params::proxy_type ##### `package_ensure` Data type: `String[1]` Package version or ensure state, when installing Kafka from a package. Default value: $kafka::params::package_ensure ##### `user_name` Data type: `String[1]` User to run Kafka as. Default value: $kafka::params::user_name ##### `user_shell` Data type: `Stdlib::Absolutepath` Login shell of the Kafka user. Default value: $kafka::params::user_shell ##### `group_name` Data type: `String[1]` Group to run Kafka as. Default value: $kafka::params::group_name ##### `system_user` Data type: `Boolean` Whether the Kafka user is a system user or not. Default value: $kafka::params::system_user ##### `system_group` Data type: `Boolean` Whether the Kafka group is a system group or not. Default value: $kafka::params::system_group ##### `user_id` Data type: `Optional[Integer]` Create the Kafka user with this ID. Default value: $kafka::params::user_id ##### `group_id` Data type: `Optional[Integer]` Create the Kafka group with this ID. Default value: $kafka::params::group_id ##### `manage_user` Data type: `Boolean` Create the Kafka user if it's not already present. Default value: $kafka::params::manage_user ##### `manage_group` Data type: `Boolean` Create the Kafka group if it's not already present. Default value: $kafka::params::manage_group ##### `config_dir` Data type: `Stdlib::Absolutepath` The directory to create the Kafka config files to. Default value: $kafka::params::config_dir ##### `log_dir` Data type: `Stdlib::Absolutepath` The directory for Kafka log files. Default value: $kafka::params::log_dir ##### `install_mode` Data type: `Stdlib::Filemode` The permissions for the install directory. Default value: $kafka::params::install_mode ### kafka::broker This class handles the Kafka (broker). #### Examples ##### Basic usage ```puppet class { 'kafka::broker': config => { 'broker.id' => '0', 'zookeeper.connect' => 'localhost:2181' } } ``` #### Parameters The following parameters are available in the `kafka::broker` class. ##### `kafka_version` Data type: `String[1]` The version of Kafka that should be installed. Default value: $kafka::params::kafka_version ##### `scala_version` Data type: `String[1]` The scala version what Kafka was built with. Default value: $kafka::params::scala_version ##### `install_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka to. Default value: $kafka::params::install_dir ##### `mirror_url` Data type: `Stdlib::HTTPUrl` The url where the Kafka is downloaded from. Default value: $kafka::params::mirror_url ##### `manage_java` Data type: `Boolean` Install java if it's not already installed. Default value: $kafka::params::manage_java ##### `package_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka. Default value: $kafka::params::package_dir ##### `package_name` Data type: `Optional[String[1]]` Package name, when installing Kafka from a package. Default value: $kafka::params::package_name ##### `package_ensure` Data type: `String[1]` Package version or ensure state, when installing Kafka from a package. Default value: $kafka::params::package_ensure ##### `user_name` Data type: `String[1]` User to run Kafka as. Default value: $kafka::params::user_name ##### `user_shell` Data type: `Stdlib::Absolutepath` Login shell of the Kafka user. Default value: $kafka::params::user_shell ##### `group_name` Data type: `String[1]` Group to run Kafka as. Default value: $kafka::params::group_name ##### `user_id` Data type: `Optional[Integer]` Create the Kafka user with this ID. Default value: $kafka::params::user_id ##### `group_id` Data type: `Optional[Integer]` Create the Kafka group with this ID. Default value: $kafka::params::group_id ##### `manage_user` Data type: `Boolean` Create the Kafka user if it's not already present. Default value: $kafka::params::manage_user ##### `manage_group` Data type: `Boolean` Create the Kafka group if it's not already present. Default value: $kafka::params::manage_group ##### `config_mode` Data type: `Stdlib::Filemode` The permissions for the config files. Default value: $kafka::params::config_mode ##### `config_dir` Data type: `Stdlib::Absolutepath` The directory to create the Kafka config files to. Default value: $kafka::params::config_dir ##### `log_dir` Data type: `Stdlib::Absolutepath` The directory for Kafka log files. Default value: $kafka::params::log_dir ##### `bin_dir` Data type: `Stdlib::Absolutepath` The directory where the Kafka scripts are. Default value: $kafka::params::bin_dir ##### `service_name` Data type: `String[1]` Set the name of the service. Default value: 'kafka' ##### `manage_service` Data type: `Boolean` Install the init.d or systemd service. Default value: $kafka::params::manage_service ##### `service_ensure` Data type: `Enum['running', 'stopped']` Set the ensure state of the service. Default value: $kafka::params::service_ensure ##### `service_restart` Data type: `Boolean` Whether the configuration files should trigger a service restart. Default value: $kafka::params::service_restart ##### `service_requires` Data type: `Array[String[1]]` Set the list of services required to be running before Kafka. Default value: $kafka::params::service_requires ##### `limit_nofile` Data type: `Optional[String[1]]` Set the 'LimitNOFILE' option of the systemd service. Default value: $kafka::params::limit_nofile ##### `limit_core` Data type: `Optional[String[1]]` Set the 'LimitCORE' option of the systemd service. Default value: $kafka::params::limit_core ##### `timeout_stop` Data type: `Optional[String[1]]` Set the 'TimeoutStopSec' option of the systemd service. Default value: $kafka::params::timeout_stop ##### `exec_stop` Data type: `Boolean` Set the 'ExecStop' option of the systemd service to 'kafka-server-stop.sh'. Default value: $kafka::params::exec_stop ##### `daemon_start` Data type: `Boolean` Use the '-daemon' option when starting Kafka with 'kafka-server-start.sh'. Default value: $kafka::params::daemon_start ##### `env` Data type: `Hash` A hash of the environment variables to set. Default value: {} ##### `config` Data type: `Hash[String[1], Any]` A hash of the broker configuration options. Default value: {} ##### `heap_opts` Data type: `String[1]` Set the Java heap size. Default value: $kafka::params::broker_heap_opts ##### `jmx_opts` Data type: `String[1]` Set the JMX options. Default value: $kafka::params::broker_jmx_opts ##### `log4j_opts` Data type: `String[1]` Set the Log4j options. Default value: $kafka::params::broker_log4j_opts ##### `opts` Data type: `String[0]` Set the Kafka options. Default value: $kafka::params::broker_opts ### kafka::consumer This class handles the Kafka (consumer). #### Examples ##### Basic usage ```puppet class { 'kafka::consumer': config => { 'client.id' => '0', 'zookeeper.connect' => 'localhost:2181' } } ``` #### Parameters The following parameters are available in the `kafka::consumer` class. ##### `kafka_version` Data type: `String[1]` The version of Kafka that should be installed. Default value: $kafka::params::kafka_version ##### `scala_version` Data type: `String[1]` The scala version what Kafka was built with. Default value: $kafka::params::scala_version ##### `install_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka to. Default value: $kafka::params::install_dir ##### `mirror_url` Data type: `Stdlib::HTTPUrl` The url where the Kafka is downloaded from. Default value: $kafka::params::mirror_url ##### `manage_java` Data type: `Boolean` Install java if it's not already installed. Default value: $kafka::params::manage_java ##### `package_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka. Default value: $kafka::params::package_dir ##### `package_name` Data type: `Optional[String[1]]` Package name, when installing Kafka from a package. Default value: $kafka::params::package_name ##### `package_ensure` Data type: `String[1]` Package version or ensure state, when installing Kafka from a package. Default value: $kafka::params::package_ensure ##### `user_name` Data type: `String[1]` User to run Kafka as. Default value: $kafka::params::user_name ##### `user_shell` Data type: `Stdlib::Absolutepath` Login shell of the Kafka user. Default value: $kafka::params::user_shell ##### `group_name` Data type: `String[1]` Group to run Kafka as. Default value: $kafka::params::group_name ##### `user_id` Data type: `Optional[Integer]` Create the Kafka user with this ID. Default value: $kafka::params::user_id ##### `group_id` Data type: `Optional[Integer]` Create the Kafka group with this ID. Default value: $kafka::params::group_id ##### `manage_user` Data type: `Boolean` Create the Kafka user if it's not already present. Default value: $kafka::params::manage_user ##### `manage_group` Data type: `Boolean` Create the Kafka group if it's not already present. Default value: $kafka::params::manage_group ##### `config_mode` Data type: `Stdlib::Filemode` The permissions for the config files. Default value: $kafka::params::config_mode ##### `config_dir` Data type: `Stdlib::Absolutepath` The directory to create the Kafka config files to. Default value: $kafka::params::config_dir ##### `log_dir` Data type: `Stdlib::Absolutepath` The directory for Kafka log files. Default value: $kafka::params::log_dir ##### `bin_dir` Data type: `Stdlib::Absolutepath` The directory where the Kafka scripts are. Default value: $kafka::params::bin_dir ##### `service_name` Data type: `String[1]` Set the name of the service. Default value: 'kafka-consumer' ##### `manage_service` Data type: `Boolean` Install the init.d or systemd service. Default value: $kafka::params::manage_service ##### `service_ensure` Data type: `Enum['running', 'stopped']` Set the ensure state of the service. Default value: $kafka::params::service_ensure ##### `service_restart` Data type: `Boolean` Whether the configuration files should trigger a service restart. Default value: $kafka::params::service_restart ##### `service_requires` Data type: `Array[String[1]]` Set the list of services required to be running before Kafka. Default value: $kafka::params::service_requires ##### `limit_nofile` Data type: `Optional[String[1]]` Set the 'LimitNOFILE' option of the systemd service. Default value: $kafka::params::limit_nofile ##### `limit_core` Data type: `Optional[String[1]]` Set the 'LimitCORE' option of the systemd service. Default value: $kafka::params::limit_core ##### `env` Data type: `Hash` A hash of the environment variables to set. Default value: {} ##### `config` Data type: `Hash[String[1], Any]` A hash of the consumer configuration options. Default value: {} ##### `service_config` Data type: `Hash[String[1],String[1]]` A hash of the `kafka-console-consumer.sh` script options. Default value: {} ##### `jmx_opts` Data type: `String[1]` Set the JMX options. Default value: $kafka::params::consumer_jmx_opts ##### `log4j_opts` Data type: `String[1]` Set the Log4j options. Default value: $kafka::params::consumer_log4j_opts ### kafka::consumer::config This class handles the Kafka (consumer) config. #### Parameters The following parameters are available in the `kafka::consumer::config` class. ##### `manage_service` Data type: `Boolean` Default value: $kafka::consumer::manage_service ##### `service_name` Data type: `String[1]` Default value: $kafka::consumer::service_name ##### `service_restart` Data type: `Boolean` Default value: $kafka::consumer::service_restart ##### `config` Data type: `Hash[String[1], Any]` Default value: $kafka::consumer::config ##### `config_dir` Data type: `Stdlib::Absolutepath` Default value: $kafka::consumer::config_dir ##### `user_name` Data type: `String[1]` Default value: $kafka::consumer::user_name ##### `group_name` Data type: `String[1]` Default value: $kafka::consumer::group_name ##### `config_mode` Data type: `Stdlib::Filemode` Default value: $kafka::consumer::config_mode ### kafka::mirror This class handles the Kafka (mirror). #### Examples ##### Basic usage ```puppet class { 'kafka::mirror': consumer_config => { 'group.id' => 'kafka-mirror', 'zookeeper.connect' => 'localhost:2181' }, producer_config => { 'zookeeper.connect' => 'localhost:2181', }, service_config => { 'whitelist' => '.*', } } ``` #### Parameters The following parameters are available in the `kafka::mirror` class. ##### `kafka_version` Data type: `String[1]` The version of Kafka that should be installed. Default value: $kafka::params::kafka_version ##### `scala_version` Data type: `String[1]` The scala version what Kafka was built with. Default value: $kafka::params::scala_version ##### `install_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka to. Default value: $kafka::params::install_dir ##### `mirror_url` Data type: `Stdlib::HTTPUrl` The url where the Kafka is downloaded from. Default value: $kafka::params::mirror_url ##### `manage_java` Data type: `Boolean` Install java if it's not already installed. Default value: $kafka::params::manage_java ##### `package_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka. Default value: $kafka::params::package_dir ##### `package_name` Data type: `Optional[String[1]]` Package name, when installing Kafka from a package. Default value: $kafka::params::package_name ##### `package_ensure` Data type: `String[1]` Package version or ensure state, when installing Kafka from a package. Default value: $kafka::params::package_ensure ##### `user_name` Data type: `String[1]` User to run Kafka as. Default value: $kafka::params::user_name ##### `user_shell` Data type: `Stdlib::Absolutepath` Login shell of the Kafka user. Default value: $kafka::params::user_shell ##### `group_name` Data type: `String[1]` Group to run Kafka as. Default value: $kafka::params::group_name ##### `user_id` Data type: `Optional[Integer]` Create the Kafka user with this ID. Default value: $kafka::params::user_id ##### `group_id` Data type: `Optional[Integer]` Create the Kafka group with this ID. Default value: $kafka::params::group_id ##### `manage_user` Data type: `Boolean` Create the Kafka user if it's not already present. Default value: $kafka::params::manage_user ##### `manage_group` Data type: `Boolean` Create the Kafka group if it's not already present. Default value: $kafka::params::manage_group ##### `config_mode` Data type: `Stdlib::Filemode` The permissions for the config files. Default value: $kafka::params::config_mode ##### `config_dir` Data type: `Stdlib::Absolutepath` The directory to create the Kafka config files to. Default value: $kafka::params::config_dir ##### `log_dir` Data type: `Stdlib::Absolutepath` The directory for Kafka log files. Default value: $kafka::params::log_dir ##### `bin_dir` Data type: `Stdlib::Absolutepath` The directory where the Kafka scripts are. Default value: $kafka::params::bin_dir ##### `service_name` Data type: `String[1]` Set the name of the service. Default value: 'kafka-mirror' ##### `manage_service` Data type: `Boolean` Install the init.d or systemd service. Default value: $kafka::params::manage_service ##### `service_ensure` Data type: `Enum['running', 'stopped']` Set the ensure state of the service. Default value: $kafka::params::service_ensure ##### `service_restart` Data type: `Boolean` Whether the configuration files should trigger a service restart. Default value: $kafka::params::service_restart ##### `service_requires` Data type: `Array[String[1]]` Set the list of services required to be running before Kafka. Default value: $kafka::params::service_requires ##### `limit_nofile` Data type: `Optional[String[1]]` Set the 'LimitNOFILE' option of the systemd service. Default value: $kafka::params::limit_nofile ##### `limit_core` Data type: `Optional[String[1]]` Set the 'LimitCORE' option of the systemd service. Default value: $kafka::params::limit_core ##### `env` Data type: `Hash` A hash of the environment variables to set. Default value: {} ##### `consumer_config` Data type: `Hash[String[1],String[1]]` A hash of the consumer configuration options. Default value: {} ##### `producer_config` Data type: `Hash[String[1],String[1]]` A hash of the producer configuration options. Default value: {} ##### `service_config` Data type: `Hash[String[1],String[1]]` A hash of the mirror script options. Default value: {} ##### `heap_opts` Data type: `String[1]` Set the Java heap size. Default value: $kafka::params::mirror_heap_opts ##### `jmx_opts` Data type: `String[1]` Set the JMX options. Default value: $kafka::params::mirror_jmx_opts ##### `log4j_opts` Data type: `String[1]` Set the Log4j options. Default value: $kafka::params::mirror_log4j_opts ### kafka::params This class provides default parameters. ### kafka::producer This class handles the Kafka (producer). #### Examples ##### Basic usage ```puppet class { 'kafka::producer': config => { 'client.id' => '0', 'zookeeper.connect' => 'localhost:2181' } } ``` #### Parameters The following parameters are available in the `kafka::producer` class. ##### `input` Data type: `Optional[String[1]]` Set named pipe as input. ##### `kafka_version` Data type: `String[1]` The version of Kafka that should be installed. Default value: $kafka::params::kafka_version ##### `scala_version` Data type: `String[1]` The scala version what Kafka was built with. Default value: $kafka::params::scala_version ##### `install_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka to. Default value: $kafka::params::install_dir ##### `mirror_url` Data type: `Stdlib::HTTPUrl` The url where the Kafka is downloaded from. Default value: $kafka::params::mirror_url ##### `manage_java` Data type: `Boolean` Install java if it's not already installed. Default value: $kafka::params::manage_java ##### `package_dir` Data type: `Stdlib::Absolutepath` The directory to install Kafka. Default value: $kafka::params::package_dir ##### `package_name` Data type: `Optional[String[1]]` Package name, when installing Kafka from a package. Default value: $kafka::params::package_name ##### `package_ensure` Data type: `String[1]` Package version or ensure state, when installing Kafka from a package. Default value: $kafka::params::package_ensure ##### `user_name` Data type: `String[1]` User to run Kafka as. Default value: $kafka::params::user_name ##### `user_shell` Data type: `Stdlib::Absolutepath` Login shell of the Kafka user. Default value: $kafka::params::user_shell ##### `group_name` Data type: `String[1]` Group to run Kafka as. Default value: $kafka::params::group_name ##### `user_id` Data type: `Optional[Integer]` Create the Kafka user with this ID. Default value: $kafka::params::user_id ##### `group_id` Data type: `Optional[Integer]` Create the Kafka group with this ID. Default value: $kafka::params::group_id ##### `manage_user` Data type: `Boolean` Create the Kafka user if it's not already present. Default value: $kafka::params::manage_user ##### `manage_group` Data type: `Boolean` Create the Kafka group if it's not already present. Default value: $kafka::params::manage_group ##### `config_mode` Data type: `Stdlib::Filemode` The permissions for the config files. Default value: $kafka::params::config_mode ##### `config_dir` Data type: `Stdlib::Absolutepath` The directory to create the Kafka config files to. Default value: $kafka::params::config_dir ##### `log_dir` Data type: `Stdlib::Absolutepath` The directory for Kafka log files. Default value: $kafka::params::log_dir ##### `bin_dir` Data type: `Stdlib::Absolutepath` The directory where the Kafka scripts are. Default value: $kafka::params::bin_dir ##### `service_name` Data type: `String[1]` Set the name of the service. Default value: 'kafka-producer' ##### `manage_service` Data type: `Boolean` Install the init.d or systemd service. Default value: $kafka::params::manage_service ##### `service_ensure` Data type: `Enum['running', 'stopped']` Set the ensure state of the service. Default value: $kafka::params::service_ensure ##### `service_restart` Data type: `Boolean` Whether the configuration files should trigger a service restart. Default value: $kafka::params::service_restart ##### `service_requires` Data type: `Array[String[1]]` Set the list of services required to be running before Kafka. Default value: $kafka::params::service_requires ##### `limit_nofile` Data type: `Optional[String[1]]` Set the 'LimitNOFILE' option of the systemd service. Default value: $kafka::params::limit_nofile ##### `limit_core` Data type: `Optional[String[1]]` Set the 'LimitCORE' option of the systemd service. Default value: $kafka::params::limit_core ##### `env` Data type: `Hash` A hash of the environment variables to set. Default value: {} ##### `config` Data type: `Hash[String[1], Any]` A hash of the producer configuration options. Default value: {} ##### `service_config` Data type: `Hash[String[1],String[1]]` A hash of the `kafka-console-producer.sh` script options. Default value: {} ##### `jmx_opts` Data type: `String[1]` Set the JMX options. Default value: $kafka::params::producer_jmx_opts ##### `log4j_opts` Data type: `String[1]` Set the Log4j options. Default value: $kafka::params::producer_log4j_opts ### kafka::producer::config This class handles the Kafka (producer) config. #### Parameters The following parameters are available in the `kafka::producer::config` class. ##### `manage_service` Data type: `Boolean` Default value: $kafka::producer::manage_service ##### `service_name` Data type: `String[1]` Default value: $kafka::producer::service_name ##### `service_restart` Data type: `Boolean` Default value: $kafka::producer::service_restart ##### `config` Data type: `Hash[String[1], Any]` Default value: $kafka::producer::config ##### `config_dir` Data type: `Stdlib::Absolutepath` Default value: $kafka::producer::config_dir ##### `user_name` Data type: `String[1]` Default value: $kafka::producer::user_name ##### `group_name` Data type: `String[1]` Default value: $kafka::producer::group_name ##### `config_mode` Data type: `Stdlib::Filemode` Default value: $kafka::producer::config_mode ## Defined types ### kafka::topic This defined type handles the creation of Kafka topics. #### Examples ##### Basic usage ```puppet kafka::topic { 'test': ensure => present, zookeeper => 'localhost:2181', replication_factor => 1, partitions => 1, } ``` #### Parameters The following parameters are available in the `kafka::topic` defined type. ##### `ensure` Data type: `String[1]` Should the topic be created. Default value: '' ##### `zookeeper` Data type: `String[1]` The connection string for the ZooKeeper connection in the form host:port. Multiple hosts can be given to allow fail-over. Default value: '' ##### `replication_factor` -Data type: `Variant[Integer,String[1]]` +Data type: `Integer` The replication factor for each partition in the topic being created. If not supplied, defaults to the cluster default. Default value: 1 ##### `partitions` -Data type: `Variant[Integer,String[1]]` +Data type: `Integer` The number of partitions for the topic being created or altered. If not supplied for create, defaults to the cluster default. Default value: 1 ##### `bin_dir` Data type: `String[1]` The directory where the file kafka-topics.sh is located. Default value: '/opt/kafka/bin' ##### `config` Data type: `Optional[Hash[String[1],String[1]]]` A topic configuration override for the topic being created or altered. See the Kafka documentation for full details on the topic configs. Default value: `undef` diff --git a/manifests/topic.pp b/manifests/topic.pp index 95c5bed..fa66a32 100644 --- a/manifests/topic.pp +++ b/manifests/topic.pp @@ -1,67 +1,60 @@ # @summary # This defined type handles the creation of Kafka topics. # # @example Basic usage # kafka::topic { 'test': # ensure => present, # zookeeper => 'localhost:2181', # replication_factor => 1, # partitions => 1, # } # # @param ensure # Should the topic be created. # # @param zookeeper # The connection string for the ZooKeeper connection in the form host:port. # Multiple hosts can be given to allow fail-over. # # @param replication_factor # The replication factor for each partition in the topic being created. If # not supplied, defaults to the cluster default. # # @param partitions # The number of partitions for the topic being created or altered. If not # supplied for create, defaults to the cluster default. # # @param bin_dir # The directory where the file kafka-topics.sh is located. # # @param config # A topic configuration override for the topic being created or altered. # See the Kafka documentation for full details on the topic configs. # define kafka::topic ( - String[1] $ensure = '', - String[1] $zookeeper = '', - Variant[Integer,String[1]] $replication_factor = 1, - Variant[Integer,String[1]] $partitions = 1, - String[1] $bin_dir = '/opt/kafka/bin', - Optional[Hash[String[1],String[1]]] $config = undef, + String[1] $ensure = '', + String[1] $zookeeper = '', + Integer $replication_factor = 1, + Integer $partitions = 1, + String[1] $bin_dir = '/opt/kafka/bin', + Optional[Hash[String[1],String[1]]] $config = undef, ) { - if is_string($replication_factor) { - deprecation('kafka::topic', 'Please use Integer type, not String, for paramter replication_factor') - } - if is_string($partitions) { - deprecation('kafka::topic', 'Please use Integer type, not String, for paramter partitions') - } - $_zookeeper = "--zookeeper ${zookeeper}" $_replication_factor = "--replication-factor ${replication_factor}" $_partitions = "--partitions ${partitions}" if $config { $_config_array = $config.map |$key, $value| { "--config ${key}=${value}" } $_config = join($_config_array, ' ') } else { $_config = '' } if $ensure == 'present' { exec { "create topic ${name}": path => "/usr/bin:/usr/sbin/:/bin:/sbin:${bin_dir}", command => "kafka-topics.sh --create ${_zookeeper} ${_replication_factor} ${_partitions} --topic ${name} ${_config}", unless => "kafka-topics.sh --list ${_zookeeper} | grep -x ${name}", } } } diff --git a/spec/defines/topic_spec.rb b/spec/defines/topic_spec.rb index f402224..8fe4942 100644 --- a/spec/defines/topic_spec.rb +++ b/spec/defines/topic_spec.rb @@ -1,48 +1,48 @@ require 'spec_helper' describe 'kafka::topic', type: :define do on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) do os_facts end context 'when create topic demo' do let(:title) { 'demo' } let :params do { 'ensure' => 'present', 'zookeeper' => 'localhost:2181', - 'replication_factor' => '1', - 'partitions' => '1' + 'replication_factor' => 1, + 'partitions' => 1 } end it { is_expected.to contain_exec('create topic demo').with( command: 'kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic demo ' ) } end context 'when create topic demo with config' do let(:title) { 'demo' } let :params do { 'ensure' => 'present', 'zookeeper' => 'localhost:2181', 'replication_factor' => 1, 'partitions' => 1, 'config' => { 'cleanup.policy' => 'compact', 'retention.ms' => '2592000000' } } end it { is_expected.to contain_exec('create topic demo').with( command: 'kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic demo --config cleanup.policy=compact --config retention.ms=2592000000' ) } end end end end