{-# 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.DescribeEventTypes
-- 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 the event types that meet the specified filter criteria. You can
-- use this API operation to find information about the AWS Health event,
-- such as the category, AWS service, and event code. The metadata for each
-- event appears in the
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_EventType.html EventType>
-- object.
--
-- If you don\'t specify a filter criteria, the API operation returns all
-- event types, in no particular order.
--
-- This API operation uses pagination. Specify the @nextToken@ parameter in
-- the next request to return more results.
--
-- This operation returns paginated results.
module Amazonka.AWSHealth.DescribeEventTypes
  ( -- * Creating a Request
    DescribeEventTypes (..),
    newDescribeEventTypes,

    -- * Request Lenses
    describeEventTypes_locale,
    describeEventTypes_nextToken,
    describeEventTypes_filter,
    describeEventTypes_maxResults,

    -- * Destructuring the Response
    DescribeEventTypesResponse (..),
    newDescribeEventTypesResponse,

    -- * Response Lenses
    describeEventTypesResponse_eventTypes,
    describeEventTypesResponse_nextToken,
    describeEventTypesResponse_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:/ 'newDescribeEventTypes' smart constructor.
data DescribeEventTypes = DescribeEventTypes'
  { -- | The locale (language) to return information in. English (en) is the
    -- default and the only supported value at this time.
    DescribeEventTypes -> 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.
    DescribeEventTypes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Values to narrow the results returned.
    DescribeEventTypes -> Maybe EventTypeFilter
filter' :: Prelude.Maybe EventTypeFilter,
    -- | The maximum number of items to return in one batch, between 10 and 100,
    -- inclusive.
    DescribeEventTypes -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeEventTypes -> DescribeEventTypes -> Bool
(DescribeEventTypes -> DescribeEventTypes -> Bool)
-> (DescribeEventTypes -> DescribeEventTypes -> Bool)
-> Eq DescribeEventTypes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventTypes -> DescribeEventTypes -> Bool
$c/= :: DescribeEventTypes -> DescribeEventTypes -> Bool
== :: DescribeEventTypes -> DescribeEventTypes -> Bool
$c== :: DescribeEventTypes -> DescribeEventTypes -> Bool
Prelude.Eq, ReadPrec [DescribeEventTypes]
ReadPrec DescribeEventTypes
Int -> ReadS DescribeEventTypes
ReadS [DescribeEventTypes]
(Int -> ReadS DescribeEventTypes)
-> ReadS [DescribeEventTypes]
-> ReadPrec DescribeEventTypes
-> ReadPrec [DescribeEventTypes]
-> Read DescribeEventTypes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventTypes]
$creadListPrec :: ReadPrec [DescribeEventTypes]
readPrec :: ReadPrec DescribeEventTypes
$creadPrec :: ReadPrec DescribeEventTypes
readList :: ReadS [DescribeEventTypes]
$creadList :: ReadS [DescribeEventTypes]
readsPrec :: Int -> ReadS DescribeEventTypes
$creadsPrec :: Int -> ReadS DescribeEventTypes
Prelude.Read, Int -> DescribeEventTypes -> ShowS
[DescribeEventTypes] -> ShowS
DescribeEventTypes -> String
(Int -> DescribeEventTypes -> ShowS)
-> (DescribeEventTypes -> String)
-> ([DescribeEventTypes] -> ShowS)
-> Show DescribeEventTypes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventTypes] -> ShowS
$cshowList :: [DescribeEventTypes] -> ShowS
show :: DescribeEventTypes -> String
$cshow :: DescribeEventTypes -> String
showsPrec :: Int -> DescribeEventTypes -> ShowS
$cshowsPrec :: Int -> DescribeEventTypes -> ShowS
Prelude.Show, (forall x. DescribeEventTypes -> Rep DescribeEventTypes x)
-> (forall x. Rep DescribeEventTypes x -> DescribeEventTypes)
-> Generic DescribeEventTypes
forall x. Rep DescribeEventTypes x -> DescribeEventTypes
forall x. DescribeEventTypes -> Rep DescribeEventTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEventTypes x -> DescribeEventTypes
$cfrom :: forall x. DescribeEventTypes -> Rep DescribeEventTypes x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEventTypes' 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', 'describeEventTypes_locale' - The locale (language) to return information in. English (en) is the
-- default and the only supported value at this time.
--
-- 'nextToken', 'describeEventTypes_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.
--
-- 'filter'', 'describeEventTypes_filter' - Values to narrow the results returned.
--
-- 'maxResults', 'describeEventTypes_maxResults' - The maximum number of items to return in one batch, between 10 and 100,
-- inclusive.
newDescribeEventTypes ::
  DescribeEventTypes
newDescribeEventTypes :: DescribeEventTypes
newDescribeEventTypes =
  DescribeEventTypes' :: Maybe Text
-> Maybe Text
-> Maybe EventTypeFilter
-> Maybe Natural
-> DescribeEventTypes
DescribeEventTypes'
    { $sel:locale:DescribeEventTypes' :: Maybe Text
locale = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeEventTypes' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':DescribeEventTypes' :: Maybe EventTypeFilter
filter' = Maybe EventTypeFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeEventTypes' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

-- | 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.
describeEventTypes_nextToken :: Lens.Lens' DescribeEventTypes (Prelude.Maybe Prelude.Text)
describeEventTypes_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEventTypes -> f DescribeEventTypes
describeEventTypes_nextToken = (DescribeEventTypes -> Maybe Text)
-> (DescribeEventTypes -> Maybe Text -> DescribeEventTypes)
-> Lens
     DescribeEventTypes DescribeEventTypes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTypes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEventTypes' :: DescribeEventTypes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEventTypes
s@DescribeEventTypes' {} Maybe Text
a -> DescribeEventTypes
s {$sel:nextToken:DescribeEventTypes' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEventTypes)

-- | Values to narrow the results returned.
describeEventTypes_filter :: Lens.Lens' DescribeEventTypes (Prelude.Maybe EventTypeFilter)
describeEventTypes_filter :: (Maybe EventTypeFilter -> f (Maybe EventTypeFilter))
-> DescribeEventTypes -> f DescribeEventTypes
describeEventTypes_filter = (DescribeEventTypes -> Maybe EventTypeFilter)
-> (DescribeEventTypes
    -> Maybe EventTypeFilter -> DescribeEventTypes)
-> Lens
     DescribeEventTypes
     DescribeEventTypes
     (Maybe EventTypeFilter)
     (Maybe EventTypeFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTypes' {Maybe EventTypeFilter
filter' :: Maybe EventTypeFilter
$sel:filter':DescribeEventTypes' :: DescribeEventTypes -> Maybe EventTypeFilter
filter'} -> Maybe EventTypeFilter
filter') (\s :: DescribeEventTypes
s@DescribeEventTypes' {} Maybe EventTypeFilter
a -> DescribeEventTypes
s {$sel:filter':DescribeEventTypes' :: Maybe EventTypeFilter
filter' = Maybe EventTypeFilter
a} :: DescribeEventTypes)

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

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

instance Prelude.NFData DescribeEventTypes

instance Core.ToHeaders DescribeEventTypes where
  toHeaders :: DescribeEventTypes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeEventTypes -> 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.DescribeEventTypes" ::
                          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 DescribeEventTypes where
  toJSON :: DescribeEventTypes -> Value
toJSON DescribeEventTypes' {Maybe Natural
Maybe Text
Maybe EventTypeFilter
maxResults :: Maybe Natural
filter' :: Maybe EventTypeFilter
nextToken :: Maybe Text
locale :: Maybe Text
$sel:maxResults:DescribeEventTypes' :: DescribeEventTypes -> Maybe Natural
$sel:filter':DescribeEventTypes' :: DescribeEventTypes -> Maybe EventTypeFilter
$sel:nextToken:DescribeEventTypes' :: DescribeEventTypes -> Maybe Text
$sel:locale:DescribeEventTypes' :: DescribeEventTypes -> 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
"filter" Text -> EventTypeFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EventTypeFilter -> Pair) -> Maybe EventTypeFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EventTypeFilter
filter',
            (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
          ]
      )

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

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

-- | /See:/ 'newDescribeEventTypesResponse' smart constructor.
data DescribeEventTypesResponse = DescribeEventTypesResponse'
  { -- | A list of event types that match the filter criteria. Event types have a
    -- category (@issue@, @accountNotification@, or @scheduledChange@), a
    -- service (for example, @EC2@, @RDS@, @DATAPIPELINE@, @BILLING@), and a
    -- code (in the format @AWS_SERVICE_DESCRIPTION @; for example,
    -- @AWS_EC2_SYSTEM_MAINTENANCE_EVENT@).
    DescribeEventTypesResponse -> Maybe [EventType]
eventTypes :: Prelude.Maybe [EventType],
    -- | 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.
    DescribeEventTypesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeEventTypesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEventTypesResponse -> DescribeEventTypesResponse -> Bool
(DescribeEventTypesResponse -> DescribeEventTypesResponse -> Bool)
-> (DescribeEventTypesResponse
    -> DescribeEventTypesResponse -> Bool)
-> Eq DescribeEventTypesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventTypesResponse -> DescribeEventTypesResponse -> Bool
$c/= :: DescribeEventTypesResponse -> DescribeEventTypesResponse -> Bool
== :: DescribeEventTypesResponse -> DescribeEventTypesResponse -> Bool
$c== :: DescribeEventTypesResponse -> DescribeEventTypesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEventTypesResponse]
ReadPrec DescribeEventTypesResponse
Int -> ReadS DescribeEventTypesResponse
ReadS [DescribeEventTypesResponse]
(Int -> ReadS DescribeEventTypesResponse)
-> ReadS [DescribeEventTypesResponse]
-> ReadPrec DescribeEventTypesResponse
-> ReadPrec [DescribeEventTypesResponse]
-> Read DescribeEventTypesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventTypesResponse]
$creadListPrec :: ReadPrec [DescribeEventTypesResponse]
readPrec :: ReadPrec DescribeEventTypesResponse
$creadPrec :: ReadPrec DescribeEventTypesResponse
readList :: ReadS [DescribeEventTypesResponse]
$creadList :: ReadS [DescribeEventTypesResponse]
readsPrec :: Int -> ReadS DescribeEventTypesResponse
$creadsPrec :: Int -> ReadS DescribeEventTypesResponse
Prelude.Read, Int -> DescribeEventTypesResponse -> ShowS
[DescribeEventTypesResponse] -> ShowS
DescribeEventTypesResponse -> String
(Int -> DescribeEventTypesResponse -> ShowS)
-> (DescribeEventTypesResponse -> String)
-> ([DescribeEventTypesResponse] -> ShowS)
-> Show DescribeEventTypesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventTypesResponse] -> ShowS
$cshowList :: [DescribeEventTypesResponse] -> ShowS
show :: DescribeEventTypesResponse -> String
$cshow :: DescribeEventTypesResponse -> String
showsPrec :: Int -> DescribeEventTypesResponse -> ShowS
$cshowsPrec :: Int -> DescribeEventTypesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEventTypesResponse -> Rep DescribeEventTypesResponse x)
-> (forall x.
    Rep DescribeEventTypesResponse x -> DescribeEventTypesResponse)
