|
| 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 | + # The definition of the `DatadogAPIKey` object. |
| 21 | + class DatadogAPIKey |
| 22 | + include BaseGenericModel |
| 23 | + |
| 24 | + # The `DatadogAPIKey` `api_key`. |
| 25 | + attr_reader :api_key |
| 26 | + |
| 27 | + # The `DatadogAPIKey` `app_key`. |
| 28 | + attr_reader :app_key |
| 29 | + |
| 30 | + # The `DatadogAPIKey` `datacenter`. |
| 31 | + attr_reader :datacenter |
| 32 | + |
| 33 | + # Custom subdomain used for Datadog URLs generated with this Connection. For example, if this org uses `https://acme.datadoghq.com` to access Datadog, set this field to `acme`. If this field is omitted, generated URLs will use the default site URL for its datacenter (see [https://docs.datadoghq.com/getting_started/site](https://docs.datadoghq.com/getting_started/site)). |
| 34 | + attr_accessor :subdomain |
| 35 | + |
| 36 | + # The definition of the `DatadogAPIKey` object. |
| 37 | + attr_reader :type |
| 38 | + |
| 39 | + attr_accessor :additional_properties |
| 40 | + |
| 41 | + # Attribute mapping from ruby-style variable name to JSON key. |
| 42 | + # @!visibility private |
| 43 | + def self.attribute_map |
| 44 | + { |
| 45 | + :'api_key' => :'api_key', |
| 46 | + :'app_key' => :'app_key', |
| 47 | + :'datacenter' => :'datacenter', |
| 48 | + :'subdomain' => :'subdomain', |
| 49 | + :'type' => :'type' |
| 50 | + } |
| 51 | + end |
| 52 | + |
| 53 | + # Attribute type mapping. |
| 54 | + # @!visibility private |
| 55 | + def self.openapi_types |
| 56 | + { |
| 57 | + :'api_key' => :'String', |
| 58 | + :'app_key' => :'String', |
| 59 | + :'datacenter' => :'String', |
| 60 | + :'subdomain' => :'String', |
| 61 | + :'type' => :'DatadogAPIKeyType' |
| 62 | + } |
| 63 | + end |
| 64 | + |
| 65 | + # Initializes the object |
| 66 | + # @param attributes [Hash] Model attributes in the form of hash |
| 67 | + # @!visibility private |
| 68 | + def initialize(attributes = {}) |
| 69 | + if (!attributes.is_a?(Hash)) |
| 70 | + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatadogAPIKey` initialize method" |
| 71 | + end |
| 72 | + |
| 73 | + self.additional_properties = {} |
| 74 | + # check to see if the attribute exists and convert string to symbol for hash key |
| 75 | + attributes = attributes.each_with_object({}) { |(k, v), h| |
| 76 | + if (!self.class.attribute_map.key?(k.to_sym)) |
| 77 | + self.additional_properties[k.to_sym] = v |
| 78 | + else |
| 79 | + h[k.to_sym] = v |
| 80 | + end |
| 81 | + } |
| 82 | + |
| 83 | + if attributes.key?(:'api_key') |
| 84 | + self.api_key = attributes[:'api_key'] |
| 85 | + end |
| 86 | + |
| 87 | + if attributes.key?(:'app_key') |
| 88 | + self.app_key = attributes[:'app_key'] |
| 89 | + end |
| 90 | + |
| 91 | + if attributes.key?(:'datacenter') |
| 92 | + self.datacenter = attributes[:'datacenter'] |
| 93 | + end |
| 94 | + |
| 95 | + if attributes.key?(:'subdomain') |
| 96 | + self.subdomain = attributes[:'subdomain'] |
| 97 | + end |
| 98 | + |
| 99 | + if attributes.key?(:'type') |
| 100 | + self.type = attributes[:'type'] |
| 101 | + end |
| 102 | + end |
| 103 | + |
| 104 | + # Check to see if the all the properties in the model are valid |
| 105 | + # @return true if the model is valid |
| 106 | + # @!visibility private |
| 107 | + def valid? |
| 108 | + return false if @api_key.nil? |
| 109 | + return false if @app_key.nil? |
| 110 | + return false if @datacenter.nil? |
| 111 | + return false if @type.nil? |
| 112 | + true |
| 113 | + end |
| 114 | + |
| 115 | + # Custom attribute writer method with validation |
| 116 | + # @param api_key [Object] Object to be assigned |
| 117 | + # @!visibility private |
| 118 | + def api_key=(api_key) |
| 119 | + if api_key.nil? |
| 120 | + fail ArgumentError, 'invalid value for "api_key", api_key cannot be nil.' |
| 121 | + end |
| 122 | + @api_key = api_key |
| 123 | + end |
| 124 | + |
| 125 | + # Custom attribute writer method with validation |
| 126 | + # @param app_key [Object] Object to be assigned |
| 127 | + # @!visibility private |
| 128 | + def app_key=(app_key) |
| 129 | + if app_key.nil? |
| 130 | + fail ArgumentError, 'invalid value for "app_key", app_key cannot be nil.' |
| 131 | + end |
| 132 | + @app_key = app_key |
| 133 | + end |
| 134 | + |
| 135 | + # Custom attribute writer method with validation |
| 136 | + # @param datacenter [Object] Object to be assigned |
| 137 | + # @!visibility private |
| 138 | + def datacenter=(datacenter) |
| 139 | + if datacenter.nil? |
| 140 | + fail ArgumentError, 'invalid value for "datacenter", datacenter cannot be nil.' |
| 141 | + end |
| 142 | + @datacenter = datacenter |
| 143 | + end |
| 144 | + |
| 145 | + # Custom attribute writer method with validation |
| 146 | + # @param type [Object] Object to be assigned |
| 147 | + # @!visibility private |
| 148 | + def type=(type) |
| 149 | + if type.nil? |
| 150 | + fail ArgumentError, 'invalid value for "type", type cannot be nil.' |
| 151 | + end |
| 152 | + @type = type |
| 153 | + end |
| 154 | + |
| 155 | + # Returns the object in the form of hash, with additionalProperties support. |
| 156 | + # @return [Hash] Returns the object in the form of hash |
| 157 | + # @!visibility private |
| 158 | + def to_hash |
| 159 | + hash = {} |
| 160 | + self.class.attribute_map.each_pair do |attr, param| |
| 161 | + value = self.send(attr) |
| 162 | + if value.nil? |
| 163 | + is_nullable = self.class.openapi_nullable.include?(attr) |
| 164 | + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) |
| 165 | + end |
| 166 | + |
| 167 | + hash[param] = _to_hash(value) |
| 168 | + end |
| 169 | + self.additional_properties.each_pair do |attr, value| |
| 170 | + hash[attr] = value |
| 171 | + end |
| 172 | + hash |
| 173 | + end |
| 174 | + |
| 175 | + # Checks equality by comparing each attribute. |
| 176 | + # @param o [Object] Object to be compared |
| 177 | + # @!visibility private |
| 178 | + def ==(o) |
| 179 | + return true if self.equal?(o) |
| 180 | + self.class == o.class && |
| 181 | + api_key == o.api_key && |
| 182 | + app_key == o.app_key && |
| 183 | + datacenter == o.datacenter && |
| 184 | + subdomain == o.subdomain && |
| 185 | + type == o.type && |
| 186 | + additional_properties == o.additional_properties |
| 187 | + end |
| 188 | + |
| 189 | + # Calculates hash code according to all attributes. |
| 190 | + # @return [Integer] Hash code |
| 191 | + # @!visibility private |
| 192 | + def hash |
| 193 | + [api_key, app_key, datacenter, subdomain, type, additional_properties].hash |
| 194 | + end |
| 195 | + end |
| 196 | +end |
0 commit comments