Class: OCI::Usage::Models::ResourceSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/usage/models/resource_summary.rb

Overview

The details of a resource under a service.

Constant Summary collapse

USAGE_DATA_TYPE_ENUM =
[
  USAGE_DATA_TYPE_INTERVAL = 'INTERVAL'.freeze,
  USAGE_DATA_TYPE_POINT_DATA = 'POINT_DATA'.freeze,
  USAGE_DATA_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ResourceSummary

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



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
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/oci/usage/models/resource_summary.rb', line 118

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.daily_unit_display_name = attributes[:'dailyUnitDisplayName'] if attributes[:'dailyUnitDisplayName']

  raise 'You cannot provide both :dailyUnitDisplayName and :daily_unit_display_name' if attributes.key?(:'dailyUnitDisplayName') && attributes.key?(:'daily_unit_display_name')

  self.daily_unit_display_name = attributes[:'daily_unit_display_name'] if attributes[:'daily_unit_display_name']

  self.hourly_unit_display_name = attributes[:'hourlyUnitDisplayName'] if attributes[:'hourlyUnitDisplayName']

  raise 'You cannot provide both :hourlyUnitDisplayName and :hourly_unit_display_name' if attributes.key?(:'hourlyUnitDisplayName') && attributes.key?(:'hourly_unit_display_name')

  self.hourly_unit_display_name = attributes[:'hourly_unit_display_name'] if attributes[:'hourly_unit_display_name']

  self.raw_unit_display_name = attributes[:'rawUnitDisplayName'] if attributes[:'rawUnitDisplayName']

  raise 'You cannot provide both :rawUnitDisplayName and :raw_unit_display_name' if attributes.key?(:'rawUnitDisplayName') && attributes.key?(:'raw_unit_display_name')

  self.raw_unit_display_name = attributes[:'raw_unit_display_name'] if attributes[:'raw_unit_display_name']

  self.usage_data_type = attributes[:'usageDataType'] if attributes[:'usageDataType']

  raise 'You cannot provide both :usageDataType and :usage_data_type' if attributes.key?(:'usageDataType') && attributes.key?(:'usage_data_type')

  self.usage_data_type = attributes[:'usage_data_type'] if attributes[:'usage_data_type']

  self.name = attributes[:'name'] if attributes[:'name']

  self.servicename = attributes[:'servicename'] if attributes[:'servicename']

  self.description = attributes[:'description'] if attributes[:'description']

  self.instance_type = attributes[:'instanceType'] if attributes[:'instanceType']

  raise 'You cannot provide both :instanceType and :instance_type' if attributes.key?(:'instanceType') && attributes.key?(:'instance_type')

  self.instance_type = attributes[:'instance_type'] if attributes[:'instance_type']

  self.is_purchased = attributes[:'isPurchased'] unless attributes[:'isPurchased'].nil?
  self.is_purchased = false if is_purchased.nil? && !attributes.key?(:'isPurchased') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isPurchased and :is_purchased' if attributes.key?(:'isPurchased') && attributes.key?(:'is_purchased')

  self.is_purchased = attributes[:'is_purchased'] unless attributes[:'is_purchased'].nil?
  self.is_purchased = false if is_purchased.nil? && !attributes.key?(:'isPurchased') && !attributes.key?(:'is_purchased') # rubocop:disable Style/StringLiterals

  self.child_resources = attributes[:'childResources'] if attributes[:'childResources']

  raise 'You cannot provide both :childResources and :child_resources' if attributes.key?(:'childResources') && attributes.key?(:'child_resources')

  self.child_resources = attributes[:'child_resources'] if attributes[:'child_resources']

  self.skus = attributes[:'skus'] if attributes[:'skus']
end

Instance Attribute Details

#child_resourcesArray<String>

The details of any child resources.

Returns:

  • (Array<String>)


57
58
59
# File 'lib/oci/usage/models/resource_summary.rb', line 57

def child_resources
  @child_resources
end

#daily_unit_display_nameString

Units to be used for daily aggregated data.

Returns:

  • (String)


21
22
23
# File 'lib/oci/usage/models/resource_summary.rb', line 21

def daily_unit_display_name
  @daily_unit_display_name
end

#descriptionString

Description of the resource.

Returns:

  • (String)


45
46
47
# File 'lib/oci/usage/models/resource_summary.rb', line 45

def description
  @description
end

#hourly_unit_display_nameString

Units to be used for hourly aggregated data.

Returns:

  • (String)


25
26
27
# File 'lib/oci/usage/models/resource_summary.rb', line 25

def hourly_unit_display_name
  @hourly_unit_display_name
end

#instance_typeString

Instance type for the resource.

Returns:

  • (String)


49
50
51
# File 'lib/oci/usage/models/resource_summary.rb', line 49

def instance_type
  @instance_type
end

#is_purchasedBOOLEAN

Indicates if the SKU was purchased

Returns:

  • (BOOLEAN)


53
54
55
# File 'lib/oci/usage/models/resource_summary.rb', line 53

def is_purchased
  @is_purchased
end

#nameString

Name of the resource.

Returns:

  • (String)


37
38
39
# File 'lib/oci/usage/models/resource_summary.rb', line 37

def name
  @name
end

#raw_unit_display_nameString

Default units to use when unspecified.

Returns:

  • (String)


29
30
31
# File 'lib/oci/usage/models/resource_summary.rb', line 29

def raw_unit_display_name
  @raw_unit_display_name
end

#servicenameString

Name of the service.

Returns:

  • (String)


41
42
43
# File 'lib/oci/usage/models/resource_summary.rb', line 41

def servicename
  @servicename
end

#skusArray<OCI::Usage::Models::SkuProducts>

The details of resource Skus.



61
62
63
# File 'lib/oci/usage/models/resource_summary.rb', line 61

def skus
  @skus
end

#usage_data_typeString

Usage data type of the resource.

Returns:

  • (String)


33
34
35
# File 'lib/oci/usage/models/resource_summary.rb', line 33

def usage_data_type
  @usage_data_type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/oci/usage/models/resource_summary.rb', line 64

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'daily_unit_display_name': :'dailyUnitDisplayName',
    'hourly_unit_display_name': :'hourlyUnitDisplayName',
    'raw_unit_display_name': :'rawUnitDisplayName',
    'usage_data_type': :'usageDataType',
    'name': :'name',
    'servicename': :'servicename',
    'description': :'description',
    'instance_type': :'instanceType',
    'is_purchased': :'isPurchased',
    'child_resources': :'childResources',
    'skus': :'skus'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/oci/usage/models/resource_summary.rb', line 83

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'daily_unit_display_name': :'String',
    'hourly_unit_display_name': :'String',
    'raw_unit_display_name': :'String',
    'usage_data_type': :'String',
    'name': :'String',
    'servicename': :'String',
    'description': :'String',
    'instance_type': :'String',
    'is_purchased': :'BOOLEAN',
    'child_resources': :'Array<String>',
    'skus': :'Array<OCI::Usage::Models::SkuProducts>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/oci/usage/models/resource_summary.rb', line 197

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    daily_unit_display_name == other.daily_unit_display_name &&
    hourly_unit_display_name == other.hourly_unit_display_name &&
    raw_unit_display_name == other.raw_unit_display_name &&
    usage_data_type == other.usage_data_type &&
    name == other.name &&
    servicename == other.servicename &&
    description == other.description &&
    instance_type == other.instance_type &&
    is_purchased == other.is_purchased &&
    child_resources == other.child_resources &&
    skus == other.skus
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/oci/usage/models/resource_summary.rb', line 237

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

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


217
218
219
# File 'lib/oci/usage/models/resource_summary.rb', line 217

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



226
227
228
# File 'lib/oci/usage/models/resource_summary.rb', line 226

def hash
  [daily_unit_display_name, hourly_unit_display_name, raw_unit_display_name, usage_data_type, name, servicename, description, instance_type, is_purchased, child_resources, skus].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



270
271
272
273
274
275
276
277
278
279
# File 'lib/oci/usage/models/resource_summary.rb', line 270

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



264
265
266
# File 'lib/oci/usage/models/resource_summary.rb', line 264

def to_s
  to_hash.to_s
end