Skip to content

Commit

Permalink
Formatting update.
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 7760345 commit f949330
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
10 changes: 6 additions & 4 deletions modules/grpc/common/credentials/grpc-credentials-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,12 @@ ClientCredentialsBuilder::build() const
case GCAM_ADC:
return ::grpc::GoogleDefaultCredentials();
case GCAM_SERVICE_ACCOUNT:
{
{
auto channel_creds = ::grpc::SslCredentials(::grpc::SslCredentialsOptions());
auto call_creds = ::grpc::ServiceAccountJWTAccessCredentials(service_account_key, service_account_validity_duration);
auto call_creds = ::grpc::ServiceAccountJWTAccessCredentials(service_account_key,
service_account_validity_duration);
return ::grpc::CompositeChannelCredentials(channel_creds, call_creds);
}
}
default:
g_assert_not_reached();
}
Expand Down Expand Up @@ -316,7 +317,8 @@ grpc_client_credentials_builder_service_account_set_key(GrpcClientCredentialsBui
}

void
grpc_client_credentials_builder_service_account_set_validity_duration (GrpcClientCredentialsBuilderW *s, guint64 validity_duration)
grpc_client_credentials_builder_service_account_set_validity_duration(GrpcClientCredentialsBuilderW *s,
guint64 validity_duration)
{
s->self->set_service_account_validity_duration(validity_duration);
}
6 changes: 4 additions & 2 deletions modules/grpc/common/credentials/grpc-credentials-builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ gboolean grpc_client_credentials_builder_set_tls_key_path(GrpcClientCredentialsB
gboolean grpc_client_credentials_builder_set_tls_cert_path(GrpcClientCredentialsBuilderW *s, const gchar *cert_path);
void grpc_client_credentials_builder_add_alts_target_service_account(GrpcClientCredentialsBuilderW *s,
const gchar *target_service_account);
gboolean grpc_client_credentials_builder_service_account_set_key(GrpcClientCredentialsBuilderW *s, const gchar *key_path);
void grpc_client_credentials_builder_service_account_set_validity_duration (GrpcClientCredentialsBuilderW *s, guint64 validity_duration);
gboolean grpc_client_credentials_builder_service_account_set_key(GrpcClientCredentialsBuilderW *s,
const gchar *key_path);
void grpc_client_credentials_builder_service_account_set_validity_duration(GrpcClientCredentialsBuilderW *s,
guint64 validity_duration);

#include "compat/cpp-end.h"

Expand Down
8 changes: 6 additions & 2 deletions modules/grpc/common/credentials/grpc-credentials-builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ class ClientCredentialsBuilder
/* ALTS */
::grpc::experimental::AltsCredentialsOptions alts_credentials_options;

std::string service_account_key;
guint64 service_account_validity_duration = 3600L;
/* SERVICE ACCOUNT */
struct
{
std::string key;
guint64 validity_duration = 3600L;
} service_account;
};

}
Expand Down
2 changes: 0 additions & 2 deletions modules/grpc/common/grpc-grammar.ym
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
*
*/

// TODO ktomi

/* START_DECLS */

%code {
Expand Down

0 comments on commit f949330

Please sign in to comment.