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

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


connection_profile -- Manage a connection profile for a Hyperledger Fabric network
==================================================================================

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


Synopsis
--------

Create, update, or delete a connection profile for a Hyperledger Fabric network by using the IBM Blockchain Platform.

This module works with the IBM Blockchain Platform managed service running in IBM Cloud, or the IBM Blockchain Platform software running in a Red Hat OpenShift or Kubernetes cluster.






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`` - If a connection profile exists at the specified path, it will be removed.

    ``present`` - Asserts that a connection profile exists at the specified path. If no connection profile exists, a connection profile will be created. If a connection profile exists, but does not match the specfied configuration, then the connection profile will be updated, if it can be. If it cannot be updated, it will be removed and re-created with the specified configuration.

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

  name
    The name of this connection profile.

    Only required when *state* is ``present``.

    | **Type**: str

  path (required)
    The path to the JSON file where the connection profile will be stored.


  organization
    The organization for this connection profile.

    Only required when *state* is ``present``.


  certificate_authority
    The certificate authority to reference in this connection profile.

    You can pass a string, which is the display name of a certificate authority registered with the IBM Blockchain Platform console.

    You can also pass a dictionary, which must match the result format of one of the :ref:`certificate_authority_info <certificate_authority_info_module>` or :ref:`certificate_authority <certificate_authority_module>` modules.

    | **Type**: raw

  peers
    The peers to reference in this connection profile.

    You can pass strings, which are the display names of peers registered with the IBM Blockchain Platform console.

    You can also pass dictionaries, which must match the result format of one of the :ref:`peer_info <peer_info_module>` or :ref:`peer <peer_module>` modules.

    Only required when *state* is ``present``.

    | **Type**: list
    | **Elements**: raw








Examples
--------

.. code-block:: yaml+jinja

    
    - name: Create a connection profile
      ibm.blockchain_platform.connection_profile:
        state: present
        api_endpoint: https://ibp-console.example.org:32000
        api_authtype: basic
        api_key: xxxxxxxx
        api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        name: Org1 Gateway
        path: Org1 Gateway.json
        organization: Org1
        certificate_authority: Org1 CA
        peers:
          - Org1 Peer

    - name: Delete a connection profile
      ibm.blockchain_platform.connection_profile:
        state: absent
        api_endpoint: https://ibp-console.example.org:32000
        api_authtype: basic
        api_key: xxxxxxxx
        api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        path: Org1 Gateway.json



