Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.bumpversion]
current_version = "2.0.0"
commit = false
tag = false
allow_dirty = true

[[tool.bumpversion.files]]
filename = "pom.xml"
search = "<version>{current_version}</version>"
replace = "<version>{new_version}</version>"

[[tool.bumpversion.files]]
filename = "README.md"
search = "{current_version}"
replace = "{new_version}"
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.enc binary
29 changes: 29 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"debug": true,
"branches": [ "main" ],
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{"type": "release","release": "patch"},
{"type": "major","release": "major"},
{"type": "minor","release": "minor"},
{"type": "patch","release": "patch"}
]}],
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "bump-my-version bump ${nextRelease.type} --allow-dirty --new-version ${nextRelease.version}"
}
],
[
"@semantic-release/git",
{
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
"assets": ["pom.xml", "modules/*/pom.xml", "README.md", ".bumpversion.toml"]
}
],
"@semantic-release/github"
]
}
62 changes: 62 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making
participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education,
socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the
project or its community. Examples of representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed representative at an online or offline
event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
phil_adams@us.ibm.com. All complaints will be reviewed and investigated and will result in a response that is deemed
necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to
the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available
at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing

Review the following guidelines for submitting issues or changes to this repository.

## Issues

If you encounter an issue with this project, you're welcome to submit a [bug report](https://github.com/IBM/secrets-manager-management-java-sdk/issues) to help us improve. Before you create a new issue, please search for similar issues in case someone has already reported the same problem.

## Changes

Thank you for contributing to IBM Cloud SDK projects! To learn more about submitting changes to this repository, check out the [IBM Cloud SDK Common contribution guidelines](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/CONTRIBUTING_java.md).
138 changes: 136 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,136 @@
# secrets-manager-management-java-sdk
Java SDK for IBM Cloud Secrets Manager instance management
# IBM Cloud Secrets Manager Management Java SDK
A Java 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.

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

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

</details>

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

| Service name | Imported class name |
|-------------------------------------------|----------------------------------------|
| Secrets Manager Management | SecretsManagerInstanceManagement |

## Prerequisites

[ibm-cloud-onboarding]: https://cloud.ibm.com/registration

- An [IBM Cloud account](https://cloud.ibm.com/registration).
- A [Secrets Manager service instance](https://cloud.ibm.com/catalog/services/secrets-manager) with the **Vault Enterprise plan**.
- An [IBM Cloud API key](https://cloud.ibm.com/iam/apikeys) that allows the SDK to access your account.
- Java 11

## Installation
##### Maven

```xml
<dependency>
<groupId>com.ibm.cloud</groupId>
<artifactId>secrets-manager-instance-management</artifactId>
<version>2.0.1</version>
</dependency>
```

##### Gradle

```gradle
'com.ibm.cloud:secrets-manager-instance-management:2.0.1'
```

## 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 `com.ibm.cloud.sdk.core.security`.

### Examples

#### Programmatic credentials

```java
import com.ibm.cloud.sdk.core.security.IamAuthenticator;
...
IamAuthenticator iamAuthenticator = new IamAuthenticator.Builder()
.apikey("<IBM_CLOUD_API_KEY>")
.build();
```

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

## Using the SDK

### Basic usage
- Use the `setServiceUrl` 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 `main.java` class file:

```java
import com.ibm.cloud.secrets_manager_sdk_instance_management.secrets_manager_instance_management.v2.SecretsManagerInstanceManagement;
import com.ibm.cloud.secrets_manager_sdk_instance_management.secrets_manager_instance_management.v2.model.*;
import com.ibm.cloud.sdk.core.http.Response;
import com.ibm.cloud.sdk.core.security.IamAuthenticator;

public class main {

protected static SecretsManagerInstanceManagement smim;
protected static IamAuthenticator iamAuthenticator;

public static void main(String[] args) {
iamAuthenticator = new IamAuthenticator.Builder()
.apikey("<IBM_CLOUD_API_KEY>")
.build();
smim = new SecretsManagerInstanceManagement("Secrets Manager Instance Management", iamAuthenticator);
smim.setServiceUrl("<SERVICE_URL>");

// Generate admin token
AdminTokenGenerateOptions adminTokenGenerateOptions = new AdminTokenGenerateOptions.Builder()
.instanceCrn("<INSTANCE_CRN>")
.build();
Response<AdminToken> tokenResp = smim.adminTokenGenerate(adminTokenGenerateOptions).execute();

System.out.println("Admin token generated!");

// Get instance details
InstanceDetailsOptions instanceDetailsOptions = new InstanceDetailsOptions.Builder()
.instanceCrn("<INSTANCE_CRN>")
.build();
Response<Instance> instanceResp = smim.instanceDetails(instanceDetailsOptions).execute();

System.out.println("Instance details: " + instanceResp.getResult());
}

}
```

Replace the `IBM_CLOUD_API_KEY`, `SERVICE_URL`, and `INSTANCE_CRN` values. Then run your application.

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

## Issues

If you encounter an issue with the project, you're welcome to submit a [bug report](https://github.com/IBM/secrets-manager-management-java-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).
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.ibm.cloud</groupId>
<artifactId>secrets-manager-management-java-sdk</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0</version>
<packaging>jar</packaging>

<name>secrets-manager-management-java-sdk</name>
Expand Down
Loading