Class: Couchbase::Protostellar::ConnectOptions Private

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/protostellar/connect_options.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeouts: Timeouts.new, username: nil, password: nil, root_certificates: nil, client_certificate: nil, private_key: nil) ⇒ ConnectOptions

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ConnectOptions.

API:

  • private



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/couchbase/protostellar/connect_options.rb', line 27

def initialize(timeouts: Timeouts.new,
               username: nil,
               password: nil,
               root_certificates: nil,
               client_certificate: nil,
               private_key: nil)
  @timeouts = timeouts
  @username = username
  @password = password
  @root_certificates = root_certificates
  @client_certificate = client_certificate
  @private_key = private_key
end

Instance Attribute Details

#timeoutsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



25
26
27
# File 'lib/couchbase/protostellar/connect_options.rb', line 25

def timeouts
  @timeouts
end

Instance Method Details

#grpc_call_metadataObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



50
51
52
53
54
55
56
# File 'lib/couchbase/protostellar/connect_options.rb', line 50

def 
  if @username && @password
    {"authorization" => ["Basic #{Base64.strict_encode64("#{@username}:#{@password}")}"]}
  else
    {}
  end
end

#grpc_channel_argsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



58
59
60
# File 'lib/couchbase/protostellar/connect_options.rb', line 58

def grpc_channel_args
  {}
end

#grpc_credentialsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



41
42
43
44
45
46
47
48
# File 'lib/couchbase/protostellar/connect_options.rb', line 41

def grpc_credentials
  if @root_certificates
    GRPC::Core::ChannelCredentials.new(@root_certificates, @client_certificate, @private_key)
  else
    # Use default certificates
    GRPC::Core::ChannelCredentials.new(nil, @client_certificate, @private_key)
  end
end