{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ECS.Types.DockerVolumeConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ECS.Types.DockerVolumeConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types.Scope
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | This parameter is specified when you are using Docker volumes. Docker
-- volumes are only supported when you are using the EC2 launch type.
-- Windows containers only support the use of the @local@ driver. To use
-- bind mounts, specify a @host@ instead.
--
-- /See:/ 'newDockerVolumeConfiguration' smart constructor.
data DockerVolumeConfiguration = DockerVolumeConfiguration'
  { -- | A map of Docker driver-specific options passed through. This parameter
    -- maps to @DriverOpts@ in the
    -- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
    -- section of the
    -- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
    -- @xxopt@ option to
    -- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
    DockerVolumeConfiguration -> Maybe (HashMap Text Text)
driverOpts :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Docker volume driver to use. The driver value must match the driver
    -- name provided by Docker because it is used for task placement. If the
    -- driver was installed using the Docker plugin CLI, use @docker plugin ls@
    -- to retrieve the driver name from your container instance. If the driver
    -- was installed using another method, use Docker plugin discovery to
    -- retrieve the driver name. For more information, see
    -- <https://docs.docker.com/engine/extend/plugin_api/#plugin-discovery Docker plugin discovery>.
    -- This parameter maps to @Driver@ in the
    -- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
    -- section of the
    -- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
    -- @xxdriver@ option to
    -- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
    DockerVolumeConfiguration -> Maybe Text
driver :: Prelude.Maybe Prelude.Text,
    -- | The scope for the Docker volume that determines its lifecycle. Docker
    -- volumes that are scoped to a @task@ are automatically provisioned when
    -- the task starts and destroyed when the task stops. Docker volumes that
    -- are scoped as @shared@ persist after the task stops.
    DockerVolumeConfiguration -> Maybe Scope
scope :: Prelude.Maybe Scope,
    -- | Custom metadata to add to your Docker volume. This parameter maps to
    -- @Labels@ in the
    -- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
    -- section of the
    -- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
    -- @xxlabel@ option to
    -- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
    DockerVolumeConfiguration -> Maybe (HashMap Text Text)
labels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | If this value is @true@, the Docker volume is created if it does not
    -- already exist.
    --
    -- This field is only used if the @scope@ is @shared@.
    DockerVolumeConfiguration -> Maybe Bool
autoprovision :: Prelude.Maybe Prelude.Bool
  }
  deriving (DockerVolumeConfiguration -> DockerVolumeConfiguration -> Bool
(DockerVolumeConfiguration -> DockerVolumeConfiguration -> Bool)
-> (DockerVolumeConfiguration -> DockerVolumeConfiguration -> Bool)
-> Eq DockerVolumeConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DockerVolumeConfiguration -> DockerVolumeConfiguration -> Bool
$c/= :: DockerVolumeConfiguration -> DockerVolumeConfiguration -> Bool
== :: DockerVolumeConfiguration -> DockerVolumeConfiguration -> Bool
$c== :: DockerVolumeConfiguration -> DockerVolumeConfiguration -> Bool
Prelude.Eq, ReadPrec [DockerVolumeConfiguration]
ReadPrec DockerVolumeConfiguration
Int -> ReadS DockerVolumeConfiguration
ReadS [DockerVolumeConfiguration]
(Int -> ReadS DockerVolumeConfiguration)
-> ReadS [DockerVolumeConfiguration]
-> ReadPrec DockerVolumeConfiguration
-> ReadPrec [DockerVolumeConfiguration]
-> Read DockerVolumeConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DockerVolumeConfiguration]
$creadListPrec :: ReadPrec [DockerVolumeConfiguration]
readPrec :: ReadPrec DockerVolumeConfiguration
$creadPrec :: ReadPrec DockerVolumeConfiguration
readList :: ReadS [DockerVolumeConfiguration]
$creadList :: ReadS [DockerVolumeConfiguration]
readsPrec :: Int -> ReadS DockerVolumeConfiguration
$creadsPrec :: Int -> ReadS DockerVolumeConfiguration
Prelude.Read, Int -> DockerVolumeConfiguration -> ShowS
[DockerVolumeConfiguration] -> ShowS
DockerVolumeConfiguration -> String
(Int -> DockerVolumeConfiguration -> ShowS)
-> (DockerVolumeConfiguration -> String)
-> ([DockerVolumeConfiguration] -> ShowS)
-> Show DockerVolumeConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DockerVolumeConfiguration] -> ShowS
$cshowList :: [DockerVolumeConfiguration] -> ShowS
show :: DockerVolumeConfiguration -> String
$cshow :: DockerVolumeConfiguration -> String
showsPrec :: Int -> DockerVolumeConfiguration -> ShowS
$cshowsPrec :: Int -> DockerVolumeConfiguration -> ShowS
Prelude.Show, (forall x.
 DockerVolumeConfiguration -> Rep DockerVolumeConfiguration x)
