{-# 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.Config.DescribeOrganizationConfigRuleStatuses
-- 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)
--
-- Provides organization config rule deployment status for an organization.
--
-- The status is not considered successful until organization config rule
-- is successfully deployed in all the member accounts with an exception of
-- excluded accounts.
--
-- When you specify the limit and the next token, you receive a paginated
-- response. Limit and next token are not applicable if you specify
-- organization config rule names. It is only applicable, when you request
-- all the organization config rules.
--
-- This operation returns paginated results.
module Amazonka.Config.DescribeOrganizationConfigRuleStatuses
  ( -- * Creating a Request
    DescribeOrganizationConfigRuleStatuses (..),
    newDescribeOrganizationConfigRuleStatuses,

    -- * Request Lenses
    describeOrganizationConfigRuleStatuses_organizationConfigRuleNames,
    describeOrganizationConfigRuleStatuses_nextToken,
    describeOrganizationConfigRuleStatuses_limit,

    -- * Destructuring the Response
    DescribeOrganizationConfigRuleStatusesResponse (..),
    newDescribeOrganizationConfigRuleStatusesResponse,

    -- * Response Lenses
    describeOrganizationConfigRuleStatusesResponse_nextToken,
    describeOrganizationConfigRuleStatusesResponse_organizationConfigRuleStatuses,
    describeOrganizationConfigRuleStatusesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeOrganizationConfigRuleStatuses' smart constructor.
data DescribeOrganizationConfigRuleStatuses = DescribeOrganizationConfigRuleStatuses'
  { -- | The names of organization config rules for which you want status
    -- details. If you do not specify any names, Config returns details for all
    -- your organization Config rules.
    DescribeOrganizationConfigRuleStatuses -> Maybe [Text]
organizationConfigRuleNames :: Prelude.Maybe [Prelude.Text],
    -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    DescribeOrganizationConfigRuleStatuses -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of @OrganizationConfigRuleStatuses@ returned on each
    -- page. If you do no specify a number, Config uses the default. The
    -- default is 100.
    DescribeOrganizationConfigRuleStatuses -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeOrganizationConfigRuleStatuses
-> DescribeOrganizationConfigRuleStatuses -> Bool
(DescribeOrganizationConfigRuleStatuses
 -> DescribeOrganizationConfigRuleStatuses -> Bool)
-> (DescribeOrganizationConfigRuleStatuses
    -> DescribeOrganizationConfigRuleStatuses -> Bool)
-> Eq DescribeOrganizationConfigRuleStatuses
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeOrganizationConfigRuleStatuses
-> DescribeOrganizationConfigRuleStatuses -> Bool
$c/= :: DescribeOrganizationConfigRuleStatuses
-> DescribeOrganizationConfigRuleStatuses -> Bool
== :: DescribeOrganizationConfigRuleStatuses
-> DescribeOrganizationConfigRuleStatuses -> Bool
$c== :: DescribeOrganizationConfigRuleStatuses
-> DescribeOrganizationConfigRuleStatuses -> Bool
Prelude.Eq, ReadPrec [DescribeOrganizationConfigRuleStatuses]
ReadPrec DescribeOrganizationConfigRuleStatuses
Int -> ReadS DescribeOrganizationConfigRuleStatuses
ReadS [DescribeOrganizationConfigRuleStatuses]
(Int -> ReadS DescribeOrganizationConfigRuleStatuses)
-> ReadS [DescribeOrganizationConfigRuleStatuses]
-> ReadPrec DescribeOrganizationConfigRuleStatuses
-> ReadPrec [DescribeOrganizationConfigRuleStatuses]
-> Read DescribeOrganizationConfigRuleStatuses
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeOrganizationConfigRuleStatuses]
$creadListPrec :: ReadPrec [DescribeOrganizationConfigRuleStatuses]
readPrec :: ReadPrec DescribeOrganizationConfigRuleStatuses
$creadPrec :: ReadPrec DescribeOrganizationConfigRuleStatuses
readList :: ReadS [DescribeOrganizationConfigRuleStatuses]
$creadList :: ReadS [DescribeOrganizationConfigRuleStatuses]
readsPrec :: Int -> ReadS DescribeOrganizationConfigRuleStatuses
$creadsPrec :: Int -> ReadS DescribeOrganizationConfigRuleStatuses
Prelude.Read, Int -> DescribeOrganizationConfigRuleStatuses -> ShowS
[DescribeOrganizationConfigRuleStatuses] -> ShowS
DescribeOrganizationConfigRuleStatuses -> String
(Int -> DescribeOrganizationConfigRuleStatuses -> ShowS)
-> (DescribeOrganizationConfigRuleStatuses -> String)
-> ([DescribeOrganizationConfigRuleStatuses] -> ShowS)
-> Show DescribeOrganizationConfigRuleStatuses
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeOrganizationConfigRuleStatuses] -> ShowS
$cshowList :: [DescribeOrganizationConfigRuleStatuses] -> ShowS
show :: DescribeOrganizationConfigRuleStatuses -> String
$cshow :: DescribeOrganizationConfigRuleStatuses -> String
showsPrec :: Int -> DescribeOrganizationConfigRuleStatuses -> ShowS
$cshowsPrec :: Int -> DescribeOrganizationConfigRuleStatuses -> ShowS
Prelude.Show, (forall x.
 DescribeOrganizationConfigRuleStatuses
 -> Rep DescribeOrganizationConfigRuleStatuses x)
