{-# 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.Route53RecoveryReadiness.GetRecoveryGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets details about a recovery group, including a list of the cells that
-- are included in it.
module Amazonka.Route53RecoveryReadiness.GetRecoveryGroup
  ( -- * Creating a Request
    GetRecoveryGroup (..),
    newGetRecoveryGroup,

    -- * Request Lenses
    getRecoveryGroup_recoveryGroupName,

    -- * Destructuring the Response
    GetRecoveryGroupResponse (..),
    newGetRecoveryGroupResponse,

    -- * Response Lenses
    getRecoveryGroupResponse_cells,
    getRecoveryGroupResponse_recoveryGroupArn,
    getRecoveryGroupResponse_recoveryGroupName,
    getRecoveryGroupResponse_tags,
    getRecoveryGroupResponse_httpStatus,
  )
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.Route53RecoveryReadiness.Types

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

-- |
-- Create a value of 'GetRecoveryGroup' 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:
--
-- 'recoveryGroupName', 'getRecoveryGroup_recoveryGroupName' - The name of a recovery group.
newGetRecoveryGroup ::
  -- | 'recoveryGroupName'
  Prelude.Text ->
  GetRecoveryGroup
newGetRecoveryGroup :: Text -> GetRecoveryGroup
newGetRecoveryGroup Text
pRecoveryGroupName_ =
  GetRecoveryGroup'
    { $sel:recoveryGroupName:GetRecoveryGroup' :: Text
recoveryGroupName =
        Text
pRecoveryGroupName_
    }

-- | The name of a recovery group.
getRecoveryGroup_recoveryGroupName :: Lens.Lens' GetRecoveryGroup Prelude.Text
getRecoveryGroup_recoveryGroupName :: Lens' GetRecoveryGroup Text
getRecoveryGroup_recoveryGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecoveryGroup' {Text
recoveryGroupName :: Text
$sel:recoveryGroupName:GetRecoveryGroup' :: GetRecoveryGroup -> Text
recoveryGroupName} -> Text
recoveryGroupName) (\s :: GetRecoveryGroup
s@GetRecoveryGroup' {} Text
a -> GetRecoveryGroup
s {$sel:recoveryGroupName:GetRecoveryGroup' :: Text
recoveryGroupName = Text
a} :: GetRecoveryGroup)

instance Core.AWSRequest GetRecoveryGroup where
  type
    AWSResponse GetRecoveryGroup =
      GetRecoveryGroupResponse
  request :: (Service -> Service)
-> GetRecoveryGroup -> Request GetRecoveryGroup
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 GetRecoveryGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRecoveryGroup)))
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 ->
          Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Int
-> GetRecoveryGroupResponse
GetRecoveryGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"cells" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"recoveryGroupArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"recoveryGroupName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"tags" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => 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))
      )

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

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

instance Data.ToHeaders GetRecoveryGroup where
  toHeaders :: GetRecoveryGroup -> 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 GetRecoveryGroup where
  toPath :: GetRecoveryGroup -> ByteString
toPath GetRecoveryGroup' {Text
recoveryGroupName :: Text
$sel:recoveryGroupName:GetRecoveryGroup' :: GetRecoveryGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/recoverygroups/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
recoveryGroupName]

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

