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

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

-- |
-- Module      : Amazonka.CodeDeploy.ContinueDeployment
-- 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)
--
-- For a blue\/green deployment, starts the process of rerouting traffic
-- from instances in the original environment to instances in the
-- replacement environment without waiting for a specified wait time to
-- elapse. (Traffic rerouting, which is achieved by registering instances
-- in the replacement environment with the load balancer, can start as soon
-- as all instances have a status of Ready.)
module Amazonka.CodeDeploy.ContinueDeployment
  ( -- * Creating a Request
    ContinueDeployment (..),
    newContinueDeployment,

    -- * Request Lenses
    continueDeployment_deploymentId,
    continueDeployment_deploymentWaitType,

    -- * Destructuring the Response
    ContinueDeploymentResponse (..),
    newContinueDeploymentResponse,
  )
where

import Amazonka.CodeDeploy.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newContinueDeployment' smart constructor.
data ContinueDeployment = ContinueDeployment'
  { -- | The unique ID of a blue\/green deployment for which you want to start
    -- rerouting traffic to the replacement environment.
    ContinueDeployment -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | The status of the deployment\'s waiting period. @READY_WAIT@ indicates
    -- that the deployment is ready to start shifting traffic.
    -- @TERMINATION_WAIT@ indicates that the traffic is shifted, but the
    -- original target is not terminated.
    ContinueDeployment -> Maybe DeploymentWaitType
deploymentWaitType :: Prelude.Maybe DeploymentWaitType
  }
  deriving (ContinueDeployment -> ContinueDeployment -> Bool
(ContinueDeployment -> ContinueDeployment -> Bool)
-> (ContinueDeployment -> ContinueDeployment -> Bool)
-> Eq ContinueDeployment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContinueDeployment -> ContinueDeployment -> Bool
$c/= :: ContinueDeployment -> ContinueDeployment -> Bool
== :: ContinueDeployment -> ContinueDeployment -> Bool
$c== :: ContinueDeployment -> ContinueDeployment -> Bool
Prelude.Eq, ReadPrec [ContinueDeployment]
ReadPrec ContinueDeployment
Int -> ReadS ContinueDeployment
ReadS [ContinueDeployment]
(Int -> ReadS ContinueDeployment)
-> ReadS [ContinueDeployment]
-> ReadPrec ContinueDeployment
-> ReadPrec [ContinueDeployment]
-> Read ContinueDeployment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContinueDeployment]
$creadListPrec :: ReadPrec [ContinueDeployment]
readPrec :: ReadPrec ContinueDeployment
$creadPrec :: ReadPrec ContinueDeployment
readList :: ReadS [ContinueDeployment]
$creadList :: ReadS [ContinueDeployment]
readsPrec :: Int -> ReadS ContinueDeployment
$creadsPrec :: Int -> ReadS ContinueDeployment
Prelude.Read, Int -> ContinueDeployment -> ShowS
[ContinueDeployment] -> ShowS
ContinueDeployment -> String
(Int -> ContinueDeployment -> ShowS)
-> (ContinueDeployment -> String)
-> ([ContinueDeployment] -> ShowS)
-> Show ContinueDeployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContinueDeployment] -> ShowS
$cshowList :: [ContinueDeployment] -> ShowS
show :: ContinueDeployment -> String
$cshow :: ContinueDeployment -> String
showsPrec :: Int -> ContinueDeployment -> ShowS
$cshowsPrec :: Int -> ContinueDeployment -> ShowS
Prelude.Show, (forall x. ContinueDeployment -> Rep ContinueDeployment x)
-> (forall x. Rep ContinueDeployment x -> ContinueDeployment)
-> Generic ContinueDeployment
forall x. Rep ContinueDeployment x -> ContinueDeployment
forall x. ContinueDeployment -> Rep ContinueDeployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContinueDeployment x -> ContinueDeployment
$cfrom :: forall x. ContinueDeployment -> Rep ContinueDeployment x
Prelude.Generic)

-- |
-- Create a value of 'ContinueDeployment' 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:
--
-- 'deploymentId', 'continueDeployment_deploymentId' - The unique ID of a blue\/green deployment for which you want to start
-- rerouting traffic to the replacement environment.
--
-- 'deploymentWaitType', 'continueDeployment_deploymentWaitType' - The status of the deployment\'s waiting period. @READY_WAIT@ indicates
-- that the deployment is ready to start shifting traffic.
-- @TERMINATION_WAIT@ indicates that the traffic is shifted, but the
-- original target is not terminated.
newContinueDeployment ::
  ContinueDeployment
