{-# 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.AWSHealth.DescribeAffectedEntities
-- 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 a list of entities that have been affected by the specified
-- events, based on the specified filter criteria. Entities can refer to
-- individual customer resources, groups of customer resources, or any
-- other construct, depending on the AWS service. Events that have impact
-- beyond that of the affected entities, or where the extent of impact is
-- unknown, include at least one entity indicating this.
--
-- At least one event ARN is required. Results are sorted by the
-- @lastUpdatedTime@ of the entity, starting with the most recent.
--
-- -   This API operation uses pagination. Specify the @nextToken@
--     parameter in the next request to return more results.
--
-- -   This operation supports resource-level permissions. You can use this
--     operation to allow or deny access to specific AWS Health events. For
--     more information, see
--     <https://docs.aws.amazon.com/health/latest/ug/security_iam_id-based-policy-examples.html#resource-action-based-conditions Resource- and action-based conditions>
--     in the /AWS Health User Guide/.
--
-- This operation returns paginated results.
module Amazonka.AWSHealth.DescribeAffectedEntities
  ( -- * Creating a Request
    DescribeAffectedEntities (..),
    newDescribeAffectedEntities,

    -- * Request Lenses
    describeAffectedEntities_locale,
    describeAffectedEntities_nextToken,
    describeAffectedEntities_maxResults,
    describeAffectedEntities_filter,

    -- * Destructuring the Response
    DescribeAffectedEntitiesResponse (..),
    newDescribeAffectedEntitiesResponse,

    -- * Response Lenses
    describeAffectedEntitiesResponse_entities,
    describeAffectedEntitiesResponse_nextToken,
    describeAffectedEntitiesResponse_httpStatus,
  )
where

import Amazonka.AWSHealth.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:/ 'newDescribeAffectedEntities' smart constructor.
data DescribeAffectedEntities = DescribeAffectedEntities'
  { -- | The locale (language) to return information in. English (en) is the
    -- default and the only supported value at this time.
    DescribeAffectedEntities -> Maybe Text
locale :: Prelude.Maybe Prelude.Text,
    -- | If the results of a search are large, only a portion of the results are
    -- returned, and a @nextToken@ pagination token is returned in the
    -- response. To retrieve the next batch of results, reissue the search
    -- request and include the returned token. When all results have been
    -- returned, the response does not contain a pagination token value.
    DescribeAffectedEntities -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return in one batch, between 10 and 100,
    -- inclusive.
    DescribeAffectedEntities -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Values to narrow the results returned. At least one event ARN is
    -- required.
    DescribeAffectedEntities -> EntityFilter
filter' :: EntityFilter
  }
  deriving (DescribeAffectedEntities -> DescribeAffectedEntities -> Bool
(DescribeAffectedEntities -> DescribeAffectedEntities -> Bool)
-> (DescribeAffectedEntities -> DescribeAffectedEntities -> Bool)
-> Eq DescribeAffectedEntities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAffectedEntities -> DescribeAffectedEntities -> Bool
$c/= :: DescribeAffectedEntities -> DescribeAffectedEntities -> Bool
== :: DescribeAffectedEntities -> DescribeAffectedEntities -> Bool
$c== :: DescribeAffectedEntities -> DescribeAffectedEntities -> Bool
Prelude.Eq, ReadPrec [DescribeAffectedEntities]
ReadPrec DescribeAffectedEntities
Int -> ReadS DescribeAffectedEntities
ReadS [DescribeAffectedEntities]
(Int -> ReadS DescribeAffectedEntities)
-> ReadS [DescribeAffectedEntities]
-> ReadPrec DescribeAffectedEntities
-> ReadPrec [DescribeAffectedEntities]
-> Read DescribeAffectedEntities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAffectedEntities]
$creadListPrec :: ReadPrec [DescribeAffectedEntities]
readPrec :: ReadPrec DescribeAffectedEntities
$creadPrec :: ReadPrec DescribeAffectedEntities
readList :: ReadS [DescribeAffectedEntities]
$creadList :: ReadS [DescribeAffectedEntities]
readsPrec :: Int -> ReadS DescribeAffectedEntities
$creadsPrec :: Int -> ReadS DescribeAffectedEntities
Prelude.Read, Int -> DescribeAffectedEntities -> ShowS
[DescribeAffectedEntities] -> ShowS
DescribeAffectedEntities -> String
(Int -> DescribeAffectedEntities -> ShowS)
-> (DescribeAffectedEntities -> String)
-> ([DescribeAffectedEntities] -> ShowS)
-> Show DescribeAffectedEntities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAffectedEntities] -> ShowS
$cshowList :: [DescribeAffectedEntities] -> ShowS
show :: DescribeAffectedEntities -> String
$cshow :: DescribeAffectedEntities -> String
showsPrec :: Int -> DescribeAffectedEntities -> ShowS
$cshowsPrec :: Int -> DescribeAffectedEntities -> ShowS
Prelude.Show, (forall x.
 DescribeAffectedEntities -> Rep DescribeAffectedEntities x)
