{-# 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.ArcZonalShift.Types.ZonalShiftSummary
-- 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.ArcZonalShift.Types.ZonalShiftSummary where

import Amazonka.ArcZonalShift.Types.ZonalShiftStatus
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

-- | You start a zonal shift to temporarily move load balancer traffic away
-- from an Availability Zone in a AWS Region. A zonal shift helps your
-- application recover immediately, for example, from a developer\'s bad
-- code deployment or from an AWS infrastructure failure in a single
-- Availability Zone. You can start a zonal shift in Route 53 ARC only for
-- managed resources in your account in an AWS Region. Supported AWS
-- resources are automatically registered with Route 53 ARC.
--
-- Zonal shifts are temporary. A zonal shift can be active for up to three
-- days (72 hours).
--
-- When you start a zonal shift, you specify how long you want it to be
-- active, which Amazon Route 53 Application Recovery Controller converts
-- to an expiry time (expiration time). You can cancel a zonal shift, for
-- example, if you\'re ready to restore traffic to the Availability Zone.
-- Or you can extend the zonal shift by updating the expiration so the
-- zonal shift is active longer.
--
-- /See:/ 'newZonalShiftSummary' smart constructor.
data ZonalShiftSummary = ZonalShiftSummary'
  { -- | The Availability Zone that traffic is moved away from for a resource
    -- when you start a zonal shift. Until the zonal shift expires or you
    -- cancel it, traffic for the resource is instead moved to other
    -- Availability Zones in the AWS Region.
    ZonalShiftSummary -> Text
awayFrom :: Prelude.Text,
    -- | A comment that you enter about the zonal shift. Only the latest comment
    -- is retained; no comment history is maintained. That is, a new comment
    -- overwrites any existing comment string.
    ZonalShiftSummary -> Text
comment :: Prelude.Text,
    -- | The expiry time (expiration time) for the zonal shift. A zonal shift is
    -- temporary and must be set to expire when you start the zonal shift. You
    -- can initially set a zonal shift to expire in a maximum of three days (72
    -- hours). However, you can update a zonal shift to set a new expiration at
    -- any time.
    --
    -- When you start a zonal shift, you specify how long you want it to be
    -- active, which Route 53 ARC converts to an expiry time (expiration time).
    -- You can cancel a zonal shift, for example, if you\'re ready to restore
    -- traffic to the Availability Zone. Or you can update the zonal shift to
    -- specify another length of time to expire in.
    ZonalShiftSummary -> POSIX
expiryTime :: Data.POSIX,
    -- | The identifier for the resource to include in a zonal shift. The
    -- identifier is the Amazon Resource Name (ARN) for the resource.
    --
    -- At this time, you can only start a zonal shift for Network Load
    -- Balancers and Application Load Balancers with cross-zone load balancing
    -- turned off.
    ZonalShiftSummary -> Text
resourceIdentifier :: Prelude.Text,
    -- | The time (UTC) when the zonal shift is started.
    ZonalShiftSummary -> POSIX
startTime :: Data.POSIX,
    -- | A status for a zonal shift.
    --
    -- The @Status@ for a zonal shift can have one of the following values:
    --
    -- -   __ACTIVE:__ The zonal shift is started and active.
    --
    -- -   __EXPIRED:__ The zonal shift has expired (the expiry time was
    --     exceeded).
    --
    -- -   __CANCELED:__ The zonal shift was canceled.
    ZonalShiftSummary -> ZonalShiftStatus
status :: ZonalShiftStatus,
    -- | The identifier of a zonal shift.
    ZonalShiftSummary -> Text
zonalShiftId :: Prelude.Text
  }
  deriving (ZonalShiftSummary -> ZonalShiftSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ZonalShiftSummary -> ZonalShiftSummary -> Bool
$c/= :: ZonalShiftSummary -> ZonalShiftSummary -> Bool
== :: ZonalShiftSummary -> ZonalShiftSummary -> Bool
$c== :: ZonalShiftSummary -> ZonalShiftSummary -> Bool
Prelude.Eq, ReadPrec [ZonalShiftSummary]
ReadPrec ZonalShiftSummary
Int -> ReadS ZonalShiftSummary
ReadS [ZonalShiftSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ZonalShiftSummary]
$creadListPrec :: ReadPrec [ZonalShiftSummary]
readPrec :: ReadPrec ZonalShiftSummary
$creadPrec :: ReadPrec ZonalShiftSummary
readList :: ReadS [ZonalShiftSummary]
$creadList :: ReadS [ZonalShiftSummary]
readsPrec :: Int -> ReadS ZonalShiftSummary
$creadsPrec :: Int -> ReadS ZonalShiftSummary
Prelude.Read, Int -> ZonalShiftSummary -> ShowS
[ZonalShiftSummary] -> ShowS
ZonalShiftSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ZonalShiftSummary] -> ShowS
$cshowList :: [ZonalShiftSummary] -> ShowS
show :: ZonalShiftSummary -> String
$cshow :: ZonalShiftSummary -> String
showsPrec :: Int -> ZonalShiftSummary -> ShowS
$cshowsPrec :: Int -> ZonalShiftSummary -> ShowS
Prelude.Show, forall x. Rep ZonalShiftSummary x -> ZonalShiftSummary
forall x. ZonalShiftSummary -> Rep ZonalShiftSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ZonalShiftSummary x -> ZonalShiftSummary
$cfrom :: forall x. ZonalShiftSummary -> Rep ZonalShiftSummary x
Prelude.Generic)

