agent/taskresource/asmsecret/asmsecret.go
func (secret *ASMSecretResource) retrieveASMSecretValue(apiSecret apicontainer.Secret, iamCredentials credentials.IAMRoleCredentials, wg *sync.WaitGroup, errorEvents chan error) {
	defer wg.Done()

	asmClient := secret.asmClientCreator.NewASMClient(apiSecret.Region, iamCredentials)
	seelog.Infof("ASM secret resource: retrieving resource for secret %v in region %s for task: [%s]", apiSecret.ValueFrom, apiSecret.Region, secret.taskARN)
	//for asm secret, ValueFrom can be arn or name
	secretValue, err := asm.GetSecretFromASM(apiSecret.ValueFrom, asmClient)
	if err != nil {
		errorEvents <- fmt.Errorf("fetching secret data from AWS Secrets Manager in region %s: %v", apiSecret.Region, err)
		return
	}

	secret.lock.Lock()
	defer secret.lock.Unlock()

	// put secret value in secretData
	secretKey := apiSecret.GetSecretResourceCacheKey()
	secret.secretData[secretKey] = secretValue
}
func (secret *ASMSecretResource) retrieveASMSecretValue(apiSecret apicontainer.Secret, iamCredentials credentials.IAMRoleCredentials, wg *sync.WaitGroup, errorEvents chan error) {
	defer wg.Done()

	asmClient := secret.asmClientCreator.NewASMClient(apiSecret.Region, iamCredentials)
	seelog.Infof("ASM secret resource: retrieving resource for secret %v in region %s for task: [%s]", apiSecret.ValueFrom, apiSecret.Region, secret.taskARN)
	//for asm secret, ValueFrom can be arn or name
	secretValue, err := asm.GetSecretFromASM(apiSecret.ValueFrom, asmClient)
	if err != nil {
		errorEvents <- fmt.Errorf("fetching secret data from AWS Secrets Manager in region %s: %v", apiSecret.Region, err)
		return
	}

	secret.lock.Lock()
	defer secret.lock.Unlock()

	// put secret value in secretData
	secretKey := apiSecret.GetSecretResourceCacheKey()
	secret.secretData[secretKey] = secretValue
}
func ( secret * ASMSecretResource ) retrieveASMSecretValue ( apiSecret apicontainer . Secret , iamCredentials credentials . IAMRoleCredentials , wg * sync . WaitGroup , errorEvents chan error ) { defer wg . Done ( ) asmClient := secret . asmClientCreator . NewASMClient ( apiSecret . Region , iamCredentials ) seelog . Infof ( " " , apiSecret . ValueFrom , apiSecret . Region , secret . taskARN ) //for asm secret, ValueFrom can be arn or name secretValue , err := asm . GetSecretFromASM ( apiSecret . ValueFrom , asmClient ) if err != nil { errorEvents <- fmt . Errorf ( " " , apiSecret . Region , err ) return } secret . lock . Lock ( ) defer secret . lock . Unlock ( ) // put secret value in secretData secretKey := apiSecret . GetSecretResourceCacheKey ( ) secret . secretData [ secretKey ] = secretValue }
// retrieveASMSecretValue reads secret value from cache first, if not exists, call GetSecretFromASM to retrieve value
// AWS secrets Manager
retrieveASMSecretValue reads secret value from cache first if not exists call GetSecretFromASM to retrieve value AWS secrets Manager