-> (forall x.
    Rep DescribeAffectedEntities x -> DescribeAffectedEntities)
-> Generic DescribeAffectedEntities
forall x.
Rep DescribeAffectedEntities x -> DescribeAffectedEntities
forall x.
DescribeAffectedEntities -> Rep DescribeAffectedEntities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAffectedEntities x -> DescribeAffectedEntities
$cfrom :: forall x.
DescribeAffectedEntities -> Rep DescribeAffectedEntities x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAffectedEntities' 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:
--
-- 'locale', 'describeAffectedEntities_locale' - The locale (language) to return information in. English (en) is the
-- default and the only supported value at this time.
--
-- 'nextToken', 'describeAffectedEntities_nextToken' - If the results of a search are large, only a portion of the results are
-- returned, and a @nextToken@ pagination token is returned in the
-- response. To retrieve the next batch of results, reissue the search
-- request and include the returned token. When all results have been
-- returned, the response does not contain a pagination token value.
--
-- 'maxResults', 'describeAffectedEntities_maxResults' - The maximum number of items to return in one batch, between 10 and 100,
-- inclusive.
--
-- 'filter'', 'describeAffectedEntities_filter' - Values to narrow the results returned. At least one event ARN is
-- required.
newDescribeAffectedEntities ::
  -- | 'filter''
  EntityFilter ->
  DescribeAffectedEntities
newDescribeAffectedEntities :: EntityFilter -> DescribeAffectedEntities
newDescribeAffectedEntities EntityFilter
pFilter_ =
  DescribeAffectedEntities' :: Maybe Text
-> Maybe Text
-> Maybe Natural
-> EntityFilter
-> DescribeAffectedEntities
DescribeAffectedEntities'
    { $sel:locale:DescribeAffectedEntities' :: Maybe Text
locale = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAffectedEntities' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeAffectedEntities' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':DescribeAffectedEntities' :: EntityFilter
filter' = EntityFilter
pFilter_
    }

-- | The locale (language) to return information in. English (en) is the
-- default and the only supported value at this time.
describeAffectedEntities_locale :: Lens.Lens' DescribeAffectedEntities (Prelude.Maybe Prelude.Text)
describeAffectedEntities_locale :: (Maybe Text -> f (Maybe Text))
-> DescribeAffectedEntities -> f DescribeAffectedEntities
describeAffectedEntities_locale = (DescribeAffectedEntities -> Maybe Text)
-> (DescribeAffectedEntities
    -> Maybe Text -> DescribeAffectedEntities)
-> Lens
     DescribeAffectedEntities
     DescribeAffectedEntities
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAffectedEntities' {Maybe Text
locale :: Maybe Text
$sel:locale:DescribeAffectedEntities' :: DescribeAffectedEntities -> Maybe Text
locale} -> Maybe Text
locale) (\s :: DescribeAffectedEntities
s@DescribeAffectedEntities' {} Maybe Text
a -> DescribeAffectedEntities
s {$sel:locale:DescribeAffectedEntities' :: Maybe Text
locale = Maybe Text
a} :: DescribeAffectedEntities)

-- | If the results of a search are large, only a portion of the results are
-- returned, and a @nextToken@ pagination token is returned in the
-- response. To retrieve the next batch of results, reissue the search
-- request and include the returned token. When all results have been
-- returned, the response does not contain a pagination token value.
describeAffectedEntities_nextToken :: Lens.Lens' DescribeAffectedEntities (Prelude.Maybe Prelude.Text)
describeAffectedEntities_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAffectedEntities -> f DescribeAffectedEntities
describeAffectedEntities_nextToken = (DescribeAffectedEntities -> Maybe Text)
-> (DescribeAffectedEntities
    -> Maybe Text -> DescribeAffectedEntities)
