{-# 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-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)
module Amazonka.AWSHealth.Types.EventAccountFilter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 AWS 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
(EventAccountFilter -> EventAccountFilter -> Bool)
-> (EventAccountFilter -> EventAccountFilter -> Bool)
-> Eq EventAccountFilter
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]
(Int -> ReadS EventAccountFilter)
-> ReadS [EventAccountFilter]
-> ReadPrec EventAccountFilter
-> ReadPrec [EventAccountFilter]
-> Read 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
(Int -> EventAccountFilter -> ShowS)
-> (EventAccountFilter -> String)
-> ([EventAccountFilter] -> ShowS)
-> Show EventAccountFilter
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. EventAccountFilter -> Rep EventAccountFilter x)
-> (forall x. Rep EventAccountFilter x -> EventAccountFilter)
-> Generic EventAccountFilter
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 AWS 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' :: Maybe Text -> Text -> EventAccountFilter
EventAccountFilter'
    { $sel:awsAccountId:EventAccountFilter' :: Maybe Text
awsAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventArn:EventAccountFilter' :: Text
eventArn = Text
pEventArn_
    }

-- | The 12-digit AWS account numbers that contains the affected entities.
eventAccountFilter_awsAccountId :: Lens.Lens' EventAccountFilter (Prelude.Maybe Prelude.Text)
eventAccountFilter_awsAccountId :: (Maybe Text -> f (Maybe Text))
-> EventAccountFilter -> f EventAccountFilter
eventAccountFilter_awsAccountId = (EventAccountFilter -> Maybe Text)
-> (EventAccountFilter -> Maybe Text -> EventAccountFilter)
-> Lens
     EventAccountFilter EventAccountFilter (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> EventAccountFilter -> f EventAccountFilter
eventAccountFilter_eventArn = (EventAccountFilter -> Text)
-> (EventAccountFilter -> Text -> EventAccountFilter)
-> Lens EventAccountFilter EventAccountFilter Text Text
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

instance Prelude.NFData EventAccountFilter

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"awsAccountId" 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
awsAccountId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"eventArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventArn)
          ]
      )