{-# 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.CloudFormation.Types.TypeFilters
-- 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.CloudFormation.Types.TypeFilters where

import Amazonka.CloudFormation.Types.Category
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

-- | Filter criteria to use in determining which extensions to return.
--
-- /See:/ 'newTypeFilters' smart constructor.
data TypeFilters = TypeFilters'
  { -- | The category of extensions to return.
    --
    -- -   @REGISTERED@: Private extensions that have been registered for this
    --     account and region.
    --
    -- -   @ACTIVATED@: Public extensions that have been activated for this
    --     account and region.
    --
    -- -   @THIRD_PARTY@: Extensions available for use from publishers other
    --     than Amazon. This includes:
    --
    --     -   Private extensions registered in the account.
    --
    --     -   Public extensions from publishers other than Amazon, whether
    --         activated or not.
    --
    -- -   @AWS_TYPES@: Extensions available for use from Amazon.
    TypeFilters -> Maybe Category
category :: Prelude.Maybe Category,
    -- | The id of the publisher of the extension.
    --
    -- Extensions published by Amazon aren\'t assigned a publisher ID. Use the
    -- @AWS_TYPES@ category to specify a list of types published by Amazon.
    TypeFilters -> Maybe Text
publisherId :: Prelude.Maybe Prelude.Text,
    -- | A prefix to use as a filter for results.
    TypeFilters -> Maybe Text
typeNamePrefix :: Prelude.Maybe Prelude.Text
  }
  deriving (TypeFilters -> TypeFilters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeFilters -> TypeFilters -> Bool
$c/= :: TypeFilters -> TypeFilters -> Bool
== :: TypeFilters -> TypeFilters -> Bool
$c== :: TypeFilters -> TypeFilters -> Bool
Prelude.Eq, ReadPrec [TypeFilters]
ReadPrec TypeFilters
Int -> ReadS TypeFilters
ReadS [TypeFilters]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypeFilters]
$creadListPrec :: ReadPrec [TypeFilters]
readPrec :: ReadPrec TypeFilters
$creadPrec :: ReadPrec TypeFilters
readList :: ReadS [TypeFilters]
$creadList :: ReadS [TypeFilters]
readsPrec :: Int -> ReadS TypeFilters
$creadsPrec :: Int -> ReadS TypeFilters
Prelude.Read, Int -> TypeFilters -> ShowS
[TypeFilters] -> ShowS
TypeFilters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeFilters] -> ShowS
$cshowList :: [TypeFilters] -> ShowS
show :: TypeFilters -> String
$cshow :: TypeFilters -> String
showsPrec :: Int -> TypeFilters -> ShowS
$cshowsPrec :: Int -> TypeFilters -> ShowS
Prelude.Show, forall x. Rep TypeFilters x -> TypeFilters
forall x. TypeFilters -> Rep TypeFilters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TypeFilters x -> TypeFilters
$cfrom :: forall x. TypeFilters -> Rep TypeFilters x
Prelude.Generic)

-- |
-- Create a value of 'TypeFilters' 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:
--
-- 'category', 'typeFilters_category' - The category of extensions to return.
--
-- -   @REGISTERED@: Private extensions that have been registered for this
--     account and region.
--
-- -   @ACTIVATED@: Public extensions that have been activated for this
--     account and region.
--
-- -   @THIRD_PARTY@: Extensions available for use from publishers other
--     than Amazon. This includes:
--
--     -   Private extensions registered in the account.
--
--     -   Public extensions from publishers other than Amazon, whether
--         activated or not.
--
-- -   @AWS_TYPES@: Extensions available for use from Amazon.
--
-- 'publisherId', 'typeFilters_publisherId' - The id of the publisher of the extension.
--
-- Extensions published by Amazon aren\'t assigned a publisher ID. Use the
-- @AWS_TYPES@ category to specify a list of types published by Amazon.
--
-- 'typeNamePrefix', 'typeFilters_typeNamePrefix' - A prefix to use as a filter for results.
newTypeFilters ::
  TypeFilters
newTypeFilters :: TypeFilters
newTypeFilters =
  TypeFilters'
    { $sel:category:TypeFilters' :: Maybe Category
category = forall a. Maybe a
Prelude.Nothing,
      $sel:publisherId:TypeFilters' :: Maybe Text
publisherId = forall a. Maybe a
Prelude.Nothing,
      $sel:typeNamePrefix:TypeFilters' :: Maybe Text
typeNamePrefix = forall a. Maybe a
Prelude.Nothing
    }

