.. _custom-role:

===============================================================================
Module *custom-role*
===============================================================================

User-defined role API.


If you want to implement your own role it must conform this API.


-------------------------------------------------------------------------------
Functions
-------------------------------------------------------------------------------


.. _custom-role.init:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
init (opts)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Role initialization callback. 
Called when role is enabled on an instance.
Caused either by editing topology or instance restart.



**Parameters:**

- *opts:* 

  - *is_master:* (**boolean**)   



.. _custom-role.stop:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stop (opts)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Role shutdown callback. 
Called when role is disabled on an instance.


**Parameters:**

- *opts:* 

  - *is_master:* (**boolean**)   



.. _custom-role.validate_config:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
validate_config (conf_new, conf_old)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Validate clusterwide configuration callback.


**Parameters:**

- *conf_new:* (`table <https://www.lua.org/manual/5.1/manual.html#5.5>`_)   
- *conf_old:* (`table <https://www.lua.org/manual/5.1/manual.html#5.5>`_)   


.. _custom-role.apply_config:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
apply_config (conf, opts)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Apply clusterwide configuration callback.


**Parameters:**

- *conf:* (`table <https://www.lua.org/manual/5.1/manual.html#5.5>`_) Clusterwide configuration  
- *opts:* 

  - *is_master:* (**boolean**)   



-------------------------------------------------------------------------------
Fields
-------------------------------------------------------------------------------


.. _custom-role.role_name:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
role_name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Displayed role name. 
When absent, module name is used instead.


- *role_name:* (`string <https://www.lua.org/manual/5.1/manual.html#5.4>`_)   


.. _custom-role.hidden:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hidden
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hidden role flag.  aren't listed in
``cartridge.admin_get_replicasets().roles``  and therefore in WebUI.
Hidden roled are supposed to be a dependency for another role.


- *hidden:* (**boolean**)   


.. _custom-role.permanent:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
permanent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Permanent role flag. 
Permanent roles will be enabled on every instance in cluster.
Implies  ``hidden = true`` .


- *permanent:* (**boolean**)   


