ibm-secrets-manager-sdk


Nameibm-secrets-manager-sdk JSON
Version 2.1.8 PyPI version JSON
download
home_pagehttps://github.com/IBM/secrets-manager-python-sdk
SummaryIBM Cloud Secrets Manager Python SDK
upload_time2024-10-07 05:12:42
maintainerNone
docs_urlNone
authorIBM
requires_pythonNone
licenseApache 2.0
keywords ibm_secrets_manager_sdk
VCS
bugtrack_url
requirements requests urllib3 python_dateutil ibm_cloud_sdk_core
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # IBM Cloud Secrets Manager Python SDK
A Python client library to interact with the [IBM Cloud® Secrets Manager APIs](https://cloud.ibm.com/apidocs/secrets-manager).

<details>
<summary>Table of Contents</summary>

* [Overview](#overview)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Authentication](#authentication)
* [Using the SDK](#using-the-sdk)
* [Questions](#questions)
* [Issues](#issues)
* [Contributing](#contributing)
* [License](#license)

</details>

## Overview
The IBM Cloud Secrets Manager Python SDK allows developers to programmatically interact with the following IBM Cloud services:

| Service name                                                     | Imported class name  |
|------------------------------------------------------------------|----------------------|
| [Secrets Manager](https://cloud.ibm.com/apidocs/secrets-manager) | SecretsManagerV2     |

## Prerequisites
   
- An [IBM Cloud account](https://cloud.ibm.com/registration).
- A [Secrets Manager service instance](https://cloud.ibm.com/catalog/services/secrets-manager).
- An [IBM Cloud API key](https://cloud.ibm.com/iam/apikeys) that allows the SDK to access your account.
- Python 3.9 or above.

## Installation
To install, use `pip` or `easy_install`:

```bash
pip install --upgrade "ibm-secrets-manager-sdk"
```

or

```bash
easy_install --upgrade "ibm-secrets-manager-sdk"
```

## Authentication

Secrets Manager uses token-based Identity and Access Management (IAM) authentication.

With IAM authentication, you supply an API key that is used to generate an access token. Then, the access token is included in each API request to Secrets Manager. Access tokens are valid for a limited amount of time and must be regenerated.

Authentication for this SDK is accomplished by using [IAM authenticators](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md#authentication). Import authenticators from `ibm_cloud_sdk_core.authenticators`.

### Examples

#### Programmatic credentials

```python
from ibm_cloud_sdk_core.authenticators.iam_authenticator import IAMAuthenticator

secretsManager = SecretsManagerV2(
    authenticator=IAMAuthenticator(apikey='<IBM_CLOUD_API_KEY>')
)
```

To learn more about IAM authenticators and how to use them in your Python application, see the [IBM Python SDK Core documentation](https://github.com/IBM/python-sdk-core/blob/master/Authentication.md).

## Using the SDK

### Basic usage

- Use the `set_service_url` method to set the endpoint URL that is specific to your Secrets Manager service instance. To
  find your endpoint URL, you can copy it from the **Endpoints** page in the Secrets Manager UI.

#### Examples

Construct a service client and use it to create and retrieve a secret from your Secrets Manager instance.

Here's an example `secrets_manager.py` file:

```python
from ibm_cloud_sdk_core.authenticators.iam_authenticator import IAMAuthenticator
from ibm_secrets_manager_sdk.secrets_manager_v2 import *

secretsManager = SecretsManagerV2(
    authenticator=IAMAuthenticator(apikey='<IBM_CLOUD_API_KEY>')
)

secretsManager.set_service_url('<SERVICE_URL>')

# create arbitrary secret
secret_prototype_model = {
    'custom_metadata': {'metadata_custom_key':'metadata_custom_value'},
    'description': 'Description of my arbitrary secret.',
    'expiration_date': '2030-10-05T11:49:42Z',
    'labels': ['dev', 'us-south'],
    'name': 'example-arbitrary-secret',
    'secret_group_id': 'default',
    'secret_type': 'arbitrary',
    'payload': 'secret-data',
    'version_custom_metadata': {'custom_version_key':'custom_version_value'},
}

response = secretsManager.create_secret(
  secret_prototype=secret_prototype_model,
)

secretId = response.result['id']

# get arbitrary secret
response = secretsManager.get_secret(
    id=secretId
)

secretPayload = response.result['payload']
print('The arbitrary secret payload is: ' + secretPayload)
```

Replace the `apikey` and `set_service_url()` values. Then use the `python secrets_manager.py` command to run your
application. You should see the payload of the arbitrary secret that was created.

For more information and IBM Cloud SDK usage examples for Python, see
the [IBM Cloud SDK Common documentation](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md).

## Questions

If you're having difficulties using this SDK, you can ask questions about this project by
using [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-cloud+secrets-manager). Be sure to include
the `ibm-cloud` and `ibm-secrets-manager` tags.

You can also check out the [Secrets Manager documentation](https://cloud.ibm.com/docs/secrets-manager)
and [API reference](https://cloud.ibm.com/apidocs/secrets-manager) for more information about the service.

## Issues

If you encounter an issue with the project, you're welcome to submit
a [bug report](https://github.com/IBM/secrets-manager-python-sdk/issues) to help us improve.

## Contributing

For general contribution guidelines, see [CONTRIBUTING](CONTRIBUTING.md).

## License

This SDK project is released under the Apache 2.0 license. The license's full text can be found in [LICENSE](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/IBM/secrets-manager-python-sdk",
    "name": "ibm-secrets-manager-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "ibm_secrets_manager_sdk",
    "author": "IBM",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/cf/9e/34c2aee66c27e24a65daf20b15f8a7b66290420c2d1c8760fb7b86e2ac7e/ibm_secrets_manager_sdk-2.1.8.tar.gz",
    "platform": null,
    "description": "# IBM Cloud Secrets Manager Python SDK\nA Python client library to interact with the [IBM Cloud\u00ae Secrets Manager APIs](https://cloud.ibm.com/apidocs/secrets-manager).\n\n<details>\n<summary>Table of Contents</summary>\n\n* [Overview](#overview)\n* [Prerequisites](#prerequisites)\n* [Installation](#installation)\n* [Authentication](#authentication)\n* [Using the SDK](#using-the-sdk)\n* [Questions](#questions)\n* [Issues](#issues)\n* [Contributing](#contributing)\n* [License](#license)\n\n</details>\n\n## Overview\nThe IBM Cloud Secrets Manager Python SDK allows developers to programmatically interact with the following IBM Cloud services:\n\n| Service name                                                     | Imported class name  |\n|------------------------------------------------------------------|----------------------|\n| [Secrets Manager](https://cloud.ibm.com/apidocs/secrets-manager) | SecretsManagerV2     |\n\n## Prerequisites\n   \n- An [IBM Cloud account](https://cloud.ibm.com/registration).\n- A [Secrets Manager service instance](https://cloud.ibm.com/catalog/services/secrets-manager).\n- An [IBM Cloud API key](https://cloud.ibm.com/iam/apikeys) that allows the SDK to access your account.\n- Python 3.9 or above.\n\n## Installation\nTo install, use `pip` or `easy_install`:\n\n```bash\npip install --upgrade \"ibm-secrets-manager-sdk\"\n```\n\nor\n\n```bash\neasy_install --upgrade \"ibm-secrets-manager-sdk\"\n```\n\n## Authentication\n\nSecrets Manager uses token-based Identity and Access Management (IAM) authentication.\n\nWith IAM authentication, you supply an API key that is used to generate an access token. Then, the access token is included in each API request to Secrets Manager. Access tokens are valid for a limited amount of time and must be regenerated.\n\nAuthentication for this SDK is accomplished by using [IAM authenticators](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md#authentication). Import authenticators from `ibm_cloud_sdk_core.authenticators`.\n\n### Examples\n\n#### Programmatic credentials\n\n```python\nfrom ibm_cloud_sdk_core.authenticators.iam_authenticator import IAMAuthenticator\n\nsecretsManager = SecretsManagerV2(\n    authenticator=IAMAuthenticator(apikey='<IBM_CLOUD_API_KEY>')\n)\n```\n\nTo learn more about IAM authenticators and how to use them in your Python application, see the [IBM Python SDK Core documentation](https://github.com/IBM/python-sdk-core/blob/master/Authentication.md).\n\n## Using the SDK\n\n### Basic usage\n\n- Use the `set_service_url` method to set the endpoint URL that is specific to your Secrets Manager service instance. To\n  find your endpoint URL, you can copy it from the **Endpoints** page in the Secrets Manager UI.\n\n#### Examples\n\nConstruct a service client and use it to create and retrieve a secret from your Secrets Manager instance.\n\nHere's an example `secrets_manager.py` file:\n\n```python\nfrom ibm_cloud_sdk_core.authenticators.iam_authenticator import IAMAuthenticator\nfrom ibm_secrets_manager_sdk.secrets_manager_v2 import *\n\nsecretsManager = SecretsManagerV2(\n    authenticator=IAMAuthenticator(apikey='<IBM_CLOUD_API_KEY>')\n)\n\nsecretsManager.set_service_url('<SERVICE_URL>')\n\n# create arbitrary secret\nsecret_prototype_model = {\n    'custom_metadata': {'metadata_custom_key':'metadata_custom_value'},\n    'description': 'Description of my arbitrary secret.',\n    'expiration_date': '2030-10-05T11:49:42Z',\n    'labels': ['dev', 'us-south'],\n    'name': 'example-arbitrary-secret',\n    'secret_group_id': 'default',\n    'secret_type': 'arbitrary',\n    'payload': 'secret-data',\n    'version_custom_metadata': {'custom_version_key':'custom_version_value'},\n}\n\nresponse = secretsManager.create_secret(\n  secret_prototype=secret_prototype_model,\n)\n\nsecretId = response.result['id']\n\n# get arbitrary secret\nresponse = secretsManager.get_secret(\n    id=secretId\n)\n\nsecretPayload = response.result['payload']\nprint('The arbitrary secret payload is: ' + secretPayload)\n```\n\nReplace the `apikey` and `set_service_url()` values. Then use the `python secrets_manager.py` command to run your\napplication. You should see the payload of the arbitrary secret that was created.\n\nFor more information and IBM Cloud SDK usage examples for Python, see\nthe [IBM Cloud SDK Common documentation](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md).\n\n## Questions\n\nIf you're having difficulties using this SDK, you can ask questions about this project by\nusing [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-cloud+secrets-manager). Be sure to include\nthe `ibm-cloud` and `ibm-secrets-manager` tags.\n\nYou can also check out the [Secrets Manager documentation](https://cloud.ibm.com/docs/secrets-manager)\nand [API reference](https://cloud.ibm.com/apidocs/secrets-manager) for more information about the service.\n\n## Issues\n\nIf you encounter an issue with the project, you're welcome to submit\na [bug report](https://github.com/IBM/secrets-manager-python-sdk/issues) to help us improve.\n\n## Contributing\n\nFor general contribution guidelines, see [CONTRIBUTING](CONTRIBUTING.md).\n\n## License\n\nThis SDK project is released under the Apache 2.0 license. The license's full text can be found in [LICENSE](LICENSE).\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "IBM Cloud Secrets Manager Python SDK",
    "version": "2.1.8",
    "project_urls": {
        "Homepage": "https://github.com/IBM/secrets-manager-python-sdk"
    },
    "split_keywords": [
        "ibm_secrets_manager_sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03ecf805b17a514777324c4e5325a979242a1f89103dcf7ac4faf1805e45c34d",
                "md5": "874217e67126d986033a328eab47969d",
                "sha256": "f5fe7993fe480b0dde872497ca15de71ca2ea5d6b52f52ee5748b38b07065cb9"
            },
            "downloads": -1,
            "filename": "ibm_secrets_manager_sdk-2.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "874217e67126d986033a328eab47969d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 130204,
            "upload_time": "2024-10-07T05:12:41",
            "upload_time_iso_8601": "2024-10-07T05:12:41.030394Z",
            "url": "https://files.pythonhosted.org/packages/03/ec/f805b17a514777324c4e5325a979242a1f89103dcf7ac4faf1805e45c34d/ibm_secrets_manager_sdk-2.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf9e34c2aee66c27e24a65daf20b15f8a7b66290420c2d1c8760fb7b86e2ac7e",
                "md5": "e04d9d995990aceef22090389dca7670",
                "sha256": "90d6fe9acd90525efc34c42d9fafda3b7c1abd429773a4f0ab4e01cbf13f33cb"
            },
            "downloads": -1,
            "filename": "ibm_secrets_manager_sdk-2.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "e04d9d995990aceef22090389dca7670",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 127666,
            "upload_time": "2024-10-07T05:12:42",
            "upload_time_iso_8601": "2024-10-07T05:12:42.649121Z",
            "url": "https://files.pythonhosted.org/packages/cf/9e/34c2aee66c27e24a65daf20b15f8a7b66290420c2d1c8760fb7b86e2ac7e/ibm_secrets_manager_sdk-2.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 05:12:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "IBM",
    "github_project": "secrets-manager-python-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    "<",
                    "3.0.0"
                ],
                [
                    ">=",
                    "2.28.2"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "<",
                    "3.0.0"
                ],
                [
                    ">=",
                    "2.1.0"
                ]
            ]
        },
        {
            "name": "python_dateutil",
            "specs": [
                [
                    "<",
                    "3.0.0"
                ],
                [
                    ">=",
                    "2.5.3"
                ]
            ]
        },
        {
            "name": "ibm_cloud_sdk_core",
            "specs": [
                [
                    "<",
                    "4.0.0"
                ],
                [
                    ">=",
                    "3.21.0"
                ]
            ]
        }
    ],
    "lcname": "ibm-secrets-manager-sdk"
}
        
IBM
Elapsed time: 0.38432s