-> Lens
     DescribeAffectedEntities
     DescribeAffectedEntities
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAffectedEntities' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAffectedEntities' :: DescribeAffectedEntities -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAffectedEntities
s@DescribeAffectedEntities' {} Maybe Text
a -> DescribeAffectedEntities
s {$sel:nextToken:DescribeAffectedEntities' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAffectedEntities)

-- | The maximum number of items to return in one batch, between 10 and 100,
-- inclusive.
describeAffectedEntities_maxResults :: Lens.Lens' DescribeAffectedEntities (Prelude.Maybe Prelude.Natural)
describeAffectedEntities_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeAffectedEntities -> f DescribeAffectedEntities
describeAffectedEntities_maxResults = (DescribeAffectedEntities -> Maybe Natural)
-> (DescribeAffectedEntities
    -> Maybe Natural -> DescribeAffectedEntities)
-> Lens
     DescribeAffectedEntities
     DescribeAffectedEntities
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAffectedEntities' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeAffectedEntities' :: DescribeAffectedEntities -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeAffectedEntities
s@DescribeAffectedEntities' {} Maybe Natural
a -> DescribeAffectedEntities
s {$sel:maxResults:DescribeAffectedEntities' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeAffectedEntities)

-- | Values to narrow the results returned. At least one event ARN is
-- required.
describeAffectedEntities_filter :: Lens.Lens' DescribeAffectedEntities EntityFilter
describeAffectedEntities_filter :: (EntityFilter -> f EntityFilter)
-> DescribeAffectedEntities -> f DescribeAffectedEntities
describeAffectedEntities_filter = (DescribeAffectedEntities -> EntityFilter)
-> (DescribeAffectedEntities
    -> EntityFilter -> DescribeAffectedEntities)
-> Lens
     DescribeAffectedEntities
     DescribeAffectedEntities
     EntityFilter
     EntityFilter
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAffectedEntities' {EntityFilter
filter' :: EntityFilter
$sel:filter':DescribeAffectedEntities' :: DescribeAffectedEntities -> EntityFilter
filter'} -> EntityFilter
filter') (\s :: DescribeAffectedEntities
s@DescribeAffectedEntities' {} EntityFilter
a -> DescribeAffectedEntities
s {$sel:filter':DescribeAffectedEntities' :: EntityFilter
filter' = EntityFilter
a} :: DescribeAffectedEntities)

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

instance Prelude.NFData DescribeAffectedEntities

instance Core.ToHeaders DescribeAffectedEntities where
  toHeaders :: DescribeAffectedEntities -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeAffectedEntities -> 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
"AWSHealth_20160804.DescribeAffectedEntities" ::
                          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 DescribeAffectedEntities where
  toJSON :: DescribeAffectedEntities -> Value
toJSON DescribeAffectedEntities' {Maybe Natural
Maybe Text
EntityFilter
filter' :: EntityFilter
maxResults :: Maybe Natural
nextToken :: Maybe Text
locale :: Maybe Text
$sel:filter':DescribeAffectedEntities' :: DescribeAffectedEntities -> EntityFilter
$sel:maxResults:DescribeAffectedEntities' :: DescribeAffectedEntities -> Maybe Natural
$sel:nextToken:DescribeAffectedEntities' :: DescribeAffectedEntities -> Maybe Text
$sel:locale:DescribeAffectedEntities' :: DescribeAffectedEntities -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"locale" 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
locale,
            (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
"maxResults" 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
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"filter" Text -> EntityFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EntityFilter
filter')
          ]
      )

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

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