-- | The category of extensions to return.
--
-- -   @REGISTERED@: Private extensions that have been registered for this
--     account and region.
--
-- -   @ACTIVATED@: Public extensions that have been activated for this
--     account and region.
--
-- -   @THIRD_PARTY@: Extensions available for use from publishers other
--     than Amazon. This includes:
--
--     -   Private extensions registered in the account.
--
--     -   Public extensions from publishers other than Amazon, whether
--         activated or not.
--
-- -   @AWS_TYPES@: Extensions available for use from Amazon.
typeFilters_category :: Lens.Lens' TypeFilters (Prelude.Maybe Category)
typeFilters_category :: Lens' TypeFilters (Maybe Category)
typeFilters_category = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypeFilters' {Maybe Category
category :: Maybe Category
$sel:category:TypeFilters' :: TypeFilters -> Maybe Category
category} -> Maybe Category
category) (\s :: TypeFilters
s@TypeFilters' {} Maybe Category
a -> TypeFilters
s {$sel:category:TypeFilters' :: Maybe Category
category = Maybe Category
a} :: TypeFilters)

-- | The id of the publisher of the extension.
--
-- Extensions published by Amazon aren\'t assigned a publisher ID. Use the
-- @AWS_TYPES@ category to specify a list of types published by Amazon.
typeFilters_publisherId :: Lens.Lens' TypeFilters (Prelude.Maybe Prelude.Text)
typeFilters_publisherId :: Lens' TypeFilters (Maybe Text)
typeFilters_publisherId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypeFilters' {Maybe Text
publisherId :: Maybe Text
$sel:publisherId:TypeFilters' :: TypeFilters -> Maybe Text
publisherId} -> Maybe Text
publisherId) (\s :: TypeFilters
s@TypeFilters' {} Maybe Text
a -> TypeFilters
s {$sel:publisherId:TypeFilters' :: Maybe Text
publisherId = Maybe Text
a} :: TypeFilters)

-- | A prefix to use as a filter for results.
typeFilters_typeNamePrefix :: Lens.Lens' TypeFilters (Prelude.Maybe Prelude.Text)
typeFilters_typeNamePrefix :: Lens' TypeFilters (Maybe Text)
typeFilters_typeNamePrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypeFilters' {Maybe Text
typeNamePrefix :: Maybe Text
$sel:typeNamePrefix:TypeFilters' :: TypeFilters -> Maybe Text
typeNamePrefix} -> Maybe Text
typeNamePrefix) (\s :: TypeFilters
s@TypeFilters' {} Maybe Text
a -> TypeFilters
s {$sel:typeNamePrefix:TypeFilters' :: Maybe Text
typeNamePrefix = Maybe Text
a} :: TypeFilters)

instance Prelude.Hashable TypeFilters where
  hashWithSalt :: Int -> TypeFilters -> Int
hashWithSalt Int
_salt TypeFilters' {Maybe Text
Maybe Category
typeNamePrefix :: Maybe Text
publisherId :: Maybe Text
category :: Maybe Category
$sel:typeNamePrefix:TypeFilters' :: TypeFilters -> Maybe Text
$sel:publisherId:TypeFilters' :: TypeFilters -> Maybe Text
$sel:category:TypeFilters' :: TypeFilters -> Maybe Category
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Category
category
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publisherId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
typeNamePrefix

instance Prelude.NFData TypeFilters where
  rnf :: TypeFilters -> ()
rnf TypeFilters' {Maybe Text
Maybe Category
typeNamePrefix :: Maybe Text
publisherId :: Maybe Text
category :: Maybe Category
$sel:typeNamePrefix:TypeFilters' :: TypeFilters -> Maybe Text
$sel:publisherId:TypeFilters' :: TypeFilters -> Maybe Text
$sel:category:TypeFilters' :: TypeFilters -> Maybe Category
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Category
category
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publisherId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
typeNamePrefix

instance Data.ToQuery TypeFilters where
  toQuery :: TypeFilters -> QueryString
toQuery TypeFilters' {Maybe Text
Maybe Category
typeNamePrefix :: Maybe Text
publisherId :: Maybe Text
category :: Maybe Category
$sel:typeNamePrefix:TypeFilters' :: TypeFilters -> Maybe Text
$sel:publisherId:TypeFilters' :: TypeFilters -> Maybe Text
$sel:category:TypeFilters' :: TypeFilters -> Maybe Category
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Category" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Category
category,
        ByteString
"PublisherId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
publisherId,
        ByteString
"TypeNamePrefix" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
typeNamePrefix
      ]