-> Generic DescribeEventTypesResponse
forall x.
Rep DescribeEventTypesResponse x -> DescribeEventTypesResponse
forall x.
DescribeEventTypesResponse -> Rep DescribeEventTypesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventTypesResponse x -> DescribeEventTypesResponse
$cfrom :: forall x.
DescribeEventTypesResponse -> Rep DescribeEventTypesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEventTypesResponse' 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:
--
-- 'eventTypes', 'describeEventTypesResponse_eventTypes' - A list of event types that match the filter criteria. Event types have a
-- category (@issue@, @accountNotification@, or @scheduledChange@), a
-- service (for example, @EC2@, @RDS@, @DATAPIPELINE@, @BILLING@), and a
-- code (in the format @AWS_SERVICE_DESCRIPTION @; for example,
-- @AWS_EC2_SYSTEM_MAINTENANCE_EVENT@).
--
-- 'nextToken', 'describeEventTypesResponse_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', 'describeEventTypesResponse_httpStatus' - The response's http status code.
newDescribeEventTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEventTypesResponse
newDescribeEventTypesResponse :: Int -> DescribeEventTypesResponse
newDescribeEventTypesResponse Int
pHttpStatus_ =
  DescribeEventTypesResponse' :: Maybe [EventType]
-> Maybe Text -> Int -> DescribeEventTypesResponse
DescribeEventTypesResponse'
    { $sel:eventTypes:DescribeEventTypesResponse' :: Maybe [EventType]
eventTypes =
        Maybe [EventType]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeEventTypesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEventTypesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of event types that match the filter criteria. Event types have a
-- category (@issue@, @accountNotification@, or @scheduledChange@), a
-- service (for example, @EC2@, @RDS@, @DATAPIPELINE@, @BILLING@), and a
-- code (in the format @AWS_SERVICE_DESCRIPTION @; for example,
-- @AWS_EC2_SYSTEM_MAINTENANCE_EVENT@).
describeEventTypesResponse_eventTypes :: Lens.Lens' DescribeEventTypesResponse (Prelude.Maybe [EventType])
describeEventTypesResponse_eventTypes :: (Maybe [EventType] -> f (Maybe [EventType]))
-> DescribeEventTypesResponse -> f DescribeEventTypesResponse
describeEventTypesResponse_eventTypes = (DescribeEventTypesResponse -> Maybe [EventType])
-> (DescribeEventTypesResponse
    -> Maybe [EventType] -> DescribeEventTypesResponse)
-> Lens' DescribeEventTypesResponse (Maybe [EventType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTypesResponse' {Maybe [EventType]
eventTypes :: Maybe [EventType]
$sel:eventTypes:DescribeEventTypesResponse' :: DescribeEventTypesResponse -> Maybe [EventType]
eventTypes} -> Maybe [EventType]
eventTypes) (\s :: DescribeEventTypesResponse
s@DescribeEventTypesResponse' {} Maybe [EventType]
a -> DescribeEventTypesResponse
s {$sel:eventTypes:DescribeEventTypesResponse' :: Maybe [EventType]
eventTypes = Maybe [EventType]
a} :: DescribeEventTypesResponse) ((Maybe [EventType] -> f (Maybe [EventType]))
 -> DescribeEventTypesResponse -> f DescribeEventTypesResponse)