-> (forall x.
    Rep DockerVolumeConfiguration x -> DockerVolumeConfiguration)
-> Generic DockerVolumeConfiguration
forall x.
Rep DockerVolumeConfiguration x -> DockerVolumeConfiguration
forall x.
DockerVolumeConfiguration -> Rep DockerVolumeConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DockerVolumeConfiguration x -> DockerVolumeConfiguration
$cfrom :: forall x.
DockerVolumeConfiguration -> Rep DockerVolumeConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DockerVolumeConfiguration' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'driverOpts', 'dockerVolumeConfiguration_driverOpts' - A map of Docker driver-specific options passed through. This parameter
-- maps to @DriverOpts@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @xxopt@ option to
-- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
--
-- 'driver', 'dockerVolumeConfiguration_driver' - The Docker volume driver to use. The driver value must match the driver
-- name provided by Docker because it is used for task placement. If the
-- driver was installed using the Docker plugin CLI, use @docker plugin ls@
-- to retrieve the driver name from your container instance. If the driver
-- was installed using another method, use Docker plugin discovery to
-- retrieve the driver name. For more information, see
-- <https://docs.docker.com/engine/extend/plugin_api/#plugin-discovery Docker plugin discovery>.
-- This parameter maps to @Driver@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @xxdriver@ option to
-- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
--
-- 'scope', 'dockerVolumeConfiguration_scope' - The scope for the Docker volume that determines its lifecycle. Docker
-- volumes that are scoped to a @task@ are automatically provisioned when
-- the task starts and destroyed when the task stops. Docker volumes that
-- are scoped as @shared@ persist after the task stops.
--
-- 'labels', 'dockerVolumeConfiguration_labels' - Custom metadata to add to your Docker volume. This parameter maps to
-- @Labels@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @xxlabel@ option to
-- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
--
-- 'autoprovision', 'dockerVolumeConfiguration_autoprovision' - If this value is @true@, the Docker volume is created if it does not
-- already exist.
--
-- This field is only used if the @scope@ is @shared@.
newDockerVolumeConfiguration ::
  DockerVolumeConfiguration
newDockerVolumeConfiguration :: DockerVolumeConfiguration
newDockerVolumeConfiguration =
  DockerVolumeConfiguration' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Scope
