From 4f506e5efe05fb5f39da0e99ff819f75457e12b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20Kosztyu?= Date: Sat, 7 Dec 2024 11:12:24 +0100 Subject: [PATCH] grpc: add service account configuring to the grammar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tamás Kosztyu --- modules/grpc/common/grpc-grammar.ym | 16 ++++++++++++++++ modules/grpc/common/grpc-parser.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/modules/grpc/common/grpc-grammar.ym b/modules/grpc/common/grpc-grammar.ym index 53b8a81d6..421bf3ca7 100644 --- a/modules/grpc/common/grpc-grammar.ym +++ b/modules/grpc/common/grpc-grammar.ym @@ -52,6 +52,11 @@ GrpcClientCredentialsBuilderW *last_grpc_client_credentials_builder; %token KW_TARGET_SERVICE_ACCOUNTS %token KW_URL %token KW_ADC +%token KW_SERVICE_ACCOUNT +%token KW_TOKEN_VALIDITY_DURATION +%token KW_AUDIENCE +%token KW_SCOPE +%token KW_KEY %token KW_COMPRESSION %token KW_BATCH_BYTES %token KW_CONCURRENT_REQUESTS @@ -211,6 +216,7 @@ grpc_client_credentials_option | KW_TLS { grpc_client_credentials_builder_set_mode(last_grpc_client_credentials_builder, GCAM_TLS); } '(' grpc_client_credentials_builder_tls_options ')' | KW_ALTS { grpc_client_credentials_builder_set_mode(last_grpc_client_credentials_builder, GCAM_ALTS); } '(' grpc_client_credentials_builder_alts_options ')' | KW_ADC { grpc_client_credentials_builder_set_mode(last_grpc_client_credentials_builder, GCAM_ADC); } '(' ')' + | KW_SERVICE_ACCOUNT { grpc_client_credentials_builder_set_mode(last_grpc_client_credentials_builder, GCAM_SERVICE_ACCOUNT); } '(' grpc_client_credentials_builder_service_account_options ')' ; grpc_client_credentials_builder_tls_options @@ -255,6 +261,16 @@ grpc_client_credentials_builder_alts_target_service_accounts | ; +grpc_client_credentials_builder_service_account_options + : grpc_client_credentials_builder_service_account_option grpc_client_credentials_builder_service_account_options + | + ; + +grpc_client_credentials_builder_service_account_option + : KW_KEY '(' path_secret ')' { grpc_client_credentials_builder_service_account_set_key(last_grpc_client_credentials_builder, $3); free($3); } + | KW_TOKEN_VALIDITY_DURATION '(' nonnegative_integer64 ')' { grpc_client_credentials_builder_service_account_set_validity_duration(last_grpc_client_credentials_builder, $3); } + ; + /* END_RULES */ %% diff --git a/modules/grpc/common/grpc-parser.h b/modules/grpc/common/grpc-parser.h index 12b00dde3..3e4daf45c 100644 --- a/modules/grpc/common/grpc-parser.h +++ b/modules/grpc/common/grpc-parser.h @@ -35,6 +35,11 @@ { "url", KW_URL }, \ { "target_service_accounts", KW_TARGET_SERVICE_ACCOUNTS }, \ { "adc", KW_ADC }, \ + { "service_account", KW_SERVICE_ACCOUNT }, \ + { "key", KW_KEY }, \ + { "scope", KW_SCOPE }, \ + { "audience", KW_AUDIENCE }, \ + { "token_validity_duration", KW_TOKEN_VALIDITY_DURATION }, \ { "compression", KW_COMPRESSION }, \ { "batch_bytes", KW_BATCH_BYTES }, \ { "channel_args", KW_CHANNEL_ARGS }, \