|
| 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 | +Contact: support@datadoghq.com |
| 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 | + # The definition of `RoleTemplateArray` object. |
| 21 | + class RoleTemplateArray |
| 22 | + include BaseGenericModel |
| 23 | + |
| 24 | + # The `RoleTemplateArray` `data`. |
| 25 | + attr_reader :data |
| 26 | + |
| 27 | + attr_accessor :additional_properties |
| 28 | + |
| 29 | + # Attribute mapping from ruby-style variable name to JSON key. |
| 30 | + # @!visibility private |
| 31 | + def self.attribute_map |
| 32 | + { |
| 33 | + :'data' => :'data' |
| 34 | + } |
| 35 | + end |
| 36 | + |
| 37 | + # Attribute type mapping. |
| 38 | + # @!visibility private |
| 39 | + def self.openapi_types |
| 40 | + { |
| 41 | + :'data' => :'Array<RoleTemplateData>' |
| 42 | + } |
| 43 | + end |
| 44 | + |
| 45 | + # Initializes the object |
| 46 | + # @param attributes [Hash] Model attributes in the form of hash |
| 47 | + # @!visibility private |
| 48 | + def initialize(attributes = {}) |
| 49 | + if (!attributes.is_a?(Hash)) |
| 50 | + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RoleTemplateArray` initialize method" |
| 51 | + end |
| 52 | + |
| 53 | + self.additional_properties = {} |
| 54 | + # check to see if the attribute exists and convert string to symbol for hash key |
| 55 | + attributes = attributes.each_with_object({}) { |(k, v), h| |
| 56 | + if (!self.class.attribute_map.key?(k.to_sym)) |
| 57 | + self.additional_properties[k.to_sym] = v |
| 58 | + else |
| 59 | + h[k.to_sym] = v |
| 60 | + end |
| 61 | + } |
| 62 | + |
| 63 | + if attributes.key?(:'data') |
| 64 | + if (value = attributes[:'data']).is_a?(Array) |
| 65 | + self.data = value |
| 66 | + end |
| 67 | + end |
| 68 | + end |
| 69 | + |
| 70 | + # Check to see if the all the properties in the model are valid |
| 71 | + # @return true if the model is valid |
| 72 | + # @!visibility private |
| 73 | + def valid? |
| 74 | + return false if @data.nil? |
| 75 | + true |
| 76 | + end |
| 77 | + |
| 78 | + # Custom attribute writer method with validation |
| 79 | + # @param data [Object] Object to be assigned |
| 80 | + # @!visibility private |
| 81 | + def data=(data) |
| 82 | + if data.nil? |
| 83 | + fail ArgumentError, 'invalid value for "data", data cannot be nil.' |
| 84 | + end |
| 85 | + @data = data |
| 86 | + end |
| 87 | + |
| 88 | + # Returns the object in the form of hash, with additionalProperties support. |
| 89 | + # @return [Hash] Returns the object in the form of hash |
| 90 | + # @!visibility private |
| 91 | + def to_hash |
| 92 | + hash = {} |
| 93 | + self.class.attribute_map.each_pair do |attr, param| |
| 94 | + value = self.send(attr) |
| 95 | + if value.nil? |
| 96 | + is_nullable = self.class.openapi_nullable.include?(attr) |
| 97 | + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) |
| 98 | + end |
| 99 | + |
| 100 | + hash[param] = _to_hash(value) |
| 101 | + end |
| 102 | + self.additional_properties.each_pair do |attr, value| |
| 103 | + hash[attr] = value |
| 104 | + end |
| 105 | + hash |
| 106 | + end |
| 107 | + |
| 108 | + # Checks equality by comparing each attribute. |
| 109 | + # @param o [Object] Object to be compared |
| 110 | + # @!visibility private |
| 111 | + def ==(o) |
| 112 | + return true if self.equal?(o) |
| 113 | + self.class == o.class && |
| 114 | + data == o.data && |
| 115 | + additional_properties == o.additional_properties |
| 116 | + end |
| 117 | + |
| 118 | + # Calculates hash code according to all attributes. |
| 119 | + # @return [Integer] Hash code |
| 120 | + # @!visibility private |
| 121 | + def hash |
| 122 | + [data, additional_properties].hash |
| 123 | + end |
| 124 | + end |
| 125 | +end |
0 commit comments