-> Maybe (HashMap Text Text)
-> Maybe Bool
-> DockerVolumeConfiguration
DockerVolumeConfiguration'
    { $sel:driverOpts:DockerVolumeConfiguration' :: Maybe (HashMap Text Text)
driverOpts =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:driver:DockerVolumeConfiguration' :: Maybe Text
driver = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scope:DockerVolumeConfiguration' :: Maybe Scope
scope = Maybe Scope
forall a. Maybe a
Prelude.Nothing,
      $sel:labels:DockerVolumeConfiguration' :: Maybe (HashMap Text Text)
labels = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:autoprovision:DockerVolumeConfiguration' :: Maybe Bool
autoprovision = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | A map of Docker driver-specific options passed through. This parameter
-- maps to @DriverOpts@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @xxopt@ option to
-- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
dockerVolumeConfiguration_driverOpts :: Lens.Lens' DockerVolumeConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
dockerVolumeConfiguration_driverOpts :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DockerVolumeConfiguration -> f DockerVolumeConfiguration
dockerVolumeConfiguration_driverOpts = (DockerVolumeConfiguration -> Maybe (HashMap Text Text))
-> (DockerVolumeConfiguration
    -> Maybe (HashMap Text Text) -> DockerVolumeConfiguration)
-> Lens
     DockerVolumeConfiguration
     DockerVolumeConfiguration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DockerVolumeConfiguration' {Maybe (HashMap Text Text)
driverOpts :: Maybe (HashMap Text Text)
$sel:driverOpts:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe (HashMap Text Text)
driverOpts} -> Maybe (HashMap Text Text)
driverOpts) (\s :: DockerVolumeConfiguration
s@DockerVolumeConfiguration' {} Maybe (HashMap Text Text)
a -> DockerVolumeConfiguration
s {$sel:driverOpts:DockerVolumeConfiguration' :: Maybe (HashMap Text Text)
driverOpts = Maybe (HashMap Text Text)
a} :: DockerVolumeConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> DockerVolumeConfiguration -> f DockerVolumeConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DockerVolumeConfiguration
-> f DockerVolumeConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Docker volume driver to use. The driver value must match the driver
-- name provided by Docker because it is used for task placement. If the
-- driver was installed using the Docker plugin CLI, use @docker plugin ls@
-- to retrieve the driver name from your container instance. If the driver
-- was installed using another method, use Docker plugin discovery to
-- retrieve the driver name. For more information, see
-- <https://docs.docker.com/engine/extend/plugin_api/#plugin-discovery Docker plugin discovery>.
-- This parameter maps to @Driver@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @xxdriver@ option to
-- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
dockerVolumeConfiguration_driver :: Lens.Lens' DockerVolumeConfiguration (Prelude.Maybe Prelude.Text)
dockerVolumeConfiguration_driver :: (Maybe Text -> f (Maybe Text))
-> DockerVolumeConfiguration -> f DockerVolumeConfiguration
dockerVolumeConfiguration_driver = (DockerVolumeConfiguration -> Maybe Text)
-> (DockerVolumeConfiguration
    -> Maybe Text -> DockerVolumeConfiguration)
-> Lens
     DockerVolumeConfiguration
     DockerVolumeConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DockerVolumeConfiguration' {Maybe Text
driver :: Maybe Text
$sel:driver:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe Text
driver} -> Maybe Text
driver) (\s :: DockerVolumeConfiguration
s@DockerVolumeConfiguration' {} Maybe Text
a -> DockerVolumeConfiguration
s {$sel:driver:DockerVolumeConfiguration' :: Maybe Text
driver = Maybe Text
a} :: DockerVolumeConfiguration)

-- | The scope for the Docker volume that determines its lifecycle. Docker
-- volumes that are scoped to a @task@ are automatically provisioned when
-- the task starts and destroyed when the task stops. Docker volumes that
-- are scoped as @shared@ persist after the task stops.
dockerVolumeConfiguration_scope :: Lens.Lens' DockerVolumeConfiguration (Prelude.Maybe Scope)
dockerVolumeConfiguration_scope :: (Maybe Scope -> f (Maybe Scope))
-> DockerVolumeConfiguration -> f DockerVolumeConfiguration
dockerVolumeConfiguration_scope = (DockerVolumeConfiguration -> Maybe Scope)
-> (DockerVolumeConfiguration
    -> Maybe Scope -> DockerVolumeConfiguration)
-> Lens
     DockerVolumeConfiguration
     DockerVolumeConfiguration
     (Maybe Scope)
     (Maybe Scope)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DockerVolumeConfiguration' {Maybe Scope
scope :: Maybe Scope
$sel:scope:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe Scope
scope} -> Maybe Scope
scope) (\s :: DockerVolumeConfiguration
s@DockerVolumeConfiguration' {} Maybe Scope
a -> DockerVolumeConfiguration
s {$sel:scope:DockerVolumeConfiguration' :: Maybe Scope
scope = Maybe Scope
a} :: DockerVolumeConfiguration)

-- | Custom metadata to add to your Docker volume. This parameter maps to
-- @Labels@ in the
-- <https://docs.docker.com/engine/api/v1.35/#operation/VolumeCreate Create a volume>
-- section of the
-- <https://docs.docker.com/engine/api/v1.35/ Docker Remote API> and the
-- @xxlabel@ option to
-- <https://docs.docker.com/engine/reference/commandline/volume_create/ docker volume create>.
dockerVolumeConfiguration_labels :: Lens.Lens' DockerVolumeConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
dockerVolumeConfiguration_labels :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DockerVolumeConfiguration -> f DockerVolumeConfiguration
dockerVolumeConfiguration_labels = (DockerVolumeConfiguration -> Maybe (HashMap Text Text))
-> (DockerVolumeConfiguration
    -> Maybe (HashMap Text Text) -> DockerVolumeConfiguration)
-> Lens
     DockerVolumeConfiguration
     DockerVolumeConfiguration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DockerVolumeConfiguration' {Maybe (HashMap Text Text)