-> (forall x.
    Rep DescribeOrganizationConfigRuleStatuses x
    -> DescribeOrganizationConfigRuleStatuses)
-> Generic DescribeOrganizationConfigRuleStatuses
forall x.
Rep DescribeOrganizationConfigRuleStatuses x
-> DescribeOrganizationConfigRuleStatuses
forall x.
DescribeOrganizationConfigRuleStatuses
-> Rep DescribeOrganizationConfigRuleStatuses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeOrganizationConfigRuleStatuses x
-> DescribeOrganizationConfigRuleStatuses
$cfrom :: forall x.
DescribeOrganizationConfigRuleStatuses
-> Rep DescribeOrganizationConfigRuleStatuses x
Prelude.Generic)

-- |
-- Create a value of 'DescribeOrganizationConfigRuleStatuses' 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:
--
-- 'organizationConfigRuleNames', 'describeOrganizationConfigRuleStatuses_organizationConfigRuleNames' - The names of organization config rules for which you want status
-- details. If you do not specify any names, Config returns details for all
-- your organization Config rules.
--
-- 'nextToken', 'describeOrganizationConfigRuleStatuses_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'limit', 'describeOrganizationConfigRuleStatuses_limit' - The maximum number of @OrganizationConfigRuleStatuses@ returned on each
-- page. If you do no specify a number, Config uses the default. The
-- default is 100.
newDescribeOrganizationConfigRuleStatuses ::
  DescribeOrganizationConfigRuleStatuses
newDescribeOrganizationConfigRuleStatuses :: DescribeOrganizationConfigRuleStatuses
newDescribeOrganizationConfigRuleStatuses =
  DescribeOrganizationConfigRuleStatuses' :: Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> DescribeOrganizationConfigRuleStatuses
