Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve spelling #11

Merged
merged 1 commit into from
Aug 12, 2020
Merged
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
44 changes: 23 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=bancolombia_secrets-manager&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=bancolombia_secrets-manager)
[![codecov](https://codecov.io/gh/bancolombia/secrets-manager/branch/master/graph/badge.svg)](https://codecov.io/gh/bancolombia/secrets-manager)
[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/bancolombia/secrets-manager/blob/master/LICENSE)

# SecretsManager - Bancolombia

This library will help you to decouple your application of your secrets provider. It supports the following conectors to get secrets:

- AWS Secrets Manager
- File Secrets (E.g Kubernetes Secrets )
- Environment System Secrets (E.g Kubernetes Secrets )

- AWS Secrets Manager
- File Secrets (E.g Kubernetes Secrets )
- Environment System Secrets (E.g Kubernetes Secrets )

# How to use

SecretsManager require [Java] v8+

Add the following dependency to your build.gradle file.

File: build.gradle
File: build.gradle

```java
dependencies {
implementation 'com.github.bancolombia:secrets-manager:1.0.2'
implementation 'com.github.bancolombia:secrets-manager:1.0.2'
}
```

File: Secrets.java

```java
import co.com.bancolombia.commons.secretsmanager.connector.AbstractConnector;
import co.com.bancolombia.commons.secretsmanager.connector.clients.AWSSecretManagerConnector;
Expand All @@ -37,22 +39,22 @@ AbstractConnector connector = new AWSSecretManagerConnector(REGION_SECRET);
GenericManager manager = new GenericManager(connector);

try {
DefineYourModel obj = manager.getSecretModel(NAME_SECRET, DefineYourModel.class);
DefineYourModel obj = manager.getSecretModel(NAME_SECRET, DefineYourModel.class);
// Use your model to get Secrets
} catch(Exception e) {
// Catch error...
// Catch error...
}
```

If you need to use a local instance for ```AWSSecretManagerConnector``` like localstack or a docker container, replace before connector instance with a new instance and the local endpoint like:
If you need to use a local instance for `AWSSecretManagerConnector` like localstack or a docker container, replace before connector instance with a new instance and the local endpoint like:

```
AbstractConnector connector = new AWSSecretManagerConnector("localhost:4566", REGION_SECRET);
```

Remind you have to define your model with the fields you will need. You can find a default AWSSecretDBModel model, it includes default fields to connect a RDS database.
Remind you have to define your model with the fields you will need. You can find a default AWSSecretDBModel model, it includes default fields to connect a RDS database.

To convert `JSON` to a `POJO`, it uses `Gson`. If you need use field with custom names, you have to create your model like:
To convert `JSON` to a `POJO`, it uses `Gson`. If you need use field with custom names, you have to create your model like:

```java
package co.com.bancolombia...;
Expand All @@ -61,13 +63,13 @@ import com.google.gson.annotations.SerializedName;

public class DefineYourModel {

@SerializedName("aes_key")
private String aesKey;
@SerializedName("aes_key")
private String aesKey;

@SerializedName("rsa_key")
private String rsaKey;
@SerializedName("rsa_key")
private String rsaKey;

...
...

}
```
Expand All @@ -76,14 +78,14 @@ public class DefineYourModel {

Great !!:

* Clone this repo
* Create a new feature branch
* Add new features or improvements
* Send us a Pull Request
- Clone this repo
- Create a new feature branch
- Add new features or improvements
- Send us a Pull Request

### To Do

- New connectors for other services.
- Vault
- Key Valut Azure
- Key Vault Azure
- Improve our tests