Code Monkey home page Code Monkey logo

alibabacloud-secretsmanager-client-java's Introduction

Aliyun Secrets Manager Client for Java

GitHub version Build Status

The Aliyun Secrets Manager Client for Java enables Java developers to easily work with Aliyun KMS Secrets. You can get started in minutes using Maven .

Read this in other languages: English, 简体中文

License

Apache License 2.0

Features

  • Provide quick integration capability to gain secret information
  • Provide Alibaba secrets cache ( memory cache or encryption file cache )
  • Provide tolerated disaster by the secrets with the same secret name and secret data in different regions
  • Provide default backoff strategy and user-defined backoff strategy

Requirements

  • Java 1.8 or later
  • Maven

Install

The recommended way to use the Aliyun Secrets Manager Client for Java in your project is to consume it from Maven. Import as follows:

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>alibabacloud-secretsmanager-client</artifactId>
    <version>1.0.0</version>
</dependency>

Build

Once you check out the code from GitHub, you can build it using Maven. Use the following command to build:

mvn clean install -DskipTests -Dgpg.skip=true

Sample Code

Ordinary User Sample Code

    SecretCacheClient client = SecretCacheClientBuilder.newClient();  
    SecretInfo secretInfo = client.getSecretInfo("#secretName#");
  • Build Secrets Manager Client by the given parameters(accessKey, accessSecret, regionId, etc)
    SecretCacheClient client = SecretCacheClientBuilder.newCacheClientBuilder(
                 BaseSecretManagerClientBuilder.standard().withCredentialsProvider(CredentialsProviderUtils  
                 .withAccessKey("#accessKeyId#", "#accessKeySecret#")).withRegion("#regionId#").build()).build();  
    SecretInfo secretInfo = client.getSecretInfo("#secretName#");

Particular User Sample Code

  • Use custom parameters or customized implementation
   SecretCacheClient client = SecretCacheClientBuilder.newCacheClientBuilder(BaseSecretManagerClientBuilder.standard()  
                          .withCredentialsProvider(CredentialsProviderUtils.withAccessKey("#accessKeyId#", "#accessKeySecret#"))   
                          .withRegion("#regionId#").withBackoffStrategy(new FullJitterBackoffStrategy(3, 2000, 10000)).build())  
                          .withCacheSecretStrategy(new FileCacheSecretStoreStrategy("#cacheSecretPath#", true,"#salt#")).withRefreshSecretStrategy(new DefaultRefreshSecretStrategy("#ttlName#"))  
                           .withCacheStage("#stage#").withSecretTTL("#secretName#", 1 * 60 * 1000l).withSecretTTL("#secretName1#", 2 * 60 * 1000l).build();  
   SecretInfo secretInfo = client.getSecretInfo("#secretName#");

alibabacloud-secretsmanager-client-java's People

Contributors

alibaba-oss avatar yingzhi-aliyun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.