Skip to content

IBM Cloud Secrets Manager Management Python SDK

A Python client library to interact with the IBM Cloud® Secrets Manager Instance Management APIs.

Important: This SDK is for use with instances of the IBM Cloud Secrets Manager Vault Enterprise plan only. It is not compatible with other Secrets Manager plans.

Table of Contents

Overview

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

Service name Imported class name
Secrets Manager Management SecretsManagerInstanceManagementV2

Prerequisites

Installation

To install, use pip or easy_install:

pip install --upgrade "ibm-secrets-manager-instance-management-sdk"

or

easy_install --upgrade "ibm-secrets-manager-instance-management-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. Import authenticators from ibm_cloud_sdk_core.authenticators.

Examples

Programmatic credentials

from ibm_cloud_sdk_core.authenticators.iam_authenticator import IAMAuthenticator

secretsManagerInstanceManagement = SecretsManagerInstanceManagementV2(
    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.

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 section on the Overview page in the Secrets Manager UI.

Examples

Construct a service client and use it to generate an admin token and get instance details.

Here's an example secrets_manager_instance_management.py file:

from ibm_cloud_sdk_core.authenticators.iam_authenticator import IAMAuthenticator
from ibm_secrets_manager_instance_management_sdk.secrets_manager_instance_management_v2 import *

secretsManagerInstanceManagement = SecretsManagerInstanceManagementV2(
    authenticator=IAMAuthenticator(apikey='<IBM_CLOUD_API_KEY>')
)

secretsManagerInstanceManagement.set_service_url('<SERVICE_URL>')

# Generate admin token
response = secretsManagerInstanceManagement.admin_token_generate(
    instance_crn='<INSTANCE_CRN>'
)

print('Admin token generated!')

# Get instance details
response = secretsManagerInstanceManagement.instance_details(
    instance_crn='<INSTANCE_CRN>'
)

print('Instance details:')
print(response.result)

Replace the apikey, SERVICE_URL, and INSTANCE_CRN values. Then use the python secrets_manager_instance_management.py command to run your application.

For more information and IBM Cloud SDK usage examples for Python, see the IBM Cloud SDK Common documentation.

Issues

If you encounter an issue with the project, you're welcome to submit a bug report to help us improve.

Contributing

For general contribution guidelines, see CONTRIBUTING.

License

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

About

Python SDK for IBM Cloud Secrets Manager instance management

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages