{-# 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.SageMaker.Types.EndpointSummary
-- 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.SageMaker.Types.EndpointSummary where

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

-- | Provides summary information for an endpoint.
--
-- /See:/ 'newEndpointSummary' smart constructor.
data EndpointSummary = EndpointSummary'
  { -- | The name of the endpoint.
    EndpointSummary -> Text
endpointName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the endpoint.
    EndpointSummary -> Text
endpointArn :: Prelude.Text,
    -- | A timestamp that shows when the endpoint was created.
    EndpointSummary -> POSIX
creationTime :: Core.POSIX,
    -- | A timestamp that shows when the endpoint was last modified.
    EndpointSummary -> POSIX
lastModifiedTime :: Core.POSIX,
    -- | The status of the endpoint.
    --
    -- -   @OutOfService@: Endpoint is not available to take incoming requests.
    --
    -- -   @Creating@: CreateEndpoint is executing.
    --
    -- -   @Updating@: UpdateEndpoint or UpdateEndpointWeightsAndCapacities is
    --     executing.
    --
    -- -   @SystemUpdating@: Endpoint is undergoing maintenance and cannot be
    --     updated or deleted or re-scaled until it has completed. This
    --     maintenance operation does not change any customer-specified values
    --     such as VPC config, KMS encryption, model, instance type, or
    --     instance count.
    --
    -- -   @RollingBack@: Endpoint fails to scale up or down or change its
    --     variant weight and is in the process of rolling back to its previous
    --     configuration. Once the rollback completes, endpoint returns to an
    --     @InService@ status. This transitional status only applies to an
    --     endpoint that has autoscaling enabled and is undergoing variant
    --     weight or capacity changes as part of an
    --     UpdateEndpointWeightsAndCapacities call or when the
    --     UpdateEndpointWeightsAndCapacities operation is called explicitly.
    --
    -- -   @InService@: Endpoint is available to process incoming requests.
    --
    -- -   @Deleting@: DeleteEndpoint is executing.
    --
    -- -   @Failed@: Endpoint could not be created, updated, or re-scaled. Use
    --     DescribeEndpointOutput$FailureReason for information about the
    --     failure. DeleteEndpoint is the only operation that can be performed
    --     on a failed endpoint.
    --
    -- To get a list of endpoints with a specified status, use the
    -- ListEndpointsInput$StatusEquals filter.
    EndpointSummary -> EndpointStatus
endpointStatus :: EndpointStatus
  }
  deriving (EndpointSummary -> EndpointSummary -> Bool
(EndpointSummary -> EndpointSummary -> Bool)
-> (EndpointSummary -> EndpointSummary -> Bool)
-> Eq EndpointSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointSummary -> EndpointSummary -> Bool
$c/= :: EndpointSummary -> EndpointSummary -> Bool
== :: EndpointSummary -> EndpointSummary -> Bool
$c== :: EndpointSummary -> EndpointSummary -> Bool
Prelude.Eq, ReadPrec [EndpointSummary]
ReadPrec EndpointSummary
Int -> ReadS EndpointSummary
ReadS [EndpointSummary]
(Int -> ReadS EndpointSummary)
-> ReadS [EndpointSummary]
-> ReadPrec EndpointSummary
-> ReadPrec [EndpointSummary]
-> Read EndpointSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointSummary]
$creadListPrec :: ReadPrec [EndpointSummary]
readPrec :: ReadPrec EndpointSummary
$creadPrec :: ReadPrec EndpointSummary
readList :: ReadS [EndpointSummary]
$creadList :: ReadS [EndpointSummary]
readsPrec :: Int -> ReadS EndpointSummary
$creadsPrec :: Int -> ReadS EndpointSummary
Prelude.Read, Int -> EndpointSummary -> ShowS
[EndpointSummary] -> ShowS
EndpointSummary -> String
(Int -> EndpointSummary -> ShowS)
-> (EndpointSummary -> String)
-> ([EndpointSummary] -> ShowS)
-> Show EndpointSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointSummary] -> ShowS
$cshowList :: [EndpointSummary] -> ShowS
show :: EndpointSummary -> String
$cshow :: EndpointSummary -> String
showsPrec :: Int -> EndpointSummary -> ShowS
$cshowsPrec :: Int -> EndpointSummary -> ShowS
Prelude.Show, (forall x. EndpointSummary -> Rep EndpointSummary x)
-> (forall x. Rep EndpointSummary x -> EndpointSummary)
-> Generic EndpointSummary
forall x. Rep EndpointSummary x -> EndpointSummary
forall x. EndpointSummary -> Rep EndpointSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointSummary x -> EndpointSummary
$cfrom :: forall x. EndpointSummary -> Rep EndpointSummary x
Prelude.Generic)