newContinueDeployment :: ContinueDeployment
newContinueDeployment =
  ContinueDeployment' :: Maybe Text -> Maybe DeploymentWaitType -> ContinueDeployment
ContinueDeployment'
    { $sel:deploymentId:ContinueDeployment' :: Maybe Text
deploymentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentWaitType:ContinueDeployment' :: Maybe DeploymentWaitType
deploymentWaitType = Maybe DeploymentWaitType
forall a. Maybe a
Prelude.Nothing
    }

-- | The unique ID of a blue\/green deployment for which you want to start
-- rerouting traffic to the replacement environment.
continueDeployment_deploymentId :: Lens.Lens' ContinueDeployment (Prelude.Maybe Prelude.Text)
continueDeployment_deploymentId :: (Maybe Text -> f (Maybe Text))
-> ContinueDeployment -> f ContinueDeployment
continueDeployment_deploymentId = (ContinueDeployment -> Maybe Text)
-> (ContinueDeployment -> Maybe Text -> ContinueDeployment)
-> Lens
     ContinueDeployment ContinueDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinueDeployment' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:ContinueDeployment' :: ContinueDeployment -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: ContinueDeployment
s@ContinueDeployment' {} Maybe Text
a -> ContinueDeployment
s {$sel:deploymentId:ContinueDeployment' :: Maybe Text
deploymentId = Maybe Text
a} :: ContinueDeployment)

-- | The status of the deployment\'s waiting period. @READY_WAIT@ indicates
-- that the deployment is ready to start shifting traffic.
-- @TERMINATION_WAIT@ indicates that the traffic is shifted, but the
-- original target is not terminated.
continueDeployment_deploymentWaitType :: Lens.Lens' ContinueDeployment (Prelude.Maybe DeploymentWaitType)
continueDeployment_deploymentWaitType :: (Maybe DeploymentWaitType -> f (Maybe DeploymentWaitType))
-> ContinueDeployment -> f ContinueDeployment
continueDeployment_deploymentWaitType = (ContinueDeployment -> Maybe DeploymentWaitType)
-> (ContinueDeployment
    -> Maybe DeploymentWaitType -> ContinueDeployment)
-> Lens
     ContinueDeployment
     ContinueDeployment
     (Maybe DeploymentWaitType)
     (Maybe DeploymentWaitType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinueDeployment' {Maybe DeploymentWaitType
deploymentWaitType :: Maybe DeploymentWaitType
$sel:deploymentWaitType:ContinueDeployment' :: ContinueDeployment -> Maybe DeploymentWaitType
deploymentWaitType} -> Maybe DeploymentWaitType
deploymentWaitType) (\s :: ContinueDeployment
s@ContinueDeployment' {} Maybe DeploymentWaitType
a -> ContinueDeployment
s {$sel:deploymentWaitType:ContinueDeployment' :: Maybe DeploymentWaitType
deploymentWaitType = Maybe DeploymentWaitType
a} :: ContinueDeployment)

instance Core.AWSRequest ContinueDeployment where
  type
    AWSResponse ContinueDeployment =
      ContinueDeploymentResponse
  request :: ContinueDeployment -> Request ContinueDeployment
request = Service -> ContinueDeployment -> Request ContinueDeployment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ContinueDeployment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ContinueDeployment)))
response =
    AWSResponse ContinueDeployment
-> Logger
-> Service
-> Proxy ContinueDeployment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ContinueDeployment)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse ContinueDeployment
ContinueDeploymentResponse
ContinueDeploymentResponse'

instance Prelude.Hashable ContinueDeployment

instance Prelude.NFData ContinueDeployment

instance Core.ToHeaders ContinueDeployment where
  toHeaders :: ContinueDeployment -> [Header]
toHeaders =
    [Header] -> ContinueDeployment -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"CodeDeploy_20141006.ContinueDeployment" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ContinueDeployment where
  toJSON :: ContinueDeployment -> Value
