{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.EventAccountFilter
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AWSHealth.Types.EventAccountFilter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The values used to filter results from the
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeEventDetailsForOrganization.html DescribeEventDetailsForOrganization>
-- and
-- <https://docs.aws.amazon.com/health/latest/APIReference/API_DescribeAffectedEntitiesForOrganization.html DescribeAffectedEntitiesForOrganization>
-- operations.
--
-- /See:/ 'newEventAccountFilter' smart constructor.
data EventAccountFilter = EventAccountFilter'
  { -- | The 12-digit Amazon Web Services account numbers that contains the
    -- affected entities.
    EventAccountFilter -> Maybe Text
awsAccountId :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the event. The event ARN has the
    -- @arn:aws:health:@/@event-region@/@::event\/@/@SERVICE@/@\/@/@EVENT_TYPE_CODE@/@\/@/@EVENT_TYPE_PLUS_ID@/@ @
    -- format.
    --
    -- For example, an event ARN might look like the following:
    --
    -- @arn:aws:health:us-east-1::event\/EC2\/EC2_INSTANCE_RETIREMENT_SCHEDULED\/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456@
    EventAccountFilter -> Text
eventArn :: Prelude.Text
  }
  deriving (EventAccountFilter -> EventAccountFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventAccountFilter -> EventAccountFilter -> Bool
$c/= :: EventAccountFilter -> EventAccountFilter -> Bool
== :: EventAccountFilter -> EventAccountFilter -> Bool
$c== :: EventAccountFilter -> EventAccountFilter -> Bool
Prelude.Eq, ReadPrec [EventAccountFilter]
ReadPrec EventAccountFilter
Int -> ReadS EventAccountFilter
ReadS [EventAccountFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventAccountFilter]
$creadListPrec :: ReadPrec [EventAccountFilter]
readPrec :: ReadPrec EventAccountFilter
$creadPrec :: ReadPrec EventAccountFilter
readList :: ReadS [EventAccountFilter]
$creadList :: ReadS [EventAccountFilter]
readsPrec :: Int -> ReadS EventAccountFilter
$creadsPrec :: Int -> ReadS EventAccountFilter
Prelude.Read, Int -> EventAccountFilter -> ShowS
[EventAccountFilter] -> ShowS
EventAccountFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventAccountFilter] -> ShowS
$cshowList :: [EventAccountFilter] -> ShowS
show :: EventAccountFilter -> String
$cshow :: EventAccountFilter -> String
showsPrec :: Int -> EventAccountFilter -> ShowS
$cshowsPrec :: Int -> EventAccountFilter -> ShowS
Prelude.Show, forall x. Rep EventAccountFilter x -> EventAccountFilter
forall x. EventAccountFilter -> Rep EventAccountFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventAccountFilter x -> EventAccountFilter
$cfrom :: forall x. EventAccountFilter -> Rep EventAccountFilter x
Prelude.Generic)

-- |
-- Create a value of 'EventAccountFilter' 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:
--
-- 'awsAccountId', 'eventAccountFilter_awsAccountId' - The 12-digit Amazon Web Services account numbers that contains the
-- affected entities.
--
-- 'eventArn', 'eventAccountFilter_eventArn' - The unique identifier for the event. The event ARN has the
-- @arn:aws:health:@/@event-region@/@::event\/@/@SERVICE@/@\/@/@EVENT_TYPE_CODE@/@\/@/@EVENT_TYPE_PLUS_ID@/@ @
-- format.
--
-- For example, an event ARN might look like the following:
--
-- @arn:aws:health:us-east-1::event\/EC2\/EC2_INSTANCE_RETIREMENT_SCHEDULED\/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456@
newEventAccountFilter ::
  -- | 'eventArn'
  Prelude.Text ->
  EventAccountFilter
newEventAccountFilter :: Text -> EventAccountFilter
newEventAccountFilter Text
pEventArn_ =
  EventAccountFilter'
    { $sel:awsAccountId:EventAccountFilter' :: Maybe Text
awsAccountId = forall a. Maybe a
Prelude.Nothing,
      $sel:eventArn:EventAccountFilter' :: Text
eventArn = Text
pEventArn_
    }

-- | The 12-digit Amazon Web Services account numbers that contains the
-- affected entities.
eventAccountFilter_awsAccountId :: Lens.Lens' EventAccountFilter (Prelude.Maybe Prelude.Text)
eventAccountFilter_awsAccountId :: Lens' EventAccountFilter (Maybe Text)
eventAccountFilter_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventAccountFilter' {Maybe Text
awsAccountId :: Maybe Text
$sel:awsAccountId:EventAccountFilter' :: EventAccountFilter -> Maybe Text
awsAccountId} -> Maybe Text
awsAccountId) (\s :: EventAccountFilter
s@EventAccountFilter' {} Maybe Text
a -> EventAccountFilter
s {$sel:awsAccountId:EventAccountFilter' :: Maybe Text
awsAccountId = Maybe Text
a} :: EventAccountFilter)

-- | The unique identifier for the event. The event ARN has the
-- @arn:aws:health:@/@event-region@/@::event\/@/@SERVICE@/@\/@/@EVENT_TYPE_CODE@/@\/@/@EVENT_TYPE_PLUS_ID@/@ @
-- format.
--
-- For example, an event ARN might look like the following:
--
-- @arn:aws:health:us-east-1::event\/EC2\/EC2_INSTANCE_RETIREMENT_SCHEDULED\/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456@
eventAccountFilter_eventArn :: Lens.Lens' EventAccountFilter Prelude.Text
eventAccountFilter_eventArn :: Lens' EventAccountFilter Text
eventAccountFilter_eventArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventAccountFilter' {Text
eventArn :: Text
$sel:eventArn:EventAccountFilter' :: EventAccountFilter -> Text
eventArn} -> Text
eventArn) (\s :: EventAccountFilter
s@EventAccountFilter' {} Text
a -> EventAccountFilter
s {$sel:eventArn:EventAccountFilter' :: Text
eventArn = Text
a} :: EventAccountFilter)

instance Prelude.Hashable EventAccountFilter where
  hashWithSalt :: Int -> EventAccountFilter -> Int
hashWithSalt Int
_salt EventAccountFilter' {Maybe Text
Text
eventArn :: Text
awsAccountId :: Maybe Text
$sel:eventArn:EventAccountFilter' :: EventAccountFilter -> Text
$sel:awsAccountId:EventAccountFilter' :: EventAccountFilter -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eventArn

instance Prelude.NFData EventAccountFilter where
  rnf :: EventAccountFilter -> ()
rnf EventAccountFilter' {Maybe Text
Text
eventArn :: Text
awsAccountId :: Maybe Text
$sel:eventArn:EventAccountFilter' :: EventAccountFilter -> Text
$sel:awsAccountId:EventAccountFilter' :: EventAccountFilter -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eventArn

instance Data.ToJSON EventAccountFilter where
  toJSON :: EventAccountFilter -> Value
toJSON EventAccountFilter' {Maybe Text
Text
eventArn :: Text
awsAccountId :: Maybe Text
$sel:eventArn:EventAccountFilter' :: EventAccountFilter -> Text
$sel:awsAccountId:EventAccountFilter' :: EventAccountFilter -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"awsAccountId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
awsAccountId,
            forall a. a -> Maybe a
Prelude.Just (Key
"eventArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
eventArn)
          ]
      )