{-# 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.GetReadinessCheckResourceStatus
-- 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)
--
-- Returns detailed information about the status of an individual resource
-- within a Readiness Check\'s Resource Set.
--
-- This operation returns paginated results.
module Amazonka.Route53RecoveryReadiness.GetReadinessCheckResourceStatus
  ( -- * Creating a Request
    GetReadinessCheckResourceStatus (..),
    newGetReadinessCheckResourceStatus,

    -- * Request Lenses
    getReadinessCheckResourceStatus_nextToken,
    getReadinessCheckResourceStatus_maxResults,
    getReadinessCheckResourceStatus_readinessCheckName,
    getReadinessCheckResourceStatus_resourceIdentifier,

    -- * Destructuring the Response
    GetReadinessCheckResourceStatusResponse (..),
    newGetReadinessCheckResourceStatusResponse,

    -- * Response Lenses
    getReadinessCheckResourceStatusResponse_rules,
    getReadinessCheckResourceStatusResponse_readiness,
    getReadinessCheckResourceStatusResponse_nextToken,
    getReadinessCheckResourceStatusResponse_httpStatus,
  )
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.Route53RecoveryReadiness.Types

-- | /See:/ 'newGetReadinessCheckResourceStatus' smart constructor.
data GetReadinessCheckResourceStatus = GetReadinessCheckResourceStatus'
  { -- | A token used to resume pagination from the end of a previous request.
    GetReadinessCheckResourceStatus -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Upper bound on number of records to return.
    GetReadinessCheckResourceStatus -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ReadinessCheck to get
    GetReadinessCheckResourceStatus -> Text
readinessCheckName :: Prelude.Text,
    -- | The resource ARN or component Id to get
    GetReadinessCheckResourceStatus -> Text
resourceIdentifier :: Prelude.Text
  }
  deriving (GetReadinessCheckResourceStatus
-> GetReadinessCheckResourceStatus -> Bool
(GetReadinessCheckResourceStatus
 -> GetReadinessCheckResourceStatus -> Bool)
-> (GetReadinessCheckResourceStatus
    -> GetReadinessCheckResourceStatus -> Bool)
-> Eq GetReadinessCheckResourceStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReadinessCheckResourceStatus
-> GetReadinessCheckResourceStatus -> Bool
$c/= :: GetReadinessCheckResourceStatus
-> GetReadinessCheckResourceStatus -> Bool
== :: GetReadinessCheckResourceStatus
-> GetReadinessCheckResourceStatus -> Bool
$c== :: GetReadinessCheckResourceStatus
-> GetReadinessCheckResourceStatus -> Bool
Prelude.Eq, ReadPrec [GetReadinessCheckResourceStatus]
ReadPrec GetReadinessCheckResourceStatus
Int -> ReadS GetReadinessCheckResourceStatus
ReadS [GetReadinessCheckResourceStatus]
(Int -> ReadS GetReadinessCheckResourceStatus)
-> ReadS [GetReadinessCheckResourceStatus]
-> ReadPrec GetReadinessCheckResourceStatus
-> ReadPrec [GetReadinessCheckResourceStatus]
-> Read GetReadinessCheckResourceStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReadinessCheckResourceStatus]
$creadListPrec :: ReadPrec [GetReadinessCheckResourceStatus]
readPrec :: ReadPrec GetReadinessCheckResourceStatus
$creadPrec :: ReadPrec GetReadinessCheckResourceStatus
readList :: ReadS [GetReadinessCheckResourceStatus]
$creadList :: ReadS [GetReadinessCheckResourceStatus]
readsPrec :: Int -> ReadS GetReadinessCheckResourceStatus
$creadsPrec :: Int -> ReadS GetReadinessCheckResourceStatus
Prelude.Read, Int -> GetReadinessCheckResourceStatus -> ShowS
[GetReadinessCheckResourceStatus] -> ShowS
GetReadinessCheckResourceStatus -> String
(Int -> GetReadinessCheckResourceStatus -> ShowS)
-> (GetReadinessCheckResourceStatus -> String)
-> ([GetReadinessCheckResourceStatus] -> ShowS)
-> Show GetReadinessCheckResourceStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReadinessCheckResourceStatus] -> ShowS
$cshowList :: [GetReadinessCheckResourceStatus] -> ShowS
show :: GetReadinessCheckResourceStatus -> String
$cshow :: GetReadinessCheckResourceStatus -> String
showsPrec :: Int -> GetReadinessCheckResourceStatus -> ShowS
$cshowsPrec :: Int -> GetReadinessCheckResourceStatus -> ShowS
Prelude.Show, (forall x.
 GetReadinessCheckResourceStatus
 -> Rep GetReadinessCheckResourceStatus x)
