https://github.com/cdcgov/lib-cloud-proxy

https://github.com/cdcgov/lib-cloud-proxy

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: CDCgov
  • License: apache-2.0
  • Language: Java
  • Default Branch: main
  • Size: 1.72 MB
Statistics
  • Stars: 0
  • Watchers: 9
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created almost 2 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Contributing License Code of conduct

README.md

This library helps encapsulate access to Clouds.

Intro

This library is built to give an abstraction of cloud implementations. Users of this library should not be concerned as to how to access specific services on each cloud environment, but have a common interface to interact with such services.

Currently, Storage (S3 and Blob) and Messaging (SQS) services are implemented for AWS and Azure. Additionally, the AWS implementations currently have Healthchecks and micrometer metrics instrumented.

Requirements

This library works with micronaut framework (currently 2.2.1). Additionally, if you desire the use of healthchecks and metrics, you'll need to use the following libraries (respectively):

  • micronaut-management
  • micronaut-micrometer

If you're already using the eip-starter project, these are included for you.

Usage

Import

Add this library to your build file:

For maven: xml <dependency> <groupId>gov.cdc.dex</groupId> <artifactId>lib-cloud-proxy</artifactId> <version>1.2.0</version> </dependency>

For gradle: groovy implementation("gov.cdc.dex:lib-cloud-proxy:1.2.0")

Configuration

This library determines which Cloud provider to load based upon which root properties are found in the application.yaml (aws or azure)

*****NOTE: At this point both aws: and azure: cannot be configured at the same time. This can be done but isn't a desired feature at this time

The following is the complete configuration (although not all elements are required. The optional properties are noted inline)

For AWS: yaml aws: region: us-east-1 # (default = us-east-1) s3: bucket: my-s3-bucket-name # (required) apiCallTimeoutSeconds: 30 # (default = 60) apiCallAttemptTimeoutSeconds: 10 # (default = 20) health: enabled: true # (default = false) sqs: queueName: my-queue-name # (required -- only the queue name is needed, not the url) apiCallTimeoutSeconds: 30 # (default = 60) apiCallAttemptTimeoutSeconds: 10 # (default = 20) health: enabled: true # (default = false)

For Azure: yaml azure: blob: container: my-blob-container-name connectStr: my-azure-blob-connection-string health: enabled: true # (default = false)

Health checks

To enable/disable health for SQS and S3, make certain the following attributes are set. (Note: Healthchecks are disabled by default)

```yaml aws: s3: health: enabled: true

sqs: health: enabled: true ```

Metrics

No configuration is required other than to make certain the micronaut-micrometer library is on your classpath (along with any micrometer specific implementation -- prometheus, cloudwatch, datadog, etc)

Each cloud proxy function call will be instrumented with timer and counter metrics and will be named with the following convention:

<cloud-feature>.<function-name>.<metric>

For example:

s3.listfolders.time

There is also a corresponding error timer for the failed calls (s3.listfolders.time.error)

To view the details of this metric, you can perform a GET request to your service endpoint with the path of /metrics/<metric-name>.

For example: GET /metrics/sqs.receivemessage.time returns:

json { "baseUnit": "seconds", "measurements": [ { "statistic": "COUNT", "value": 904.0 }, { "statistic": "TOTAL_TIME", "value": 4525.5659989 }, { "statistic": "MAX", "value": 5.006728281 } ], "name": "sqs.receivemessage.time" }

Code injection

The decision of which cloud provider implementation to use is driven by the inclusion of the aws: or azure: root properties inside of the application.yaml. Once that's configured, one only needs to inject the interface, like so:

For Storage: ```kotlin class FooService(private val storageClient: CloudStorage) {

fun doSomething() {
    storageClient.listFolders().forEach(::println)
}

} ```

For Messaging: ```kotlin class BarService(private val messagingClient: CloudMessaging) {

fun doSomething() {
    messagingClient.listQueues("abc-prefix").forEach(::println)
}

} ```

Owner

  • Name: Centers for Disease Control and Prevention
  • Login: CDCgov
  • Kind: organization
  • Email: data@cdc.gov
  • Location: Atlanta, GA

CDC's collaborative software projects to protect America from health, safety, and security threats, both foreign and in the U.S.

GitHub Events

Total
  • Fork event: 2
Last Year
  • Fork event: 2

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • marcia-schulman (4)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

build/tmp/expandedArchives/org.jacoco.agent-0.8.7.jar_3a83c50b4a016f281c4e9f3500d16b55/META-INF/maven/org.jacoco/org.jacoco.agent/pom.xml maven
build.gradle maven
  • io.micronaut:micronaut-runtime-groovy * compile
  • io.micronaut:micronaut-inject-groovy * compileOnly
  • com.azure:azure-storage-blob 12.22.1 implementation
  • com.azure:azure-storage-queue 12.15.3 implementation
  • com.jayway.jsonpath:json-path 2.7.0 implementation
  • io.micronaut.aws:micronaut-aws-sdk-v2 * implementation
  • io.micronaut.micrometer:micronaut-micrometer-core * implementation
  • io.micronaut:micronaut-inject * implementation
  • io.micronaut:micronaut-management * implementation
  • io.micronaut:micronaut-runtime * implementation
  • io.micronaut:micronaut-validation * implementation
  • io.projectreactor:reactor-core 3.4.19 implementation
  • javax.annotation:javax.annotation-api * implementation
  • javax.inject:javax.inject 1 implementation
  • org.jetbrains.kotlin:kotlin-reflect * implementation
  • org.jetbrains.kotlin:kotlin-stdlib * implementation
  • software.amazon.awssdk:s3 * implementation
  • software.amazon.awssdk:sqs * implementation
  • software.amazon.awssdk:sts * implementation
  • ch.qos.logback:logback-classic 1.4.7 runtimeOnly
  • com.fasterxml.jackson.module:jackson-module-kotlin * runtimeOnly
  • io.grpc:grpc-netty-shaded 1.53.0 runtimeOnly
  • io.micronaut.test:micronaut-test-junit5 $micronautVersion testImplementation
  • io.micronaut.test:micronaut-test-spock * testImplementation
  • org.junit.jupiter:junit-jupiter-api $junitVersion testImplementation
  • io.netty:netty-tcnative-boringssl-static 2.0.53.Final testRuntimeOnly
  • org.junit.jupiter:junit-jupiter-engine $junitVersion testRuntimeOnly