Class: SDM::Postgres

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bind_interface: nil, database: nil, egress_filter: nil, healthy: nil, hostname: nil, id: nil, name: nil, override_database: nil, password: nil, port: nil, port_override: nil, secret_store_id: nil, subdomain: nil, tags: nil, username: nil) ⇒ Postgres

Returns a new instance of Postgres.



8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
# File 'lib/models/porcelain.rb', line 8272

def initialize(
  bind_interface: nil,
  database: nil,
  egress_filter: nil,
  healthy: nil,
  hostname: nil,
  id: nil,
  name: nil,
  override_database: nil,
  password: nil,
  port: nil,
  port_override: nil,
  secret_store_id: nil,
  subdomain: nil,
  tags: nil,
  username: nil
)
  @bind_interface = bind_interface == nil ? "" : bind_interface
  @database = database == nil ? "" : database
  @egress_filter = egress_filter == nil ? "" : egress_filter
  @healthy = healthy == nil ? false : healthy
  @hostname = hostname == nil ? "" : hostname
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @override_database = override_database == nil ? false : override_database
  @password = password == nil ? "" : password
  @port = port == nil ? 0 : port
  @port_override = port_override == nil ? 0 : port_override
  @secret_store_id = secret_store_id == nil ? "" : secret_store_id
  @subdomain = subdomain == nil ? "" : subdomain
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
  @username = username == nil ? "" : username
end

Instance Attribute Details

#bind_interfaceObject

The bind interface is the IP address to which the port override of a resource is bound (for example, 127.0.0.1). It is automatically generated if not provided.



8242
8243
8244
# File 'lib/models/porcelain.rb', line 8242

def bind_interface
  @bind_interface
end

#databaseObject

The initial database to connect to. This setting does not by itself prevent switching to another database after connecting.



8244
8245
8246
# File 'lib/models/porcelain.rb', line 8244

def database
  @database
end

#egress_filterObject

A filter applied to the routing logic to pin datasource to nodes.



8246
8247
8248
# File 'lib/models/porcelain.rb', line 8246

def egress_filter
  @egress_filter
end

#healthyObject

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



8248
8249
8250
# File 'lib/models/porcelain.rb', line 8248

def healthy
  @healthy
end

#hostnameObject

The host to dial to initiate a connection from the egress node to this resource.



8250
8251
8252
# File 'lib/models/porcelain.rb', line 8250

def hostname
  @hostname
end

#idObject

Unique identifier of the Resource.



8252
8253
8254
# File 'lib/models/porcelain.rb', line 8252

def id
  @id
end

#nameObject

Unique human-readable name of the Resource.



8254
8255
8256
# File 'lib/models/porcelain.rb', line 8254

def name
  @name
end

#override_databaseObject

If set, the database configured cannot be changed by users. This setting is not recommended for most use cases, as some clients will insist their database has changed when it has not, leading to user confusion.



8256
8257
8258
# File 'lib/models/porcelain.rb', line 8256

def override_database
  @override_database
end

#passwordObject

The password to authenticate with.



8258
8259
8260
# File 'lib/models/porcelain.rb', line 8258

def password
  @password
end

#portObject

The port to dial to initiate a connection from the egress node to this resource.



8260
8261
8262
# File 'lib/models/porcelain.rb', line 8260

def port
  @port
end

#port_overrideObject

The local port used by clients to connect to this resource.



8262
8263
8264
# File 'lib/models/porcelain.rb', line 8262

def port_override
  @port_override
end

#secret_store_idObject

ID of the secret store containing credentials for this resource, if any.



8264
8265
8266
# File 'lib/models/porcelain.rb', line 8264

def secret_store_id
  @secret_store_id
end

#subdomainObject

Subdomain is the local DNS address. (e.g. app-prod1 turns into app-prod1.your-org-name.sdm.network)



8266
8267
8268
# File 'lib/models/porcelain.rb', line 8266

def subdomain
  @subdomain
end

#tagsObject

Tags is a map of key, value pairs.



8268
8269
8270
# File 'lib/models/porcelain.rb', line 8268

def tags
  @tags
end

#usernameObject

The username to authenticate with.



8270
8271
8272
# File 'lib/models/porcelain.rb', line 8270

def username
  @username
end

Instance Method Details

#to_json(options = {}) ⇒ Object



8306
8307
8308
8309
8310
8311
8312
# File 'lib/models/porcelain.rb', line 8306

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