DescribeOrganizationConfigRuleStatuses'
    { $sel:organizationConfigRuleNames:DescribeOrganizationConfigRuleStatuses' :: Maybe [Text]
organizationConfigRuleNames =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeOrganizationConfigRuleStatuses' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeOrganizationConfigRuleStatuses' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The names of organization config rules for which you want status
-- details. If you do not specify any names, Config returns details for all
-- your organization Config rules.
describeOrganizationConfigRuleStatuses_organizationConfigRuleNames :: Lens.Lens' DescribeOrganizationConfigRuleStatuses (Prelude.Maybe [Prelude.Text])
describeOrganizationConfigRuleStatuses_organizationConfigRuleNames :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeOrganizationConfigRuleStatuses
-> f DescribeOrganizationConfigRuleStatuses
describeOrganizationConfigRuleStatuses_organizationConfigRuleNames = (DescribeOrganizationConfigRuleStatuses -> Maybe [Text])
-> (DescribeOrganizationConfigRuleStatuses
    -> Maybe [Text] -> DescribeOrganizationConfigRuleStatuses)
-> Lens
     DescribeOrganizationConfigRuleStatuses
     DescribeOrganizationConfigRuleStatuses
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationConfigRuleStatuses' {Maybe [Text]
organizationConfigRuleNames :: Maybe [Text]
$sel:organizationConfigRuleNames:DescribeOrganizationConfigRuleStatuses' :: DescribeOrganizationConfigRuleStatuses -> Maybe [Text]
organizationConfigRuleNames} -> Maybe [Text]
organizationConfigRuleNames) (\s :: DescribeOrganizationConfigRuleStatuses
s@DescribeOrganizationConfigRuleStatuses' {} Maybe [Text]
a -> DescribeOrganizationConfigRuleStatuses
s {$sel:organizationConfigRuleNames:DescribeOrganizationConfigRuleStatuses' :: Maybe [Text]
organizationConfigRuleNames = Maybe [Text]
a} :: DescribeOrganizationConfigRuleStatuses) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeOrganizationConfigRuleStatuses
 -> f DescribeOrganizationConfigRuleStatuses)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeOrganizationConfigRuleStatuses
-> f DescribeOrganizationConfigRuleStatuses
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
describeOrganizationConfigRuleStatuses_nextToken :: Lens.Lens' DescribeOrganizationConfigRuleStatuses (Prelude.Maybe Prelude.Text)
describeOrganizationConfigRuleStatuses_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeOrganizationConfigRuleStatuses
-> f DescribeOrganizationConfigRuleStatuses
describeOrganizationConfigRuleStatuses_nextToken = (DescribeOrganizationConfigRuleStatuses -> Maybe Text)
-> (DescribeOrganizationConfigRuleStatuses
    -> Maybe Text -> DescribeOrganizationConfigRuleStatuses)
