{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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
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
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]
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
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. 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' {$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 :: Lens' GetReplicationSet Text
getReplicationSet_arn = 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 :: (Service -> Service)
-> GetReplicationSet -> Request GetReplicationSet
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 GetReplicationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReplicationSet)))
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 ->
          Int -> ReplicationSet -> GetReplicationSetResponse
GetReplicationSetResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"replicationSet")
      )

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

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

instance Data.ToHeaders GetReplicationSet where
  toHeaders :: GetReplicationSet -> 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 GetReplicationSet where
  toPath :: GetReplicationSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/getReplicationSet"

instance Data.ToQuery GetReplicationSet where
  toQuery :: GetReplicationSet -> QueryString
toQuery GetReplicationSet' {Text
arn :: Text
$sel:arn:GetReplicationSet' :: GetReplicationSet -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"arn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: 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
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]
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
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.
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'
      { $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 :: Lens' GetReplicationSetResponse Int
getReplicationSetResponse_httpStatus = 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 :: Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_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 where
  rnf :: GetReplicationSetResponse -> ()
rnf GetReplicationSetResponse' {Int
ReplicationSet
replicationSet :: ReplicationSet
httpStatus :: Int
$sel:replicationSet:GetReplicationSetResponse' :: GetReplicationSetResponse -> ReplicationSet
$sel:httpStatus:GetReplicationSetResponse' :: GetReplicationSetResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ReplicationSet
replicationSet