/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.2.7 * User agent: apibuilder app.apibuilder.io/gilt/svc-sundial/0.2.7/http4s_0_22 */ package com.gilt.svc.sundial.v0.mock { class Client[F[_]: cats.Applicative] extends com.gilt.svc.sundial.v0.interfaces.Client[F] { val baseUrl: org.http4s.Uri = org.http4s.Uri.unsafeFromString("http://mock.localhost") override def healthchecks: com.gilt.svc.sundial.v0.Healthchecks[F] = new MockHealthchecks[F] override def processes: com.gilt.svc.sundial.v0.Processes[F] = new MockProcesses[F] override def processDefinitions: com.gilt.svc.sundial.v0.ProcessDefinitions[F] = new MockProcessDefinitions[F] override def tasks: com.gilt.svc.sundial.v0.Tasks[F] = new MockTasks[F] } class MockHealthchecks[F[_]: cats.Applicative] extends com.gilt.svc.sundial.v0.Healthchecks[F] { def getMetrics( requestHeaders: Seq[(String, String)] = Nil ): F[String] = cats.Applicative[F].pure { Factories.randomString() } } class MockProcesses[F[_]: cats.Applicative] extends com.gilt.svc.sundial.v0.Processes[F] { /** * Retrieves a list of process runs based on search parameters. */ def get( processDefinitionName: _root_.scala.Option[String] = None, startTime: _root_.scala.Option[_root_.java.time.Instant] = None, endTime: _root_.scala.Option[_root_.java.time.Instant] = None, maxRecords: _root_.scala.Option[Int] = None, allowedStatuses: Seq[com.gilt.svc.sundial.v0.models.ProcessStatus], requestHeaders: Seq[(String, String)] = Nil ): F[Seq[com.gilt.svc.sundial.v0.models.Process]] = cats.Applicative[F].pure { Nil } /** * Retrieves a process run */ def getByProcessId( processId: _root_.java.util.UUID, requestHeaders: Seq[(String, String)] = Nil ): F[com.gilt.svc.sundial.v0.models.Process] = cats.Applicative[F].pure { com.gilt.svc.sundial.v0.mock.Factories.makeProcess() } /** * Retries a failed process run by restarting failed tasks; tasks will be given a * single additional attempt */ def postRetryByProcessId( processId: _root_.java.util.UUID, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } /** * Terminates an active process */ def postKillByProcessId( processId: _root_.java.util.UUID, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } } class MockProcessDefinitions[F[_]: cats.Applicative] extends com.gilt.svc.sundial.v0.ProcessDefinitions[F] { /** * Get all currently registered process definitions */ def get( requestHeaders: Seq[(String, String)] = Nil ): F[Seq[com.gilt.svc.sundial.v0.models.ProcessDefinition]] = cats.Applicative[F].pure { Nil } /** * Get a registered process definition */ def getByProcessDefinitionName( processDefinitionName: String, requestHeaders: Seq[(String, String)] = Nil ): F[com.gilt.svc.sundial.v0.models.ProcessDefinition] = cats.Applicative[F].pure { com.gilt.svc.sundial.v0.mock.Factories.makeProcessDefinition() } /** * Updates or creates a process definition */ def putByProcessDefinitionName( processDefinitionName: String, processDefinition: com.gilt.svc.sundial.v0.models.ProcessDefinition, requestHeaders: Seq[(String, String)] = Nil ): F[com.gilt.svc.sundial.v0.models.ProcessDefinition] = cats.Applicative[F].pure { com.gilt.svc.sundial.v0.mock.Factories.makeProcessDefinition() } /** * Deletes a registered process definition */ def deleteByProcessDefinitionName( processDefinitionName: String, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } /** * Triggers a new instance of the process */ def postTriggerByProcessDefinitionName( processDefinitionName: String, taskDefinitionName: _root_.scala.Option[String] = None, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } /** * Pause the process schedule */ def postPauseByProcessDefinitionName( processDefinitionName: String, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } /** * Resume the process schedule */ def postResumeByProcessDefinitionName( processDefinitionName: String, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } } class MockTasks[F[_]: cats.Applicative] extends com.gilt.svc.sundial.v0.Tasks[F] { /** * Retrieves the most recent tasks meeting the given criteria */ def get( processDefinitionName: String, taskDefinitionName: String, allowedStatuses: Seq[com.gilt.svc.sundial.v0.models.TaskStatus], startTime: _root_.scala.Option[_root_.java.time.Instant] = None, endTime: _root_.scala.Option[_root_.java.time.Instant] = None, limit: _root_.scala.Option[Int] = None, requestHeaders: Seq[(String, String)] = Nil ): F[Seq[com.gilt.svc.sundial.v0.models.Task]] = cats.Applicative[F].pure { Nil } /** * Appends log entries for a task; intended for use within the task executable */ def postLogEntriesByTaskId( taskId: _root_.java.util.UUID, logEntries: Seq[com.gilt.svc.sundial.v0.models.LogEntry], requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } /** * Appends metadata entries for a task; intended for use within the task executable */ def postMetadataByTaskId( taskId: _root_.java.util.UUID, metadataEntries: Seq[com.gilt.svc.sundial.v0.models.MetadataEntry], requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } /** * Marks the task as having succeeded */ def postSucceedByTaskId( taskId: _root_.java.util.UUID, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } /** * Marks the task as having failed */ def postFailByTaskId( taskId: _root_.java.util.UUID, requestHeaders: Seq[(String, String)] = Nil ): F[Unit] = cats.Applicative[F].pure { // unit type } } object Factories { def randomString(length: Int = 24): String = { _root_.scala.util.Random.alphanumeric.take(length).mkString } def makeDefaultEmrJobFlowRole(): com.gilt.svc.sundial.v0.models.DefaultEmrJobFlowRole = com.gilt.svc.sundial.v0.models.DefaultEmrJobFlowRole.DefaultEmrJobFlowRole def makeDefaultEmrServiceRole(): com.gilt.svc.sundial.v0.models.DefaultEmrServiceRole = com.gilt.svc.sundial.v0.models.DefaultEmrServiceRole.DefaultEmrServiceRole def makeEmrApplication(): com.gilt.svc.sundial.v0.models.EmrApplication = com.gilt.svc.sundial.v0.models.EmrApplication.Hadoop def makeEmrReleaseLabel(): com.gilt.svc.sundial.v0.models.EmrReleaseLabel = com.gilt.svc.sundial.v0.models.EmrReleaseLabel.Emr5140 def makeNotificationOptions(): com.gilt.svc.sundial.v0.models.NotificationOptions = com.gilt.svc.sundial.v0.models.NotificationOptions.Always def makeOnDemand(): com.gilt.svc.sundial.v0.models.OnDemand = com.gilt.svc.sundial.v0.models.OnDemand.OnDemand def makeProcessOverlapAction(): com.gilt.svc.sundial.v0.models.ProcessOverlapAction = com.gilt.svc.sundial.v0.models.ProcessOverlapAction.Wait def makeProcessStatus(): com.gilt.svc.sundial.v0.models.ProcessStatus = com.gilt.svc.sundial.v0.models.ProcessStatus.Running def makeTaskStatus(): com.gilt.svc.sundial.v0.models.TaskStatus = com.gilt.svc.sundial.v0.models.TaskStatus.Submitted def makeBatchImageCommand(): com.gilt.svc.sundial.v0.models.BatchImageCommand = com.gilt.svc.sundial.v0.models.BatchImageCommand( image = Factories.randomString(24), tag = Factories.randomString(24), command = Nil, memory = 1, vCpus = 1, jobRoleArn = None, environmentVariables = Nil, jobQueue = None ) def makeContinuousSchedule(): com.gilt.svc.sundial.v0.models.ContinuousSchedule = com.gilt.svc.sundial.v0.models.ContinuousSchedule( bufferSeconds = None ) def makeCronSchedule(): com.gilt.svc.sundial.v0.models.CronSchedule = com.gilt.svc.sundial.v0.models.CronSchedule( dayOfWeek = Factories.randomString(24), month = Factories.randomString(24), dayOfMonth = Factories.randomString(24), hours = Factories.randomString(24), minutes = Factories.randomString(24) ) def makeCustomEmrJobFlowRole(): com.gilt.svc.sundial.v0.models.CustomEmrJobFlowRole = com.gilt.svc.sundial.v0.models.CustomEmrJobFlowRole( roleName = Factories.randomString(24) ) def makeCustomEmrServiceRole(): com.gilt.svc.sundial.v0.models.CustomEmrServiceRole = com.gilt.svc.sundial.v0.models.CustomEmrServiceRole( roleName = Factories.randomString(24) ) def makeDockerImageCommand(): com.gilt.svc.sundial.v0.models.DockerImageCommand = com.gilt.svc.sundial.v0.models.DockerImageCommand( image = Factories.randomString(24), tag = Factories.randomString(24), command = Nil, memory = None, cpu = None, taskRoleArn = None, logPaths = Nil, environmentVariables = Nil ) def makeEmail(): com.gilt.svc.sundial.v0.models.Email = com.gilt.svc.sundial.v0.models.Email( name = Factories.randomString(24), email = Factories.randomString(24), notifyWhen = com.gilt.svc.sundial.v0.mock.Factories.makeNotificationOptions() ) def makeEmrCommand(): com.gilt.svc.sundial.v0.models.EmrCommand = com.gilt.svc.sundial.v0.models.EmrCommand( emrCluster = com.gilt.svc.sundial.v0.mock.Factories.makeEmrCluster(), jobName = Factories.randomString(24), region = Factories.randomString(24), `class` = Factories.randomString(24), s3JarPath = Factories.randomString(24), sparkConf = Nil, args = Nil, s3LogDetails = None, loadData = None, saveResults = None ) def makeEmrInstanceGroupDetails(): com.gilt.svc.sundial.v0.models.EmrInstanceGroupDetails = com.gilt.svc.sundial.v0.models.EmrInstanceGroupDetails( emrInstanceType = Factories.randomString(24), instanceCount = 1, awsMarket = com.gilt.svc.sundial.v0.mock.Factories.makeAwsMarket(), ebsVolumeSize = None ) def makeEnvironmentVariable(): com.gilt.svc.sundial.v0.models.EnvironmentVariable = com.gilt.svc.sundial.v0.models.EnvironmentVariable( variableName = Factories.randomString(24), value = Factories.randomString(24) ) def makeExistingEmrCluster(): com.gilt.svc.sundial.v0.models.ExistingEmrCluster = com.gilt.svc.sundial.v0.models.ExistingEmrCluster( clusterId = Factories.randomString(24) ) def makeHealthcheck(): com.gilt.svc.sundial.v0.models.Healthcheck = com.gilt.svc.sundial.v0.models.Healthcheck( status = Factories.randomString(24) ) def makeLogEntry(): com.gilt.svc.sundial.v0.models.LogEntry = com.gilt.svc.sundial.v0.models.LogEntry( logEntryId = _root_.java.util.UUID.randomUUID, when = _root_.java.time.Instant.now, source = Factories.randomString(24), message = Factories.randomString(24) ) def makeMetadataEntry(): com.gilt.svc.sundial.v0.models.MetadataEntry = com.gilt.svc.sundial.v0.models.MetadataEntry( metadataEntryId = _root_.java.util.UUID.randomUUID, when = _root_.java.time.Instant.now, key = Factories.randomString(24), value = Factories.randomString(24) ) def makeNewEmrCluster(): com.gilt.svc.sundial.v0.models.NewEmrCluster = com.gilt.svc.sundial.v0.models.NewEmrCluster( name = Factories.randomString(24), releaseLabel = com.gilt.svc.sundial.v0.mock.Factories.makeEmrReleaseLabel(), applications = Nil, s3LogUri = Factories.randomString(24), masterInstance = com.gilt.svc.sundial.v0.mock.Factories.makeEmrInstanceGroupDetails(), coreInstance = None, taskInstance = None, ec2Subnet = None, emrServiceRole = com.gilt.svc.sundial.v0.mock.Factories.makeEmrServiceRole(), emrJobFlowRole = com.gilt.svc.sundial.v0.mock.Factories.makeEmrJobFlowRole(), visibleToAllUsers = true ) def makePagerduty(): com.gilt.svc.sundial.v0.models.Pagerduty = com.gilt.svc.sundial.v0.models.Pagerduty( serviceKey = Factories.randomString(24), numConsecutiveFailures = 1, apiUrl = Factories.randomString(24) ) def makeProcess(): com.gilt.svc.sundial.v0.models.Process = com.gilt.svc.sundial.v0.models.Process( processId = _root_.java.util.UUID.randomUUID, processDefinitionName = Factories.randomString(24), startTime = _root_.java.time.Instant.now, status = com.gilt.svc.sundial.v0.mock.Factories.makeProcessStatus(), task = Nil ) def makeProcessDefinition(): com.gilt.svc.sundial.v0.models.ProcessDefinition = com.gilt.svc.sundial.v0.models.ProcessDefinition( processDefinitionName = Factories.randomString(24), paused = None, processDescription = None, schedule = None, taskDefinitions = Nil, overlapAction = com.gilt.svc.sundial.v0.mock.Factories.makeProcessOverlapAction(), notifications = None ) def makeS3Cp(): com.gilt.svc.sundial.v0.models.S3Cp = com.gilt.svc.sundial.v0.models.S3Cp( source = Factories.randomString(24), destination = Factories.randomString(24) ) def makeS3LogDetails(): com.gilt.svc.sundial.v0.models.S3LogDetails = com.gilt.svc.sundial.v0.models.S3LogDetails( logGroupName = Factories.randomString(24), logStreamName = Factories.randomString(24) ) def makeShellScriptCommand(): com.gilt.svc.sundial.v0.models.ShellScriptCommand = com.gilt.svc.sundial.v0.models.ShellScriptCommand( script = Factories.randomString(24), environmentVariables = None ) def makeSpot(): com.gilt.svc.sundial.v0.models.Spot = com.gilt.svc.sundial.v0.models.Spot( bidPrice = BigDecimal("1") ) def makeTask(): com.gilt.svc.sundial.v0.models.Task = com.gilt.svc.sundial.v0.models.Task( taskId = _root_.java.util.UUID.randomUUID, processId = _root_.java.util.UUID.randomUUID, processDefinitionName = Factories.randomString(24), taskDefinitionName = Factories.randomString(24), startTime = _root_.java.time.Instant.now, endTime = None, previousAttemptCount = 1, logEntries = Nil, metadataEntries = Nil, executionState = None, status = com.gilt.svc.sundial.v0.mock.Factories.makeTaskStatus() ) def makeTaskDefinition(): com.gilt.svc.sundial.v0.models.TaskDefinition = com.gilt.svc.sundial.v0.models.TaskDefinition( taskDefinitionName = Factories.randomString(24), dependencies = Nil, executable = com.gilt.svc.sundial.v0.mock.Factories.makeTaskExecutable(), maxAttempts = 1, maxRuntimeSeconds = None, backoffBaseSeconds = 1, backoffExponent = 1.0, requireExplicitSuccess = true ) def makeTaskDependency(): com.gilt.svc.sundial.v0.models.TaskDependency = com.gilt.svc.sundial.v0.models.TaskDependency( taskDefinitionName = Factories.randomString(24), successRequired = true ) def makeAwsMarket(): com.gilt.svc.sundial.v0.models.AwsMarket = com.gilt.svc.sundial.v0.mock.Factories.makeOnDemand() def makeEmrCluster(): com.gilt.svc.sundial.v0.models.EmrCluster = com.gilt.svc.sundial.v0.mock.Factories.makeNewEmrCluster() def makeEmrJobFlowRole(): com.gilt.svc.sundial.v0.models.EmrJobFlowRole = com.gilt.svc.sundial.v0.mock.Factories.makeDefaultEmrJobFlowRole() def makeEmrServiceRole(): com.gilt.svc.sundial.v0.models.EmrServiceRole = com.gilt.svc.sundial.v0.mock.Factories.makeDefaultEmrServiceRole() def makeNotification(): com.gilt.svc.sundial.v0.models.Notification = com.gilt.svc.sundial.v0.mock.Factories.makeEmail() def makeProcessSchedule(): com.gilt.svc.sundial.v0.models.ProcessSchedule = com.gilt.svc.sundial.v0.mock.Factories.makeCronSchedule() def makeTaskExecutable(): com.gilt.svc.sundial.v0.models.TaskExecutable = com.gilt.svc.sundial.v0.mock.Factories.makeDockerImageCommand() } }