-- | /See:/ 'newDescribeAffectedEntitiesResponse' smart constructor.
data DescribeAffectedEntitiesResponse = DescribeAffectedEntitiesResponse'
  { -- | The entities that match the filter criteria.
    DescribeAffectedEntitiesResponse -> Maybe [AffectedEntity]
entities :: Prelude.Maybe [AffectedEntity],
    -- | If the results of a search are large, only a portion of the results are
    -- returned, and a @nextToken@ pagination token is returned in the
    -- response. To retrieve the next batch of results, reissue the search
    -- request and include the returned token. When all results have been
    -- returned, the response does not contain a pagination token value.
    DescribeAffectedEntitiesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeAffectedEntitiesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAffectedEntitiesResponse
-> DescribeAffectedEntitiesResponse -> Bool
(DescribeAffectedEntitiesResponse
 -> DescribeAffectedEntitiesResponse -> Bool)
-> (DescribeAffectedEntitiesResponse
    -> DescribeAffectedEntitiesResponse -> Bool)
-> Eq DescribeAffectedEntitiesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAffectedEntitiesResponse
-> DescribeAffectedEntitiesResponse -> Bool
$c/= :: DescribeAffectedEntitiesResponse
-> DescribeAffectedEntitiesResponse -> Bool
== :: DescribeAffectedEntitiesResponse
-> DescribeAffectedEntitiesResponse -> Bool
$c== :: DescribeAffectedEntitiesResponse
-> DescribeAffectedEntitiesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAffectedEntitiesResponse]
ReadPrec DescribeAffectedEntitiesResponse
Int -> ReadS DescribeAffectedEntitiesResponse
ReadS [DescribeAffectedEntitiesResponse]
(Int -> ReadS DescribeAffectedEntitiesResponse)
-> ReadS [DescribeAffectedEntitiesResponse]
-> ReadPrec DescribeAffectedEntitiesResponse
-> ReadPrec [DescribeAffectedEntitiesResponse]
-> Read DescribeAffectedEntitiesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAffectedEntitiesResponse]
$creadListPrec :: ReadPrec [DescribeAffectedEntitiesResponse]
readPrec :: ReadPrec DescribeAffectedEntitiesResponse
$creadPrec :: ReadPrec DescribeAffectedEntitiesResponse
readList :: ReadS [DescribeAffectedEntitiesResponse]
$creadList :: ReadS [DescribeAffectedEntitiesResponse]
readsPrec :: Int -> ReadS DescribeAffectedEntitiesResponse
$creadsPrec :: Int -> ReadS DescribeAffectedEntitiesResponse
Prelude.Read, Int -> DescribeAffectedEntitiesResponse -> ShowS
[DescribeAffectedEntitiesResponse] -> ShowS
DescribeAffectedEntitiesResponse -> String
(Int -> DescribeAffectedEntitiesResponse -> ShowS)
-> (DescribeAffectedEntitiesResponse -> String)
-> ([DescribeAffectedEntitiesResponse] -> ShowS)
-> Show DescribeAffectedEntitiesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAffectedEntitiesResponse] -> ShowS
$cshowList :: [DescribeAffectedEntitiesResponse] -> ShowS
show :: DescribeAffectedEntitiesResponse -> String
$cshow :: DescribeAffectedEntitiesResponse -> String
showsPrec :: Int -> DescribeAffectedEntitiesResponse -> ShowS
$cshowsPrec :: Int -> DescribeAffectedEntitiesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAffectedEntitiesResponse
 -> Rep DescribeAffectedEntitiesResponse x)
-> (forall x.
    Rep DescribeAffectedEntitiesResponse x
    -> DescribeAffectedEntitiesResponse)
-> Generic DescribeAffectedEntitiesResponse
forall x.
Rep DescribeAffectedEntitiesResponse x
-> DescribeAffectedEntitiesResponse
forall x.
DescribeAffectedEntitiesResponse
-> Rep DescribeAffectedEntitiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAffectedEntitiesResponse x
-> DescribeAffectedEntitiesResponse
$cfrom :: forall x.
DescribeAffectedEntitiesResponse
-> Rep DescribeAffectedEntitiesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAffectedEntitiesResponse' 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:
--
-- 'entities', 'describeAffectedEntitiesResponse_entities' - The entities that match the filter criteria.
--
-- 'nextToken', 'describeAffectedEntitiesResponse_nextToken' - If the results of a search are large, only a portion of the results are
-- returned, and a @nextToken@ pagination token is returned in the
-- response. To retrieve the next batch of results, reissue the search
-- request and include the returned token. When all results have been
-- returned, the response does not contain a pagination token value.
--
-- 'httpStatus', 'describeAffectedEntitiesResponse_httpStatus' - The response's http status code.
newDescribeAffectedEntitiesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAffectedEntitiesResponse
newDescribeAffectedEntitiesResponse :: Int -> DescribeAffectedEntitiesResponse
newDescribeAffectedEntitiesResponse Int
pHttpStatus_ =
  DescribeAffectedEntitiesResponse' :: Maybe [AffectedEntity]