-> Lens
     DescribeOrganizationConfigRuleStatuses
     DescribeOrganizationConfigRuleStatuses
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationConfigRuleStatuses' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeOrganizationConfigRuleStatuses' :: DescribeOrganizationConfigRuleStatuses -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeOrganizationConfigRuleStatuses
s@DescribeOrganizationConfigRuleStatuses' {} Maybe Text
a -> DescribeOrganizationConfigRuleStatuses
s {$sel:nextToken:DescribeOrganizationConfigRuleStatuses' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeOrganizationConfigRuleStatuses)

-- | The maximum number of @OrganizationConfigRuleStatuses@ returned on each
-- page. If you do no specify a number, Config uses the default. The
-- default is 100.
describeOrganizationConfigRuleStatuses_limit :: Lens.Lens' DescribeOrganizationConfigRuleStatuses (Prelude.Maybe Prelude.Natural)
describeOrganizationConfigRuleStatuses_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeOrganizationConfigRuleStatuses
-> f DescribeOrganizationConfigRuleStatuses
describeOrganizationConfigRuleStatuses_limit = (DescribeOrganizationConfigRuleStatuses -> Maybe Natural)
-> (DescribeOrganizationConfigRuleStatuses
    -> Maybe Natural -> DescribeOrganizationConfigRuleStatuses)
-> Lens
     DescribeOrganizationConfigRuleStatuses
     DescribeOrganizationConfigRuleStatuses
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationConfigRuleStatuses' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeOrganizationConfigRuleStatuses' :: DescribeOrganizationConfigRuleStatuses -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeOrganizationConfigRuleStatuses
s@DescribeOrganizationConfigRuleStatuses' {} Maybe Natural
a -> DescribeOrganizationConfigRuleStatuses
s {$sel:limit:DescribeOrganizationConfigRuleStatuses' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeOrganizationConfigRuleStatuses)

instance
  Core.AWSPager
    DescribeOrganizationConfigRuleStatuses
  where
  page :: DescribeOrganizationConfigRuleStatuses
-> AWSResponse DescribeOrganizationConfigRuleStatuses
-> Maybe DescribeOrganizationConfigRuleStatuses
page DescribeOrganizationConfigRuleStatuses
rq AWSResponse DescribeOrganizationConfigRuleStatuses
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeOrganizationConfigRuleStatuses
DescribeOrganizationConfigRuleStatusesResponse
rs
            DescribeOrganizationConfigRuleStatusesResponse
-> Getting
     (First Text) DescribeOrganizationConfigRuleStatusesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeOrganizationConfigRuleStatusesResponse
-> Const
     (First Text) DescribeOrganizationConfigRuleStatusesResponse
Lens' DescribeOrganizationConfigRuleStatusesResponse (Maybe Text)
describeOrganizationConfigRuleStatusesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeOrganizationConfigRuleStatusesResponse
 -> Const
      (First Text) DescribeOrganizationConfigRuleStatusesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeOrganizationConfigRuleStatusesResponse 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 DescribeOrganizationConfigRuleStatuses
forall a. Maybe a
Prelude.Nothing
    | Maybe [OrganizationConfigRuleStatus] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeOrganizationConfigRuleStatuses
DescribeOrganizationConfigRuleStatusesResponse
rs
            DescribeOrganizationConfigRuleStatusesResponse
-> Getting
     (First [OrganizationConfigRuleStatus])
     DescribeOrganizationConfigRuleStatusesResponse
     [OrganizationConfigRuleStatus]
-> Maybe [OrganizationConfigRuleStatus]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [OrganizationConfigRuleStatus]
 -> Const
      (First [OrganizationConfigRuleStatus])
      (Maybe [OrganizationConfigRuleStatus]))
-> DescribeOrganizationConfigRuleStatusesResponse
-> Const
     (First [OrganizationConfigRuleStatus])
     DescribeOrganizationConfigRuleStatusesResponse
Lens'
  DescribeOrganizationConfigRuleStatusesResponse
  (Maybe [OrganizationConfigRuleStatus])
describeOrganizationConfigRuleStatusesResponse_organizationConfigRuleStatuses
              ((Maybe [OrganizationConfigRuleStatus]
  -> Const
       (First [OrganizationConfigRuleStatus])
       (Maybe [OrganizationConfigRuleStatus]))
 -> DescribeOrganizationConfigRuleStatusesResponse
 -> Const
      (First [OrganizationConfigRuleStatus])
      DescribeOrganizationConfigRuleStatusesResponse)
-> (([OrganizationConfigRuleStatus]
     -> Const
          (First [OrganizationConfigRuleStatus])
          [OrganizationConfigRuleStatus])
    -> Maybe [OrganizationConfigRuleStatus]
    -> Const
         (First [OrganizationConfigRuleStatus])
         (Maybe [OrganizationConfigRuleStatus]))
-> Getting
     (First [OrganizationConfigRuleStatus])
     DescribeOrganizationConfigRuleStatusesResponse
     [OrganizationConfigRuleStatus]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([OrganizationConfigRuleStatus]
 -> Const
      (First [OrganizationConfigRuleStatus])
      [OrganizationConfigRuleStatus])
-> Maybe [OrganizationConfigRuleStatus]
-> Const
     (First [OrganizationConfigRuleStatus])
     (Maybe [OrganizationConfigRuleStatus])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeOrganizationConfigRuleStatuses
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeOrganizationConfigRuleStatuses
-> Maybe DescribeOrganizationConfigRuleStatuses
forall a. a -> Maybe a
Prelude.Just (DescribeOrganizationConfigRuleStatuses
 -> Maybe DescribeOrganizationConfigRuleStatuses)
-> DescribeOrganizationConfigRuleStatuses
-> Maybe DescribeOrganizationConfigRuleStatuses
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeOrganizationConfigRuleStatuses
rq
          DescribeOrganizationConfigRuleStatuses
-> (DescribeOrganizationConfigRuleStatuses
    -> DescribeOrganizationConfigRuleStatuses)
-> DescribeOrganizationConfigRuleStatuses
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeOrganizationConfigRuleStatuses
-> Identity DescribeOrganizationConfigRuleStatuses
Lens
  DescribeOrganizationConfigRuleStatuses
  DescribeOrganizationConfigRuleStatuses
  (Maybe Text)
  (Maybe Text)
describeOrganizationConfigRuleStatuses_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeOrganizationConfigRuleStatuses
 -> Identity DescribeOrganizationConfigRuleStatuses)