-- |
-- Create a value of 'ZonalShiftSummary' 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:
--
-- 'awayFrom', 'zonalShiftSummary_awayFrom' - The Availability Zone that traffic is moved away from for a resource
-- when you start a zonal shift. Until the zonal shift expires or you
-- cancel it, traffic for the resource is instead moved to other
-- Availability Zones in the AWS Region.
--
-- 'comment', 'zonalShiftSummary_comment' - A comment that you enter about the zonal shift. Only the latest comment
-- is retained; no comment history is maintained. That is, a new comment
-- overwrites any existing comment string.
--
-- 'expiryTime', 'zonalShiftSummary_expiryTime' - The expiry time (expiration time) for the zonal shift. A zonal shift is
-- temporary and must be set to expire when you start the zonal shift. You
-- can initially set a zonal shift to expire in a maximum of three days (72
-- hours). However, you can update a zonal shift to set a new expiration at
-- any time.
--
-- When you start a zonal shift, you specify how long you want it to be
-- active, which Route 53 ARC converts to an expiry time (expiration time).
-- You can cancel a zonal shift, for example, if you\'re ready to restore
-- traffic to the Availability Zone. Or you can update the zonal shift to
-- specify another length of time to expire in.
--
-- 'resourceIdentifier', 'zonalShiftSummary_resourceIdentifier' - The identifier for the resource to include in a zonal shift. The
-- identifier is the Amazon Resource Name (ARN) for the resource.
--
-- At this time, you can only start a zonal shift for Network Load
-- Balancers and Application Load Balancers with cross-zone load balancing
-- turned off.
--
-- 'startTime', 'zonalShiftSummary_startTime' - The time (UTC) when the zonal shift is started.
--
-- 'status', 'zonalShiftSummary_status' - A status for a zonal shift.
--
-- The @Status@ for a zonal shift can have one of the following values:
--
-- -   __ACTIVE:__ The zonal shift is started and active.
--
-- -   __EXPIRED:__ The zonal shift has expired (the expiry time was
--     exceeded).
--
-- -   __CANCELED:__ The zonal shift was canceled.
--
-- 'zonalShiftId', 'zonalShiftSummary_zonalShiftId' - The identifier of a zonal shift.
newZonalShiftSummary ::
  -- | 'awayFrom'
  Prelude.Text ->
  -- | 'comment'
  Prelude.Text ->
  -- | 'expiryTime'
  Prelude.UTCTime ->
  -- | 'resourceIdentifier'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'status'
  ZonalShiftStatus ->
  -- | 'zonalShiftId'
  Prelude.Text ->
  ZonalShiftSummary
newZonalShiftSummary :: Text
-> Text
-> UTCTime
-> Text
-> UTCTime
-> ZonalShiftStatus
-> Text
-> ZonalShiftSummary
newZonalShiftSummary
  Text
pAwayFrom_
  Text
pComment_
  UTCTime
pExpiryTime_
  Text
pResourceIdentifier_
  UTCTime
pStartTime_
  ZonalShiftStatus
pStatus_
  Text
pZonalShiftId_ =
    ZonalShiftSummary'
      { $sel:awayFrom:ZonalShiftSummary' :: Text
awayFrom = Text
pAwayFrom_,
        $sel:comment:ZonalShiftSummary' :: Text
comment = Text
pComment_,
        $sel:expiryTime:ZonalShiftSummary' :: POSIX
expiryTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pExpiryTime_,
        $sel:resourceIdentifier:ZonalShiftSummary' :: Text
resourceIdentifier = Text
pResourceIdentifier_,
        $sel:startTime:ZonalShiftSummary' :: POSIX
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:status:ZonalShiftSummary' :: ZonalShiftStatus
status = ZonalShiftStatus
pStatus_,
        $sel:zonalShiftId:ZonalShiftSummary' :: Text
zonalShiftId = Text
pZonalShiftId_
      }

