..
.. SPDX-License-Identifier: Apache-2.0
..

:github_url: https://github.com/IBM-Blockchain/ansible-collection/edit/main/plugins/modules/console_user.py


console_user -- Manage the list of users for an IBM Blockchain Platform console
===============================================================================

.. contents::
   :local:
   :depth: 1


Synopsis
--------

Add, update, and remove users for an instance of the IBM Blockchain Platform console.

This module works with the IBM Blockchain Platform software running in a Red Hat OpenShift or Kubernetes cluster. It does not work with the IBM Blockchain Platform managed service running in IBM Cloud; to manage the list of users in this environment, you must use IAM.






Parameters
----------

  api_endpoint (required)
    The URL for the IBM Blockchain Platform console.

    | **Type**: str

  api_authtype (required)
    ``ibmcloud`` - Authenticate to the IBM Blockchain Platform console using IBM Cloud authentication. You must provide a valid API key using *api_key*.

    ``basic`` - Authenticate to the IBM Blockchain Platform console using basic authentication. You must provide both a valid API key using *api_key* and API secret using *api_secret*.

    | **Type**: str

  api_key (required)
    The API key for the IBM Blockchain Platform console.

    | **Type**: str

  api_secret
    The API secret for the IBM Blockchain Platform console.

    Only required when *api_authtype* is ``basic``.

    | **Type**: str

  api_timeout
    The timeout, in seconds, to use when interacting with the IBM Blockchain Platform console.

    | **Type**: int
    | **Default value**: ``60``

  api_token_endpoint
    The IBM Cloud IAM token endpoint to use when using IBM Cloud authentication.

    Only required when *api_authtype* is ``ibmcloud``, and you are using IBM internal staging servers for testing.

    | **Type**: str
    | **Default value**: ``https://iam.cloud.ibm.com/identity/token``

  state
    ``absent`` - A user matching the specified email will be removed from the IBM Blockchain Platform console.

    ``present`` - Asserts that a user matching the specified email and configuration exists in the IBM Blockchain Platform console. If no user matches the specified email, the user will be added to the IBM Blockchain Platform console. If a user matches the specified email but the configuration does not match, then the user in the IBM Blockchain Platform console will be updated.

    | **Type**: str
    | **Default value**: ``present``

  email
    The email address of the user.

    | **Type**: str

  roles
    The roles for the user. A user must have one or more roles from the list of roles ``reader``, ``writer``, and ``manager``.

    If you specify ``manager``, then the roles ``reader`` and ``writer`` will be automatically specified for you. If you specify ``writer``, then the role ``reader`` will be automatically specified for you.

    | **Type**: list
    | **Elements**: str








Examples
--------

.. code-block:: yaml+jinja

    
    ---
    - name: Add a user with the manager role to the console
      ibm.blockchain_platform.console_user:
        state: present
        api_endpoint: https://ibp-console.example.org:32000
        api_authtype: basic
        api_key: xxxxxxxx
        api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        email: alice@example.org
        roles:
          - manager

    - name: Add a user with the writer role to the console
      ibm.blockchain_platform.console_user:
        state: present
        api_endpoint: https://ibp-console.example.org:32000
        api_authtype: basic
        api_key: xxxxxxxx
        api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        email: bob@example.org
        roles:
          - writer

    - name: Add a user with the reader role to the console
      ibm.blockchain_platform.console_user:
        state: present
        api_endpoint: https://ibp-console.example.org:32000
        api_authtype: basic
        api_key: xxxxxxxx
        api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        email: charlie@example.org
        roles:
          - reader

    - name: Remove the user from the console
      ibm.blockchain_platform.console_user:
        state: absent
        api_endpoint: https://ibp-console.example.org:32000
        api_authtype: basic
        api_key: xxxxxxxx
        api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        email: alice@example.org



Return Values
-------------

  console_user
    The user.

    | **Returned**: when *state* is ``present``
    | **Type**: dict

    uuid
      The UUID of the user.

      | **Type**: str
      | **Sample**: ``7ea7d413-d718-4138-9c25-3712fb5d7d0f``

    email
      The email address of the user.

      | **Type**: str
      | **Sample**: ``alice@example.org``

    roles
      The roles assigned to the user.

      | **Type**: list
      | **Elements**: str
      | **Sample**: ``manager``