-> Maybe Text
-> DescribeOrganizationConfigRuleStatuses
-> DescribeOrganizationConfigRuleStatuses
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeOrganizationConfigRuleStatuses
DescribeOrganizationConfigRuleStatusesResponse
rs
            DescribeOrganizationConfigRuleStatusesResponse
-> Getting
     (First Text) DescribeOrganizationConfigRuleStatusesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeOrganizationConfigRuleStatusesResponse
-> Const
     (First Text) DescribeOrganizationConfigRuleStatusesResponse
Lens' DescribeOrganizationConfigRuleStatusesResponse (Maybe Text)
describeOrganizationConfigRuleStatusesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeOrganizationConfigRuleStatusesResponse
 -> Const
      (First Text) DescribeOrganizationConfigRuleStatusesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeOrganizationConfigRuleStatusesResponse 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
    DescribeOrganizationConfigRuleStatuses
  where
  type
    AWSResponse
      DescribeOrganizationConfigRuleStatuses =
      DescribeOrganizationConfigRuleStatusesResponse
  request :: DescribeOrganizationConfigRuleStatuses
-> Request DescribeOrganizationConfigRuleStatuses
request = Service
-> DescribeOrganizationConfigRuleStatuses
-> Request DescribeOrganizationConfigRuleStatuses
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeOrganizationConfigRuleStatuses
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeOrganizationConfigRuleStatuses)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse DescribeOrganizationConfigRuleStatuses))
-> Logger
-> Service
-> Proxy DescribeOrganizationConfigRuleStatuses
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeOrganizationConfigRuleStatuses)))
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 Text
-> Maybe [OrganizationConfigRuleStatus]
-> Int
-> DescribeOrganizationConfigRuleStatusesResponse
DescribeOrganizationConfigRuleStatusesResponse'
            (Maybe Text
 -> Maybe [OrganizationConfigRuleStatus]
 -> Int
 -> DescribeOrganizationConfigRuleStatusesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [OrganizationConfigRuleStatus]
      -> Int -> DescribeOrganizationConfigRuleStatusesResponse)
forall (f :: * -> *) a b. Functor 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
  (Maybe [OrganizationConfigRuleStatus]
   -> Int -> DescribeOrganizationConfigRuleStatusesResponse)
-> Either String (Maybe [OrganizationConfigRuleStatus])
-> Either
     String (Int -> DescribeOrganizationConfigRuleStatusesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [OrganizationConfigRuleStatus]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"OrganizationConfigRuleStatuses"
                              Either String (Maybe (Maybe [OrganizationConfigRuleStatus]))
-> Maybe [OrganizationConfigRuleStatus]
-> Either String (Maybe [OrganizationConfigRuleStatus])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [OrganizationConfigRuleStatus]
forall a. Monoid a => a
Prelude.mempty
                          )
              Either
  String (Int -> DescribeOrganizationConfigRuleStatusesResponse)
-> Either String Int
-> Either String DescribeOrganizationConfigRuleStatusesResponse
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
    DescribeOrganizationConfigRuleStatuses

instance
  Prelude.NFData
    DescribeOrganizationConfigRuleStatuses

instance
  Core.ToHeaders
    DescribeOrganizationConfigRuleStatuses
  where
  toHeaders :: DescribeOrganizationConfigRuleStatuses -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeOrganizationConfigRuleStatuses -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StarlingDoveService.DescribeOrganizationConfigRuleStatuses" ::
                          Prelude.ByteString
                      ),
            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.ToJSON
    DescribeOrganizationConfigRuleStatuses
  where
  toJSON :: DescribeOrganizationConfigRuleStatuses -> Value
