One PR of many to simplify Job resource interactions.
The changes focus on saucecloud.JobService, which acts as a proxy wrapper for easier interactions with the cloud APIs by conditionally handling the differences between RDC and VDC.
Too Many Abstractions
saucecloud.JobService came with its own layer of abstractions instead of directly interacting with the implementations. The burden to instantiate saucecloud.JobService correctly was on the caller. Despite its heavy use of interfaces, only certain implementations were able to satisfy either VDC or RDC, but not both, despite the interface claiming that it can. Thus there were duplicate field members depending on the device type.
Furthermore, one of those was the job.ArtifactDownloader interface, whose implementation is downloader.ArtifactDownloader, which in turn had its layer of abstractions to interact with the Job APIs, a responsibility that saucecloud.JobService ought to have.
Solution
Consolidate downloader.ArtifactDownloader into saucecloud.JobService.
Replace interfaces in saucecloud.JobService with their real implementations.
Move saucecloud.ArtifactService to the artifacts command, as it's very bespoke to the functional needs of that command package. Stop embedding JobService and use a regular member variable instead.
Description
One PR of many to simplify Job resource interactions.
The changes focus on
saucecloud.JobService
, which acts as a proxy wrapper for easier interactions with the cloud APIs by conditionally handling the differences between RDC and VDC.Too Many Abstractions
saucecloud.JobService
came with its own layer of abstractions instead of directly interacting with the implementations. The burden to instantiatesaucecloud.JobService
correctly was on the caller. Despite its heavy use of interfaces, only certain implementations were able to satisfy either VDC or RDC, but not both, despite the interface claiming that it can. Thus there were duplicate field members depending on the device type.Furthermore, one of those was the
job.ArtifactDownloader
interface, whose implementation isdownloader.ArtifactDownloader
, which in turn had its layer of abstractions to interact with the Job APIs, a responsibility thatsaucecloud.JobService
ought to have.Solution
downloader.ArtifactDownloader
intosaucecloud.JobService
.saucecloud.JobService
with their real implementations.saucecloud.ArtifactService
to the artifacts command, as it's very bespoke to the functional needs of that command package. Stop embeddingJobService
and use a regular member variable instead.