Skip to content

Commit

Permalink
grpc: add service account configuring to the grammar
Browse files Browse the repository at this point in the history
Signed-off-by: Tamás Kosztyu <tamas.kosztyu@axoflow.com>
  • Loading branch information
sodomelle committed Dec 7, 2024
1 parent 98f5f57 commit 4f506e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/grpc/common/grpc-grammar.ym
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */

%%
5 changes: 5 additions & 0 deletions modules/grpc/common/grpc-parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 }, \
Expand Down

0 comments on commit 4f506e5

Please sign in to comment.