{-# 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.SSMIncidents.GetReplicationSet
-- 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)
--
-- Retrieve your Incident Manager replication set.
module Amazonka.SSMIncidents.GetReplicationSet
  ( -- * Creating a Request
    GetReplicationSet (..),
    newGetReplicationSet,

    -- * Request Lenses
    getReplicationSet_arn,

    -- * Destructuring the Response
    GetReplicationSetResponse (..),
    newGetReplicationSetResponse,

    -- * Response Lenses
    getReplicationSetResponse_httpStatus,
    getReplicationSetResponse_replicationSet,
  )
where

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
import Amazonka.SSMIncidents.Types

-- | /See:/ 'newGetReplicationSet' smart constructor.
data GetReplicationSet = GetReplicationSet'
  { -- | The Amazon Resource Name (ARN) of the replication set you want to
    -- retrieve.
    GetReplicationSet -> Text
arn :: Prelude.Text
  }
  deriving (GetReplicationSet -> GetReplicationSet -> Bool
(GetReplicationSet -> GetReplicationSet -> Bool)
-> (GetReplicationSet -> GetReplicationSet -> Bool)
-> Eq GetReplicationSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReplicationSet -> GetReplicationSet -> Bool
$c/= :: GetReplicationSet -> GetReplicationSet -> Bool
== :: GetReplicationSet -> GetReplicationSet -> Bool
$c== :: GetReplicationSet -> GetReplicationSet -> Bool
Prelude.Eq, ReadPrec [GetReplicationSet]
ReadPrec GetReplicationSet
Int -> ReadS GetReplicationSet
ReadS [GetReplicationSet]
(Int -> ReadS GetReplicationSet)
-> ReadS [GetReplicationSet]
-> ReadPrec GetReplicationSet
-> ReadPrec [GetReplicationSet]
-> Read GetReplicationSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReplicationSet]
$creadListPrec :: ReadPrec [GetReplicationSet]
readPrec :: ReadPrec GetReplicationSet
$creadPrec :: ReadPrec GetReplicationSet
readList :: ReadS [GetReplicationSet]
$creadList :: ReadS [GetReplicationSet]
readsPrec :: Int -> ReadS GetReplicationSet
$creadsPrec :: Int -> ReadS GetReplicationSet
Prelude.Read, Int -> GetReplicationSet -> ShowS
[GetReplicationSet] -> ShowS
GetReplicationSet -> String
(Int -> GetReplicationSet -> ShowS)
-> (GetReplicationSet -> String)
-> ([GetReplicationSet] -> ShowS)
-> Show GetReplicationSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReplicationSet] -> ShowS
$cshowList :: [GetReplicationSet] -> ShowS
show :: GetReplicationSet -> String
$cshow :: GetReplicationSet -> String
showsPrec :: Int -> GetReplicationSet -> ShowS
$cshowsPrec :: Int -> GetReplicationSet -> ShowS
Prelude.Show, (forall x. GetReplicationSet -> Rep GetReplicationSet x)
-> (forall x. Rep GetReplicationSet x -> GetReplicationSet)
-> Generic GetReplicationSet
forall x. Rep GetReplicationSet x -> GetReplicationSet
forall x. GetReplicationSet -> Rep GetReplicationSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetReplicationSet x -> GetReplicationSet
$cfrom :: forall x. GetReplicationSet -> Rep GetReplicationSet x
Prelude.Generic)

-- |
-- Create a value of 'GetReplicationSet' 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:
--
-- 'arn', 'getReplicationSet_arn' - The Amazon Resource Name (ARN) of the replication set you want to
-- retrieve.
newGetReplicationSet ::
  -- | 'arn'
  Prelude.Text ->
  GetReplicationSet
newGetReplicationSet :: Text -> GetReplicationSet
newGetReplicationSet Text
pArn_ =
  GetReplicationSet' :: Text -> GetReplicationSet
GetReplicationSet' {$sel:arn:GetReplicationSet' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the replication set you want to
-- retrieve.
getReplicationSet_arn :: Lens.Lens' GetReplicationSet Prelude.Text
getReplicationSet_arn :: (Text -> f Text) -> GetReplicationSet -> f GetReplicationSet
getReplicationSet_arn = (GetReplicationSet -> Text)
-> (GetReplicationSet -> Text -> GetReplicationSet)
-> Lens GetReplicationSet GetReplicationSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationSet' {Text
arn :: Text
$sel:arn:GetReplicationSet' :: GetReplicationSet -> Text
arn} -> Text
arn) (\s :: GetReplicationSet
s@GetReplicationSet' {} Text
a -> GetReplicationSet
s {$sel:arn:GetReplicationSet' :: Text
arn = Text
a} :: GetReplicationSet)

instance Core.AWSRequest GetReplicationSet where
  type
    AWSResponse GetReplicationSet =
      GetReplicationSetResponse
  request :: GetReplicationSet -> Request GetReplicationSet
request = Service -> GetReplicationSet -> Request GetReplicationSet
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetReplicationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReplicationSet)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetReplicationSet))
-> Logger
-> Service
-> Proxy GetReplicationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReplicationSet)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> ReplicationSet -> GetReplicationSetResponse
GetReplicationSetResponse'
            (Int -> ReplicationSet -> GetReplicationSetResponse)
-> Either String Int
-> Either String (ReplicationSet -> GetReplicationSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (ReplicationSet -> GetReplicationSetResponse)
-> Either String ReplicationSet
-> Either String GetReplicationSetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ReplicationSet
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"replicationSet")
      )

instance Prelude.Hashable GetReplicationSet

instance Prelude.NFData GetReplicationSet

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

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

instance Core.ToQuery GetReplicationSet where
  toQuery :: GetReplicationSet -> QueryString
toQuery GetReplicationSet' {Text
arn :: Text
$sel:arn:GetReplicationSet' :: GetReplicationSet -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"arn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
arn]

-- | /See:/ 'newGetReplicationSetResponse' smart constructor.
data GetReplicationSetResponse = GetReplicationSetResponse'
  { -- | The response's http status code.
    GetReplicationSetResponse -> Int
httpStatus :: Prelude.Int,
    -- | Details of the replication set.
    GetReplicationSetResponse -> ReplicationSet
replicationSet :: ReplicationSet
  }
  deriving (GetReplicationSetResponse -> GetReplicationSetResponse -> Bool
(GetReplicationSetResponse -> GetReplicationSetResponse -> Bool)
-> (GetReplicationSetResponse -> GetReplicationSetResponse -> Bool)
-> Eq GetReplicationSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReplicationSetResponse -> GetReplicationSetResponse -> Bool
$c/= :: GetReplicationSetResponse -> GetReplicationSetResponse -> Bool
== :: GetReplicationSetResponse -> GetReplicationSetResponse -> Bool
$c== :: GetReplicationSetResponse -> GetReplicationSetResponse -> Bool
Prelude.Eq, ReadPrec [GetReplicationSetResponse]
ReadPrec GetReplicationSetResponse
Int -> ReadS GetReplicationSetResponse
ReadS [GetReplicationSetResponse]
(Int -> ReadS GetReplicationSetResponse)
-> ReadS [GetReplicationSetResponse]
-> ReadPrec GetReplicationSetResponse
-> ReadPrec [GetReplicationSetResponse]
-> Read GetReplicationSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReplicationSetResponse]
$creadListPrec :: ReadPrec [GetReplicationSetResponse]
readPrec :: ReadPrec GetReplicationSetResponse
$creadPrec :: ReadPrec GetReplicationSetResponse
readList :: ReadS [GetReplicationSetResponse]
$creadList :: ReadS [GetReplicationSetResponse]
readsPrec :: Int -> ReadS GetReplicationSetResponse
$creadsPrec :: Int -> ReadS GetReplicationSetResponse
Prelude.Read, Int -> GetReplicationSetResponse -> ShowS
[GetReplicationSetResponse] -> ShowS
GetReplicationSetResponse -> String
(Int -> GetReplicationSetResponse -> ShowS)
-> (GetReplicationSetResponse -> String)
-> ([GetReplicationSetResponse] -> ShowS)
-> Show GetReplicationSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReplicationSetResponse] -> ShowS
$cshowList :: [GetReplicationSetResponse] -> ShowS
show :: GetReplicationSetResponse -> String
$cshow :: GetReplicationSetResponse -> String
showsPrec :: Int -> GetReplicationSetResponse -> ShowS
$cshowsPrec :: Int -> GetReplicationSetResponse -> ShowS
Prelude.Show, (forall x.
 GetReplicationSetResponse -> Rep GetReplicationSetResponse x)
-> (forall x.
    Rep GetReplicationSetResponse x -> GetReplicationSetResponse)
-> Generic GetReplicationSetResponse
forall x.
Rep GetReplicationSetResponse x -> GetReplicationSetResponse
forall x.
GetReplicationSetResponse -> Rep GetReplicationSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReplicationSetResponse x -> GetReplicationSetResponse
$cfrom :: forall x.
GetReplicationSetResponse -> Rep GetReplicationSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetReplicationSetResponse' 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:
--
-- 'httpStatus', 'getReplicationSetResponse_httpStatus' - The response's http status code.
--
-- 'replicationSet', 'getReplicationSetResponse_replicationSet' - Details of the replication set.
newGetReplicationSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'replicationSet'
  ReplicationSet ->
  GetReplicationSetResponse
newGetReplicationSetResponse :: Int -> ReplicationSet -> GetReplicationSetResponse
newGetReplicationSetResponse
  Int
pHttpStatus_
  ReplicationSet
pReplicationSet_ =
    GetReplicationSetResponse' :: Int -> ReplicationSet -> GetReplicationSetResponse
GetReplicationSetResponse'
      { $sel:httpStatus:GetReplicationSetResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:replicationSet:GetReplicationSetResponse' :: ReplicationSet
replicationSet = ReplicationSet
pReplicationSet_
      }

-- | The response's http status code.
getReplicationSetResponse_httpStatus :: Lens.Lens' GetReplicationSetResponse Prelude.Int
getReplicationSetResponse_httpStatus :: (Int -> f Int)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
getReplicationSetResponse_httpStatus = (GetReplicationSetResponse -> Int)
-> (GetReplicationSetResponse -> Int -> GetReplicationSetResponse)
-> Lens GetReplicationSetResponse GetReplicationSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetReplicationSetResponse' :: GetReplicationSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetReplicationSetResponse
s@GetReplicationSetResponse' {} Int
a -> GetReplicationSetResponse
s {$sel:httpStatus:GetReplicationSetResponse' :: Int
httpStatus = Int
a} :: GetReplicationSetResponse)

-- | Details of the replication set.
getReplicationSetResponse_replicationSet :: Lens.Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_replicationSet :: (ReplicationSet -> f ReplicationSet)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
getReplicationSetResponse_replicationSet = (GetReplicationSetResponse -> ReplicationSet)
-> (GetReplicationSetResponse
    -> ReplicationSet -> GetReplicationSetResponse)
-> Lens
     GetReplicationSetResponse
     GetReplicationSetResponse
     ReplicationSet
     ReplicationSet
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationSetResponse' {ReplicationSet
replicationSet :: ReplicationSet
$sel:replicationSet:GetReplicationSetResponse' :: GetReplicationSetResponse -> ReplicationSet
replicationSet} -> ReplicationSet
replicationSet) (\s :: GetReplicationSetResponse
s@GetReplicationSetResponse' {} ReplicationSet
a -> GetReplicationSetResponse
s {$sel:replicationSet:GetReplicationSetResponse' :: ReplicationSet
replicationSet = ReplicationSet
a} :: GetReplicationSetResponse)

instance Prelude.NFData GetReplicationSetResponse