|
| 1 | +=begin |
| 2 | +#Datadog API V2 Collection |
| 3 | +
|
| 4 | +#Collection of all Datadog Public endpoints. |
| 5 | +
|
| 6 | +The version of the OpenAPI document: 1.0 |
| 7 | + |
| 8 | +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator |
| 9 | +
|
| 10 | + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 11 | + This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 12 | + Copyright 2020-Present Datadog, Inc. |
| 13 | +
|
| 14 | +=end |
| 15 | + |
| 16 | +require 'date' |
| 17 | +require 'time' |
| 18 | + |
| 19 | +module DatadogAPIClient::V2 |
| 20 | + # Represents a user object in the context of an escalation policy, including their `id`, type, and basic attributes. |
| 21 | + class EscalationPolicyUser |
| 22 | + include BaseGenericModel |
| 23 | + |
| 24 | + # Provides basic user information for an escalation policy, including a name and email address. |
| 25 | + attr_accessor :attributes |
| 26 | + |
| 27 | + # The unique user identifier. |
| 28 | + attr_accessor :id |
| 29 | + |
| 30 | + # Users resource type. |
| 31 | + attr_reader :type |
| 32 | + |
| 33 | + attr_accessor :additional_properties |
| 34 | + |
| 35 | + # Attribute mapping from ruby-style variable name to JSON key. |
| 36 | + # @!visibility private |
| 37 | + def self.attribute_map |
| 38 | + { |
| 39 | + :'attributes' => :'attributes', |
| 40 | + :'id' => :'id', |
| 41 | + :'type' => :'type' |
| 42 | + } |
| 43 | + end |
| 44 | + |
| 45 | + # Attribute type mapping. |
| 46 | + # @!visibility private |
| 47 | + def self.openapi_types |
| 48 | + { |
| 49 | + :'attributes' => :'EscalationPolicyUserAttributes', |
| 50 | + :'id' => :'String', |
| 51 | + :'type' => :'EscalationPolicyUserType' |
| 52 | + } |
| 53 | + end |
| 54 | + |
| 55 | + # Initializes the object |
| 56 | + # @param attributes [Hash] Model attributes in the form of hash |
| 57 | + # @!visibility private |
| 58 | + def initialize(attributes = {}) |
| 59 | + if (!attributes.is_a?(Hash)) |
| 60 | + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EscalationPolicyUser` initialize method" |
| 61 | + end |
| 62 | + |
| 63 | + self.additional_properties = {} |
| 64 | + # check to see if the attribute exists and convert string to symbol for hash key |
| 65 | + attributes = attributes.each_with_object({}) { |(k, v), h| |
| 66 | + if (!self.class.attribute_map.key?(k.to_sym)) |
| 67 | + self.additional_properties[k.to_sym] = v |
| 68 | + else |
| 69 | + h[k.to_sym] = v |
| 70 | + end |
| 71 | + } |
| 72 | + |
| 73 | + if attributes.key?(:'attributes') |
| 74 | + self.attributes = attributes[:'attributes'] |
| 75 | + end |
| 76 | + |
| 77 | + if attributes.key?(:'id') |
| 78 | + self.id = attributes[:'id'] |
| 79 | + end |
| 80 | + |
| 81 | + if attributes.key?(:'type') |
| 82 | + self.type = attributes[:'type'] |
| 83 | + end |
| 84 | + end |
| 85 | + |
| 86 | + # Check to see if the all the properties in the model are valid |
| 87 | + # @return true if the model is valid |
| 88 | + # @!visibility private |
| 89 | + def valid? |
| 90 | + return false if @type.nil? |
| 91 | + true |
| 92 | + end |
| 93 | + |
| 94 | + # Custom attribute writer method with validation |
| 95 | + # @param type [Object] Object to be assigned |
| 96 | + # @!visibility private |
| 97 | + def type=(type) |
| 98 | + if type.nil? |
| 99 | + fail ArgumentError, 'invalid value for "type", type cannot be nil.' |
| 100 | + end |
| 101 | + @type = type |
| 102 | + end |
| 103 | + |
| 104 | + # Returns the object in the form of hash, with additionalProperties support. |
| 105 | + # @return [Hash] Returns the object in the form of hash |
| 106 | + # @!visibility private |
| 107 | + def to_hash |
| 108 | + hash = {} |
| 109 | + self.class.attribute_map.each_pair do |attr, param| |
| 110 | + value = self.send(attr) |
| 111 | + if value.nil? |
| 112 | + is_nullable = self.class.openapi_nullable.include?(attr) |
| 113 | + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) |
| 114 | + end |
| 115 | + |
| 116 | + hash[param] = _to_hash(value) |
| 117 | + end |
| 118 | + self.additional_properties.each_pair do |attr, value| |
| 119 | + hash[attr] = value |
| 120 | + end |
| 121 | + hash |
| 122 | + end |
| 123 | + |
| 124 | + # Checks equality by comparing each attribute. |
| 125 | + # @param o [Object] Object to be compared |
| 126 | + # @!visibility private |
| 127 | + def ==(o) |
| 128 | + return true if self.equal?(o) |
| 129 | + self.class == o.class && |
| 130 | + attributes == o.attributes && |
| 131 | + id == o.id && |
| 132 | + type == o.type && |
| 133 | + additional_properties == o.additional_properties |
| 134 | + end |
| 135 | + |
| 136 | + # Calculates hash code according to all attributes. |
| 137 | + # @return [Integer] Hash code |
| 138 | + # @!visibility private |
| 139 | + def hash |
| 140 | + [attributes, id, type, additional_properties].hash |
| 141 | + end |
| 142 | + end |
| 143 | +end |
0 commit comments