Class: OCI::UsageApi::Models::QueryProperties
- Inherits:
-
Object
- Object
- OCI::UsageApi::Models::QueryProperties
- Defined in:
- lib/oci/usage_api/models/query_properties.rb
Overview
The query properties.
Constant Summary collapse
- GRANULARITY_ENUM =
[ GRANULARITY_DAILY = 'DAILY'.freeze, GRANULARITY_MONTHLY = 'MONTHLY'.freeze, GRANULARITY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- QUERY_TYPE_ENUM =
[ QUERY_TYPE_USAGE = 'USAGE'.freeze, QUERY_TYPE_COST = 'COST'.freeze, QUERY_TYPE_USAGE_AND_COST = 'USAGE_AND_COST'.freeze, QUERY_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#compartment_depth ⇒ Float
The depth level of the compartment.
-
#date_range ⇒ OCI::UsageApi::Models::DateRange
This attribute is required.
- #filter ⇒ OCI::UsageApi::Models::Filter
-
#granularity ⇒ String
[Required] The usage granularity.
-
#group_by ⇒ Array<String>
Aggregate the result by.
-
#group_by_tag ⇒ Array<OCI::UsageApi::Models::Tag>
GroupBy a specific tagKey.
-
#is_aggregate_by_time ⇒ BOOLEAN
Specifies whether aggregated by time.
-
#query_type ⇒ String
The query usage type.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ QueryProperties
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ QueryProperties
Initializes the object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 113 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.group_by = attributes[:'groupBy'] if attributes[:'groupBy'] raise 'You cannot provide both :groupBy and :group_by' if attributes.key?(:'groupBy') && attributes.key?(:'group_by') self.group_by = attributes[:'group_by'] if attributes[:'group_by'] self.group_by_tag = attributes[:'groupByTag'] if attributes[:'groupByTag'] raise 'You cannot provide both :groupByTag and :group_by_tag' if attributes.key?(:'groupByTag') && attributes.key?(:'group_by_tag') self.group_by_tag = attributes[:'group_by_tag'] if attributes[:'group_by_tag'] self.filter = attributes[:'filter'] if attributes[:'filter'] self.compartment_depth = attributes[:'compartmentDepth'] if attributes[:'compartmentDepth'] raise 'You cannot provide both :compartmentDepth and :compartment_depth' if attributes.key?(:'compartmentDepth') && attributes.key?(:'compartment_depth') self.compartment_depth = attributes[:'compartment_depth'] if attributes[:'compartment_depth'] self.granularity = attributes[:'granularity'] if attributes[:'granularity'] self.query_type = attributes[:'queryType'] if attributes[:'queryType'] self.query_type = "COST" if query_type.nil? && !attributes.key?(:'queryType') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :queryType and :query_type' if attributes.key?(:'queryType') && attributes.key?(:'query_type') self.query_type = attributes[:'query_type'] if attributes[:'query_type'] self.query_type = "COST" if query_type.nil? && !attributes.key?(:'queryType') && !attributes.key?(:'query_type') # rubocop:disable Style/StringLiterals self.is_aggregate_by_time = attributes[:'isAggregateByTime'] unless attributes[:'isAggregateByTime'].nil? self.is_aggregate_by_time = false if is_aggregate_by_time.nil? && !attributes.key?(:'isAggregateByTime') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isAggregateByTime and :is_aggregate_by_time' if attributes.key?(:'isAggregateByTime') && attributes.key?(:'is_aggregate_by_time') self.is_aggregate_by_time = attributes[:'is_aggregate_by_time'] unless attributes[:'is_aggregate_by_time'].nil? self.is_aggregate_by_time = false if is_aggregate_by_time.nil? && !attributes.key?(:'isAggregateByTime') && !attributes.key?(:'is_aggregate_by_time') # rubocop:disable Style/StringLiterals self.date_range = attributes[:'dateRange'] if attributes[:'dateRange'] raise 'You cannot provide both :dateRange and :date_range' if attributes.key?(:'dateRange') && attributes.key?(:'date_range') self.date_range = attributes[:'date_range'] if attributes[:'date_range'] end |
Instance Attribute Details
#compartment_depth ⇒ Float
The depth level of the compartment.
40 41 42 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 40 def compartment_depth @compartment_depth end |
#date_range ⇒ OCI::UsageApi::Models::DateRange
This attribute is required.
65 66 67 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 65 def date_range @date_range end |
#filter ⇒ OCI::UsageApi::Models::Filter
36 37 38 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 36 def filter @filter end |
#granularity ⇒ String
[Required] The usage granularity. DAILY - Daily data aggregation. MONTHLY - Monthly data aggregation. Allowed values are: DAILY MONTHLY
48 49 50 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 48 def granularity @granularity end |
#group_by ⇒ Array<String>
Aggregate the result by. For example: [ "tagNamespace", "tagKey", "tagValue", "service", "skuName", "skuPartNumber", "unit", "compartmentName", "compartmentPath", "compartmentId", "platform", "region", "logicalAd", "resourceId", "tenantId", "tenantName" ]
28 29 30 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 28 def group_by @group_by end |
#group_by_tag ⇒ Array<OCI::UsageApi::Models::Tag>
GroupBy a specific tagKey. Provide the tagNamespace and tagKey in the tag object. Only supports one tag in the list. For example: [ { "namespace": "oracle", "key": "createdBy" ]
33 34 35 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 33 def group_by_tag @group_by_tag end |
#is_aggregate_by_time ⇒ BOOLEAN
Specifies whether aggregated by time. If isAggregateByTime is true, all usage or cost over the query time period will be added up.
61 62 63 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 61 def is_aggregate_by_time @is_aggregate_by_time end |
#query_type ⇒ String
The query usage type. COST by default if it is missing. Usage - Query the usage data. Cost - Query the cost/billing data. Allowed values are: USAGE COST USAGE_AND_COST
57 58 59 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 57 def query_type @query_type end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 68 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'group_by': :'groupBy', 'group_by_tag': :'groupByTag', 'filter': :'filter', 'compartment_depth': :'compartmentDepth', 'granularity': :'granularity', 'query_type': :'queryType', 'is_aggregate_by_time': :'isAggregateByTime', 'date_range': :'dateRange' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 84 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'group_by': :'Array<String>', 'group_by_tag': :'Array<OCI::UsageApi::Models::Tag>', 'filter': :'OCI::UsageApi::Models::Filter', 'compartment_depth': :'Float', 'granularity': :'String', 'query_type': :'String', 'is_aggregate_by_time': :'BOOLEAN', 'date_range': :'OCI::UsageApi::Models::DateRange' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 197 def ==(other) return true if equal?(other) self.class == other.class && group_by == other.group_by && group_by_tag == other.group_by_tag && filter == other.filter && compartment_depth == other.compartment_depth && granularity == other.granularity && query_type == other.query_type && is_aggregate_by_time == other.is_aggregate_by_time && date_range == other.date_range end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 234 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
214 215 216 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 214 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
223 224 225 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 223 def hash [group_by, group_by_tag, filter, compartment_depth, granularity, query_type, is_aggregate_by_time, date_range].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
267 268 269 270 271 272 273 274 275 276 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 267 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
261 262 263 |
# File 'lib/oci/usage_api/models/query_properties.rb', line 261 def to_s to_hash.to_s end |