-> (forall x.
    Rep GetReadinessCheckResourceStatus x
    -> GetReadinessCheckResourceStatus)
-> Generic GetReadinessCheckResourceStatus
forall x.
Rep GetReadinessCheckResourceStatus x
-> GetReadinessCheckResourceStatus
forall x.
GetReadinessCheckResourceStatus
-> Rep GetReadinessCheckResourceStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReadinessCheckResourceStatus x
-> GetReadinessCheckResourceStatus
$cfrom :: forall x.
GetReadinessCheckResourceStatus
-> Rep GetReadinessCheckResourceStatus x
Prelude.Generic)

-- |
-- Create a value of 'GetReadinessCheckResourceStatus' 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:
--
-- 'nextToken', 'getReadinessCheckResourceStatus_nextToken' - A token used to resume pagination from the end of a previous request.
--
-- 'maxResults', 'getReadinessCheckResourceStatus_maxResults' - Upper bound on number of records to return.
--
-- 'readinessCheckName', 'getReadinessCheckResourceStatus_readinessCheckName' - The ReadinessCheck to get
--
-- 'resourceIdentifier', 'getReadinessCheckResourceStatus_resourceIdentifier' - The resource ARN or component Id to get
newGetReadinessCheckResourceStatus ::
  -- | 'readinessCheckName'
  Prelude.Text ->
  -- | 'resourceIdentifier'
  Prelude.Text ->
  GetReadinessCheckResourceStatus
newGetReadinessCheckResourceStatus :: Text -> Text -> GetReadinessCheckResourceStatus
newGetReadinessCheckResourceStatus
  Text
pReadinessCheckName_
  Text
pResourceIdentifier_ =
    GetReadinessCheckResourceStatus' :: Maybe Text
-> Maybe Natural -> Text -> Text -> GetReadinessCheckResourceStatus
GetReadinessCheckResourceStatus'
      { $sel:nextToken:GetReadinessCheckResourceStatus' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:GetReadinessCheckResourceStatus' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:readinessCheckName:GetReadinessCheckResourceStatus' :: Text
readinessCheckName = Text
pReadinessCheckName_,
        $sel:resourceIdentifier:GetReadinessCheckResourceStatus' :: Text
resourceIdentifier = Text
pResourceIdentifier_
      }

-- | A token used to resume pagination from the end of a previous request.
getReadinessCheckResourceStatus_nextToken :: Lens.Lens' GetReadinessCheckResourceStatus (Prelude.Maybe Prelude.Text)
getReadinessCheckResourceStatus_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetReadinessCheckResourceStatus
-> f GetReadinessCheckResourceStatus
getReadinessCheckResourceStatus_nextToken = (GetReadinessCheckResourceStatus -> Maybe Text)
-> (GetReadinessCheckResourceStatus
    -> Maybe Text -> GetReadinessCheckResourceStatus)
-> Lens
     GetReadinessCheckResourceStatus
     GetReadinessCheckResourceStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReadinessCheckResourceStatus' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetReadinessCheckResourceStatus
s@GetReadinessCheckResourceStatus' {} Maybe Text
a -> GetReadinessCheckResourceStatus
s {$sel:nextToken:GetReadinessCheckResourceStatus' :: Maybe Text
nextToken = Maybe Text
a} :: GetReadinessCheckResourceStatus)

-- | Upper bound on number of records to return.
getReadinessCheckResourceStatus_maxResults :: Lens.Lens' GetReadinessCheckResourceStatus (Prelude.Maybe Prelude.Natural)
getReadinessCheckResourceStatus_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetReadinessCheckResourceStatus
-> f GetReadinessCheckResourceStatus
getReadinessCheckResourceStatus_maxResults = (GetReadinessCheckResourceStatus -> Maybe Natural)
-> (GetReadinessCheckResourceStatus
    -> Maybe Natural -> GetReadinessCheckResourceStatus)
