目录
Sumit Rawat

chore: update PR template (#129)

Description

Why is this change being made?

  1. Standardize the PR process by adding reviewee and reviewer checklists that ensure consistent validation steps, improve code quality, and make reviews more efficient.

What is changing?

  1. Setting up change review template for the repo.
  • Issue #, if available: N/A

Testing

How was this tested?

  1. Validated the MD preview. The template needs to be merged to the main branch to be auto applied.

When testing locally, provide testing artifact(s):

  1. N/A

Reviewee Checklist

Update the checklist after submitting the PR

  • I have reviewed, tested and understand all changes If not, why:
  • I have filled out the Description and Testing sections above If not, why:
  • Build and Unit tests are passing If not, why:
  • Unit test coverage check is passing If not, why:
  • Integration tests pass locally If not, why: Just an MD update. No code changes.
  • I have updated integration tests (if needed) If not, why: Just an MD update. No code changes.
  • I have ensured no sensitive information is leaking (i.e., no logging of sensitive fields, or otherwise) If not, why:
  • I have added explanatory comments for complex logic, new classes/methods and new tests If not, why: Just an MD update. No code changes.
  • I have updated README/documentation (if needed) If not, why: No relevant doc changes required.
  • I have clearly called out breaking changes (if any) If not, why: Just an MD update. No code changes.

Reviewer Checklist

All reviewers please ensure the following are true before reviewing:

  • Reviewee checklist has been accurately filled out
  • Code changes align with stated purpose in description
  • Test coverage adequately validates the changes

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

1个月前41次提交

AWS Secrets Manager Go Caching Client

Go Reference Tests codecov

The AWS Secrets Manager Go caching client enables in-process caching of secrets for Go applications.

Getting Started

Required Prerequisites

To use this client you must have:

  • A Go development environment

    If you do not have one, go to Golang Getting Started on The Go Programming Language website, then download and install Go.

An Amazon Web Services (AWS) account to access secrets stored in AWS Secrets Manager and use AWS SDK for Go.

  • To create an AWS account, go to Sign In or Create an AWS Account and then choose I am a new user. Follow the instructions to create an AWS account.

  • To create a secret in AWS Secrets Manager, go to Creating Secrets and follow the instructions on that page.

Get Started

The following code sample demonstrates how to get started:

  1. Instantiate the caching client.
  2. Request secret.
// This example shows how an AWS Lambda function can be written
// to retrieve a cached secret from AWS Secrets Manager caching
// client.
package main

import (
    "github.com/aws/aws-lambda-go/lambda"
    "github.com/aws/aws-secretsmanager-caching-go/v2/secretcache"
)

var(
    secretCache, _ = secretcache.New()
)

func HandleRequest(secretId string) string {
    result, _ := secretCache.GetSecretString(secretId)
    // Use secret to connect to secured resource.
    return "Success"
}

func main() {
    lambda.Start(HandleRequest)
}

Cache Configuration

  • MaxCacheSize int The maximum number of cached secrets to maintain before evicting secrets that have not been accessed recently.
  • CacheItemTTL int64 The number of nanoseconds that a cached item is considered valid before requiring a refresh of the secret state. Items that have exceeded this TTL will be refreshed synchronously when requesting the secret value. If the synchronous refresh failed, the stale secret will be returned.
  • VersionStage string The version stage that will be used when requesting the secret values for this cache.
  • Hook CacheHook Used to hook in-memory cache updates.

Instantiating Cache with a custom Config and a custom Client


    //Create a custom secretsmanager client
    client := getCustomClient()

    //Create a custom CacheConfig struct
    config := secretcache.CacheConfig{
        MaxCacheSize: secretcache.DefaultMaxCacheSize + 10,
        VersionStage: secretcache.DefaultVersionStage,
        CacheItemTTL: secretcache.DefaultCacheItemTTL,
    }
    
    //Instantiate the cache
    cache, _ := secretcache.New(
        func(c *secretcache.Cache) { c.CacheConfig = config },
        func(c *secretcache.Cache) { c.Client = client },
    )

Getting Help

Please use these community resources for getting help:

License

This library is licensed under the Apache 2.0 License.

关于
305.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号