type Cache - AWS Secrets Manager

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

type Cache

Secret Manager에서 요청한 보안 암호에 대한 인 메모리 캐시. GetSecretString 또는 GetSecretBinary를 사용하여 캐시에서 보안 암호를 검색합니다.

다음 예제에서는 캐시 설정을 구성하는 방법을 보여줍니다.

// 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 }, )

예제를 포함한 자세한 내용은 클라이언트측 캐싱과 함께 Go를 사용하여 Secrets Manager 비밀 값 가져오기을 참조하세요.

메서드

New

func New(optFns ...func(*Cache)) (*Cache, error)

New는 함수 옵션을 사용하여 보안 암호 캐시를 구성하고, 그렇지 않으면 기본값을 사용합니다. 새 세션에서 SecretsManager 클라이언트를 초기화합니다. 기본값으로 초기화합니다 CacheConfig . LRU 캐시를 기본 최대 크기로 초기화합니다.

GetSecretString

func (c *Cache) GetSecretString(secretId string) (string, error)

GetSecretString 캐시에서 지정된 비밀 ID의 비밀 문자열 값을 가져옵니다. 작업이 실패하면 보안 암호 문자열과 오류를 반환합니다.

GetSecretStringWithStage

func (c *Cache) GetSecretStringWithStage(secretId string, versionStage string) (string, error)

GetSecretStringWithStage 지정된 비밀 ID 및 버전 단계의 캐시에서 비밀 문자열 값을 가져옵니다. 작업이 실패하면 보안 암호 문자열과 오류를 반환합니다.

GetSecretBinary

func (c *Cache) GetSecretBinary(secretId string) ([]byte, error) {

GetSecretBinary 캐시에서 지정된 비밀 ID의 비밀 바이너리 값을 가져옵니다. 보안 암호 이진 값을 반환하고 작업이 실패하면 오류를 반환합니다.

GetSecretBinaryWithStage

func (c *Cache) GetSecretBinaryWithStage(secretId string, versionStage string) ([]byte, error)

GetSecretBinaryWithStage 지정된 시크릿 ID 및 버전 스테이지에 대해 캐시에서 시크릿 바이너리 값을 가져옵니다. 보안 암호 이진 값을 반환하고 작업이 실패하면 오류를 반환합니다.