{-# 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.Comprehend.Types.EndpointFilter
-- 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.Comprehend.Types.EndpointFilter where

import Amazonka.Comprehend.Types.EndpointStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The filter used to determine which endpoints are returned. You can
-- filter jobs on their name, model, status, or the date and time that they
-- were created. You can only set one filter at a time.
--
-- /See:/ 'newEndpointFilter' smart constructor.
data EndpointFilter = EndpointFilter'
  { -- | Specifies the status of the endpoint being returned. Possible values
    -- are: Creating, Ready, Updating, Deleting, Failed.
    EndpointFilter -> Maybe EndpointStatus
status :: Prelude.Maybe EndpointStatus,
    -- | The Amazon Resource Number (ARN) of the model to which the endpoint is
    -- attached.
    EndpointFilter -> Maybe Text
modelArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies a date after which the returned endpoint or endpoints were
    -- created.
    EndpointFilter -> Maybe POSIX
creationTimeAfter :: Prelude.Maybe Core.POSIX,
    -- | Specifies a date before which the returned endpoint or endpoints were
    -- created.
    EndpointFilter -> Maybe POSIX
creationTimeBefore :: Prelude.Maybe Core.POSIX
  }
  deriving (EndpointFilter -> EndpointFilter -> Bool
(EndpointFilter -> EndpointFilter -> Bool)
-> (EndpointFilter -> EndpointFilter -> Bool) -> Eq EndpointFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointFilter -> EndpointFilter -> Bool
$c/= :: EndpointFilter -> EndpointFilter -> Bool
== :: EndpointFilter -> EndpointFilter -> Bool
$c== :: EndpointFilter -> EndpointFilter -> Bool
Prelude.Eq, ReadPrec [EndpointFilter]
ReadPrec EndpointFilter
Int -> ReadS EndpointFilter
ReadS [EndpointFilter]
(Int -> ReadS EndpointFilter)
-> ReadS [EndpointFilter]
-> ReadPrec EndpointFilter
-> ReadPrec [EndpointFilter]
-> Read EndpointFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointFilter]
$creadListPrec :: ReadPrec [EndpointFilter]
readPrec :: ReadPrec EndpointFilter
$creadPrec :: ReadPrec EndpointFilter
readList :: ReadS [EndpointFilter]
$creadList :: ReadS [EndpointFilter]
readsPrec :: Int -> ReadS EndpointFilter
$creadsPrec :: Int -> ReadS EndpointFilter
Prelude.Read, Int -> EndpointFilter -> ShowS
[EndpointFilter] -> ShowS
EndpointFilter -> String
(Int -> EndpointFilter -> ShowS)
-> (EndpointFilter -> String)
-> ([EndpointFilter] -> ShowS)
-> Show EndpointFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointFilter] -> ShowS
$cshowList :: [EndpointFilter] -> ShowS
show :: EndpointFilter -> String
$cshow :: EndpointFilter -> String
showsPrec :: Int -> EndpointFilter -> ShowS
$cshowsPrec :: Int -> EndpointFilter -> ShowS
Prelude.Show, (forall x. EndpointFilter -> Rep EndpointFilter x)
-> (forall x. Rep EndpointFilter x -> EndpointFilter)
-> Generic EndpointFilter
forall x. Rep EndpointFilter x -> EndpointFilter
forall x. EndpointFilter -> Rep EndpointFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointFilter x -> EndpointFilter
$cfrom :: forall x. EndpointFilter -> Rep EndpointFilter x
Prelude.Generic)

-- |
-- Create a value of 'EndpointFilter' 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:
--
-- 'status', 'endpointFilter_status' - Specifies the status of the endpoint being returned. Possible values
-- are: Creating, Ready, Updating, Deleting, Failed.
--
-- 'modelArn', 'endpointFilter_modelArn' - The Amazon Resource Number (ARN) of the model to which the endpoint is
-- attached.
--
-- 'creationTimeAfter', 'endpointFilter_creationTimeAfter' - Specifies a date after which the returned endpoint or endpoints were
-- created.
--
-- 'creationTimeBefore', 'endpointFilter_creationTimeBefore' - Specifies a date before which the returned endpoint or endpoints were
-- created.
newEndpointFilter ::
  EndpointFilter
newEndpointFilter :: EndpointFilter
newEndpointFilter =
  EndpointFilter' :: Maybe EndpointStatus
-> Maybe Text -> Maybe POSIX -> Maybe POSIX -> EndpointFilter
EndpointFilter'
    { $sel:status:EndpointFilter' :: Maybe EndpointStatus
status = Maybe EndpointStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:modelArn:EndpointFilter' :: Maybe Text
modelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeAfter:EndpointFilter' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimeBefore:EndpointFilter' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the status of the endpoint being returned. Possible values
-- are: Creating, Ready, Updating, Deleting, Failed.
endpointFilter_status :: Lens.Lens' EndpointFilter (Prelude.Maybe EndpointStatus)
endpointFilter_status :: (Maybe EndpointStatus -> f (Maybe EndpointStatus))
-> EndpointFilter -> f EndpointFilter
endpointFilter_status = (EndpointFilter -> Maybe EndpointStatus)
-> (EndpointFilter -> Maybe EndpointStatus -> EndpointFilter)
-> Lens
     EndpointFilter
     EndpointFilter
     (Maybe EndpointStatus)
     (Maybe EndpointStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointFilter' {Maybe EndpointStatus
status :: Maybe EndpointStatus
$sel:status:EndpointFilter' :: EndpointFilter -> Maybe EndpointStatus
status} -> Maybe EndpointStatus
status) (\s :: EndpointFilter
s@EndpointFilter' {} Maybe EndpointStatus
a -> EndpointFilter
s {$sel:status:EndpointFilter' :: Maybe EndpointStatus
status = Maybe EndpointStatus
a} :: EndpointFilter)

