Class: IbmPowerHmc::AbstractRest Abstract
- Inherits:
-
AbstractNonRest
- Object
- AbstractNonRest
- IbmPowerHmc::AbstractRest
- Defined in:
- lib/ibm_power_hmc/schema/parser.rb
Overview
HMC generic K2 REST object. Encapsulate data for a single REST object. The XML looks like this: <entry>
<id>uuid</id>
<published>timestamp</published>
<link rel="SELF" href="https://..."/>
<etag:etag>ETag</etag:etag>
<content type="type">
<!-- actual content here -->
</content>
</entry>
Direct Known Subclasses
BasePartition, Cluster, Event, Group, HttpErrorResponse, JobRequest, JobResponse, ManagedSystem, ManagementConsole, ManagementConsolePcmPreference, PartitionTemplate, PartitionTemplateSummary, SRIOVConfiguredLogicalPort, ServiceableEvent, SharedMemoryPool, SharedProcessorPool, SharedStoragePool, Tier, VirtualIOAdapter, VirtualNetwork, VirtualSwitch, VolumeGroup
Constant Summary
Constants inherited from AbstractNonRest
IbmPowerHmc::AbstractNonRest::ATTRS
Instance Attribute Summary collapse
-
#content_type ⇒ String
readonly
The content type of the object contained in the entry.
-
#etag ⇒ String
readonly
The entity tag of the entry.
-
#href ⇒ URI::HTTPS
readonly
The URL of the object itself.
-
#published ⇒ Time
readonly
The time at which the entry was published.
-
#uuid ⇒ String
readonly
The UUID of the object contained in the entry.
Attributes inherited from AbstractNonRest
Instance Method Summary collapse
-
#initialize(entry) ⇒ AbstractRest
constructor
A new instance of AbstractRest.
- #to_s ⇒ Object
Methods inherited from AbstractNonRest
#collection_of, #create_element, #marshal, marshal, #singleton, #timestamp, #uuid_from_href, #uuids_from_links
Constructor Details
#initialize(entry) ⇒ AbstractRest
Returns a new instance of AbstractRest.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/ibm_power_hmc/schema/parser.rb', line 215 def initialize(entry) if entry.name != "entry" # We are inlined. super(entry) return end @uuid = entry.elements["id"]&.text @published = Time.xmlschema(entry.elements["published"]&.text) link = entry.elements["link[@rel='SELF']"] @href = URI(link.attributes["href"]) unless link.nil? @etag = entry.elements["etag:etag"]&.text&.strip content = entry.elements["content"] @content_type = content.attributes["type"] super(content.elements.first) end |
Instance Attribute Details
#content_type ⇒ String (readonly)
The content type of the object contained in the entry.
212 213 214 |
# File 'lib/ibm_power_hmc/schema/parser.rb', line 212 def content_type @content_type end |
#etag ⇒ String (readonly)
The entity tag of the entry.
212 213 214 |
# File 'lib/ibm_power_hmc/schema/parser.rb', line 212 def etag @etag end |
#href ⇒ URI::HTTPS (readonly)
The URL of the object itself.
212 213 214 |
# File 'lib/ibm_power_hmc/schema/parser.rb', line 212 def href @href end |
#published ⇒ Time (readonly)
The time at which the entry was published.
212 213 214 |
# File 'lib/ibm_power_hmc/schema/parser.rb', line 212 def published @published end |
#uuid ⇒ String (readonly)
The UUID of the object contained in the entry.
212 213 214 |
# File 'lib/ibm_power_hmc/schema/parser.rb', line 212 def uuid @uuid end |
Instance Method Details
#to_s ⇒ Object
232 233 234 235 236 237 |
# File 'lib/ibm_power_hmc/schema/parser.rb', line 232 def to_s str = super str << " uuid: '#{uuid}'\n" if defined?(@uuid) str << " published: '#{published}'\n" if defined?(@published) str end |