コード例 #1
0
        internal async IAsyncEnumerable <string> ListSecretsAsync()
        {
            var response = m_client.ListSecretsAsync($"projects/{m_projectId}");

            await foreach (var item in response)
            {
                yield return(item.SecretName.SecretId);
            }
        }
コード例 #2
0
        private async Task LoadAsync()
        {
            logger.LogDebug($"Loading secrets from project: {projectName}");

            var secrets = client.ListSecretsAsync(projectName);

            await foreach (var secret in secrets)
            {
                var secretVersionName = new SecretVersionName(secret.SecretName.ProjectId, secret.SecretName.SecretId, "latest");

                logger.LogDebug($"Loading secret: {secretVersionName}");

                var version = await client.AccessSecretVersionAsync(secretVersionName);

                var payload = version.Payload.Data.ToStringUtf8();

                Data.Add(secret.SecretName.SecretId, payload);
            }
        }