labels :: Maybe (HashMap Text Text)
$sel:labels:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe (HashMap Text Text)
labels} -> Maybe (HashMap Text Text)
labels) (\s :: DockerVolumeConfiguration
s@DockerVolumeConfiguration' {} Maybe (HashMap Text Text)
a -> DockerVolumeConfiguration
s {$sel:labels:DockerVolumeConfiguration' :: Maybe (HashMap Text Text)
labels = Maybe (HashMap Text Text)
a} :: DockerVolumeConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> DockerVolumeConfiguration -> f DockerVolumeConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DockerVolumeConfiguration
-> f DockerVolumeConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If this value is @true@, the Docker volume is created if it does not
-- already exist.
--
-- This field is only used if the @scope@ is @shared@.
dockerVolumeConfiguration_autoprovision :: Lens.Lens' DockerVolumeConfiguration (Prelude.Maybe Prelude.Bool)
dockerVolumeConfiguration_autoprovision :: (Maybe Bool -> f (Maybe Bool))
-> DockerVolumeConfiguration -> f DockerVolumeConfiguration
dockerVolumeConfiguration_autoprovision = (DockerVolumeConfiguration -> Maybe Bool)
-> (DockerVolumeConfiguration
    -> Maybe Bool -> DockerVolumeConfiguration)
-> Lens
     DockerVolumeConfiguration
     DockerVolumeConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DockerVolumeConfiguration' {Maybe Bool
autoprovision :: Maybe Bool
$sel:autoprovision:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe Bool
autoprovision} -> Maybe Bool
autoprovision) (\s :: DockerVolumeConfiguration
s@DockerVolumeConfiguration' {} Maybe Bool
a -> DockerVolumeConfiguration
s {$sel:autoprovision:DockerVolumeConfiguration' :: Maybe Bool
autoprovision = Maybe Bool
a} :: DockerVolumeConfiguration)

instance Core.FromJSON DockerVolumeConfiguration where
  parseJSON :: Value -> Parser DockerVolumeConfiguration
parseJSON =
    String
-> (Object -> Parser DockerVolumeConfiguration)
-> Value
-> Parser DockerVolumeConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DockerVolumeConfiguration"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Scope
-> Maybe (HashMap Text Text)
-> Maybe Bool
-> DockerVolumeConfiguration
DockerVolumeConfiguration'
            (Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe Scope
 -> Maybe (HashMap Text Text)
 -> Maybe Bool
 -> DockerVolumeConfiguration)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe Text
      -> Maybe Scope
      -> Maybe (HashMap Text Text)
      -> Maybe Bool
      -> DockerVolumeConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"driverOpts" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Scope
   -> Maybe (HashMap Text Text)
   -> Maybe Bool
   -> DockerVolumeConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Scope
      -> Maybe (HashMap Text Text)
      -> Maybe Bool
      -> DockerVolumeConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"driver")
            Parser
  (Maybe Scope
   -> Maybe (HashMap Text Text)
   -> Maybe Bool
   -> DockerVolumeConfiguration)
-> Parser (Maybe Scope)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Bool -> DockerVolumeConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Scope)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"scope")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Bool -> DockerVolumeConfiguration)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Bool -> DockerVolumeConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"labels" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Bool -> DockerVolumeConfiguration)
-> Parser (Maybe Bool) -> Parser DockerVolumeConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"autoprovision")
      )

instance Prelude.Hashable DockerVolumeConfiguration

instance Prelude.NFData DockerVolumeConfiguration

instance Core.ToJSON DockerVolumeConfiguration where
  toJSON :: DockerVolumeConfiguration -> Value
toJSON DockerVolumeConfiguration' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe Scope
autoprovision :: Maybe Bool
labels :: Maybe (HashMap Text Text)
scope :: Maybe Scope
driver :: Maybe Text
driverOpts :: Maybe (HashMap Text Text)
$sel:autoprovision:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe Bool
$sel:labels:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe (HashMap Text Text)
$sel:scope:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe Scope
$sel:driver:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe Text
$sel:driverOpts:DockerVolumeConfiguration' :: DockerVolumeConfiguration -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"driverOpts" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
driverOpts,
            (Text
"driver" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
driver,
            (Text
"scope" Text -> Scope -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Scope -> Pair) -> Maybe Scope -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Scope
scope,
            (Text
"labels" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
labels,
            (Text
"autoprovision" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
autoprovision
          ]
      )