=begin #Datadog API V2 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-Present Datadog, Inc. =end require 'date' require 'time' module DatadogAPIClient::V2 # A dashboard within a list. class DashboardListItem include BaseGenericModel # Creator of the object. attr_accessor :author # Date of creation of the dashboard. attr_accessor :created # URL to the icon of the dashboard. attr_accessor :icon # ID of the dashboard. attr_reader :id # The short name of the integration. attr_accessor :integration_id # Whether or not the dashboard is in the favorites. attr_accessor :is_favorite # Whether or not the dashboard is read only. attr_accessor :is_read_only # Whether the dashboard is publicly shared or not. attr_accessor :is_shared # Date of last edition of the dashboard. attr_accessor :modified # Popularity of the dashboard. attr_reader :popularity # List of team names representing ownership of a dashboard. attr_reader :tags # Title of the dashboard. attr_accessor :title # The type of the dashboard. attr_reader :type # URL path to the dashboard. attr_accessor :url attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { :'author' => :'author', :'created' => :'created', :'icon' => :'icon', :'id' => :'id', :'integration_id' => :'integration_id', :'is_favorite' => :'is_favorite', :'is_read_only' => :'is_read_only', :'is_shared' => :'is_shared', :'modified' => :'modified', :'popularity' => :'popularity', :'tags' => :'tags', :'title' => :'title', :'type' => :'type', :'url' => :'url' } end # Attribute type mapping. # @!visibility private def self.openapi_types { :'author' => :'Creator', :'created' => :'Time', :'icon' => :'String', :'id' => :'String', :'integration_id' => :'String', :'is_favorite' => :'Boolean', :'is_read_only' => :'Boolean', :'is_shared' => :'Boolean', :'modified' => :'Time', :'popularity' => :'Integer', :'tags' => :'Array', :'title' => :'String', :'type' => :'DashboardType', :'url' => :'String' } end # List of attributes with nullable: true # @!visibility private def self.openapi_nullable Set.new([ :'icon', :'integration_id', :'tags', ]) end # Initializes the object # @param attributes [Hash] Model attributes in the form of hash # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DashboardListItem` initialize method" end self.additional_properties = {} # 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)) self.additional_properties[k.to_sym] = v else h[k.to_sym] = v end } if attributes.key?(:'author') self.author = attributes[:'author'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'icon') self.icon = attributes[:'icon'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'integration_id') self.integration_id = attributes[:'integration_id'] end if attributes.key?(:'is_favorite') self.is_favorite = attributes[:'is_favorite'] end if attributes.key?(:'is_read_only') self.is_read_only = attributes[:'is_read_only'] end if attributes.key?(:'is_shared') self.is_shared = attributes[:'is_shared'] end if attributes.key?(:'modified') self.modified = attributes[:'modified'] end if attributes.key?(:'popularity') self.popularity = attributes[:'popularity'] end if attributes.key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value end end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'url') self.url = attributes[:'url'] end end # Check to see if the all the properties in the model are valid # @return true if the model is valid # @!visibility private def valid? return false if @id.nil? return false if !@popularity.nil? && @popularity > 5 return false if !@tags.nil? && @tags.length > 5 return false if @type.nil? true end # Custom attribute writer method with validation # @param id [Object] Object to be assigned # @!visibility private def id=(id) if id.nil? fail ArgumentError, 'invalid value for "id", id cannot be nil.' end @id = id end # Custom attribute writer method with validation # @param popularity [Object] Object to be assigned # @!visibility private def popularity=(popularity) if !popularity.nil? && popularity > 5 fail ArgumentError, 'invalid value for "popularity", must be smaller than or equal to 5.' end @popularity = popularity end # Custom attribute writer method with validation # @param tags [Object] Object to be assigned # @!visibility private def tags=(tags) if !tags.nil? && tags.length > 5 fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 5.' end @tags = tags end # Custom attribute writer method with validation # @param type [Object] Object to be assigned # @!visibility private def type=(type) if type.nil? fail ArgumentError, 'invalid value for "type", type cannot be nil.' end @type = type end # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private 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 self.additional_properties.each_pair do |attr, value| hash[attr] = value end hash end # Checks equality by comparing each attribute. # @param o [Object] Object to be compared # @!visibility private def ==(o) return true if self.equal?(o) self.class == o.class && author == o.author && created == o.created && icon == o.icon && id == o.id && integration_id == o.integration_id && is_favorite == o.is_favorite && is_read_only == o.is_read_only && is_shared == o.is_shared && modified == o.modified && popularity == o.popularity && tags == o.tags && title == o.title && type == o.type && url == o.url additional_properties == o.additional_properties end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash [author, created, icon, id, integration_id, is_favorite, is_read_only, is_shared, modified, popularity, tags, title, type, url].hash end end end