-- | The Amazon Resource Number (ARN) of the model to which the endpoint is
-- attached.
endpointFilter_modelArn :: Lens.Lens' EndpointFilter (Prelude.Maybe Prelude.Text)
endpointFilter_modelArn :: (Maybe Text -> f (Maybe Text))
-> EndpointFilter -> f EndpointFilter
endpointFilter_modelArn = (EndpointFilter -> Maybe Text)
-> (EndpointFilter -> Maybe Text -> EndpointFilter)
-> Lens EndpointFilter EndpointFilter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointFilter' {Maybe Text
modelArn :: Maybe Text
$sel:modelArn:EndpointFilter' :: EndpointFilter -> Maybe Text
modelArn} -> Maybe Text
modelArn) (\s :: EndpointFilter
s@EndpointFilter' {} Maybe Text
a -> EndpointFilter
s {$sel:modelArn:EndpointFilter' :: Maybe Text
modelArn = Maybe Text
a} :: EndpointFilter)

-- | Specifies a date after which the returned endpoint or endpoints were
-- created.
endpointFilter_creationTimeAfter :: Lens.Lens' EndpointFilter (Prelude.Maybe Prelude.UTCTime)
endpointFilter_creationTimeAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EndpointFilter -> f EndpointFilter
endpointFilter_creationTimeAfter = (EndpointFilter -> Maybe POSIX)
-> (EndpointFilter -> Maybe POSIX -> EndpointFilter)
-> Lens EndpointFilter EndpointFilter (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointFilter' {Maybe POSIX
creationTimeAfter :: Maybe POSIX
$sel:creationTimeAfter:EndpointFilter' :: EndpointFilter -> Maybe POSIX
creationTimeAfter} -> Maybe POSIX
creationTimeAfter) (\s :: EndpointFilter
s@EndpointFilter' {} Maybe POSIX
a -> EndpointFilter
s {$sel:creationTimeAfter:EndpointFilter' :: Maybe POSIX
creationTimeAfter = Maybe POSIX
a} :: EndpointFilter) ((Maybe POSIX -> f (Maybe POSIX))
 -> EndpointFilter -> f EndpointFilter)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EndpointFilter
-> f EndpointFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Specifies a date before which the returned endpoint or endpoints were
-- created.
endpointFilter_creationTimeBefore :: Lens.Lens' EndpointFilter (Prelude.Maybe Prelude.UTCTime)
endpointFilter_creationTimeBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EndpointFilter -> f EndpointFilter
endpointFilter_creationTimeBefore = (EndpointFilter -> Maybe POSIX)
-> (EndpointFilter -> Maybe POSIX -> EndpointFilter)
-> Lens EndpointFilter EndpointFilter (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointFilter' {Maybe POSIX
creationTimeBefore :: Maybe POSIX
$sel:creationTimeBefore:EndpointFilter' :: EndpointFilter -> Maybe POSIX
creationTimeBefore} -> Maybe POSIX
creationTimeBefore) (\s :: EndpointFilter
s@EndpointFilter' {} Maybe POSIX
a -> EndpointFilter
s {$sel:creationTimeBefore:EndpointFilter' :: Maybe POSIX
creationTimeBefore = Maybe POSIX
a} :: EndpointFilter) ((Maybe POSIX -> f (Maybe POSIX))
 -> EndpointFilter -> f EndpointFilter)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EndpointFilter
-> f EndpointFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Prelude.Hashable EndpointFilter

instance Prelude.NFData EndpointFilter

instance Core.ToJSON EndpointFilter where
  toJSON :: EndpointFilter -> Value
toJSON EndpointFilter' {Maybe Text
Maybe POSIX
Maybe EndpointStatus
creationTimeBefore :: Maybe POSIX
creationTimeAfter :: Maybe POSIX
modelArn :: Maybe Text
status :: Maybe EndpointStatus
$sel:creationTimeBefore:EndpointFilter' :: EndpointFilter -> Maybe POSIX
$sel:creationTimeAfter:EndpointFilter' :: EndpointFilter -> Maybe POSIX
$sel:modelArn:EndpointFilter' :: EndpointFilter -> Maybe Text
$sel:status:EndpointFilter' :: EndpointFilter -> Maybe EndpointStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> EndpointStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EndpointStatus -> Pair) -> Maybe EndpointStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointStatus
status,
            (Text
"ModelArn" 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
modelArn,
            (Text
"CreationTimeAfter" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
creationTimeAfter,
            (Text
"CreationTimeBefore" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
creationTimeBefore
          ]
      )