{-# 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.Lightsail.Types.ContainerServiceDeploymentRequest
-- 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.Lightsail.Types.ContainerServiceDeploymentRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.Container
import Amazonka.Lightsail.Types.EndpointRequest
import qualified Amazonka.Prelude as Prelude

-- | Describes a container deployment configuration of an Amazon Lightsail
-- container service.
--
-- A deployment specifies the settings, such as the ports and launch
-- command, of containers that are deployed to your container service.
--
-- /See:/ 'newContainerServiceDeploymentRequest' smart constructor.
data ContainerServiceDeploymentRequest = ContainerServiceDeploymentRequest'
  { -- | An object that describes the endpoint of the deployment.
    ContainerServiceDeploymentRequest -> Maybe EndpointRequest
publicEndpoint :: Prelude.Maybe EndpointRequest,
    -- | An object that describes the configuration for the containers of the
    -- deployment.
    ContainerServiceDeploymentRequest -> Maybe (HashMap Text Container)
containers :: Prelude.Maybe (Prelude.HashMap Prelude.Text Container)
  }
  deriving (ContainerServiceDeploymentRequest
-> ContainerServiceDeploymentRequest -> Bool
(ContainerServiceDeploymentRequest
 -> ContainerServiceDeploymentRequest -> Bool)
-> (ContainerServiceDeploymentRequest
    -> ContainerServiceDeploymentRequest -> Bool)
-> Eq ContainerServiceDeploymentRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerServiceDeploymentRequest
-> ContainerServiceDeploymentRequest -> Bool
$c/= :: ContainerServiceDeploymentRequest
-> ContainerServiceDeploymentRequest -> Bool
== :: ContainerServiceDeploymentRequest
-> ContainerServiceDeploymentRequest -> Bool
$c== :: ContainerServiceDeploymentRequest
-> ContainerServiceDeploymentRequest -> Bool
Prelude.Eq, ReadPrec [ContainerServiceDeploymentRequest]
ReadPrec ContainerServiceDeploymentRequest
Int -> ReadS ContainerServiceDeploymentRequest
ReadS [ContainerServiceDeploymentRequest]
(Int -> ReadS ContainerServiceDeploymentRequest)
-> ReadS [ContainerServiceDeploymentRequest]
-> ReadPrec ContainerServiceDeploymentRequest
-> ReadPrec [ContainerServiceDeploymentRequest]
-> Read ContainerServiceDeploymentRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerServiceDeploymentRequest]
$creadListPrec :: ReadPrec [ContainerServiceDeploymentRequest]
readPrec :: ReadPrec ContainerServiceDeploymentRequest
$creadPrec :: ReadPrec ContainerServiceDeploymentRequest
readList :: ReadS [ContainerServiceDeploymentRequest]
$creadList :: ReadS [ContainerServiceDeploymentRequest]
readsPrec :: Int -> ReadS ContainerServiceDeploymentRequest
$creadsPrec :: Int -> ReadS ContainerServiceDeploymentRequest
Prelude.Read, Int -> ContainerServiceDeploymentRequest -> ShowS
[ContainerServiceDeploymentRequest] -> ShowS
ContainerServiceDeploymentRequest -> String
(Int -> ContainerServiceDeploymentRequest -> ShowS)
-> (ContainerServiceDeploymentRequest -> String)
-> ([ContainerServiceDeploymentRequest] -> ShowS)
-> Show ContainerServiceDeploymentRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerServiceDeploymentRequest] -> ShowS
$cshowList :: [ContainerServiceDeploymentRequest] -> ShowS
show :: ContainerServiceDeploymentRequest -> String
$cshow :: ContainerServiceDeploymentRequest -> String
showsPrec :: Int -> ContainerServiceDeploymentRequest -> ShowS
$cshowsPrec :: Int -> ContainerServiceDeploymentRequest -> ShowS
Prelude.Show, (forall x.
 ContainerServiceDeploymentRequest
 -> Rep ContainerServiceDeploymentRequest x)
-> (forall x.
    Rep ContainerServiceDeploymentRequest x
    -> ContainerServiceDeploymentRequest)
-> Generic ContainerServiceDeploymentRequest
forall x.
Rep ContainerServiceDeploymentRequest x
-> ContainerServiceDeploymentRequest
forall x.
ContainerServiceDeploymentRequest
-> Rep ContainerServiceDeploymentRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContainerServiceDeploymentRequest x
-> ContainerServiceDeploymentRequest
$cfrom :: forall x.
ContainerServiceDeploymentRequest
-> Rep ContainerServiceDeploymentRequest x
Prelude.Generic)

-- |
-- Create a value of 'ContainerServiceDeploymentRequest' 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:
--
-- 'publicEndpoint', 'containerServiceDeploymentRequest_publicEndpoint' - An object that describes the endpoint of the deployment.
--
-- 'containers', 'containerServiceDeploymentRequest_containers' - An object that describes the configuration for the containers of the
-- deployment.
newContainerServiceDeploymentRequest ::
  ContainerServiceDeploymentRequest
newContainerServiceDeploymentRequest :: ContainerServiceDeploymentRequest
newContainerServiceDeploymentRequest =
  ContainerServiceDeploymentRequest' :: Maybe EndpointRequest
-> Maybe (HashMap Text Container)
-> ContainerServiceDeploymentRequest
ContainerServiceDeploymentRequest'
    { $sel:publicEndpoint:ContainerServiceDeploymentRequest' :: Maybe EndpointRequest
publicEndpoint =
        Maybe EndpointRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:containers:ContainerServiceDeploymentRequest' :: Maybe (HashMap Text Container)
containers = Maybe (HashMap Text Container)
forall a. Maybe a
Prelude.Nothing
    }

