ibm-secrets-manager-sdk


Nameibm-secrets-manager-sdk JSON
Version 2.1.3 PyPI version JSON
download
home_pagehttps://github.com/IBM/secrets-manager-python-sdk
SummaryIBM Cloud Secrets Manager Python SDK
upload_time2024-02-07 09:38:56
maintainer
docs_urlNone
authorIBM
requires_python
licenseApache 2.0
keywords ibm_secrets_manager_sdk
VCS
bugtrack_url
requirements No requirements were recorded.
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": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ibm_secrets_manager_sdk",
    "author": "IBM",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/46/02/db0a75d6d3c9bc8889e7298af908f542b6539609cd278b3b8facd30f71e0/ibm-secrets-manager-sdk-2.1.3.tar.gz",
    "platform": null,
    "description": "# IBM Cloud Secrets Manager Python SDK\n\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\n\nThe IBM Cloud Secrets Manager Python SDK allows developers to programmatically interact with the following IBM Cloud\nservices:\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\n\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\nincluded in each API request to Secrets Manager. Access tokens are valid for a limited amount of time and must be\nregenerated.\n\nAuthentication for this SDK is accomplished by\nusing [IAM authenticators](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md#authentication). Import\nauthenticators 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.3",
    "project_urls": {
        "Homepage": "https://github.com/IBM/secrets-manager-python-sdk"
    },
    "split_keywords": [
        "ibm_secrets_manager_sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c685e1c6b4967b0cd43b42470d5dd1dd9b304afa58c155347695653e0e27b58d",
                "md5": "7c0ae71fcf7c8bc55c06b8d75d0e4cc5",
                "sha256": "b4693ef52f6811e433ede100260515692d6c491633acfeffe8eca8d776b8de62"
            },
            "downloads": -1,
            "filename": "ibm_secrets_manager_sdk-2.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7c0ae71fcf7c8bc55c06b8d75d0e4cc5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 122467,
            "upload_time": "2024-02-07T09:38:53",
            "upload_time_iso_8601": "2024-02-07T09:38:53.484709Z",
            "url": "https://files.pythonhosted.org/packages/c6/85/e1c6b4967b0cd43b42470d5dd1dd9b304afa58c155347695653e0e27b58d/ibm_secrets_manager_sdk-2.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4602db0a75d6d3c9bc8889e7298af908f542b6539609cd278b3b8facd30f71e0",
                "md5": "1336fb57ef97f12ab07b1e91f8460e70",
                "sha256": "efe80cb9d532f15d30b20f53aa6a36b3edd1aa5d29713fc7911fa8f8daf83bb2"
            },
            "downloads": -1,
            "filename": "ibm-secrets-manager-sdk-2.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "1336fb57ef97f12ab07b1e91f8460e70",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 120282,
            "upload_time": "2024-02-07T09:38:56",
            "upload_time_iso_8601": "2024-02-07T09:38:56.285486Z",
            "url": "https://files.pythonhosted.org/packages/46/02/db0a75d6d3c9bc8889e7298af908f542b6539609cd278b3b8facd30f71e0/ibm-secrets-manager-sdk-2.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 09:38:56",
    "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": [],
    "lcname": "ibm-secrets-manager-sdk"
}
        
IBM
Elapsed time: 0.17209s