-> ((Maybe [EventType] -> f (Maybe [EventType]))
    -> Maybe [EventType] -> f (Maybe [EventType]))
-> (Maybe [EventType] -> f (Maybe [EventType]))
-> DescribeEventTypesResponse
-> f DescribeEventTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [EventType] [EventType] [EventType] [EventType]
-> Iso
     (Maybe [EventType])
     (Maybe [EventType])
     (Maybe [EventType])
     (Maybe [EventType])
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 [EventType] [EventType] [EventType] [EventType]
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.
describeEventTypesResponse_nextToken :: Lens.Lens' DescribeEventTypesResponse (Prelude.Maybe Prelude.Text)
describeEventTypesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEventTypesResponse -> f DescribeEventTypesResponse
describeEventTypesResponse_nextToken = (DescribeEventTypesResponse -> Maybe Text)
-> (DescribeEventTypesResponse
    -> Maybe Text -> DescribeEventTypesResponse)
-> Lens' DescribeEventTypesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventTypesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEventTypesResponse' :: DescribeEventTypesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEventTypesResponse
s@DescribeEventTypesResponse' {} Maybe Text
a -> DescribeEventTypesResponse
s {$sel:nextToken:DescribeEventTypesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEventTypesResponse)

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

instance Prelude.NFData DescribeEventTypesResponse