-- |
-- Create a value of 'EndpointSummary' 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:
--
-- 'endpointName', 'endpointSummary_endpointName' - The name of the endpoint.
--
-- 'endpointArn', 'endpointSummary_endpointArn' - The Amazon Resource Name (ARN) of the endpoint.
--
-- 'creationTime', 'endpointSummary_creationTime' - A timestamp that shows when the endpoint was created.
--
-- 'lastModifiedTime', 'endpointSummary_lastModifiedTime' - A timestamp that shows when the endpoint was last modified.
--
-- 'endpointStatus', 'endpointSummary_endpointStatus' - The status of the endpoint.
--
-- -   @OutOfService@: Endpoint is not available to take incoming requests.
--
-- -   @Creating@: CreateEndpoint is executing.
--
-- -   @Updating@: UpdateEndpoint or UpdateEndpointWeightsAndCapacities is
--     executing.
--
-- -   @SystemUpdating@: Endpoint is undergoing maintenance and cannot be
--     updated or deleted or re-scaled until it has completed. This
--     maintenance operation does not change any customer-specified values
--     such as VPC config, KMS encryption, model, instance type, or
--     instance count.
--
-- -   @RollingBack@: Endpoint fails to scale up or down or change its
--     variant weight and is in the process of rolling back to its previous
--     configuration. Once the rollback completes, endpoint returns to an
--     @InService@ status. This transitional status only applies to an
--     endpoint that has autoscaling enabled and is undergoing variant
--     weight or capacity changes as part of an
--     UpdateEndpointWeightsAndCapacities call or when the
--     UpdateEndpointWeightsAndCapacities operation is called explicitly.
--
-- -   @InService@: Endpoint is available to process incoming requests.
--
-- -   @Deleting@: DeleteEndpoint is executing.
--
-- -   @Failed@: Endpoint could not be created, updated, or re-scaled. Use
--     DescribeEndpointOutput$FailureReason for information about the
--     failure. DeleteEndpoint is the only operation that can be performed
--     on a failed endpoint.
--
-- To get a list of endpoints with a specified status, use the
-- ListEndpointsInput$StatusEquals filter.
newEndpointSummary ::
  -- | 'endpointName'
  Prelude.Text ->
  -- | 'endpointArn'
  Prelude.Text ->
  -- | 'creationTime'
  Prelude.UTCTime ->
  -- | 'lastModifiedTime'
  Prelude.UTCTime ->
  -- | 'endpointStatus'
  EndpointStatus ->
  EndpointSummary
newEndpointSummary :: Text
-> Text -> UTCTime -> UTCTime -> EndpointStatus -> EndpointSummary
newEndpointSummary
  Text
pEndpointName_
  Text
pEndpointArn_
  UTCTime
pCreationTime_
  UTCTime
pLastModifiedTime_
  EndpointStatus
pEndpointStatus_ =
    EndpointSummary' :: Text -> Text -> POSIX -> POSIX -> EndpointStatus -> EndpointSummary
