Java CF Env S3 Support Library

Library to obtain credentials of AWS/S3 in Cloudfoundry

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

de.hdi.cfenv
Идентификатор

Идентификатор

java-cfenv-s3
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Java CF Env S3 Support Library
Library to obtain credentials of AWS/S3 in Cloudfoundry
Ссылка на сайт

Ссылка на сайт

https://github.com/hdisysteme/java-cfenv-s3
Система контроля версий

Система контроля версий

https://github.com/hdisysteme/java-cfenv-s3/tree/main

Скачать java-cfenv-s3

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/de.hdi.cfenv/java-cfenv-s3/ -->
<dependency>
    <groupId>de.hdi.cfenv</groupId>
    <artifactId>java-cfenv-s3</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/de.hdi.cfenv/java-cfenv-s3/
implementation 'de.hdi.cfenv:java-cfenv-s3:1.0.0'
// https://jarcasting.com/artifacts/de.hdi.cfenv/java-cfenv-s3/
implementation ("de.hdi.cfenv:java-cfenv-s3:1.0.0")
'de.hdi.cfenv:java-cfenv-s3:jar:1.0.0'
<dependency org="de.hdi.cfenv" name="java-cfenv-s3" rev="1.0.0">
  <artifact name="java-cfenv-s3" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.hdi.cfenv', module='java-cfenv-s3', version='1.0.0')
)
libraryDependencies += "de.hdi.cfenv" % "java-cfenv-s3" % "1.0.0"
[de.hdi.cfenv/java-cfenv-s3 "1.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
io.pivotal.cfenv : java-cfenv-boot jar 2.2.2.RELEASE

test (2)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter jar 5.6.2
org.mockito : mockito-core jar 3.3.3

Модули Проекта

Данный проект не имеет модулей.

java-cfenv-s3

This spring boot library allows easy access to the Cloud Foundry VCAP variables for an S3 bucket, without the values having to be stored as plain text.

Use Case

A spring boot application in Cloud Foundry uses an S3 bucket to store data. The data can only be read and written once the application has been authenticated on the S3 bucket. The data for authentication can be easily determined with the help of this library.

Limitation: This library currently only supports one S3 bucket per app.

HowTo

Embed Maven-Dependency

The following dependency-Entry is required:

<dependency>
  <groupId>de.hdi.cfenv</groupId>
  <artifactId>java-cfenv-s3</artifactId>
  <version>1.0.0</version>
</dependency>

Example

There are two options to gather the S3-Information

  1. Using application Properties
  2. Using the class CfEnvS3

A bean of the type CfEnvS3 must be created for both variants. To get an instance, a method annotated with @Bean is recommended, which must be passed an instance of org.springframework.core.env.Environment:

@Bean
public CfEnvS3 cfEnvS3(Environment environment) {
	return new CfEnvS3(environment);
}

Properties

The S3 information can be determined as usual using the following properties:

  • cfenv.s3.accessKeyId
  • cfenv.s3.secretKey
  • cfenv.s3.region
  • cfenv.s3.bucket

However, these properties must not be present in the application.yml, because the dynamically determined values ​​would be overwritten.

The S3 properties are then accessed via member variables or formal parameters that are annotated with @Value:

@Value("${cfenv.s3.accessKeyId}")
private String accessKeyId;

@Value("${cfenv.s3.secretKey}")
private String secretAccessKey;

@Value("${cfenv.s3.region}")
private String region;

@Value("${cfenv.s3.bucket}")
private String bucket;

CfEnvS3

Alternatively, you can also have an instance of the type CfEnvS3 injected directly and access the S3 information via the getters:

  • public String getRegion()
  • public String getAccessKeyId()
  • public SecretAccessKey getSecretAccessKey()
  • public String getBucket()
de.hdi.cfenv

HDI Systeme AG

HDI Systeme AG. "We (de)code insurance."

Версии библиотеки

Версия
1.0.0