-> Lens
     GetReadinessCheckResourceStatus
     GetReadinessCheckResourceStatus
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReadinessCheckResourceStatus' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetReadinessCheckResourceStatus
s@GetReadinessCheckResourceStatus' {} Maybe Natural
a -> GetReadinessCheckResourceStatus
s {$sel:maxResults:GetReadinessCheckResourceStatus' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetReadinessCheckResourceStatus)

-- | The ReadinessCheck to get
getReadinessCheckResourceStatus_readinessCheckName :: Lens.Lens' GetReadinessCheckResourceStatus Prelude.Text
getReadinessCheckResourceStatus_readinessCheckName :: (Text -> f Text)
-> GetReadinessCheckResourceStatus
-> f GetReadinessCheckResourceStatus
getReadinessCheckResourceStatus_readinessCheckName = (GetReadinessCheckResourceStatus -> Text)
-> (GetReadinessCheckResourceStatus
    -> Text -> GetReadinessCheckResourceStatus)
-> Lens
     GetReadinessCheckResourceStatus
     GetReadinessCheckResourceStatus
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReadinessCheckResourceStatus' {Text
readinessCheckName :: Text
$sel:readinessCheckName:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Text
readinessCheckName} -> Text
readinessCheckName) (\s :: GetReadinessCheckResourceStatus
s@GetReadinessCheckResourceStatus' {} Text
a -> GetReadinessCheckResourceStatus
s {$sel:readinessCheckName:GetReadinessCheckResourceStatus' :: Text
readinessCheckName = Text
a} :: GetReadinessCheckResourceStatus)

-- | The resource ARN or component Id to get
getReadinessCheckResourceStatus_resourceIdentifier :: Lens.Lens' GetReadinessCheckResourceStatus Prelude.Text
getReadinessCheckResourceStatus_resourceIdentifier :: (Text -> f Text)
-> GetReadinessCheckResourceStatus
-> f GetReadinessCheckResourceStatus
getReadinessCheckResourceStatus_resourceIdentifier = (GetReadinessCheckResourceStatus -> Text)
-> (GetReadinessCheckResourceStatus
    -> Text -> GetReadinessCheckResourceStatus)
-> Lens
     GetReadinessCheckResourceStatus
     GetReadinessCheckResourceStatus
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReadinessCheckResourceStatus' {Text
resourceIdentifier :: Text
$sel:resourceIdentifier:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Text
resourceIdentifier} -> Text
resourceIdentifier) (\s :: GetReadinessCheckResourceStatus
s@GetReadinessCheckResourceStatus' {} Text
a -> GetReadinessCheckResourceStatus
s {$sel:resourceIdentifier:GetReadinessCheckResourceStatus' :: Text
resourceIdentifier = Text
a} :: GetReadinessCheckResourceStatus)

instance
  Core.AWSPager
    GetReadinessCheckResourceStatus
  where
  page :: GetReadinessCheckResourceStatus
-> AWSResponse GetReadinessCheckResourceStatus
-> Maybe GetReadinessCheckResourceStatus
page GetReadinessCheckResourceStatus
rq AWSResponse GetReadinessCheckResourceStatus
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetReadinessCheckResourceStatus
GetReadinessCheckResourceStatusResponse
rs
            GetReadinessCheckResourceStatusResponse
-> Getting
     (First Text) GetReadinessCheckResourceStatusResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetReadinessCheckResourceStatusResponse
-> Const (First Text) GetReadinessCheckResourceStatusResponse
Lens' GetReadinessCheckResourceStatusResponse (Maybe Text)
getReadinessCheckResourceStatusResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetReadinessCheckResourceStatusResponse
 -> Const (First Text) GetReadinessCheckResourceStatusResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) GetReadinessCheckResourceStatusResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetReadinessCheckResourceStatus
forall a. Maybe a
Prelude.Nothing
    | Maybe [RuleResult] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetReadinessCheckResourceStatus
GetReadinessCheckResourceStatusResponse
rs
            GetReadinessCheckResourceStatusResponse
-> Getting
     (First [RuleResult])
     GetReadinessCheckResourceStatusResponse
     [RuleResult]
-> Maybe [RuleResult]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RuleResult]
 -> Const (First [RuleResult]) (Maybe [RuleResult]))
-> GetReadinessCheckResourceStatusResponse
-> Const
     (First [RuleResult]) GetReadinessCheckResourceStatusResponse