EndpointSummary'
      { $sel:endpointName:EndpointSummary' :: Text
endpointName = Text
pEndpointName_,
        $sel:endpointArn:EndpointSummary' :: Text
endpointArn = Text
pEndpointArn_,
        $sel:creationTime:EndpointSummary' :: POSIX
creationTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_,
        $sel:lastModifiedTime:EndpointSummary' :: POSIX
lastModifiedTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_,
        $sel:endpointStatus:EndpointSummary' :: EndpointStatus
endpointStatus = EndpointStatus
pEndpointStatus_
      }

-- | The name of the endpoint.
endpointSummary_endpointName :: Lens.Lens' EndpointSummary Prelude.Text
endpointSummary_endpointName :: (Text -> f Text) -> EndpointSummary -> f EndpointSummary
endpointSummary_endpointName = (EndpointSummary -> Text)
-> (EndpointSummary -> Text -> EndpointSummary)
-> Lens EndpointSummary EndpointSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointSummary' {Text
endpointName :: Text
$sel:endpointName:EndpointSummary' :: EndpointSummary -> Text
endpointName} -> Text
endpointName) (\s :: EndpointSummary
s@EndpointSummary' {} Text
a -> EndpointSummary
s {$sel:endpointName:EndpointSummary' :: Text
endpointName = Text
a} :: EndpointSummary)

-- | The Amazon Resource Name (ARN) of the endpoint.
endpointSummary_endpointArn :: Lens.Lens' EndpointSummary Prelude.Text
endpointSummary_endpointArn :: (Text -> f Text) -> EndpointSummary -> f EndpointSummary
endpointSummary_endpointArn = (EndpointSummary -> Text)
-> (EndpointSummary -> Text -> EndpointSummary)
-> Lens EndpointSummary EndpointSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointSummary' {Text
endpointArn :: Text
$sel:endpointArn:EndpointSummary' :: EndpointSummary -> Text
endpointArn} -> Text
endpointArn) (\s :: EndpointSummary
s@EndpointSummary' {} Text
a -> EndpointSummary
s {$sel:endpointArn:EndpointSummary' :: Text
endpointArn = Text
a} :: EndpointSummary)