-- | The Availability Zone that traffic is moved away from for a resource
-- when you start a zonal shift. Until the zonal shift expires or you
-- cancel it, traffic for the resource is instead moved to other
-- Availability Zones in the AWS Region.
zonalShiftSummary_awayFrom :: Lens.Lens' ZonalShiftSummary Prelude.Text
zonalShiftSummary_awayFrom :: Lens' ZonalShiftSummary Text
zonalShiftSummary_awayFrom = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftSummary' {Text
awayFrom :: Text
$sel:awayFrom:ZonalShiftSummary' :: ZonalShiftSummary -> Text
awayFrom} -> Text
awayFrom) (\s :: ZonalShiftSummary
s@ZonalShiftSummary' {} Text
a -> ZonalShiftSummary
s {$sel:awayFrom:ZonalShiftSummary' :: Text
awayFrom = Text
a} :: ZonalShiftSummary)

-- | A comment that you enter about the zonal shift. Only the latest comment
-- is retained; no comment history is maintained. That is, a new comment
-- overwrites any existing comment string.
zonalShiftSummary_comment :: Lens.Lens' ZonalShiftSummary Prelude.Text
zonalShiftSummary_comment :: Lens' ZonalShiftSummary Text
zonalShiftSummary_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftSummary' {Text
comment :: Text
$sel:comment:ZonalShiftSummary' :: ZonalShiftSummary -> Text
comment} -> Text
comment) (\s :: ZonalShiftSummary
s@ZonalShiftSummary' {} Text
a -> ZonalShiftSummary
s {$sel:comment:ZonalShiftSummary' :: Text
comment = Text
a} :: ZonalShiftSummary)

-- | The expiry time (expiration time) for the zonal shift. A zonal shift is
-- temporary and must be set to expire when you start the zonal shift. You
-- can initially set a zonal shift to expire in a maximum of three days (72
-- hours). However, you can update a zonal shift to set a new expiration at
-- any time.
--
-- When you start a zonal shift, you specify how long you want it to be
-- active, which Route 53 ARC converts to an expiry time (expiration time).
-- You can cancel a zonal shift, for example, if you\'re ready to restore
-- traffic to the Availability Zone. Or you can update the zonal shift to
-- specify another length of time to expire in.
zonalShiftSummary_expiryTime :: Lens.Lens' ZonalShiftSummary Prelude.UTCTime
zonalShiftSummary_expiryTime :: Lens' ZonalShiftSummary UTCTime
zonalShiftSummary_expiryTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftSummary' {POSIX
expiryTime :: POSIX
$sel:expiryTime:ZonalShiftSummary' :: ZonalShiftSummary -> POSIX
expiryTime} -> POSIX
expiryTime) (\s :: ZonalShiftSummary
s@ZonalShiftSummary' {} POSIX
a -> ZonalShiftSummary
s {$sel:expiryTime:ZonalShiftSummary' :: POSIX
expiryTime = POSIX
a} :: ZonalShiftSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The identifier for the resource to include in a zonal shift. The
-- identifier is the Amazon Resource Name (ARN) for the resource.
--
-- At this time, you can only start a zonal shift for Network Load
-- Balancers and Application Load Balancers with cross-zone load balancing
-- turned off.
zonalShiftSummary_resourceIdentifier :: Lens.Lens' ZonalShiftSummary Prelude.Text
zonalShiftSummary_resourceIdentifier :: Lens' ZonalShiftSummary Text
zonalShiftSummary_resourceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftSummary' {Text
resourceIdentifier :: Text
$sel:resourceIdentifier:ZonalShiftSummary' :: ZonalShiftSummary -> Text
resourceIdentifier} -> Text
resourceIdentifier) (\s :: ZonalShiftSummary
s@ZonalShiftSummary' {} Text
a -> ZonalShiftSummary
s {$sel:resourceIdentifier:ZonalShiftSummary' :: Text
resourceIdentifier = Text
a} :: ZonalShiftSummary)

