Class: OCI::UsageApi::Models::UsageCarbonEmissionSummary
- Inherits:
-
Object
- Object
- OCI::UsageApi::Models::UsageCarbonEmissionSummary
- Defined in:
- lib/oci/usage_api/models/usage_carbon_emission_summary.rb
Overview
The usage carbon emission store result.
Instance Attribute Summary collapse
-
#ad ⇒ String
The availability domain of the usage.
-
#compartment_id ⇒ String
The compartment OCID.
-
#compartment_name ⇒ String
The compartment name.
-
#compartment_path ⇒ String
The compartment path, starting from root.
-
#computed_carbon_emission ⇒ Float
[Required] The carbon emission in MTCO2 unit.
-
#emission_calculation_method ⇒ String
[Required] The method used to calculate carbon emission.
-
#platform ⇒ String
Platform for the cost.
-
#region ⇒ String
The region of the usage.
-
#resource_id ⇒ String
The resource OCID that is incurring the cost.
-
#resource_name ⇒ String
The resource name that is incurring the cost.
-
#service ⇒ String
The service name that is incurring the cost.
-
#sku_name ⇒ String
The SKU friendly name.
-
#sku_part_number ⇒ String
The SKU part number.
-
#subscription_id ⇒ String
The subscription ID.
-
#tags ⇒ Array<OCI::UsageApi::Models::Tag>
For grouping, a tag definition.
-
#tenant_id ⇒ String
The tenancy OCID.
-
#tenant_name ⇒ String
The tenancy name.
-
#time_usage_ended ⇒ DateTime
[Required] The usage end time.
-
#time_usage_started ⇒ DateTime
[Required] The usage start time.
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 = {}) ⇒ UsageCarbonEmissionSummary
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 = {}) ⇒ UsageCarbonEmissionSummary
Initializes the object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 166 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.tenant_id = attributes[:'tenantId'] if attributes[:'tenantId'] raise 'You cannot provide both :tenantId and :tenant_id' if attributes.key?(:'tenantId') && attributes.key?(:'tenant_id') self.tenant_id = attributes[:'tenant_id'] if attributes[:'tenant_id'] self.tenant_name = attributes[:'tenantName'] if attributes[:'tenantName'] raise 'You cannot provide both :tenantName and :tenant_name' if attributes.key?(:'tenantName') && attributes.key?(:'tenant_name') self.tenant_name = attributes[:'tenant_name'] if attributes[:'tenant_name'] self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId'] raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id') self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id'] self.compartment_path = attributes[:'compartmentPath'] if attributes[:'compartmentPath'] raise 'You cannot provide both :compartmentPath and :compartment_path' if attributes.key?(:'compartmentPath') && attributes.key?(:'compartment_path') self.compartment_path = attributes[:'compartment_path'] if attributes[:'compartment_path'] self.compartment_name = attributes[:'compartmentName'] if attributes[:'compartmentName'] raise 'You cannot provide both :compartmentName and :compartment_name' if attributes.key?(:'compartmentName') && attributes.key?(:'compartment_name') self.compartment_name = attributes[:'compartment_name'] if attributes[:'compartment_name'] self.service = attributes[:'service'] if attributes[:'service'] self.resource_name = attributes[:'resourceName'] if attributes[:'resourceName'] raise 'You cannot provide both :resourceName and :resource_name' if attributes.key?(:'resourceName') && attributes.key?(:'resource_name') self.resource_name = attributes[:'resource_name'] if attributes[:'resource_name'] self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId'] raise 'You cannot provide both :resourceId and :resource_id' if attributes.key?(:'resourceId') && attributes.key?(:'resource_id') self.resource_id = attributes[:'resource_id'] if attributes[:'resource_id'] self.region = attributes[:'region'] if attributes[:'region'] self.ad = attributes[:'ad'] if attributes[:'ad'] self.sku_part_number = attributes[:'skuPartNumber'] if attributes[:'skuPartNumber'] raise 'You cannot provide both :skuPartNumber and :sku_part_number' if attributes.key?(:'skuPartNumber') && attributes.key?(:'sku_part_number') self.sku_part_number = attributes[:'sku_part_number'] if attributes[:'sku_part_number'] self.sku_name = attributes[:'skuName'] if attributes[:'skuName'] raise 'You cannot provide both :skuName and :sku_name' if attributes.key?(:'skuName') && attributes.key?(:'sku_name') self.sku_name = attributes[:'sku_name'] if attributes[:'sku_name'] self.platform = attributes[:'platform'] if attributes[:'platform'] self.time_usage_started = attributes[:'timeUsageStarted'] if attributes[:'timeUsageStarted'] raise 'You cannot provide both :timeUsageStarted and :time_usage_started' if attributes.key?(:'timeUsageStarted') && attributes.key?(:'time_usage_started') self.time_usage_started = attributes[:'time_usage_started'] if attributes[:'time_usage_started'] self.time_usage_ended = attributes[:'timeUsageEnded'] if attributes[:'timeUsageEnded'] raise 'You cannot provide both :timeUsageEnded and :time_usage_ended' if attributes.key?(:'timeUsageEnded') && attributes.key?(:'time_usage_ended') self.time_usage_ended = attributes[:'time_usage_ended'] if attributes[:'time_usage_ended'] self.computed_carbon_emission = attributes[:'computedCarbonEmission'] if attributes[:'computedCarbonEmission'] raise 'You cannot provide both :computedCarbonEmission and :computed_carbon_emission' if attributes.key?(:'computedCarbonEmission') && attributes.key?(:'computed_carbon_emission') self.computed_carbon_emission = attributes[:'computed_carbon_emission'] if attributes[:'computed_carbon_emission'] self.emission_calculation_method = attributes[:'emissionCalculationMethod'] if attributes[:'emissionCalculationMethod'] raise 'You cannot provide both :emissionCalculationMethod and :emission_calculation_method' if attributes.key?(:'emissionCalculationMethod') && attributes.key?(:'emission_calculation_method') self.emission_calculation_method = attributes[:'emission_calculation_method'] if attributes[:'emission_calculation_method'] self.subscription_id = attributes[:'subscriptionId'] if attributes[:'subscriptionId'] raise 'You cannot provide both :subscriptionId and :subscription_id' if attributes.key?(:'subscriptionId') && attributes.key?(:'subscription_id') self.subscription_id = attributes[:'subscription_id'] if attributes[:'subscription_id'] self. = attributes[:'tags'] if attributes[:'tags'] end |
Instance Attribute Details
#ad ⇒ String
The availability domain of the usage.
49 50 51 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 49 def ad @ad end |
#compartment_id ⇒ String
The compartment OCID.
21 22 23 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 21 def compartment_id @compartment_id end |
#compartment_name ⇒ String
The compartment name.
29 30 31 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 29 def compartment_name @compartment_name end |
#compartment_path ⇒ String
The compartment path, starting from root.
25 26 27 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 25 def compartment_path @compartment_path end |
#computed_carbon_emission ⇒ Float
[Required] The carbon emission in MTCO2 unit.
73 74 75 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 73 def computed_carbon_emission @computed_carbon_emission end |
#emission_calculation_method ⇒ String
[Required] The method used to calculate carbon emission.
77 78 79 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 77 def emission_calculation_method @emission_calculation_method end |
#platform ⇒ String
Platform for the cost.
61 62 63 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 61 def platform @platform end |
#region ⇒ String
The region of the usage.
45 46 47 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 45 def region @region end |
#resource_id ⇒ String
The resource OCID that is incurring the cost.
41 42 43 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 41 def resource_id @resource_id end |
#resource_name ⇒ String
The resource name that is incurring the cost.
37 38 39 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 37 def resource_name @resource_name end |
#service ⇒ String
The service name that is incurring the cost.
33 34 35 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 33 def service @service end |
#sku_name ⇒ String
The SKU friendly name.
57 58 59 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 57 def sku_name @sku_name end |
#sku_part_number ⇒ String
The SKU part number.
53 54 55 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 53 def sku_part_number @sku_part_number end |
#subscription_id ⇒ String
The subscription ID.
81 82 83 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 81 def subscription_id @subscription_id end |
#tags ⇒ Array<OCI::UsageApi::Models::Tag>
For grouping, a tag definition. For filtering, a definition and key.
85 86 87 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 85 def @tags end |
#tenant_id ⇒ String
The tenancy OCID.
13 14 15 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 13 def tenant_id @tenant_id end |
#tenant_name ⇒ String
The tenancy name.
17 18 19 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 17 def tenant_name @tenant_name end |
#time_usage_ended ⇒ DateTime
[Required] The usage end time.
69 70 71 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 69 def time_usage_ended @time_usage_ended end |
#time_usage_started ⇒ DateTime
[Required] The usage start time.
65 66 67 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 65 def time_usage_started @time_usage_started end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 88 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'tenant_id': :'tenantId', 'tenant_name': :'tenantName', 'compartment_id': :'compartmentId', 'compartment_path': :'compartmentPath', 'compartment_name': :'compartmentName', 'service': :'service', 'resource_name': :'resourceName', 'resource_id': :'resourceId', 'region': :'region', 'ad': :'ad', 'sku_part_number': :'skuPartNumber', 'sku_name': :'skuName', 'platform': :'platform', 'time_usage_started': :'timeUsageStarted', 'time_usage_ended': :'timeUsageEnded', 'computed_carbon_emission': :'computedCarbonEmission', 'emission_calculation_method': :'emissionCalculationMethod', 'subscription_id': :'subscriptionId', 'tags': :'tags' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 115 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'tenant_id': :'String', 'tenant_name': :'String', 'compartment_id': :'String', 'compartment_path': :'String', 'compartment_name': :'String', 'service': :'String', 'resource_name': :'String', 'resource_id': :'String', 'region': :'String', 'ad': :'String', 'sku_part_number': :'String', 'sku_name': :'String', 'platform': :'String', 'time_usage_started': :'DateTime', 'time_usage_ended': :'DateTime', 'computed_carbon_emission': :'Float', 'emission_calculation_method': :'String', 'subscription_id': :'String', 'tags': :'Array<OCI::UsageApi::Models::Tag>' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 274 def ==(other) return true if equal?(other) self.class == other.class && tenant_id == other.tenant_id && tenant_name == other.tenant_name && compartment_id == other.compartment_id && compartment_path == other.compartment_path && compartment_name == other.compartment_name && service == other.service && resource_name == other.resource_name && resource_id == other.resource_id && region == other.region && ad == other.ad && sku_part_number == other.sku_part_number && sku_name == other.sku_name && platform == other.platform && time_usage_started == other.time_usage_started && time_usage_ended == other.time_usage_ended && computed_carbon_emission == other.computed_carbon_emission && emission_calculation_method == other.emission_calculation_method && subscription_id == other.subscription_id && == other. end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 322 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
302 303 304 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 302 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
311 312 313 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 311 def hash [tenant_id, tenant_name, compartment_id, compartment_path, compartment_name, service, resource_name, resource_id, region, ad, sku_part_number, sku_name, platform, time_usage_started, time_usage_ended, computed_carbon_emission, emission_calculation_method, subscription_id, ].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
355 356 357 358 359 360 361 362 363 364 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 355 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
349 350 351 |
# File 'lib/oci/usage_api/models/usage_carbon_emission_summary.rb', line 349 def to_s to_hash.to_s end |