{-# 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.BillingConductor.Types.ListAccountAssociationsFilter
-- 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.BillingConductor.Types.ListAccountAssociationsFilter 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 filter on the account ID of the linked account, or any of the
-- following:
--
-- @MONITORED@: linked accounts that are associated to billing groups.
--
-- @UNMONITORED@: linked accounts that are not associated to billing
-- groups.
--
-- @Billing Group Arn@: linked accounts that are associated to the provided
-- Billing Group Arn.
--
-- /See:/ 'newListAccountAssociationsFilter' smart constructor.
data ListAccountAssociationsFilter = ListAccountAssociationsFilter'
  { -- | The Amazon Web Services account ID to filter on.
    ListAccountAssociationsFilter -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | @MONITORED@: linked accounts that are associated to billing groups.
    --
    -- @UNMONITORED@: linked accounts that are not associated to billing
    -- groups.
    --
    -- @Billing Group Arn@: linked accounts that are associated to the provided
    -- Billing Group Arn.
    ListAccountAssociationsFilter -> Maybe Text
association :: Prelude.Maybe Prelude.Text
  }
  deriving (ListAccountAssociationsFilter
-> ListAccountAssociationsFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountAssociationsFilter
-> ListAccountAssociationsFilter -> Bool
$c/= :: ListAccountAssociationsFilter
-> ListAccountAssociationsFilter -> Bool
== :: ListAccountAssociationsFilter
-> ListAccountAssociationsFilter -> Bool
$c== :: ListAccountAssociationsFilter
-> ListAccountAssociationsFilter -> Bool
Prelude.Eq, ReadPrec [ListAccountAssociationsFilter]
ReadPrec ListAccountAssociationsFilter
Int -> ReadS ListAccountAssociationsFilter
ReadS [ListAccountAssociationsFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountAssociationsFilter]
$creadListPrec :: ReadPrec [ListAccountAssociationsFilter]
readPrec :: ReadPrec ListAccountAssociationsFilter
$creadPrec :: ReadPrec ListAccountAssociationsFilter
readList :: ReadS [ListAccountAssociationsFilter]
$creadList :: ReadS [ListAccountAssociationsFilter]
readsPrec :: Int -> ReadS ListAccountAssociationsFilter
$creadsPrec :: Int -> ReadS ListAccountAssociationsFilter
Prelude.Read, Int -> ListAccountAssociationsFilter -> ShowS
[ListAccountAssociationsFilter] -> ShowS
ListAccountAssociationsFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountAssociationsFilter] -> ShowS
$cshowList :: [ListAccountAssociationsFilter] -> ShowS
show :: ListAccountAssociationsFilter -> String
$cshow :: ListAccountAssociationsFilter -> String
showsPrec :: Int -> ListAccountAssociationsFilter -> ShowS
$cshowsPrec :: Int -> ListAccountAssociationsFilter -> ShowS
Prelude.Show, forall x.
Rep ListAccountAssociationsFilter x
-> ListAccountAssociationsFilter
forall x.
ListAccountAssociationsFilter
-> Rep ListAccountAssociationsFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountAssociationsFilter x
-> ListAccountAssociationsFilter
$cfrom :: forall x.
ListAccountAssociationsFilter
-> Rep ListAccountAssociationsFilter x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountAssociationsFilter' 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:
--
-- 'accountId', 'listAccountAssociationsFilter_accountId' - The Amazon Web Services account ID to filter on.
--
-- 'association', 'listAccountAssociationsFilter_association' - @MONITORED@: linked accounts that are associated to billing groups.
--
-- @UNMONITORED@: linked accounts that are not associated to billing
-- groups.
--
-- @Billing Group Arn@: linked accounts that are associated to the provided
-- Billing Group Arn.
newListAccountAssociationsFilter ::
  ListAccountAssociationsFilter
newListAccountAssociationsFilter :: ListAccountAssociationsFilter
newListAccountAssociationsFilter =
  ListAccountAssociationsFilter'
    { $sel:accountId:ListAccountAssociationsFilter' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:association:ListAccountAssociationsFilter' :: Maybe Text
association = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID to filter on.
listAccountAssociationsFilter_accountId :: Lens.Lens' ListAccountAssociationsFilter (Prelude.Maybe Prelude.Text)
listAccountAssociationsFilter_accountId :: Lens' ListAccountAssociationsFilter (Maybe Text)
listAccountAssociationsFilter_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociationsFilter' {Maybe Text
accountId :: Maybe Text
$sel:accountId:ListAccountAssociationsFilter' :: ListAccountAssociationsFilter -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: ListAccountAssociationsFilter
s@ListAccountAssociationsFilter' {} Maybe Text
a -> ListAccountAssociationsFilter
s {$sel:accountId:ListAccountAssociationsFilter' :: Maybe Text
accountId = Maybe Text
a} :: ListAccountAssociationsFilter)

-- | @MONITORED@: linked accounts that are associated to billing groups.
--
-- @UNMONITORED@: linked accounts that are not associated to billing
-- groups.
--
-- @Billing Group Arn@: linked accounts that are associated to the provided
-- Billing Group Arn.
listAccountAssociationsFilter_association :: Lens.Lens' ListAccountAssociationsFilter (Prelude.Maybe Prelude.Text)
listAccountAssociationsFilter_association :: Lens' ListAccountAssociationsFilter (Maybe Text)
listAccountAssociationsFilter_association = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountAssociationsFilter' {Maybe Text
association :: Maybe Text
$sel:association:ListAccountAssociationsFilter' :: ListAccountAssociationsFilter -> Maybe Text
association} -> Maybe Text
association) (\s :: ListAccountAssociationsFilter
s@ListAccountAssociationsFilter' {} Maybe Text
a -> ListAccountAssociationsFilter
s {$sel:association:ListAccountAssociationsFilter' :: Maybe Text
association = Maybe Text
a} :: ListAccountAssociationsFilter)

instance
  Prelude.Hashable
    ListAccountAssociationsFilter
  where
  hashWithSalt :: Int -> ListAccountAssociationsFilter -> Int
hashWithSalt Int
_salt ListAccountAssociationsFilter' {Maybe Text
association :: Maybe Text
accountId :: Maybe Text
$sel:association:ListAccountAssociationsFilter' :: ListAccountAssociationsFilter -> Maybe Text
$sel:accountId:ListAccountAssociationsFilter' :: ListAccountAssociationsFilter -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
association

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

instance Data.ToJSON ListAccountAssociationsFilter where
  toJSON :: ListAccountAssociationsFilter -> Value
toJSON ListAccountAssociationsFilter' {Maybe Text
association :: Maybe Text
accountId :: Maybe Text
$sel:association:ListAccountAssociationsFilter' :: ListAccountAssociationsFilter -> Maybe Text
$sel:accountId:ListAccountAssociationsFilter' :: ListAccountAssociationsFilter -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AccountId" 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
accountId,
            (Key
"Association" 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
association
          ]
      )