toJSON ContinueDeployment' {Maybe Text
Maybe DeploymentWaitType
deploymentWaitType :: Maybe DeploymentWaitType
deploymentId :: Maybe Text
$sel:deploymentWaitType:ContinueDeployment' :: ContinueDeployment -> Maybe DeploymentWaitType
$sel:deploymentId:ContinueDeployment' :: ContinueDeployment -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"deploymentId" 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
deploymentId,
            (Text
"deploymentWaitType" Text -> DeploymentWaitType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DeploymentWaitType -> Pair)
-> Maybe DeploymentWaitType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeploymentWaitType
deploymentWaitType
          ]
      )

instance Core.ToPath ContinueDeployment where
  toPath :: ContinueDeployment -> ByteString
toPath = ByteString -> ContinueDeployment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ContinueDeployment where
  toQuery :: ContinueDeployment -> QueryString
toQuery = QueryString -> ContinueDeployment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newContinueDeploymentResponse' smart constructor.
data ContinueDeploymentResponse = ContinueDeploymentResponse'
  {
  }
  deriving (ContinueDeploymentResponse -> ContinueDeploymentResponse -> Bool
(ContinueDeploymentResponse -> ContinueDeploymentResponse -> Bool)
-> (ContinueDeploymentResponse
    -> ContinueDeploymentResponse -> Bool)
-> Eq ContinueDeploymentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContinueDeploymentResponse -> ContinueDeploymentResponse -> Bool
$c/= :: ContinueDeploymentResponse -> ContinueDeploymentResponse -> Bool
== :: ContinueDeploymentResponse -> ContinueDeploymentResponse -> Bool
$c== :: ContinueDeploymentResponse -> ContinueDeploymentResponse -> Bool
Prelude.Eq, ReadPrec [ContinueDeploymentResponse]
ReadPrec ContinueDeploymentResponse
Int -> ReadS ContinueDeploymentResponse
ReadS [ContinueDeploymentResponse]
(Int -> ReadS ContinueDeploymentResponse)
-> ReadS [ContinueDeploymentResponse]
-> ReadPrec ContinueDeploymentResponse
-> ReadPrec [ContinueDeploymentResponse]
-> Read ContinueDeploymentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContinueDeploymentResponse]
$creadListPrec :: ReadPrec [ContinueDeploymentResponse]
readPrec :: ReadPrec ContinueDeploymentResponse
$creadPrec :: ReadPrec ContinueDeploymentResponse
readList :: ReadS [ContinueDeploymentResponse]
$creadList :: ReadS [ContinueDeploymentResponse]
readsPrec :: Int -> ReadS ContinueDeploymentResponse
$creadsPrec :: Int -> ReadS ContinueDeploymentResponse
Prelude.Read, Int -> ContinueDeploymentResponse -> ShowS
[ContinueDeploymentResponse] -> ShowS
ContinueDeploymentResponse -> String
(Int -> ContinueDeploymentResponse -> ShowS)
-> (ContinueDeploymentResponse -> String)
-> ([ContinueDeploymentResponse] -> ShowS)
-> Show ContinueDeploymentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContinueDeploymentResponse] -> ShowS
$cshowList :: [ContinueDeploymentResponse] -> ShowS
show :: ContinueDeploymentResponse -> String
$cshow :: ContinueDeploymentResponse -> String
showsPrec :: Int -> ContinueDeploymentResponse -> ShowS
$cshowsPrec :: Int -> ContinueDeploymentResponse -> ShowS
Prelude.Show, (forall x.
 ContinueDeploymentResponse -> Rep ContinueDeploymentResponse x)
-> (forall x.
    Rep ContinueDeploymentResponse x -> ContinueDeploymentResponse)
-> Generic ContinueDeploymentResponse
forall x.
Rep ContinueDeploymentResponse x -> ContinueDeploymentResponse
forall x.
ContinueDeploymentResponse -> Rep ContinueDeploymentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContinueDeploymentResponse x -> ContinueDeploymentResponse
$cfrom :: forall x.
ContinueDeploymentResponse -> Rep ContinueDeploymentResponse x
Prelude.Generic)

-- |
-- Create a value of 'ContinueDeploymentResponse' 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.
newContinueDeploymentResponse ::
  ContinueDeploymentResponse
newContinueDeploymentResponse :: ContinueDeploymentResponse
newContinueDeploymentResponse =
  ContinueDeploymentResponse
ContinueDeploymentResponse'

instance Prelude.NFData ContinueDeploymentResponse