toJSON DescribeOrganizationConfigRuleStatuses' {Maybe Natural
Maybe [Text]
Maybe Text
limit :: Maybe Natural
nextToken :: Maybe Text
organizationConfigRuleNames :: Maybe [Text]
$sel:limit:DescribeOrganizationConfigRuleStatuses' :: DescribeOrganizationConfigRuleStatuses -> Maybe Natural
$sel:nextToken:DescribeOrganizationConfigRuleStatuses' :: DescribeOrganizationConfigRuleStatuses -> Maybe Text
$sel:organizationConfigRuleNames:DescribeOrganizationConfigRuleStatuses' :: DescribeOrganizationConfigRuleStatuses -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OrganizationConfigRuleNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
organizationConfigRuleNames,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit
          ]
      )

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

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

-- | /See:/ 'newDescribeOrganizationConfigRuleStatusesResponse' smart constructor.
data DescribeOrganizationConfigRuleStatusesResponse = DescribeOrganizationConfigRuleStatusesResponse'
  { -- | The @nextToken@ string returned on a previous page that you use to get
    -- the next page of results in a paginated response.
    DescribeOrganizationConfigRuleStatusesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of @OrganizationConfigRuleStatus@ objects.
    DescribeOrganizationConfigRuleStatusesResponse
-> Maybe [OrganizationConfigRuleStatus]
organizationConfigRuleStatuses :: Prelude.Maybe [OrganizationConfigRuleStatus],
    -- | The response's http status code.
    DescribeOrganizationConfigRuleStatusesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeOrganizationConfigRuleStatusesResponse
-> DescribeOrganizationConfigRuleStatusesResponse -> Bool
(DescribeOrganizationConfigRuleStatusesResponse
 -> DescribeOrganizationConfigRuleStatusesResponse -> Bool)
-> (DescribeOrganizationConfigRuleStatusesResponse
    -> DescribeOrganizationConfigRuleStatusesResponse -> Bool)
-> Eq DescribeOrganizationConfigRuleStatusesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeOrganizationConfigRuleStatusesResponse
-> DescribeOrganizationConfigRuleStatusesResponse -> Bool
$c/= :: DescribeOrganizationConfigRuleStatusesResponse
-> DescribeOrganizationConfigRuleStatusesResponse -> Bool
== :: DescribeOrganizationConfigRuleStatusesResponse
-> DescribeOrganizationConfigRuleStatusesResponse -> Bool
$c== :: DescribeOrganizationConfigRuleStatusesResponse
-> DescribeOrganizationConfigRuleStatusesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeOrganizationConfigRuleStatusesResponse]
ReadPrec DescribeOrganizationConfigRuleStatusesResponse
Int -> ReadS DescribeOrganizationConfigRuleStatusesResponse
ReadS [DescribeOrganizationConfigRuleStatusesResponse]
(Int -> ReadS DescribeOrganizationConfigRuleStatusesResponse)
-> ReadS [DescribeOrganizationConfigRuleStatusesResponse]
-> ReadPrec DescribeOrganizationConfigRuleStatusesResponse
-> ReadPrec [DescribeOrganizationConfigRuleStatusesResponse]
-> Read DescribeOrganizationConfigRuleStatusesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeOrganizationConfigRuleStatusesResponse]
$creadListPrec :: ReadPrec [DescribeOrganizationConfigRuleStatusesResponse]
readPrec :: ReadPrec DescribeOrganizationConfigRuleStatusesResponse
$creadPrec :: ReadPrec DescribeOrganizationConfigRuleStatusesResponse
readList :: ReadS [DescribeOrganizationConfigRuleStatusesResponse]
$creadList :: ReadS [DescribeOrganizationConfigRuleStatusesResponse]
readsPrec :: Int -> ReadS DescribeOrganizationConfigRuleStatusesResponse
$creadsPrec :: Int -> ReadS DescribeOrganizationConfigRuleStatusesResponse
Prelude.Read, Int -> DescribeOrganizationConfigRuleStatusesResponse -> ShowS
[DescribeOrganizationConfigRuleStatusesResponse] -> ShowS
DescribeOrganizationConfigRuleStatusesResponse -> String
(Int -> DescribeOrganizationConfigRuleStatusesResponse -> ShowS)
-> (DescribeOrganizationConfigRuleStatusesResponse -> String)
-> ([DescribeOrganizationConfigRuleStatusesResponse] -> ShowS)
-> Show DescribeOrganizationConfigRuleStatusesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeOrganizationConfigRuleStatusesResponse] -> ShowS
$cshowList :: [DescribeOrganizationConfigRuleStatusesResponse] -> ShowS
show :: DescribeOrganizationConfigRuleStatusesResponse -> String
$cshow :: DescribeOrganizationConfigRuleStatusesResponse -> String
showsPrec :: Int -> DescribeOrganizationConfigRuleStatusesResponse -> ShowS
$cshowsPrec :: Int -> DescribeOrganizationConfigRuleStatusesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeOrganizationConfigRuleStatusesResponse
 -> Rep DescribeOrganizationConfigRuleStatusesResponse x)