-> Maybe Text -> Int -> DescribeAffectedEntitiesResponse
DescribeAffectedEntitiesResponse'
    { $sel:entities:DescribeAffectedEntitiesResponse' :: Maybe [AffectedEntity]
entities =
        Maybe [AffectedEntity]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeAffectedEntitiesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAffectedEntitiesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The entities that match the filter criteria.
describeAffectedEntitiesResponse_entities :: Lens.Lens' DescribeAffectedEntitiesResponse (Prelude.Maybe [AffectedEntity])
describeAffectedEntitiesResponse_entities :: (Maybe [AffectedEntity] -> f (Maybe [AffectedEntity]))
-> DescribeAffectedEntitiesResponse
-> f DescribeAffectedEntitiesResponse
describeAffectedEntitiesResponse_entities = (DescribeAffectedEntitiesResponse -> Maybe [AffectedEntity])
-> (DescribeAffectedEntitiesResponse
    -> Maybe [AffectedEntity] -> DescribeAffectedEntitiesResponse)
-> Lens' DescribeAffectedEntitiesResponse (Maybe [AffectedEntity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAffectedEntitiesResponse' {Maybe [AffectedEntity]
entities :: Maybe [AffectedEntity]
$sel:entities:DescribeAffectedEntitiesResponse' :: DescribeAffectedEntitiesResponse -> Maybe [AffectedEntity]
entities} -> Maybe [AffectedEntity]
entities) (\s :: DescribeAffectedEntitiesResponse
s@DescribeAffectedEntitiesResponse' {} Maybe [AffectedEntity]
a -> DescribeAffectedEntitiesResponse
s {$sel:entities:DescribeAffectedEntitiesResponse' :: Maybe [AffectedEntity]
entities = Maybe [AffectedEntity]
a} :: DescribeAffectedEntitiesResponse) ((Maybe [AffectedEntity] -> f (Maybe [AffectedEntity]))
 -> DescribeAffectedEntitiesResponse
 -> f DescribeAffectedEntitiesResponse)
-> ((Maybe [AffectedEntity] -> f (Maybe [AffectedEntity]))
    -> Maybe [AffectedEntity] -> f (Maybe [AffectedEntity]))
-> (Maybe [AffectedEntity] -> f (Maybe [AffectedEntity]))
-> DescribeAffectedEntitiesResponse
-> f DescribeAffectedEntitiesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AffectedEntity] [AffectedEntity] [AffectedEntity] [AffectedEntity]
-> Iso
     (Maybe [AffectedEntity])
     (Maybe [AffectedEntity])
     (Maybe [AffectedEntity])
     (Maybe [AffectedEntity])
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
  [AffectedEntity] [AffectedEntity] [AffectedEntity] [AffectedEntity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the results of a search are large, only a portion of the results are
-- returned, and a @nextToken@ pagination token is returned in the
-- response. To retrieve the next batch of results, reissue the search
-- request and include the returned token. When all results have been
-- returned, the response does not contain a pagination token value.
describeAffectedEntitiesResponse_nextToken :: Lens.Lens' DescribeAffectedEntitiesResponse (Prelude.Maybe Prelude.Text)
describeAffectedEntitiesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeAffectedEntitiesResponse
-> f DescribeAffectedEntitiesResponse
describeAffectedEntitiesResponse_nextToken = (DescribeAffectedEntitiesResponse -> Maybe Text)
-> (DescribeAffectedEntitiesResponse
    -> Maybe Text -> DescribeAffectedEntitiesResponse)
-> Lens' DescribeAffectedEntitiesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAffectedEntitiesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeAffectedEntitiesResponse' :: DescribeAffectedEntitiesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeAffectedEntitiesResponse
s@DescribeAffectedEntitiesResponse' {} Maybe Text
a -> DescribeAffectedEntitiesResponse
s {$sel:nextToken:DescribeAffectedEntitiesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeAffectedEntitiesResponse)

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

instance
  Prelude.NFData
    DescribeAffectedEntitiesResponse