Skip to content

Commit

Permalink
Merge pull request #1 from ayeshLK/master
Browse files Browse the repository at this point in the history
Add initial project structure for the `aws.secretmanager` package
  • Loading branch information
ayeshLK authored Dec 20, 2024
2 parents 1fe83f2 + 3954c88 commit 6b8aa68
Show file tree
Hide file tree
Showing 32 changed files with 1,256 additions and 74 deletions.
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

# See: https://help.github.com/articles/about-codeowners/

# These owners will be the default owners for everything in the repo.
* @NipunaRanasinghe @ayeshLK @shafreenAnfar
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Purpose

Fixes:

## Examples

## Checklist
- [ ] Linked to an issue
- [ ] Updated the changelog
- [ ] Added tests
- [ ] Updated the spec
- [ ] Checked native-image compatibility
17 changes: 17 additions & 0 deletions .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: GraalVM Check

on:
schedule:
- cron: "30 18 * * *"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
call_stdlib_workflow:
name: Run StdLib Workflow
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }}
uses: ballerina-platform/ballerina-library/.github/workflows/[email protected]
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build

on:
push:
branches:
- main
- 2201.[0-9]+.x
repository_dispatch:
types: check_connector_for_breaking_changes

jobs:
call_workflow:
name: Run Connector Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/[email protected]
secrets: inherit
with:
repo-name: module-ballerinax-aws.secretmanager
14 changes: 14 additions & 0 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Daily build

on:
schedule:
- cron: "30 2 * * *"

jobs:
call_workflow:
name: Run Daily Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/[email protected]
secrets: inherit
with:
repo-name: module-ballerinax-aws.secretmanager
21 changes: 21 additions & 0 deletions .github/workflows/dev-stg-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish to the Ballerina Dev\Stage Central

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select Environment
required: true
options:
- DEV CENTRAL
- STAGE CENTRAL

jobs:
call_workflow:
name: Run Dev\Stage Central Publish Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/[email protected]
secrets: inherit
with:
environment: ${{ github.event.inputs.environment }}
14 changes: 14 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: PR Build

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

on: pull_request

jobs:
call_workflow:
name: Run PR Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/[email protected]
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish Release

on:
workflow_dispatch:
repository_dispatch:
types: [ connector-release-pipeline ]

jobs:
call_workflow:
name: Run Release Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/[email protected]
secrets: inherit
with:
package-name: aws.secretmanager
package-org: ballerinax
13 changes: 13 additions & 0 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Trivy

on:
workflow_dispatch:
schedule:
- cron: "30 20 * * *"

jobs:
call_workflow:
name: Run Trivy Scan Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/[email protected]
secrets: inherit
32 changes: 30 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,40 @@
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
*.deb

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# mac
.DS_Store

.classpath
.project
.settings
.vscode

# Files related to IntelliJ
.idea
*.iml
*.ipr
*.iws

# Gradle build related files
.gradle
!gradle/wrapper/gradle-wrapper.jar
.m2

# Ignore output directories
build
target
generated

# Environment files
*.env
**/Config.toml
examples/**/Dependencies.toml
149 changes: 147 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,147 @@
# module-ballerinax-aws.secretmanager
The Ballerina Connector for AWS Secret Manager
# Ballerina AWS Marketplace Metering connector

[![Build](https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager/actions/workflows/ci.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager/actions/workflows/ci.yml)
[![Trivy](https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager/actions/workflows/trivy-scan.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager/actions/workflows/trivy-scan.yml)
[![GraalVM Check](https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager/actions/workflows/build-with-bal-test-graalvm.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager/actions/workflows/build-with-bal-test-graalvm.yml)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerinax-aws.secretmanager.svg)](https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager/commits/main)
[![GitHub Issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-library/module/aws.secretmanager.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-library/labels/module%2Faws.secretmanager)

[AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html) is a service that helps you protect sensitive information, such as database credentials, API keys, and other secrets, by securely storing and managing access to them.

The `ballerinax/aws.secretmanager` package provides APIs to interact with AWS Secrets Manager, enabling developers to programmatically manage secrets, including creating, retrieving, updating, and deleting secrets in their applications.

## Setup guide
Before using this connector in your Ballerina application, complete the following:
1. Create an [AWS account](https://portal.aws.amazon.com/billing/signup?nc2=h_ct&src=default&redirect_url=https%3A%2F%2Faws.amazon.com%2Fregistration-confirmation#/start)
2. [Obtain tokens](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)

## Quickstart

To use the `aws.secretmanager` connector in your Ballerina project, modify the `.bal` file as follows:

### Step 1: Import the module

Import the `ballerinax/aws.secretmanager` module into your Ballerina project.

```ballerina
import ballerinax/aws.secretmanager;
```

### Step 2: Instantiate a new connector

Create a new `secretmanager:Client` by providing the access key ID, secret access key, and the region.

```ballerina
configurable string accessKeyId = ?;
configurable string secretAccessKey = ?;
secretmanager:Client secretmanager = check new(region = secretmanager:US_EAST_1, auth = {
accessKeyId,
secretAccessKey
});
```

### Step 3: Invoke the connector operation

// todo: complete this

### Step 4: Run the Ballerina application

Use the following command to compile and run the Ballerina program.

```bash
bal run
```

## Build from the source

### Setting up the prerequisites

1. Download and install Java SE Development Kit (JDK) version 17. You can download it from either of the following sources:

* [Oracle JDK](https://www.oracle.com/java/technologies/downloads/)
* [OpenJDK](https://adoptium.net/)

> **Note:** After installation, remember to set the `JAVA_HOME` environment variable to the directory where JDK was installed.
2. Download and install [Ballerina Swan Lake](https://ballerina.io/).

3. Download and install [Docker](https://www.docker.com/get-started).

> **Note**: Ensure that the Docker daemon is running before executing any tests.
4. Export Github Personal access token with read package permissions as follows,

```bash
export packageUser=<Username>
export packagePAT=<Personal access token>
```

### Build options

Execute the commands below to build from the source.

1. To build the package:

```bash
./gradlew clean build
```

2. To run the tests:

```bash
./gradlew clean test
```

3. To build the without the tests:

```bash
./gradlew clean build -x test
```

4. To run tests against different environments:

```bash
./gradlew clean test -Pgroups=<Comma separated groups/test cases>
```

5. To debug the package with a remote debugger:

```bash
./gradlew clean build -Pdebug=<port>
```

6. To debug with the Ballerina language:

```bash
./gradlew clean build -PbalJavaDebug=<port>
```

7. Publish the generated artifacts to the local Ballerina Central repository:

```bash
./gradlew clean build -PpublishToLocalCentral=true
```

8. Publish the generated artifacts to the Ballerina Central repository:

```bash
./gradlew clean build -PpublishToCentral=true
```

## Contribute to Ballerina

As an open-source project, Ballerina welcomes contributions from the community.

For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md).

## Code of conduct

All the contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct).

## Useful links

* For more information go to the [`aws.secretmanager` package](https://central.ballerina.io/ballerinax/aws.secretmanager/latest).
* For example demonstrations of the usage, go to [Ballerina By Examples](https://ballerina.io/learn/by-example/).
* Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
* Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
25 changes: 25 additions & 0 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
distribution = "2201.10.0"
org = "ballerinax"
name = "aws.secretmanager"
version = "0.1.0"
license= ["Apache-2.0"]
authors = ["Ballerina"]
keywords = ["AWS", "Secret Manager", "Cloud/Subscriptions"]
icon = "icon.png"
repository = "https://github.com/ballerina-platform/module-ballerinax-aws.secretmanager"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
groupId = "io.ballerina.lib"
artifactId = "aws.secretmanager-native"
version = "0.1.0-SNAPSHOT"
path = "../native/build/libs/aws.secretmanager-native-0.1.0-SNAPSHOT.jar"

[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "time-native"
version = "2.5.0"
path = "./lib/time-native-2.5.0.jar"
Loading

0 comments on commit 6b8aa68

Please sign in to comment.