-> (forall x.
    Rep DescribeOrganizationConfigRuleStatusesResponse x
    -> DescribeOrganizationConfigRuleStatusesResponse)
-> Generic DescribeOrganizationConfigRuleStatusesResponse
forall x.
Rep DescribeOrganizationConfigRuleStatusesResponse x
-> DescribeOrganizationConfigRuleStatusesResponse
forall x.
DescribeOrganizationConfigRuleStatusesResponse
-> Rep DescribeOrganizationConfigRuleStatusesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeOrganizationConfigRuleStatusesResponse x
-> DescribeOrganizationConfigRuleStatusesResponse
$cfrom :: forall x.
DescribeOrganizationConfigRuleStatusesResponse
-> Rep DescribeOrganizationConfigRuleStatusesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeOrganizationConfigRuleStatusesResponse' 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', 'describeOrganizationConfigRuleStatusesResponse_nextToken' - The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
--
-- 'organizationConfigRuleStatuses', 'describeOrganizationConfigRuleStatusesResponse_organizationConfigRuleStatuses' - A list of @OrganizationConfigRuleStatus@ objects.
--
-- 'httpStatus', 'describeOrganizationConfigRuleStatusesResponse_httpStatus' - The response's http status code.
newDescribeOrganizationConfigRuleStatusesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeOrganizationConfigRuleStatusesResponse
newDescribeOrganizationConfigRuleStatusesResponse :: Int -> DescribeOrganizationConfigRuleStatusesResponse
newDescribeOrganizationConfigRuleStatusesResponse
  Int
pHttpStatus_ =
    DescribeOrganizationConfigRuleStatusesResponse' :: Maybe Text
-> Maybe [OrganizationConfigRuleStatus]
-> Int
-> DescribeOrganizationConfigRuleStatusesResponse
DescribeOrganizationConfigRuleStatusesResponse'
      { $sel:nextToken:DescribeOrganizationConfigRuleStatusesResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationConfigRuleStatuses:DescribeOrganizationConfigRuleStatusesResponse' :: Maybe [OrganizationConfigRuleStatus]
organizationConfigRuleStatuses =
          Maybe [OrganizationConfigRuleStatus]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeOrganizationConfigRuleStatusesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The @nextToken@ string returned on a previous page that you use to get
-- the next page of results in a paginated response.
describeOrganizationConfigRuleStatusesResponse_nextToken :: Lens.Lens' DescribeOrganizationConfigRuleStatusesResponse (Prelude.Maybe Prelude.Text)
describeOrganizationConfigRuleStatusesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeOrganizationConfigRuleStatusesResponse
-> f DescribeOrganizationConfigRuleStatusesResponse
describeOrganizationConfigRuleStatusesResponse_nextToken = (DescribeOrganizationConfigRuleStatusesResponse -> Maybe Text)
-> (DescribeOrganizationConfigRuleStatusesResponse
    -> Maybe Text -> DescribeOrganizationConfigRuleStatusesResponse)
-> Lens'
     DescribeOrganizationConfigRuleStatusesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationConfigRuleStatusesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeOrganizationConfigRuleStatusesResponse' :: DescribeOrganizationConfigRuleStatusesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeOrganizationConfigRuleStatusesResponse
s@DescribeOrganizationConfigRuleStatusesResponse' {} Maybe Text
a -> DescribeOrganizationConfigRuleStatusesResponse
s {$sel:nextToken:DescribeOrganizationConfigRuleStatusesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeOrganizationConfigRuleStatusesResponse)

-- | A list of @OrganizationConfigRuleStatus@ objects.
describeOrganizationConfigRuleStatusesResponse_organizationConfigRuleStatuses :: Lens.Lens' DescribeOrganizationConfigRuleStatusesResponse (Prelude.Maybe [OrganizationConfigRuleStatus])
describeOrganizationConfigRuleStatusesResponse_organizationConfigRuleStatuses :: (Maybe [OrganizationConfigRuleStatus]
 -> f (Maybe [OrganizationConfigRuleStatus]))
-> DescribeOrganizationConfigRuleStatusesResponse
-> f DescribeOrganizationConfigRuleStatusesResponse
describeOrganizationConfigRuleStatusesResponse_organizationConfigRuleStatuses = (DescribeOrganizationConfigRuleStatusesResponse
 -> Maybe [OrganizationConfigRuleStatus])
-> (DescribeOrganizationConfigRuleStatusesResponse
    -> Maybe [OrganizationConfigRuleStatus]
    -> DescribeOrganizationConfigRuleStatusesResponse)
-> Lens'
     DescribeOrganizationConfigRuleStatusesResponse
     (Maybe [OrganizationConfigRuleStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationConfigRuleStatusesResponse' {Maybe [OrganizationConfigRuleStatus]
organizationConfigRuleStatuses :: Maybe [OrganizationConfigRuleStatus]
$sel:organizationConfigRuleStatuses:DescribeOrganizationConfigRuleStatusesResponse' :: DescribeOrganizationConfigRuleStatusesResponse
-> Maybe [OrganizationConfigRuleStatus]
organizationConfigRuleStatuses} -> Maybe [OrganizationConfigRuleStatus]
organizationConfigRuleStatuses) (\s :: DescribeOrganizationConfigRuleStatusesResponse
s@DescribeOrganizationConfigRuleStatusesResponse' {} Maybe [OrganizationConfigRuleStatus]
a -> DescribeOrganizationConfigRuleStatusesResponse
s {$sel:organizationConfigRuleStatuses:DescribeOrganizationConfigRuleStatusesResponse' :: Maybe [OrganizationConfigRuleStatus]
organizationConfigRuleStatuses = Maybe [OrganizationConfigRuleStatus]
a} :: DescribeOrganizationConfigRuleStatusesResponse) ((Maybe [OrganizationConfigRuleStatus]
  -> f (Maybe [OrganizationConfigRuleStatus]))
 -> DescribeOrganizationConfigRuleStatusesResponse
 -> f DescribeOrganizationConfigRuleStatusesResponse)
-> ((Maybe [OrganizationConfigRuleStatus]
     -> f (Maybe [OrganizationConfigRuleStatus]))
    -> Maybe [OrganizationConfigRuleStatus]
    -> f (Maybe [OrganizationConfigRuleStatus]))
-> (Maybe [OrganizationConfigRuleStatus]
    -> f (Maybe [OrganizationConfigRuleStatus]))
-> DescribeOrganizationConfigRuleStatusesResponse
-> f DescribeOrganizationConfigRuleStatusesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OrganizationConfigRuleStatus]
  [OrganizationConfigRuleStatus]
  [OrganizationConfigRuleStatus]
  [OrganizationConfigRuleStatus]
-> Iso
     (Maybe [OrganizationConfigRuleStatus])
     (Maybe [OrganizationConfigRuleStatus])
     (Maybe [OrganizationConfigRuleStatus])
     (Maybe [OrganizationConfigRuleStatus])
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
  [OrganizationConfigRuleStatus]
  [OrganizationConfigRuleStatus]
  [OrganizationConfigRuleStatus]
  [OrganizationConfigRuleStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeOrganizationConfigRuleStatusesResponse