module Network.AWS.ECS.Types
(
ECS
, JSONError
, NetworkBinding
, networkBinding
, nbBindIP
, nbContainerPort
, nbHostPort
, Cluster
, cluster
, cClusterArn
, cClusterName
, cStatus
, Volume
, volume
, vHost
, vName
, ContainerOverride
, containerOverride
, coCommand
, coName
, KeyValuePair
, keyValuePair
, kvpName
, kvpValue
, VolumeFrom
, volumeFrom
, vfReadOnly
, vfSourceContainer
, TaskOverride
, taskOverride
, toContainerOverrides
, HostVolumeProperties
, hostVolumeProperties
, hvpSourcePath
, Container
, container
, cContainerArn
, cExitCode
, cLastStatus
, cName
, cNetworkBindings
, cReason
, cTaskArn
, ContainerDefinition
, containerDefinition
, cdCommand
, cdCpu
, cdEntryPoint
, cdEnvironment
, cdEssential
, cdImage
, cdLinks
, cdMemory
, cdMountPoints
, cdName
, cdPortMappings
, cdVolumesFrom
, Resource
, resource
, rDoubleValue
, rIntegerValue
, rLongValue
, rName
, rStringSetValue
, rType
, Task
, task
, tClusterArn
, tContainerInstanceArn
, tContainers
, tDesiredStatus
, tLastStatus
, tOverrides
, tTaskArn
, tTaskDefinitionArn
, PortMapping
, portMapping
, pmContainerPort
, pmHostPort
, TaskDefinition
, taskDefinition
, tdContainerDefinitions
, tdFamily
, tdRevision
, tdTaskDefinitionArn
, tdVolumes
, Failure
, failure
, fArn
, fReason
, ContainerInstance
, containerInstance
, ciAgentConnected
, ciContainerInstanceArn
, ciEc2InstanceId
, ciRegisteredResources
, ciRemainingResources
, ciStatus
, MountPoint
, mountPoint
, mpContainerPath
, mpReadOnly
, mpSourceVolume
) where
import Network.AWS.Prelude
import Network.AWS.Signing
import qualified GHC.Exts
data ECS
instance AWSService ECS where
type Sg ECS = V4
type Er ECS = JSONError
service = service'
where
service' :: Service ECS
service' = Service
{ _svcAbbrev = "ECS"
, _svcPrefix = "ecs"
, _svcVersion = "2014-11-13"
, _svcTargetPrefix = Just "AmazonEC2ContainerServiceV20141113"
, _svcJSONVersion = Just "1.1"
, _svcHandle = handle
, _svcRetry = retry
}
handle :: Status
-> Maybe (LazyByteString -> ServiceError JSONError)
handle = jsonError statusSuccess service'
retry :: Retry ECS
retry = Exponential
{ _retryBase = 0.05
, _retryGrowth = 2
, _retryAttempts = 5
, _retryCheck = check
}
check :: Status
-> JSONError
-> Bool
check (statusCode -> s) (awsErrorCode -> e)
| s == 500 = True
| s == 509 = True
| s == 503 = True
| otherwise = False
data NetworkBinding = NetworkBinding
{ _nbBindIP :: Maybe Text
, _nbContainerPort :: Maybe Int
, _nbHostPort :: Maybe Int
} deriving (Eq, Ord, Read, Show)
networkBinding :: NetworkBinding
networkBinding = NetworkBinding
{ _nbBindIP = Nothing
, _nbContainerPort = Nothing
, _nbHostPort = Nothing
}
nbBindIP :: Lens' NetworkBinding (Maybe Text)
nbBindIP = lens _nbBindIP (\s a -> s { _nbBindIP = a })
nbContainerPort :: Lens' NetworkBinding (Maybe Int)
nbContainerPort = lens _nbContainerPort (\s a -> s { _nbContainerPort = a })
nbHostPort :: Lens' NetworkBinding (Maybe Int)
nbHostPort = lens _nbHostPort (\s a -> s { _nbHostPort = a })
instance FromJSON NetworkBinding where
parseJSON = withObject "NetworkBinding" $ \o -> NetworkBinding
<$> o .:? "bindIP"
<*> o .:? "containerPort"
<*> o .:? "hostPort"
instance ToJSON NetworkBinding where
toJSON NetworkBinding{..} = object
[ "bindIP" .= _nbBindIP
, "containerPort" .= _nbContainerPort
, "hostPort" .= _nbHostPort
]
data Cluster = Cluster
{ _cClusterArn :: Maybe Text
, _cClusterName :: Maybe Text
, _cStatus :: Maybe Text
} deriving (Eq, Ord, Read, Show)
cluster :: Cluster
cluster = Cluster
{ _cClusterArn = Nothing
, _cClusterName = Nothing
, _cStatus = Nothing
}
cClusterArn :: Lens' Cluster (Maybe Text)
cClusterArn = lens _cClusterArn (\s a -> s { _cClusterArn = a })
cClusterName :: Lens' Cluster (Maybe Text)
cClusterName = lens _cClusterName (\s a -> s { _cClusterName = a })
cStatus :: Lens' Cluster (Maybe Text)
cStatus = lens _cStatus (\s a -> s { _cStatus = a })
instance FromJSON Cluster where
parseJSON = withObject "Cluster" $ \o -> Cluster
<$> o .:? "clusterArn"
<*> o .:? "clusterName"
<*> o .:? "status"
instance ToJSON Cluster where
toJSON Cluster{..} = object
[ "clusterArn" .= _cClusterArn
, "clusterName" .= _cClusterName
, "status" .= _cStatus
]
data Volume = Volume
{ _vHost :: Maybe HostVolumeProperties
, _vName :: Maybe Text
} deriving (Eq, Read, Show)
volume :: Volume
volume = Volume
{ _vName = Nothing
, _vHost = Nothing
}
vHost :: Lens' Volume (Maybe HostVolumeProperties)
vHost = lens _vHost (\s a -> s { _vHost = a })
vName :: Lens' Volume (Maybe Text)
vName = lens _vName (\s a -> s { _vName = a })
instance FromJSON Volume where
parseJSON = withObject "Volume" $ \o -> Volume
<$> o .:? "host"
<*> o .:? "name"
instance ToJSON Volume where
toJSON Volume{..} = object
[ "name" .= _vName
, "host" .= _vHost
]
data ContainerOverride = ContainerOverride
{ _coCommand :: List "command" Text
, _coName :: Maybe Text
} deriving (Eq, Ord, Read, Show)
containerOverride :: ContainerOverride
containerOverride = ContainerOverride
{ _coName = Nothing
, _coCommand = mempty
}
coCommand :: Lens' ContainerOverride [Text]
coCommand = lens _coCommand (\s a -> s { _coCommand = a }) . _List
coName :: Lens' ContainerOverride (Maybe Text)
coName = lens _coName (\s a -> s { _coName = a })
instance FromJSON ContainerOverride where
parseJSON = withObject "ContainerOverride" $ \o -> ContainerOverride
<$> o .:? "command" .!= mempty
<*> o .:? "name"
instance ToJSON ContainerOverride where
toJSON ContainerOverride{..} = object
[ "name" .= _coName
, "command" .= _coCommand
]
data KeyValuePair = KeyValuePair
{ _kvpName :: Maybe Text
, _kvpValue :: Maybe Text
} deriving (Eq, Ord, Read, Show)
keyValuePair :: KeyValuePair
keyValuePair = KeyValuePair
{ _kvpName = Nothing
, _kvpValue = Nothing
}
kvpName :: Lens' KeyValuePair (Maybe Text)
kvpName = lens _kvpName (\s a -> s { _kvpName = a })
kvpValue :: Lens' KeyValuePair (Maybe Text)
kvpValue = lens _kvpValue (\s a -> s { _kvpValue = a })
instance FromJSON KeyValuePair where
parseJSON = withObject "KeyValuePair" $ \o -> KeyValuePair
<$> o .:? "name"
<*> o .:? "value"
instance ToJSON KeyValuePair where
toJSON KeyValuePair{..} = object
[ "name" .= _kvpName
, "value" .= _kvpValue
]
data VolumeFrom = VolumeFrom
{ _vfReadOnly :: Maybe Bool
, _vfSourceContainer :: Maybe Text
} deriving (Eq, Ord, Read, Show)
volumeFrom :: VolumeFrom
volumeFrom = VolumeFrom
{ _vfSourceContainer = Nothing
, _vfReadOnly = Nothing
}
vfReadOnly :: Lens' VolumeFrom (Maybe Bool)
vfReadOnly = lens _vfReadOnly (\s a -> s { _vfReadOnly = a })
vfSourceContainer :: Lens' VolumeFrom (Maybe Text)
vfSourceContainer =
lens _vfSourceContainer (\s a -> s { _vfSourceContainer = a })
instance FromJSON VolumeFrom where
parseJSON = withObject "VolumeFrom" $ \o -> VolumeFrom
<$> o .:? "readOnly"
<*> o .:? "sourceContainer"
instance ToJSON VolumeFrom where
toJSON VolumeFrom{..} = object
[ "sourceContainer" .= _vfSourceContainer
, "readOnly" .= _vfReadOnly
]
newtype TaskOverride = TaskOverride
{ _toContainerOverrides :: List "containerOverrides" ContainerOverride
} deriving (Eq, Read, Show, Monoid, Semigroup)
instance GHC.Exts.IsList TaskOverride where
type Item TaskOverride = ContainerOverride
fromList = TaskOverride . GHC.Exts.fromList
toList = GHC.Exts.toList . _toContainerOverrides
taskOverride :: TaskOverride
taskOverride = TaskOverride
{ _toContainerOverrides = mempty
}
toContainerOverrides :: Lens' TaskOverride [ContainerOverride]
toContainerOverrides =
lens _toContainerOverrides (\s a -> s { _toContainerOverrides = a })
. _List
instance FromJSON TaskOverride where
parseJSON = withObject "TaskOverride" $ \o -> TaskOverride
<$> o .:? "containerOverrides" .!= mempty
instance ToJSON TaskOverride where
toJSON TaskOverride{..} = object
[ "containerOverrides" .= _toContainerOverrides
]
newtype HostVolumeProperties = HostVolumeProperties
{ _hvpSourcePath :: Maybe Text
} deriving (Eq, Ord, Read, Show, Monoid)
hostVolumeProperties :: HostVolumeProperties
hostVolumeProperties = HostVolumeProperties
{ _hvpSourcePath = Nothing
}
hvpSourcePath :: Lens' HostVolumeProperties (Maybe Text)
hvpSourcePath = lens _hvpSourcePath (\s a -> s { _hvpSourcePath = a })
instance FromJSON HostVolumeProperties where
parseJSON = withObject "HostVolumeProperties" $ \o -> HostVolumeProperties
<$> o .:? "sourcePath"
instance ToJSON HostVolumeProperties where
toJSON HostVolumeProperties{..} = object
[ "sourcePath" .= _hvpSourcePath
]
data Container = Container
{ _cContainerArn :: Maybe Text
, _cExitCode :: Maybe Int
, _cLastStatus :: Maybe Text
, _cName :: Maybe Text
, _cNetworkBindings :: List "networkBindings" NetworkBinding
, _cReason :: Maybe Text
, _cTaskArn :: Maybe Text
} deriving (Eq, Read, Show)
container :: Container
container = Container
{ _cContainerArn = Nothing
, _cTaskArn = Nothing
, _cName = Nothing
, _cLastStatus = Nothing
, _cExitCode = Nothing
, _cReason = Nothing
, _cNetworkBindings = mempty
}
cContainerArn :: Lens' Container (Maybe Text)
cContainerArn = lens _cContainerArn (\s a -> s { _cContainerArn = a })
cExitCode :: Lens' Container (Maybe Int)
cExitCode = lens _cExitCode (\s a -> s { _cExitCode = a })
cLastStatus :: Lens' Container (Maybe Text)
cLastStatus = lens _cLastStatus (\s a -> s { _cLastStatus = a })
cName :: Lens' Container (Maybe Text)
cName = lens _cName (\s a -> s { _cName = a })
cNetworkBindings :: Lens' Container [NetworkBinding]
cNetworkBindings = lens _cNetworkBindings (\s a -> s { _cNetworkBindings = a }) . _List
cReason :: Lens' Container (Maybe Text)
cReason = lens _cReason (\s a -> s { _cReason = a })
cTaskArn :: Lens' Container (Maybe Text)
cTaskArn = lens _cTaskArn (\s a -> s { _cTaskArn = a })
instance FromJSON Container where
parseJSON = withObject "Container" $ \o -> Container
<$> o .:? "containerArn"
<*> o .:? "exitCode"
<*> o .:? "lastStatus"
<*> o .:? "name"
<*> o .:? "networkBindings" .!= mempty
<*> o .:? "reason"
<*> o .:? "taskArn"
instance ToJSON Container where
toJSON Container{..} = object
[ "containerArn" .= _cContainerArn
, "taskArn" .= _cTaskArn
, "name" .= _cName
, "lastStatus" .= _cLastStatus
, "exitCode" .= _cExitCode
, "reason" .= _cReason
, "networkBindings" .= _cNetworkBindings
]
data ContainerDefinition = ContainerDefinition
{ _cdCommand :: List "command" Text
, _cdCpu :: Maybe Int
, _cdEntryPoint :: List "entryPoint" Text
, _cdEnvironment :: List "environment" KeyValuePair
, _cdEssential :: Maybe Bool
, _cdImage :: Maybe Text
, _cdLinks :: List "links" Text
, _cdMemory :: Maybe Int
, _cdMountPoints :: List "mountPoints" MountPoint
, _cdName :: Maybe Text
, _cdPortMappings :: List "portMappings" PortMapping
, _cdVolumesFrom :: List "volumesFrom" VolumeFrom
} deriving (Eq, Read, Show)
containerDefinition :: ContainerDefinition
containerDefinition = ContainerDefinition
{ _cdName = Nothing
, _cdImage = Nothing
, _cdCpu = Nothing
, _cdMemory = Nothing
, _cdLinks = mempty
, _cdPortMappings = mempty
, _cdEssential = Nothing
, _cdEntryPoint = mempty
, _cdCommand = mempty
, _cdEnvironment = mempty
, _cdMountPoints = mempty
, _cdVolumesFrom = mempty
}
cdCommand :: Lens' ContainerDefinition [Text]
cdCommand = lens _cdCommand (\s a -> s { _cdCommand = a }) . _List
cdCpu :: Lens' ContainerDefinition (Maybe Int)
cdCpu = lens _cdCpu (\s a -> s { _cdCpu = a })
cdEntryPoint :: Lens' ContainerDefinition [Text]
cdEntryPoint = lens _cdEntryPoint (\s a -> s { _cdEntryPoint = a }) . _List
cdEnvironment :: Lens' ContainerDefinition [KeyValuePair]
cdEnvironment = lens _cdEnvironment (\s a -> s { _cdEnvironment = a }) . _List
cdEssential :: Lens' ContainerDefinition (Maybe Bool)
cdEssential = lens _cdEssential (\s a -> s { _cdEssential = a })
cdImage :: Lens' ContainerDefinition (Maybe Text)
cdImage = lens _cdImage (\s a -> s { _cdImage = a })
cdLinks :: Lens' ContainerDefinition [Text]
cdLinks = lens _cdLinks (\s a -> s { _cdLinks = a }) . _List
cdMemory :: Lens' ContainerDefinition (Maybe Int)
cdMemory = lens _cdMemory (\s a -> s { _cdMemory = a })
cdMountPoints :: Lens' ContainerDefinition [MountPoint]
cdMountPoints = lens _cdMountPoints (\s a -> s { _cdMountPoints = a }) . _List
cdName :: Lens' ContainerDefinition (Maybe Text)
cdName = lens _cdName (\s a -> s { _cdName = a })
cdPortMappings :: Lens' ContainerDefinition [PortMapping]
cdPortMappings = lens _cdPortMappings (\s a -> s { _cdPortMappings = a }) . _List
cdVolumesFrom :: Lens' ContainerDefinition [VolumeFrom]
cdVolumesFrom = lens _cdVolumesFrom (\s a -> s { _cdVolumesFrom = a }) . _List
instance FromJSON ContainerDefinition where
parseJSON = withObject "ContainerDefinition" $ \o -> ContainerDefinition
<$> o .:? "command" .!= mempty
<*> o .:? "cpu"
<*> o .:? "entryPoint" .!= mempty
<*> o .:? "environment" .!= mempty
<*> o .:? "essential"
<*> o .:? "image"
<*> o .:? "links" .!= mempty
<*> o .:? "memory"
<*> o .:? "mountPoints" .!= mempty
<*> o .:? "name"
<*> o .:? "portMappings" .!= mempty
<*> o .:? "volumesFrom" .!= mempty
instance ToJSON ContainerDefinition where
toJSON ContainerDefinition{..} = object
[ "name" .= _cdName
, "image" .= _cdImage
, "cpu" .= _cdCpu
, "memory" .= _cdMemory
, "links" .= _cdLinks
, "portMappings" .= _cdPortMappings
, "essential" .= _cdEssential
, "entryPoint" .= _cdEntryPoint
, "command" .= _cdCommand
, "environment" .= _cdEnvironment
, "mountPoints" .= _cdMountPoints
, "volumesFrom" .= _cdVolumesFrom
]
data Resource = Resource
{ _rDoubleValue :: Maybe Double
, _rIntegerValue :: Maybe Int
, _rLongValue :: Maybe Integer
, _rName :: Maybe Text
, _rStringSetValue :: List "stringSetValue" Text
, _rType :: Maybe Text
} deriving (Eq, Ord, Read, Show)
resource :: Resource
resource = Resource
{ _rName = Nothing
, _rType = Nothing
, _rDoubleValue = Nothing
, _rLongValue = Nothing
, _rIntegerValue = Nothing
, _rStringSetValue = mempty
}
rDoubleValue :: Lens' Resource (Maybe Double)
rDoubleValue = lens _rDoubleValue (\s a -> s { _rDoubleValue = a })
rIntegerValue :: Lens' Resource (Maybe Int)
rIntegerValue = lens _rIntegerValue (\s a -> s { _rIntegerValue = a })
rLongValue :: Lens' Resource (Maybe Integer)
rLongValue = lens _rLongValue (\s a -> s { _rLongValue = a })
rName :: Lens' Resource (Maybe Text)
rName = lens _rName (\s a -> s { _rName = a })
rStringSetValue :: Lens' Resource [Text]
rStringSetValue = lens _rStringSetValue (\s a -> s { _rStringSetValue = a }) . _List
rType :: Lens' Resource (Maybe Text)
rType = lens _rType (\s a -> s { _rType = a })
instance FromJSON Resource where
parseJSON = withObject "Resource" $ \o -> Resource
<$> o .:? "doubleValue"
<*> o .:? "integerValue"
<*> o .:? "longValue"
<*> o .:? "name"
<*> o .:? "stringSetValue" .!= mempty
<*> o .:? "type"
instance ToJSON Resource where
toJSON Resource{..} = object
[ "name" .= _rName
, "type" .= _rType
, "doubleValue" .= _rDoubleValue
, "longValue" .= _rLongValue
, "integerValue" .= _rIntegerValue
, "stringSetValue" .= _rStringSetValue
]
data Task = Task
{ _tClusterArn :: Maybe Text
, _tContainerInstanceArn :: Maybe Text
, _tContainers :: List "containers" Container
, _tDesiredStatus :: Maybe Text
, _tLastStatus :: Maybe Text
, _tOverrides :: Maybe TaskOverride
, _tTaskArn :: Maybe Text
, _tTaskDefinitionArn :: Maybe Text
} deriving (Eq, Read, Show)
task :: Task
task = Task
{ _tTaskArn = Nothing
, _tClusterArn = Nothing
, _tTaskDefinitionArn = Nothing
, _tContainerInstanceArn = Nothing
, _tOverrides = Nothing
, _tLastStatus = Nothing
, _tDesiredStatus = Nothing
, _tContainers = mempty
}
tClusterArn :: Lens' Task (Maybe Text)
tClusterArn = lens _tClusterArn (\s a -> s { _tClusterArn = a })
tContainerInstanceArn :: Lens' Task (Maybe Text)
tContainerInstanceArn =
lens _tContainerInstanceArn (\s a -> s { _tContainerInstanceArn = a })
tContainers :: Lens' Task [Container]
tContainers = lens _tContainers (\s a -> s { _tContainers = a }) . _List
tDesiredStatus :: Lens' Task (Maybe Text)
tDesiredStatus = lens _tDesiredStatus (\s a -> s { _tDesiredStatus = a })
tLastStatus :: Lens' Task (Maybe Text)
tLastStatus = lens _tLastStatus (\s a -> s { _tLastStatus = a })
tOverrides :: Lens' Task (Maybe TaskOverride)
tOverrides = lens _tOverrides (\s a -> s { _tOverrides = a })
tTaskArn :: Lens' Task (Maybe Text)
tTaskArn = lens _tTaskArn (\s a -> s { _tTaskArn = a })
tTaskDefinitionArn :: Lens' Task (Maybe Text)
tTaskDefinitionArn =
lens _tTaskDefinitionArn (\s a -> s { _tTaskDefinitionArn = a })
instance FromJSON Task where
parseJSON = withObject "Task" $ \o -> Task
<$> o .:? "clusterArn"
<*> o .:? "containerInstanceArn"
<*> o .:? "containers" .!= mempty
<*> o .:? "desiredStatus"
<*> o .:? "lastStatus"
<*> o .:? "overrides"
<*> o .:? "taskArn"
<*> o .:? "taskDefinitionArn"
instance ToJSON Task where
toJSON Task{..} = object
[ "taskArn" .= _tTaskArn
, "clusterArn" .= _tClusterArn
, "taskDefinitionArn" .= _tTaskDefinitionArn
, "containerInstanceArn" .= _tContainerInstanceArn
, "overrides" .= _tOverrides
, "lastStatus" .= _tLastStatus
, "desiredStatus" .= _tDesiredStatus
, "containers" .= _tContainers
]
data PortMapping = PortMapping
{ _pmContainerPort :: Maybe Int
, _pmHostPort :: Maybe Int
} deriving (Eq, Ord, Read, Show)
portMapping :: PortMapping
portMapping = PortMapping
{ _pmContainerPort = Nothing
, _pmHostPort = Nothing
}
pmContainerPort :: Lens' PortMapping (Maybe Int)
pmContainerPort = lens _pmContainerPort (\s a -> s { _pmContainerPort = a })
pmHostPort :: Lens' PortMapping (Maybe Int)
pmHostPort = lens _pmHostPort (\s a -> s { _pmHostPort = a })
instance FromJSON PortMapping where
parseJSON = withObject "PortMapping" $ \o -> PortMapping
<$> o .:? "containerPort"
<*> o .:? "hostPort"
instance ToJSON PortMapping where
toJSON PortMapping{..} = object
[ "containerPort" .= _pmContainerPort
, "hostPort" .= _pmHostPort
]
data TaskDefinition = TaskDefinition
{ _tdContainerDefinitions :: List "containerDefinitions" ContainerDefinition
, _tdFamily :: Maybe Text
, _tdRevision :: Maybe Int
, _tdTaskDefinitionArn :: Maybe Text
, _tdVolumes :: List "volumes" Volume
} deriving (Eq, Read, Show)
taskDefinition :: TaskDefinition
taskDefinition = TaskDefinition
{ _tdTaskDefinitionArn = Nothing
, _tdContainerDefinitions = mempty
, _tdFamily = Nothing
, _tdRevision = Nothing
, _tdVolumes = mempty
}
tdContainerDefinitions :: Lens' TaskDefinition [ContainerDefinition]
tdContainerDefinitions =
lens _tdContainerDefinitions (\s a -> s { _tdContainerDefinitions = a })
. _List
tdFamily :: Lens' TaskDefinition (Maybe Text)
tdFamily = lens _tdFamily (\s a -> s { _tdFamily = a })
tdRevision :: Lens' TaskDefinition (Maybe Int)
tdRevision = lens _tdRevision (\s a -> s { _tdRevision = a })
tdTaskDefinitionArn :: Lens' TaskDefinition (Maybe Text)
tdTaskDefinitionArn =
lens _tdTaskDefinitionArn (\s a -> s { _tdTaskDefinitionArn = a })
tdVolumes :: Lens' TaskDefinition [Volume]
tdVolumes = lens _tdVolumes (\s a -> s { _tdVolumes = a }) . _List
instance FromJSON TaskDefinition where
parseJSON = withObject "TaskDefinition" $ \o -> TaskDefinition
<$> o .:? "containerDefinitions" .!= mempty
<*> o .:? "family"
<*> o .:? "revision"
<*> o .:? "taskDefinitionArn"
<*> o .:? "volumes" .!= mempty
instance ToJSON TaskDefinition where
toJSON TaskDefinition{..} = object
[ "taskDefinitionArn" .= _tdTaskDefinitionArn
, "containerDefinitions" .= _tdContainerDefinitions
, "family" .= _tdFamily
, "revision" .= _tdRevision
, "volumes" .= _tdVolumes
]
data Failure = Failure
{ _fArn :: Maybe Text
, _fReason :: Maybe Text
} deriving (Eq, Ord, Read, Show)
failure :: Failure
failure = Failure
{ _fArn = Nothing
, _fReason = Nothing
}
fArn :: Lens' Failure (Maybe Text)
fArn = lens _fArn (\s a -> s { _fArn = a })
fReason :: Lens' Failure (Maybe Text)
fReason = lens _fReason (\s a -> s { _fReason = a })
instance FromJSON Failure where
parseJSON = withObject "Failure" $ \o -> Failure
<$> o .:? "arn"
<*> o .:? "reason"
instance ToJSON Failure where
toJSON Failure{..} = object
[ "arn" .= _fArn
, "reason" .= _fReason
]
data ContainerInstance = ContainerInstance
{ _ciAgentConnected :: Maybe Bool
, _ciContainerInstanceArn :: Maybe Text
, _ciEc2InstanceId :: Maybe Text
, _ciRegisteredResources :: List "registeredResources" Resource
, _ciRemainingResources :: List "remainingResources" Resource
, _ciStatus :: Maybe Text
} deriving (Eq, Read, Show)
containerInstance :: ContainerInstance
containerInstance = ContainerInstance
{ _ciContainerInstanceArn = Nothing
, _ciEc2InstanceId = Nothing
, _ciRemainingResources = mempty
, _ciRegisteredResources = mempty
, _ciStatus = Nothing
, _ciAgentConnected = Nothing
}
ciAgentConnected :: Lens' ContainerInstance (Maybe Bool)
ciAgentConnected = lens _ciAgentConnected (\s a -> s { _ciAgentConnected = a })
ciContainerInstanceArn :: Lens' ContainerInstance (Maybe Text)
ciContainerInstanceArn =
lens _ciContainerInstanceArn (\s a -> s { _ciContainerInstanceArn = a })
ciEc2InstanceId :: Lens' ContainerInstance (Maybe Text)
ciEc2InstanceId = lens _ciEc2InstanceId (\s a -> s { _ciEc2InstanceId = a })
ciRegisteredResources :: Lens' ContainerInstance [Resource]
ciRegisteredResources =
lens _ciRegisteredResources (\s a -> s { _ciRegisteredResources = a })
. _List
ciRemainingResources :: Lens' ContainerInstance [Resource]
ciRemainingResources =
lens _ciRemainingResources (\s a -> s { _ciRemainingResources = a })
. _List
ciStatus :: Lens' ContainerInstance (Maybe Text)
ciStatus = lens _ciStatus (\s a -> s { _ciStatus = a })
instance FromJSON ContainerInstance where
parseJSON = withObject "ContainerInstance" $ \o -> ContainerInstance
<$> o .:? "agentConnected"
<*> o .:? "containerInstanceArn"
<*> o .:? "ec2InstanceId"
<*> o .:? "registeredResources" .!= mempty
<*> o .:? "remainingResources" .!= mempty
<*> o .:? "status"
instance ToJSON ContainerInstance where
toJSON ContainerInstance{..} = object
[ "containerInstanceArn" .= _ciContainerInstanceArn
, "ec2InstanceId" .= _ciEc2InstanceId
, "remainingResources" .= _ciRemainingResources
, "registeredResources" .= _ciRegisteredResources
, "status" .= _ciStatus
, "agentConnected" .= _ciAgentConnected
]
data MountPoint = MountPoint
{ _mpContainerPath :: Maybe Text
, _mpReadOnly :: Maybe Bool
, _mpSourceVolume :: Maybe Text
} deriving (Eq, Ord, Read, Show)
mountPoint :: MountPoint
mountPoint = MountPoint
{ _mpSourceVolume = Nothing
, _mpContainerPath = Nothing
, _mpReadOnly = Nothing
}
mpContainerPath :: Lens' MountPoint (Maybe Text)
mpContainerPath = lens _mpContainerPath (\s a -> s { _mpContainerPath = a })
mpReadOnly :: Lens' MountPoint (Maybe Bool)
mpReadOnly = lens _mpReadOnly (\s a -> s { _mpReadOnly = a })
mpSourceVolume :: Lens' MountPoint (Maybe Text)
mpSourceVolume = lens _mpSourceVolume (\s a -> s { _mpSourceVolume = a })
instance FromJSON MountPoint where
parseJSON = withObject "MountPoint" $ \o -> MountPoint
<$> o .:? "containerPath"
<*> o .:? "readOnly"
<*> o .:? "sourceVolume"
instance ToJSON MountPoint where
toJSON MountPoint{..} = object
[ "sourceVolume" .= _mpSourceVolume
, "containerPath" .= _mpContainerPath
, "readOnly" .= _mpReadOnly
]