Lens' GetReadinessCheckResourceStatusResponse (Maybe [RuleResult])
getReadinessCheckResourceStatusResponse_rules
              ((Maybe [RuleResult]
  -> Const (First [RuleResult]) (Maybe [RuleResult]))
 -> GetReadinessCheckResourceStatusResponse
 -> Const
      (First [RuleResult]) GetReadinessCheckResourceStatusResponse)
-> (([RuleResult] -> Const (First [RuleResult]) [RuleResult])
    -> Maybe [RuleResult]
    -> Const (First [RuleResult]) (Maybe [RuleResult]))
-> Getting
     (First [RuleResult])
     GetReadinessCheckResourceStatusResponse
     [RuleResult]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RuleResult] -> Const (First [RuleResult]) [RuleResult])
-> Maybe [RuleResult]
-> Const (First [RuleResult]) (Maybe [RuleResult])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetReadinessCheckResourceStatus
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetReadinessCheckResourceStatus
-> Maybe GetReadinessCheckResourceStatus
forall a. a -> Maybe a
Prelude.Just (GetReadinessCheckResourceStatus
 -> Maybe GetReadinessCheckResourceStatus)
-> GetReadinessCheckResourceStatus
-> Maybe GetReadinessCheckResourceStatus
forall a b. (a -> b) -> a -> b
Prelude.$
        GetReadinessCheckResourceStatus
rq
          GetReadinessCheckResourceStatus
-> (GetReadinessCheckResourceStatus
    -> GetReadinessCheckResourceStatus)
-> GetReadinessCheckResourceStatus
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetReadinessCheckResourceStatus
-> Identity GetReadinessCheckResourceStatus
Lens
  GetReadinessCheckResourceStatus
  GetReadinessCheckResourceStatus
  (Maybe Text)
  (Maybe Text)
getReadinessCheckResourceStatus_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetReadinessCheckResourceStatus
 -> Identity GetReadinessCheckResourceStatus)
-> Maybe Text
-> GetReadinessCheckResourceStatus
-> GetReadinessCheckResourceStatus
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetReadinessCheckResourceStatus
GetReadinessCheckResourceStatusResponse
rs
          GetReadinessCheckResourceStatusResponse
-> Getting
     (First Text) GetReadinessCheckResourceStatusResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetReadinessCheckResourceStatusResponse
-> Const (First Text) GetReadinessCheckResourceStatusResponse
Lens' GetReadinessCheckResourceStatusResponse (Maybe Text)
getReadinessCheckResourceStatusResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetReadinessCheckResourceStatusResponse
 -> Const (First Text) GetReadinessCheckResourceStatusResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) GetReadinessCheckResourceStatusResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    GetReadinessCheckResourceStatus
  where
  type
    AWSResponse GetReadinessCheckResourceStatus =
      GetReadinessCheckResourceStatusResponse
  request :: GetReadinessCheckResourceStatus
-> Request GetReadinessCheckResourceStatus
request = Service
-> GetReadinessCheckResourceStatus
-> Request GetReadinessCheckResourceStatus
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetReadinessCheckResourceStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetReadinessCheckResourceStatus)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetReadinessCheckResourceStatus))
-> Logger
-> Service
-> Proxy GetReadinessCheckResourceStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetReadinessCheckResourceStatus)))
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 ->
          Maybe [RuleResult]
-> Maybe Readiness
-> Maybe Text
-> Int
-> GetReadinessCheckResourceStatusResponse
GetReadinessCheckResourceStatusResponse'
            (Maybe [RuleResult]
 -> Maybe Readiness
 -> Maybe Text
 -> Int
 -> GetReadinessCheckResourceStatusResponse)
-> Either String (Maybe [RuleResult])
-> Either
     String
     (Maybe Readiness
      -> Maybe Text -> Int -> GetReadinessCheckResourceStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [RuleResult]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"rules" Either String (Maybe (Maybe [RuleResult]))
-> Maybe [RuleResult] -> Either String (Maybe [RuleResult])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RuleResult]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Readiness
   -> Maybe Text -> Int -> GetReadinessCheckResourceStatusResponse)