-- | /See:/ 'newGetRecoveryGroupResponse' smart constructor.
data GetRecoveryGroupResponse = GetRecoveryGroupResponse'
  { -- | A list of a cell\'s Amazon Resource Names (ARNs).
    GetRecoveryGroupResponse -> Maybe [Text]
cells :: Prelude.Maybe [Prelude.Text],
    -- | The Amazon Resource Name (ARN) for the recovery group.
    GetRecoveryGroupResponse -> Maybe Text
recoveryGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the recovery group.
    GetRecoveryGroupResponse -> Maybe Text
recoveryGroupName :: Prelude.Maybe Prelude.Text,
    -- | The tags associated with the recovery group.
    GetRecoveryGroupResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The response's http status code.
    GetRecoveryGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetRecoveryGroupResponse -> GetRecoveryGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecoveryGroupResponse -> GetRecoveryGroupResponse -> Bool
$c/= :: GetRecoveryGroupResponse -> GetRecoveryGroupResponse -> Bool
== :: GetRecoveryGroupResponse -> GetRecoveryGroupResponse -> Bool
$c== :: GetRecoveryGroupResponse -> GetRecoveryGroupResponse -> Bool
Prelude.Eq, ReadPrec [GetRecoveryGroupResponse]
ReadPrec GetRecoveryGroupResponse
Int -> ReadS GetRecoveryGroupResponse
ReadS [GetRecoveryGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecoveryGroupResponse]
$creadListPrec :: ReadPrec [GetRecoveryGroupResponse]
readPrec :: ReadPrec GetRecoveryGroupResponse
$creadPrec :: ReadPrec GetRecoveryGroupResponse
readList :: ReadS [GetRecoveryGroupResponse]
$creadList :: ReadS [GetRecoveryGroupResponse]
readsPrec :: Int -> ReadS GetRecoveryGroupResponse
$creadsPrec :: Int -> ReadS GetRecoveryGroupResponse
Prelude.Read, Int -> GetRecoveryGroupResponse -> ShowS
[GetRecoveryGroupResponse] -> ShowS
GetRecoveryGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecoveryGroupResponse] -> ShowS
$cshowList :: [GetRecoveryGroupResponse] -> ShowS
show :: GetRecoveryGroupResponse -> String
$cshow :: GetRecoveryGroupResponse -> String
showsPrec :: Int -> GetRecoveryGroupResponse -> ShowS
$cshowsPrec :: Int -> GetRecoveryGroupResponse -> ShowS
Prelude.Show, forall x.
Rep GetRecoveryGroupResponse x -> GetRecoveryGroupResponse
forall x.
GetRecoveryGroupResponse -> Rep GetRecoveryGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecoveryGroupResponse x -> GetRecoveryGroupResponse
$cfrom :: forall x.
GetRecoveryGroupResponse -> Rep GetRecoveryGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRecoveryGroupResponse' 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:
--
-- 'cells', 'getRecoveryGroupResponse_cells' - A list of a cell\'s Amazon Resource Names (ARNs).
--
-- 'recoveryGroupArn', 'getRecoveryGroupResponse_recoveryGroupArn' - The Amazon Resource Name (ARN) for the recovery group.
--
-- 'recoveryGroupName', 'getRecoveryGroupResponse_recoveryGroupName' - The name of the recovery group.
--
-- 'tags', 'getRecoveryGroupResponse_tags' - The tags associated with the recovery group.
--
-- 'httpStatus', 'getRecoveryGroupResponse_httpStatus' - The response's http status code.
newGetRecoveryGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRecoveryGroupResponse
newGetRecoveryGroupResponse :: Int -> GetRecoveryGroupResponse
newGetRecoveryGroupResponse Int
pHttpStatus_ =
  GetRecoveryGroupResponse'
    { $sel:cells:GetRecoveryGroupResponse' :: Maybe [Text]
cells = forall a. Maybe a
Prelude.Nothing,
      $sel:recoveryGroupArn:GetRecoveryGroupResponse' :: Maybe Text
recoveryGroupArn = forall a. Maybe a
Prelude.Nothing,
      $sel:recoveryGroupName:GetRecoveryGroupResponse' :: Maybe Text
recoveryGroupName = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:GetRecoveryGroupResponse' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRecoveryGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of a cell\'s Amazon Resource Names (ARNs).
getRecoveryGroupResponse_cells :: Lens.Lens' GetRecoveryGroupResponse (Prelude.Maybe [Prelude.Text])
getRecoveryGroupResponse_cells :: Lens' GetRecoveryGroupResponse (Maybe [Text])
getRecoveryGroupResponse_cells = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecoveryGroupResponse' {Maybe [Text]
cells :: Maybe [Text]
$sel:cells:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe [Text]
cells} -> Maybe [Text]
cells) (\s :: GetRecoveryGroupResponse
s@GetRecoveryGroupResponse' {} Maybe [Text]
a -> GetRecoveryGroupResponse
s {$sel:cells:GetRecoveryGroupResponse' :: Maybe [Text]
cells = Maybe [Text]
a} :: GetRecoveryGroupResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) for the recovery group.
getRecoveryGroupResponse_recoveryGroupArn :: Lens.Lens' GetRecoveryGroupResponse (Prelude.Maybe Prelude.Text)
getRecoveryGroupResponse_recoveryGroupArn :: Lens' GetRecoveryGroupResponse (Maybe Text)
getRecoveryGroupResponse_recoveryGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecoveryGroupResponse' {Maybe Text
recoveryGroupArn :: Maybe Text
$sel:recoveryGroupArn:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe Text
recoveryGroupArn} -> Maybe Text
recoveryGroupArn) (\s :: GetRecoveryGroupResponse
s@GetRecoveryGroupResponse' {} Maybe Text
a -> GetRecoveryGroupResponse
s {$sel:recoveryGroupArn:GetRecoveryGroupResponse' :: Maybe Text
recoveryGroupArn = Maybe Text
a} :: GetRecoveryGroupResponse)

-- | The name of the recovery group.
getRecoveryGroupResponse_recoveryGroupName :: Lens.Lens' GetRecoveryGroupResponse (Prelude.Maybe Prelude.Text)
getRecoveryGroupResponse_recoveryGroupName :: Lens' GetRecoveryGroupResponse (Maybe Text)
getRecoveryGroupResponse_recoveryGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecoveryGroupResponse' {Maybe Text
recoveryGroupName :: Maybe Text
$sel:recoveryGroupName:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe Text
recoveryGroupName} -> Maybe Text
recoveryGroupName) (\s :: GetRecoveryGroupResponse
s@GetRecoveryGroupResponse' {} Maybe Text
a -> GetRecoveryGroupResponse
s {$sel:recoveryGroupName:GetRecoveryGroupResponse' :: Maybe Text
recoveryGroupName = Maybe Text
a} :: GetRecoveryGroupResponse)

-- | The tags associated with the recovery group.
getRecoveryGroupResponse_tags :: Lens.Lens' GetRecoveryGroupResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getRecoveryGroupResponse_tags :: Lens' GetRecoveryGroupResponse (Maybe (HashMap Text Text))
getRecoveryGroupResponse_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecoveryGroupResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: GetRecoveryGroupResponse
s@GetRecoveryGroupResponse' {} Maybe (HashMap Text Text)
a -> GetRecoveryGroupResponse
s {$sel:tags:GetRecoveryGroupResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: GetRecoveryGroupResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetRecoveryGroupResponse where
  rnf :: GetRecoveryGroupResponse -> ()
rnf GetRecoveryGroupResponse' {Int
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
httpStatus :: Int
tags :: Maybe (HashMap Text Text)
recoveryGroupName :: Maybe Text
recoveryGroupArn :: Maybe Text
cells :: Maybe [Text]
$sel:httpStatus:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Int
$sel:tags:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe (HashMap Text Text)
$sel:recoveryGroupName:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe Text
$sel:recoveryGroupArn:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe Text
$sel:cells:GetRecoveryGroupResponse' :: GetRecoveryGroupResponse -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
cells
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recoveryGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recoveryGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus