class GRPC::Core::XdsServerCredentials

Public Class Methods

creds = ServerCredentials.new(fallback_creds) click to toggle source
fallback_creds: (ServerCredentials) fallback credentials to create
XDS credentials.
Initializes ServerCredential instances.
static VALUE grpc_rb_xds_server_credentials_init(VALUE self,
                                                 VALUE fallback_creds) {
  grpc_rb_xds_server_credentials* wrapper = NULL;
  grpc_server_credentials* creds = NULL;

  grpc_server_credentials* grpc_fallback_creds =
      grpc_rb_get_wrapped_server_credentials(fallback_creds);
  creds = grpc_xds_server_credentials_create(grpc_fallback_creds);

  if (creds == NULL) {
    rb_raise(rb_eRuntimeError,
             "the call to grpc_xds_server_credentials_create() failed, could "
             "not create a credentials, see "
             "https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md for "
             "debugging tips");
    return Qnil;
  }
  TypedData_Get_Struct(self, grpc_rb_xds_server_credentials,
                       &grpc_rb_xds_server_credentials_data_type, wrapper);
  wrapper->wrapped = creds;

  /* Add the input objects as hidden fields to preserve them. */
  rb_ivar_set(self, id_fallback_creds, fallback_creds);

  return self;
}