-- | The time (UTC) when the zonal shift is started.
zonalShiftSummary_startTime :: Lens.Lens' ZonalShiftSummary Prelude.UTCTime
zonalShiftSummary_startTime :: Lens' ZonalShiftSummary UTCTime
zonalShiftSummary_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftSummary' {POSIX
startTime :: POSIX
$sel:startTime:ZonalShiftSummary' :: ZonalShiftSummary -> POSIX
startTime} -> POSIX
startTime) (\s :: ZonalShiftSummary
s@ZonalShiftSummary' {} POSIX
a -> ZonalShiftSummary
s {$sel:startTime:ZonalShiftSummary' :: POSIX
startTime = POSIX
a} :: ZonalShiftSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A status for a zonal shift.
--
-- The @Status@ for a zonal shift can have one of the following values:
--
-- -   __ACTIVE:__ The zonal shift is started and active.
--
-- -   __EXPIRED:__ The zonal shift has expired (the expiry time was
--     exceeded).
--
-- -   __CANCELED:__ The zonal shift was canceled.
zonalShiftSummary_status :: Lens.Lens' ZonalShiftSummary ZonalShiftStatus
zonalShiftSummary_status :: Lens' ZonalShiftSummary ZonalShiftStatus
zonalShiftSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftSummary' {ZonalShiftStatus
status :: ZonalShiftStatus
$sel:status:ZonalShiftSummary' :: ZonalShiftSummary -> ZonalShiftStatus
status} -> ZonalShiftStatus
status) (\s :: ZonalShiftSummary
s@ZonalShiftSummary' {} ZonalShiftStatus
a -> ZonalShiftSummary
s {$sel:status:ZonalShiftSummary' :: ZonalShiftStatus
status = ZonalShiftStatus
a} :: ZonalShiftSummary)

-- | The identifier of a zonal shift.
zonalShiftSummary_zonalShiftId :: Lens.Lens' ZonalShiftSummary Prelude.Text
zonalShiftSummary_zonalShiftId :: Lens' ZonalShiftSummary Text
zonalShiftSummary_zonalShiftId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftSummary' {Text
zonalShiftId :: Text
$sel:zonalShiftId:ZonalShiftSummary' :: ZonalShiftSummary -> Text
zonalShiftId} -> Text
zonalShiftId) (\s :: ZonalShiftSummary
s@ZonalShiftSummary' {} Text
a -> ZonalShiftSummary
s {$sel:zonalShiftId:ZonalShiftSummary' :: Text
zonalShiftId = Text
a} :: ZonalShiftSummary)

instance Data.FromJSON ZonalShiftSummary where
  parseJSON :: Value -> Parser ZonalShiftSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ZonalShiftSummary"
      ( \Object
x ->
          Text
-> Text
-> POSIX
-> Text
-> POSIX
-> ZonalShiftStatus
-> Text
-> ZonalShiftSummary
ZonalShiftSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"awayFrom")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"comment")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"expiryTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"startTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"zonalShiftId")
      )

instance Prelude.Hashable ZonalShiftSummary where
  hashWithSalt :: Int -> ZonalShiftSummary -> Int
hashWithSalt Int
_salt ZonalShiftSummary' {Text
POSIX
ZonalShiftStatus
zonalShiftId :: Text
status :: ZonalShiftStatus
startTime :: POSIX
resourceIdentifier :: Text
expiryTime :: POSIX
comment :: Text
awayFrom :: Text
$sel:zonalShiftId:ZonalShiftSummary' :: ZonalShiftSummary -> Text
$sel:status:ZonalShiftSummary' :: ZonalShiftSummary -> ZonalShiftStatus
$sel:startTime:ZonalShiftSummary' :: ZonalShiftSummary -> POSIX
$sel:resourceIdentifier:ZonalShiftSummary' :: ZonalShiftSummary -> Text
$sel:expiryTime:ZonalShiftSummary' :: ZonalShiftSummary -> POSIX
$sel:comment:ZonalShiftSummary' :: ZonalShiftSummary -> Text
$sel:awayFrom:ZonalShiftSummary' :: ZonalShiftSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awayFrom
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
expiryTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ZonalShiftStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
zonalShiftId

instance Prelude.NFData ZonalShiftSummary where
  rnf :: ZonalShiftSummary -> ()
rnf ZonalShiftSummary' {Text
POSIX
ZonalShiftStatus
zonalShiftId :: Text
status :: ZonalShiftStatus
startTime :: POSIX
resourceIdentifier :: Text
expiryTime :: POSIX
comment :: Text
awayFrom :: Text
$sel:zonalShiftId:ZonalShiftSummary' :: ZonalShiftSummary -> Text
$sel:status:ZonalShiftSummary' :: ZonalShiftSummary -> ZonalShiftStatus
$sel:startTime:ZonalShiftSummary' :: ZonalShiftSummary -> POSIX
$sel:resourceIdentifier:ZonalShiftSummary' :: ZonalShiftSummary -> Text
$sel:expiryTime:ZonalShiftSummary' :: ZonalShiftSummary -> POSIX
$sel:comment:ZonalShiftSummary' :: ZonalShiftSummary -> Text
$sel:awayFrom:ZonalShiftSummary' :: ZonalShiftSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
awayFrom
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
comment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
expiryTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ZonalShiftStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
zonalShiftId