{-# 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.AppConfig.GetDeploymentStrategy
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about a deployment strategy. A deployment strategy
-- defines important criteria for rolling out your configuration to the
-- designated targets. A deployment strategy includes the overall duration
-- required, a percentage of targets to receive the deployment during each
-- interval, an algorithm that defines how percentage grows, and bake time.
module Amazonka.AppConfig.GetDeploymentStrategy
  ( -- * Creating a Request
    GetDeploymentStrategy (..),
    newGetDeploymentStrategy,

    -- * Request Lenses
    getDeploymentStrategy_deploymentStrategyId,

    -- * Destructuring the Response
    DeploymentStrategy (..),
    newDeploymentStrategy,

    -- * Response Lenses
    deploymentStrategy_deploymentDurationInMinutes,
    deploymentStrategy_description,
    deploymentStrategy_finalBakeTimeInMinutes,
    deploymentStrategy_growthFactor,
    deploymentStrategy_growthType,
    deploymentStrategy_id,
    deploymentStrategy_name,
    deploymentStrategy_replicateTo,
  )
where

import Amazonka.AppConfig.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetDeploymentStrategy' smart constructor.
data GetDeploymentStrategy = GetDeploymentStrategy'
  { -- | The ID of the deployment strategy to get.
    GetDeploymentStrategy -> Text
deploymentStrategyId :: Prelude.Text
  }
  deriving (GetDeploymentStrategy -> GetDeploymentStrategy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeploymentStrategy -> GetDeploymentStrategy -> Bool
$c/= :: GetDeploymentStrategy -> GetDeploymentStrategy -> Bool
== :: GetDeploymentStrategy -> GetDeploymentStrategy -> Bool
$c== :: GetDeploymentStrategy -> GetDeploymentStrategy -> Bool
Prelude.Eq, ReadPrec [GetDeploymentStrategy]
ReadPrec GetDeploymentStrategy
Int -> ReadS GetDeploymentStrategy
ReadS [GetDeploymentStrategy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeploymentStrategy]
$creadListPrec :: ReadPrec [GetDeploymentStrategy]
readPrec :: ReadPrec GetDeploymentStrategy
$creadPrec :: ReadPrec GetDeploymentStrategy
readList :: ReadS [GetDeploymentStrategy]
$creadList :: ReadS [GetDeploymentStrategy]
readsPrec :: Int -> ReadS GetDeploymentStrategy
$creadsPrec :: Int -> ReadS GetDeploymentStrategy
Prelude.Read, Int -> GetDeploymentStrategy -> ShowS
[GetDeploymentStrategy] -> ShowS
GetDeploymentStrategy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeploymentStrategy] -> ShowS
$cshowList :: [GetDeploymentStrategy] -> ShowS
show :: GetDeploymentStrategy -> String
$cshow :: GetDeploymentStrategy -> String
showsPrec :: Int -> GetDeploymentStrategy -> ShowS
$cshowsPrec :: Int -> GetDeploymentStrategy -> ShowS
Prelude.Show, forall x. Rep GetDeploymentStrategy x -> GetDeploymentStrategy
forall x. GetDeploymentStrategy -> Rep GetDeploymentStrategy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDeploymentStrategy x -> GetDeploymentStrategy
$cfrom :: forall x. GetDeploymentStrategy -> Rep GetDeploymentStrategy x
Prelude.Generic)

-- |
-- Create a value of 'GetDeploymentStrategy' 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:
--
-- 'deploymentStrategyId', 'getDeploymentStrategy_deploymentStrategyId' - The ID of the deployment strategy to get.
newGetDeploymentStrategy ::
  -- | 'deploymentStrategyId'
  Prelude.Text ->
  GetDeploymentStrategy
newGetDeploymentStrategy :: Text -> GetDeploymentStrategy
newGetDeploymentStrategy Text
pDeploymentStrategyId_ =
  GetDeploymentStrategy'
    { $sel:deploymentStrategyId:GetDeploymentStrategy' :: Text
deploymentStrategyId =
        Text
pDeploymentStrategyId_
    }

-- | The ID of the deployment strategy to get.
getDeploymentStrategy_deploymentStrategyId :: Lens.Lens' GetDeploymentStrategy Prelude.Text
getDeploymentStrategy_deploymentStrategyId :: Lens' GetDeploymentStrategy Text
getDeploymentStrategy_deploymentStrategyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentStrategy' {Text
deploymentStrategyId :: Text
$sel:deploymentStrategyId:GetDeploymentStrategy' :: GetDeploymentStrategy -> Text
deploymentStrategyId} -> Text
deploymentStrategyId) (\s :: GetDeploymentStrategy
s@GetDeploymentStrategy' {} Text
a -> GetDeploymentStrategy
s {$sel:deploymentStrategyId:GetDeploymentStrategy' :: Text
deploymentStrategyId = Text
a} :: GetDeploymentStrategy)

instance Core.AWSRequest GetDeploymentStrategy where
  type
    AWSResponse GetDeploymentStrategy =
      DeploymentStrategy
  request :: (Service -> Service)
-> GetDeploymentStrategy -> Request GetDeploymentStrategy
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDeploymentStrategy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetDeploymentStrategy)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

instance Prelude.Hashable GetDeploymentStrategy where
  hashWithSalt :: Int -> GetDeploymentStrategy -> Int
hashWithSalt Int
_salt GetDeploymentStrategy' {Text
deploymentStrategyId :: Text
$sel:deploymentStrategyId:GetDeploymentStrategy' :: GetDeploymentStrategy -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deploymentStrategyId

instance Prelude.NFData GetDeploymentStrategy where
  rnf :: GetDeploymentStrategy -> ()
rnf GetDeploymentStrategy' {Text
deploymentStrategyId :: Text
$sel:deploymentStrategyId:GetDeploymentStrategy' :: GetDeploymentStrategy -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
deploymentStrategyId

instance Data.ToHeaders GetDeploymentStrategy where
  toHeaders :: GetDeploymentStrategy -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath GetDeploymentStrategy where
  toPath :: GetDeploymentStrategy -> ByteString
toPath GetDeploymentStrategy' {Text
deploymentStrategyId :: Text
$sel:deploymentStrategyId:GetDeploymentStrategy' :: GetDeploymentStrategy -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/deploymentstrategies/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
deploymentStrategyId
      ]

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