Class: SDM::Cassandra

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, name: nil, healthy: nil, hostname: nil, username: nil, password: nil, port_override: nil, port: nil, tls_required: nil) ⇒ Cassandra

Returns a new instance of Cassandra.



781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
# File 'lib/models/porcelain.rb', line 781

def initialize(
  id: nil,
  name: nil,
  healthy: nil,
  hostname: nil,
  username: nil,
  password: nil,
  port_override: nil,
  port: nil,
  tls_required: nil
)
  if id != nil
    @id = id
  end
  if name != nil
    @name = name
  end
  if healthy != nil
    @healthy = healthy
  end
  if hostname != nil
    @hostname = hostname
  end
  if username != nil
    @username = username
  end
  if password != nil
    @password = password
  end
  if port_override != nil
    @port_override = port_override
  end
  if port != nil
    @port = port
  end
  if tls_required != nil
    @tls_required = tls_required
  end
end

Instance Attribute Details

#healthyObject

True if the datasource is reachable and the credentials are valid.



767
768
769
# File 'lib/models/porcelain.rb', line 767

def healthy
  @healthy
end

#hostnameObject

Returns the value of attribute hostname.



769
770
771
# File 'lib/models/porcelain.rb', line 769

def hostname
  @hostname
end

#idObject

Unique identifier of the Resource.



763
764
765
# File 'lib/models/porcelain.rb', line 763

def id
  @id
end

#nameObject

Unique human-readable name of the Resource.



765
766
767
# File 'lib/models/porcelain.rb', line 765

def name
  @name
end

#passwordObject

Returns the value of attribute password.



773
774
775
# File 'lib/models/porcelain.rb', line 773

def password
  @password
end

#portObject

Returns the value of attribute port.



777
778
779
# File 'lib/models/porcelain.rb', line 777

def port
  @port
end

#port_overrideObject

Returns the value of attribute port_override.



775
776
777
# File 'lib/models/porcelain.rb', line 775

def port_override
  @port_override
end

#tls_requiredObject

Returns the value of attribute tls_required.



779
780
781
# File 'lib/models/porcelain.rb', line 779

def tls_required
  @tls_required
end

#usernameObject

Returns the value of attribute username.



771
772
773
# File 'lib/models/porcelain.rb', line 771

def username
  @username
end

Instance Method Details

#to_json(options = {}) ⇒ Object



821
822
823
824
825
826
827
# File 'lib/models/porcelain.rb', line 821

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end