-- | An object that describes the endpoint of the deployment.
containerServiceDeploymentRequest_publicEndpoint :: Lens.Lens' ContainerServiceDeploymentRequest (Prelude.Maybe EndpointRequest)
containerServiceDeploymentRequest_publicEndpoint :: (Maybe EndpointRequest -> f (Maybe EndpointRequest))
-> ContainerServiceDeploymentRequest
-> f ContainerServiceDeploymentRequest
containerServiceDeploymentRequest_publicEndpoint = (ContainerServiceDeploymentRequest -> Maybe EndpointRequest)
-> (ContainerServiceDeploymentRequest
    -> Maybe EndpointRequest -> ContainerServiceDeploymentRequest)
-> Lens
     ContainerServiceDeploymentRequest
     ContainerServiceDeploymentRequest
     (Maybe EndpointRequest)
     (Maybe EndpointRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceDeploymentRequest' {Maybe EndpointRequest
publicEndpoint :: Maybe EndpointRequest
$sel:publicEndpoint:ContainerServiceDeploymentRequest' :: ContainerServiceDeploymentRequest -> Maybe EndpointRequest
publicEndpoint} -> Maybe EndpointRequest
publicEndpoint) (\s :: ContainerServiceDeploymentRequest
s@ContainerServiceDeploymentRequest' {} Maybe EndpointRequest
a -> ContainerServiceDeploymentRequest
s {$sel:publicEndpoint:ContainerServiceDeploymentRequest' :: Maybe EndpointRequest
publicEndpoint = Maybe EndpointRequest
a} :: ContainerServiceDeploymentRequest)

-- | An object that describes the configuration for the containers of the
-- deployment.
containerServiceDeploymentRequest_containers :: Lens.Lens' ContainerServiceDeploymentRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Container))
containerServiceDeploymentRequest_containers :: (Maybe (HashMap Text Container)
 -> f (Maybe (HashMap Text Container)))
-> ContainerServiceDeploymentRequest
-> f ContainerServiceDeploymentRequest
containerServiceDeploymentRequest_containers = (ContainerServiceDeploymentRequest
 -> Maybe (HashMap Text Container))
-> (ContainerServiceDeploymentRequest
    -> Maybe (HashMap Text Container)
    -> ContainerServiceDeploymentRequest)
-> Lens
     ContainerServiceDeploymentRequest
     ContainerServiceDeploymentRequest
     (Maybe (HashMap Text Container))
     (Maybe (HashMap Text Container))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceDeploymentRequest' {Maybe (HashMap Text Container)
containers :: Maybe (HashMap Text Container)
$sel:containers:ContainerServiceDeploymentRequest' :: ContainerServiceDeploymentRequest -> Maybe (HashMap Text Container)
containers} -> Maybe (HashMap Text Container)
containers) (\s :: ContainerServiceDeploymentRequest
s@ContainerServiceDeploymentRequest' {} Maybe (HashMap Text Container)
a -> ContainerServiceDeploymentRequest
s {$sel:containers:ContainerServiceDeploymentRequest' :: Maybe (HashMap Text Container)
containers = Maybe (HashMap Text Container)
a} :: ContainerServiceDeploymentRequest) ((Maybe (HashMap Text Container)
  -> f (Maybe (HashMap Text Container)))
 -> ContainerServiceDeploymentRequest
 -> f ContainerServiceDeploymentRequest)
-> ((Maybe (HashMap Text Container)
     -> f (Maybe (HashMap Text Container)))
    -> Maybe (HashMap Text Container)
    -> f (Maybe (HashMap Text Container)))
-> (Maybe (HashMap Text Container)
    -> f (Maybe (HashMap Text Container)))
-> ContainerServiceDeploymentRequest
-> f ContainerServiceDeploymentRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Container)
  (HashMap Text Container)
  (HashMap Text Container)
  (HashMap Text Container)
-> Iso
     (Maybe (HashMap Text Container))
     (Maybe (HashMap Text Container))
     (Maybe (HashMap Text Container))
     (Maybe (HashMap Text Container))
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 Container)
  (HashMap Text Container)
  (HashMap Text Container)
  (HashMap Text Container)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.Hashable
    ContainerServiceDeploymentRequest

instance
  Prelude.NFData
    ContainerServiceDeploymentRequest

instance
  Core.ToJSON
    ContainerServiceDeploymentRequest
  where
  toJSON :: ContainerServiceDeploymentRequest -> Value
toJSON ContainerServiceDeploymentRequest' {Maybe (HashMap Text Container)
Maybe EndpointRequest
containers :: Maybe (HashMap Text Container)
publicEndpoint :: Maybe EndpointRequest
$sel:containers:ContainerServiceDeploymentRequest' :: ContainerServiceDeploymentRequest -> Maybe (HashMap Text Container)
$sel:publicEndpoint:ContainerServiceDeploymentRequest' :: ContainerServiceDeploymentRequest -> Maybe EndpointRequest
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"publicEndpoint" Text -> EndpointRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EndpointRequest -> Pair) -> Maybe EndpointRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointRequest
publicEndpoint,
            (Text
"containers" Text -> HashMap Text Container -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Container -> Pair)
-> Maybe (HashMap Text Container) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Container)
containers
          ]
      )