-> Either String (Maybe Readiness)
-> Either
     String
     (Maybe Text -> Int -> GetReadinessCheckResourceStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Readiness)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"readiness")
            Either
  String
  (Maybe Text -> Int -> GetReadinessCheckResourceStatusResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetReadinessCheckResourceStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> GetReadinessCheckResourceStatusResponse)
-> Either String Int
-> Either String GetReadinessCheckResourceStatusResponse
forall (f :: * -> *) a b. Applicative f => 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))
      )

instance
  Prelude.Hashable
    GetReadinessCheckResourceStatus

instance
  Prelude.NFData
    GetReadinessCheckResourceStatus

instance
  Core.ToHeaders
    GetReadinessCheckResourceStatus
  where
  toHeaders :: GetReadinessCheckResourceStatus -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetReadinessCheckResourceStatus -> 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 GetReadinessCheckResourceStatus where
  toPath :: GetReadinessCheckResourceStatus -> ByteString
toPath GetReadinessCheckResourceStatus' {Maybe Natural
Maybe Text
Text
resourceIdentifier :: Text
readinessCheckName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:resourceIdentifier:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Text
$sel:readinessCheckName:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Text
$sel:maxResults:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Maybe Natural
$sel:nextToken:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/readinesschecks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
readinessCheckName,
        ByteString
"/resource/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceIdentifier,
        ByteString
"/status"
      ]

instance Core.ToQuery GetReadinessCheckResourceStatus where
  toQuery :: GetReadinessCheckResourceStatus -> QueryString
toQuery GetReadinessCheckResourceStatus' {Maybe Natural
Maybe Text
Text
resourceIdentifier :: Text
readinessCheckName :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:resourceIdentifier:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Text
$sel:readinessCheckName:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Text
$sel:maxResults:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Maybe Natural
$sel:nextToken:GetReadinessCheckResourceStatus' :: GetReadinessCheckResourceStatus -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newGetReadinessCheckResourceStatusResponse' smart constructor.
data GetReadinessCheckResourceStatusResponse = GetReadinessCheckResourceStatusResponse'
  { -- | Details of the rules\'s results
    GetReadinessCheckResourceStatusResponse -> Maybe [RuleResult]
rules :: Prelude.Maybe [RuleResult],
    -- | The readiness at rule level.
    GetReadinessCheckResourceStatusResponse -> Maybe Readiness
readiness :: Prelude.Maybe Readiness,
    -- | A token that can be used to resume pagination from the end of the
    -- collection.
    GetReadinessCheckResourceStatusResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetReadinessCheckResourceStatusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetReadinessCheckResourceStatusResponse
-> GetReadinessCheckResourceStatusResponse -> Bool
(GetReadinessCheckResourceStatusResponse
 -> GetReadinessCheckResourceStatusResponse -> Bool)
-> (GetReadinessCheckResourceStatusResponse
    -> GetReadinessCheckResourceStatusResponse -> Bool)
-> Eq GetReadinessCheckResourceStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReadinessCheckResourceStatusResponse
-> GetReadinessCheckResourceStatusResponse -> Bool
$c/= :: GetReadinessCheckResourceStatusResponse
-> GetReadinessCheckResourceStatusResponse -> Bool
== :: GetReadinessCheckResourceStatusResponse
-> GetReadinessCheckResourceStatusResponse -> Bool
$c== :: GetReadinessCheckResourceStatusResponse
-> GetReadinessCheckResourceStatusResponse -> Bool
Prelude.Eq, ReadPrec [GetReadinessCheckResourceStatusResponse]
ReadPrec GetReadinessCheckResourceStatusResponse
Int -> ReadS GetReadinessCheckResourceStatusResponse
ReadS [GetReadinessCheckResourceStatusResponse]
(Int -> ReadS GetReadinessCheckResourceStatusResponse)
-> ReadS [GetReadinessCheckResourceStatusResponse]
-> ReadPrec GetReadinessCheckResourceStatusResponse
-> ReadPrec [GetReadinessCheckResourceStatusResponse]
-> Read GetReadinessCheckResourceStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReadinessCheckResourceStatusResponse]
$creadListPrec :: ReadPrec [GetReadinessCheckResourceStatusResponse]
readPrec :: ReadPrec GetReadinessCheckResourceStatusResponse
$creadPrec :: ReadPrec GetReadinessCheckResourceStatusResponse
readList :: ReadS [GetReadinessCheckResourceStatusResponse]
$creadList :: ReadS [GetReadinessCheckResourceStatusResponse]
readsPrec :: Int -> ReadS GetReadinessCheckResourceStatusResponse
$creadsPrec :: Int -> ReadS GetReadinessCheckResourceStatusResponse
Prelude.Read, Int -> GetReadinessCheckResourceStatusResponse -> ShowS
[GetReadinessCheckResourceStatusResponse] -> ShowS
GetReadinessCheckResourceStatusResponse -> String
(Int -> GetReadinessCheckResourceStatusResponse -> ShowS)
-> (GetReadinessCheckResourceStatusResponse -> String)
-> ([GetReadinessCheckResourceStatusResponse] -> ShowS)
-> Show GetReadinessCheckResourceStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReadinessCheckResourceStatusResponse] -> ShowS
$cshowList :: [GetReadinessCheckResourceStatusResponse] -> ShowS
show :: GetReadinessCheckResourceStatusResponse -> String
$cshow :: GetReadinessCheckResourceStatusResponse -> String
showsPrec :: Int -> GetReadinessCheckResourceStatusResponse -> ShowS
$cshowsPrec :: Int -> GetReadinessCheckResourceStatusResponse -> ShowS
Prelude.Show, (forall x.
 GetReadinessCheckResourceStatusResponse
 -> Rep GetReadinessCheckResourceStatusResponse x)
