Class: LinodeOpenapiClient::PostDomainRecord200Response

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

Overview

A single record on a Domain.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PostDomainRecord200Response

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 134

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `LinodeOpenapiClient::PostDomainRecord200Response` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `LinodeOpenapiClient::PostDomainRecord200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.key?(:'tag')
    self.tag = attributes[:'tag']
  end

  if attributes.key?(:'protocol')
    self.protocol = attributes[:'protocol']
  end

  if attributes.key?(:'target')
    self.target = attributes[:'target']
  end

  if attributes.key?(:'service')
    self.service = attributes[:'service']
  end

  if attributes.key?(:'priority')
    self.priority = attributes[:'priority']
  end

  if attributes.key?(:'ttl_sec')
    self.ttl_sec = attributes[:'ttl_sec']
  end

  if attributes.key?(:'port')
    self.port = attributes[:'port']
  end

  if attributes.key?(:'weight')
    self.weight = attributes[:'weight']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'updated')
    self.updated = attributes[:'updated']
  end
end

Instance Attribute Details

#createdObject

Read-only When this Domain Record was created.



23
24
25
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 23

def created
  @created
end

#idObject

Read-only This Record’s unique ID.



20
21
22
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 20

def id
  @id
end

#nameObject

__Filterable__ The name of this Record. For requests, this property’s actual usage and whether it is required depends on the type of record this represents: ‘A` and `AAAA`: The hostname or FQDN of the Record. `NS`: The subdomain, if any, to use with the Domain of the Record. Wildcard NS records (`*`) are not supported. `MX`: The mail subdomain. For example, `sub` for the address `[email protected]` under the `example.com` Domain. - The left-most subdomain component may be an asterisk (`*`) to designate a wildcard subdomain. - Other subdomain components must only contain letters, digits, and hyphens, start with a letter, end with a letter or digit, and contain less than 64 characters. - Must be an empty string (`""`) for a Null MX Record. `CNAME`: The hostname. Must be unique. Required. `TXT`: The hostname. `SRV`: Unused. Use the `service` property to set the service name for this record. `CAA`: The subdomain. Omit or enter an empty string (`""`) to apply to the entire Domain. `PTR`: See our guide on how to [Configure Your Linode for Reverse DNS (rDNS)](www.linode.com/docs/guides/configure-rdns/).



26
27
28
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 26

def name
  @name
end

#portObject

The port this Record points to. Only valid and required for SRV record requests.



47
48
49
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 47

def port
  @port
end

#priorityObject

The priority of the target host for this Record. Lower values are preferred. Only valid for MX and SRV record requests. Required for SRV record requests. Defaults to ‘0` for MX record requests. Must be `0` for Null MX records.



41
42
43
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 41

def priority
  @priority
end

#protocolObject

The protocol this Record’s service communicates with. An underscore (‘_`) is prepended automatically to the submitted value for this property. Only valid for SRV record requests.



32
33
34
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 32

def protocol
  @protocol
end

#serviceObject

The name of the service. An underscore (‘_`) is prepended and a period (`.`) is appended automatically to the submitted value for this property. Only valid and required for SRV record requests.



38
39
40
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 38

def service
  @service
end

#tagObject

__Filterable__ The tag portion of a CAA record. Only valid and required for CAA record requests.



29
30
31
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 29

def tag
  @tag
end

#targetObject

__Filterable__ The target for this Record. For requests, this property’s actual usage and whether it is required depends on the type of record this represents: ‘A` and `AAAA`: The IP address. Use `[remote_addr]` to submit the IPv4 address of the request. Required. `NS`: The name server. Must be a valid domain. Required. `MX`: The mail server. Must be a valid domain unless creating a Null MX Record. Required. - Must have less than 254 total characters. - The left-most domain component may be an asterisk (`*`) to designate a wildcard domain. - Other domain components must only contain letters, digits, and hyphens, start with a letter, end with a letter or digit, and contain less than 64 characters. - To create a [Null MX Record](datatracker.ietf.org/doc/html/rfc7505), first [remove](techdocs.akamai.com/linode-api/reference/delete-domain-record) any additional MX records, then create an MX record with empty strings (`""`) for the `target` and `name`. If a Domain has a Null MX record, new MX records cannot be created. `CNAME`: The alias. Must be a valid domain. Required. `TXT`: The value. Required. `SRV`: The target domain or subdomain. If a subdomain is entered, it is automatically used with the Domain. To configure for a different domain, enter a valid FQDN. For example, the value `www` with a Domain for `example.com` results in a target set to `www.example.com`, whereas the value `sample.com` results in a target set to `sample.com`. Required. `CAA`: The value. For `issue` or `issuewild` tags, the domain of your certificate issuer. For the `iodef` tag, a contact or submission URL (domain, http, https, or mailto). Requirements depend on the tag for this record: - `issue`: The domain of your certificate issuer. Must include a valid domain. May include additional parameters separated with semicolons (`;`), for example: `www.example.com; foo=bar` - `issuewild`: The domain of your wildcard certificate issuer. Must be a valid domain and must not start with an asterisk (`*`). - `iodef`: Must be either (1) a valid domain, (2) a valid domain prepended with `http://` or `https://`, or (3) a valid email address prepended with `mailto:`. `PTR`: Required. See our guide on how to [Configure Your Linode for Reverse DNS (rDNS)](www.linode.com/docs/guides/configure-rdns/). With the exception of A, AAAA, and CAA records, this field accepts a trailing period.



35
36
37
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 35

def target
  @target
end

#ttl_secObject

"Time to Live" - the amount of time in seconds that this Domain’s records may be cached by resolvers or other domain servers. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to the nearest valid value.



44
45
46
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 44

def ttl_sec
  @ttl_sec
end

#typeObject

__Filterable__ The type of Record this is in the DNS system. For example, A records associate a domain name with an IPv4 address, and AAAA records associate a domain name with an IPv6 address. For more information, see the guides on [DNS Record Types](www.linode.com/docs/products/networking/dns-manager/guides/#dns-record-types).



53
54
55
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 53

def type
  @type
end

#updatedObject

Read-only When this Domain Record was last updated.



56
57
58
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 56

def updated
  @updated
end

#weightObject

The relative weight of this Record used in the case of identical priority. Higher values are preferred. Only valid and required for SRV record requests.



50
51
52
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 50

def weight
  @weight
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 429

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = LinodeOpenapiClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



100
101
102
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 100

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 81

def self.attribute_map
  {
    :'id' => :'id',
    :'created' => :'created',
    :'name' => :'name',
    :'tag' => :'tag',
    :'protocol' => :'protocol',
    :'target' => :'target',
    :'service' => :'service',
    :'priority' => :'priority',
    :'ttl_sec' => :'ttl_sec',
    :'port' => :'port',
    :'weight' => :'weight',
    :'type' => :'type',
    :'updated' => :'updated'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 405

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



124
125
126
127
128
129
130
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 124

def self.openapi_nullable
  Set.new([
    :'tag',
    :'protocol',
    :'service',
  ])
end

.openapi_typesObject

Attribute type mapping.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 105

def self.openapi_types
  {
    :'id' => :'Integer',
    :'created' => :'Time',
    :'name' => :'String',
    :'tag' => :'String',
    :'protocol' => :'String',
    :'target' => :'String',
    :'service' => :'String',
    :'priority' => :'Integer',
    :'ttl_sec' => :'Integer',
    :'port' => :'Integer',
    :'weight' => :'Integer',
    :'type' => :'String',
    :'updated' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 372

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      created == o.created &&
      name == o.name &&
      tag == o.tag &&
      protocol == o.protocol &&
      target == o.target &&
      service == o.service &&
      priority == o.priority &&
      ttl_sec == o.ttl_sec &&
      port == o.port &&
      weight == o.weight &&
      type == o.type &&
      updated == o.updated
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 500

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


392
393
394
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 392

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



398
399
400
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 398

def hash
  [id, created, name, tag, protocol, target, service, priority, ttl_sec, port, weight, type, updated].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 202

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@name.nil? && @name.to_s.length > 100
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
  end

  if !@name.nil? && @name.to_s.length < 1
    invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
  end

  if !@target.nil? && @target.to_s.length > 65535
    invalid_properties.push('invalid value for "target", the character length must be smaller than or equal to 65535.')
  end

  if !@priority.nil? && @priority > 255
    invalid_properties.push('invalid value for "priority", must be smaller than or equal to 255.')
  end

  if !@priority.nil? && @priority < 0
    invalid_properties.push('invalid value for "priority", must be greater than or equal to 0.')
  end

  if !@port.nil? && @port > 65535
    invalid_properties.push('invalid value for "port", must be smaller than or equal to 65535.')
  end

  if !@port.nil? && @port < 0
    invalid_properties.push('invalid value for "port", must be greater than or equal to 0.')
  end

  if !@weight.nil? && @weight > 65535
    invalid_properties.push('invalid value for "weight", must be smaller than or equal to 65535.')
  end

  if !@weight.nil? && @weight < 0
    invalid_properties.push('invalid value for "weight", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



476
477
478
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 476

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 482

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



470
471
472
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 470

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/linode_openapi_client/models/post_domain_record200_response.rb', line 246

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@name.nil? && @name.to_s.length > 100
  return false if !@name.nil? && @name.to_s.length < 1
  tag_validator = EnumAttributeValidator.new('String', ["issue", "issuewild", "iodef"])
  return false unless tag_validator.valid?(@tag)
  return false if !@target.nil? && @target.to_s.length > 65535
  return false if !@priority.nil? && @priority > 255
  return false if !@priority.nil? && @priority < 0
  return false if !@port.nil? && @port > 65535
  return false if !@port.nil? && @port < 0
  return false if !@weight.nil? && @weight > 65535
  return false if !@weight.nil? && @weight < 0
  type_validator = EnumAttributeValidator.new('String', ["A", "AAAA", "NS", "MX", "CNAME", "TXT", "SRV", "PTR", "CAA"])
  return false unless type_validator.valid?(@type)
  true
end