-- | A timestamp that shows when the endpoint was created.
endpointSummary_creationTime :: Lens.Lens' EndpointSummary Prelude.UTCTime
endpointSummary_creationTime :: (UTCTime -> f UTCTime) -> EndpointSummary -> f EndpointSummary
endpointSummary_creationTime = (EndpointSummary -> POSIX)
-> (EndpointSummary -> POSIX -> EndpointSummary)
-> Lens EndpointSummary EndpointSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointSummary' {POSIX
creationTime :: POSIX
$sel:creationTime:EndpointSummary' :: EndpointSummary -> POSIX
creationTime} -> POSIX
creationTime) (\s :: EndpointSummary
s@EndpointSummary' {} POSIX
a -> EndpointSummary
s {$sel:creationTime:EndpointSummary' :: POSIX
creationTime = POSIX
a} :: EndpointSummary) ((POSIX -> f POSIX) -> EndpointSummary -> f EndpointSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> EndpointSummary
-> f EndpointSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A timestamp that shows when the endpoint was last modified.
endpointSummary_lastModifiedTime :: Lens.Lens' EndpointSummary Prelude.UTCTime
endpointSummary_lastModifiedTime :: (UTCTime -> f UTCTime) -> EndpointSummary -> f EndpointSummary
endpointSummary_lastModifiedTime = (EndpointSummary -> POSIX)
-> (EndpointSummary -> POSIX -> EndpointSummary)
-> Lens EndpointSummary EndpointSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointSummary' {POSIX
lastModifiedTime :: POSIX
$sel:lastModifiedTime:EndpointSummary' :: EndpointSummary -> POSIX
lastModifiedTime} -> POSIX
lastModifiedTime) (\s :: EndpointSummary
s@EndpointSummary' {} POSIX
a -> EndpointSummary
s {$sel:lastModifiedTime:EndpointSummary' :: POSIX
lastModifiedTime = POSIX
a} :: EndpointSummary) ((POSIX -> f POSIX) -> EndpointSummary -> f EndpointSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> EndpointSummary
-> f EndpointSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of the endpoint.
--
-- -   @OutOfService@: Endpoint is not available to take incoming requests.
--
-- -   @Creating@: CreateEndpoint is executing.
--
-- -   @Updating@: UpdateEndpoint or UpdateEndpointWeightsAndCapacities is
--     executing.
--
-- -   @SystemUpdating@: Endpoint is undergoing maintenance and cannot be
--     updated or deleted or re-scaled until it has completed. This
--     maintenance operation does not change any customer-specified values
--     such as VPC config, KMS encryption, model, instance type, or
--     instance count.
--
-- -   @RollingBack@: Endpoint fails to scale up or down or change its
--     variant weight and is in the process of rolling back to its previous
--     configuration. Once the rollback completes, endpoint returns to an
--     @InService@ status. This transitional status only applies to an
--     endpoint that has autoscaling enabled and is undergoing variant
--     weight or capacity changes as part of an
--     UpdateEndpointWeightsAndCapacities call or when the
--     UpdateEndpointWeightsAndCapacities operation is called explicitly.
--
-- -   @InService@: Endpoint is available to process incoming requests.
--
-- -   @Deleting@: DeleteEndpoint is executing.
--
-- -   @Failed@: Endpoint could not be created, updated, or re-scaled. Use
--     DescribeEndpointOutput$FailureReason for information about the
--     failure. DeleteEndpoint is the only operation that can be performed
--     on a failed endpoint.
--
-- To get a list of endpoints with a specified status, use the
-- ListEndpointsInput$StatusEquals filter.
endpointSummary_endpointStatus :: Lens.Lens' EndpointSummary EndpointStatus
endpointSummary_endpointStatus :: (EndpointStatus -> f EndpointStatus)
-> EndpointSummary -> f EndpointSummary
endpointSummary_endpointStatus = (EndpointSummary -> EndpointStatus)
-> (EndpointSummary -> EndpointStatus -> EndpointSummary)
-> Lens
     EndpointSummary EndpointSummary EndpointStatus EndpointStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointSummary' {EndpointStatus
endpointStatus :: EndpointStatus
$sel:endpointStatus:EndpointSummary' :: EndpointSummary -> EndpointStatus
endpointStatus} -> EndpointStatus
endpointStatus) (\s :: EndpointSummary
s@EndpointSummary' {} EndpointStatus
a -> EndpointSummary
s {$sel:endpointStatus:EndpointSummary' :: EndpointStatus
endpointStatus = EndpointStatus
a} :: EndpointSummary)

instance Core.FromJSON EndpointSummary where
  parseJSON :: Value -> Parser EndpointSummary
parseJSON =
    String
-> (Object -> Parser EndpointSummary)
-> Value
-> Parser EndpointSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EndpointSummary"
      ( \Object
x ->
          Text -> Text -> POSIX -> POSIX -> EndpointStatus -> EndpointSummary
EndpointSummary'
            (Text
 -> Text -> POSIX -> POSIX -> EndpointStatus -> EndpointSummary)
-> Parser Text
-> Parser
     (Text -> POSIX -> POSIX -> EndpointStatus -> EndpointSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndpointName")
            Parser
  (Text -> POSIX -> POSIX -> EndpointStatus -> EndpointSummary)
-> Parser Text
-> Parser (POSIX -> POSIX -> EndpointStatus -> EndpointSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndpointArn")
            Parser (POSIX -> POSIX -> EndpointStatus -> EndpointSummary)
-> Parser POSIX
-> Parser (POSIX -> EndpointStatus -> EndpointSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CreationTime")
            Parser (POSIX -> EndpointStatus -> EndpointSummary)
-> Parser POSIX -> Parser (EndpointStatus -> EndpointSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LastModifiedTime")
            Parser (EndpointStatus -> EndpointSummary)
-> Parser EndpointStatus -> Parser EndpointSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser EndpointStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EndpointStatus")
      )

instance Prelude.Hashable EndpointSummary

instance Prelude.NFData EndpointSummary