-> (forall x.
    Rep GetReadinessCheckResourceStatusResponse x
    -> GetReadinessCheckResourceStatusResponse)
-> Generic GetReadinessCheckResourceStatusResponse
forall x.
Rep GetReadinessCheckResourceStatusResponse x
-> GetReadinessCheckResourceStatusResponse
forall x.
GetReadinessCheckResourceStatusResponse
-> Rep GetReadinessCheckResourceStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReadinessCheckResourceStatusResponse x
-> GetReadinessCheckResourceStatusResponse
$cfrom :: forall x.
GetReadinessCheckResourceStatusResponse
-> Rep GetReadinessCheckResourceStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetReadinessCheckResourceStatusResponse' 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:
--
-- 'rules', 'getReadinessCheckResourceStatusResponse_rules' - Details of the rules\'s results
--
-- 'readiness', 'getReadinessCheckResourceStatusResponse_readiness' - The readiness at rule level.
--
-- 'nextToken', 'getReadinessCheckResourceStatusResponse_nextToken' - A token that can be used to resume pagination from the end of the
-- collection.
--
-- 'httpStatus', 'getReadinessCheckResourceStatusResponse_httpStatus' - The response's http status code.
newGetReadinessCheckResourceStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetReadinessCheckResourceStatusResponse
newGetReadinessCheckResourceStatusResponse :: Int -> GetReadinessCheckResourceStatusResponse
newGetReadinessCheckResourceStatusResponse
  Int
pHttpStatus_ =
    GetReadinessCheckResourceStatusResponse' :: Maybe [RuleResult]
-> Maybe Readiness
-> Maybe Text
-> Int
-> GetReadinessCheckResourceStatusResponse
GetReadinessCheckResourceStatusResponse'
      { $sel:rules:GetReadinessCheckResourceStatusResponse' :: Maybe [RuleResult]
rules =
          Maybe [RuleResult]
forall a. Maybe a
Prelude.Nothing,
        $sel:readiness:GetReadinessCheckResourceStatusResponse' :: Maybe Readiness
readiness = Maybe Readiness
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetReadinessCheckResourceStatusResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetReadinessCheckResourceStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Details of the rules\'s results
getReadinessCheckResourceStatusResponse_rules :: Lens.Lens' GetReadinessCheckResourceStatusResponse (Prelude.Maybe [RuleResult])
getReadinessCheckResourceStatusResponse_rules :: (Maybe [RuleResult] -> f (Maybe [RuleResult]))
-> GetReadinessCheckResourceStatusResponse
-> f GetReadinessCheckResourceStatusResponse
getReadinessCheckResourceStatusResponse_rules = (GetReadinessCheckResourceStatusResponse -> Maybe [RuleResult])
-> (GetReadinessCheckResourceStatusResponse
    -> Maybe [RuleResult] -> GetReadinessCheckResourceStatusResponse)
-> Lens'
     GetReadinessCheckResourceStatusResponse (Maybe [RuleResult])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReadinessCheckResourceStatusResponse' {Maybe [RuleResult]
rules :: Maybe [RuleResult]
$sel:rules:GetReadinessCheckResourceStatusResponse' :: GetReadinessCheckResourceStatusResponse -> Maybe [RuleResult]
rules} -> Maybe [RuleResult]
rules) (\s :: GetReadinessCheckResourceStatusResponse
s@GetReadinessCheckResourceStatusResponse' {} Maybe [RuleResult]
a -> GetReadinessCheckResourceStatusResponse
s {$sel:rules:GetReadinessCheckResourceStatusResponse' :: Maybe [RuleResult]
rules = Maybe [RuleResult]
a} :: GetReadinessCheckResourceStatusResponse) ((Maybe [RuleResult] -> f (Maybe [RuleResult]))
 -> GetReadinessCheckResourceStatusResponse
 -> f GetReadinessCheckResourceStatusResponse)
-> ((Maybe [RuleResult] -> f (Maybe [RuleResult]))
    -> Maybe [RuleResult] -> f (Maybe [RuleResult]))
-> (Maybe [RuleResult] -> f (Maybe [RuleResult]))
-> GetReadinessCheckResourceStatusResponse
-> f GetReadinessCheckResourceStatusResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RuleResult] [RuleResult] [RuleResult] [RuleResult]
-> Iso
     (Maybe [RuleResult])
     (Maybe [RuleResult])
     (Maybe [RuleResult])
     (Maybe [RuleResult])
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 AnIso [RuleResult] [RuleResult] [RuleResult] [RuleResult]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The readiness at rule level.
getReadinessCheckResourceStatusResponse_readiness :: Lens.Lens' GetReadinessCheckResourceStatusResponse (Prelude.Maybe Readiness)
getReadinessCheckResourceStatusResponse_readiness :: (Maybe Readiness -> f (Maybe Readiness))
-> GetReadinessCheckResourceStatusResponse
-> f GetReadinessCheckResourceStatusResponse
getReadinessCheckResourceStatusResponse_readiness = (GetReadinessCheckResourceStatusResponse -> Maybe Readiness)
-> (GetReadinessCheckResourceStatusResponse
    -> Maybe Readiness -> GetReadinessCheckResourceStatusResponse)
-> Lens
     GetReadinessCheckResourceStatusResponse
     GetReadinessCheckResourceStatusResponse
     (Maybe Readiness)
     (Maybe Readiness)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReadinessCheckResourceStatusResponse' {Maybe Readiness
readiness :: Maybe Readiness
$sel:readiness:GetReadinessCheckResourceStatusResponse' :: GetReadinessCheckResourceStatusResponse -> Maybe Readiness
readiness} -> Maybe Readiness
readiness) (\s :: GetReadinessCheckResourceStatusResponse
s@GetReadinessCheckResourceStatusResponse' {} Maybe Readiness
a -> GetReadinessCheckResourceStatusResponse
s {$sel:readiness:GetReadinessCheckResourceStatusResponse' :: Maybe Readiness
readiness = Maybe Readiness
a} :: GetReadinessCheckResourceStatusResponse)

-- | A token that can be used to resume pagination from the end of the
-- collection.
getReadinessCheckResourceStatusResponse_nextToken :: Lens.Lens' GetReadinessCheckResourceStatusResponse (Prelude.Maybe Prelude.Text)
getReadinessCheckResourceStatusResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetReadinessCheckResourceStatusResponse
-> f GetReadinessCheckResourceStatusResponse
getReadinessCheckResourceStatusResponse_nextToken = (GetReadinessCheckResourceStatusResponse -> Maybe Text)
-> (GetReadinessCheckResourceStatusResponse
    -> Maybe Text -> GetReadinessCheckResourceStatusResponse)
-> Lens' GetReadinessCheckResourceStatusResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReadinessCheckResourceStatusResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetReadinessCheckResourceStatusResponse' :: GetReadinessCheckResourceStatusResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetReadinessCheckResourceStatusResponse
s@GetReadinessCheckResourceStatusResponse' {} Maybe Text
a -> GetReadinessCheckResourceStatusResponse
s {$sel:nextToken:GetReadinessCheckResourceStatusResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetReadinessCheckResourceStatusResponse)

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

instance
  Prelude.NFData
    GetReadinessCheckResourceStatusResponse