{-# 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.ZonalShift
-- 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.ZonalShift 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

-- | /See:/ 'newZonalShift' smart constructor.
data ZonalShift = ZonalShift'
  { -- | 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.
    ZonalShift -> Text
awayFrom :: Prelude.Text,
    -- | A comment that you enter about the zonal shift. Only the latest comment
    -- is retained; no comment history is maintained. A new comment overwrites
    -- any existing comment string.
    ZonalShift -> 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.
    ZonalShift -> 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.
    ZonalShift -> Text
resourceIdentifier :: Prelude.Text,
    -- | The time (UTC) when the zonal shift is started.
    ZonalShift -> 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.
    ZonalShift -> ZonalShiftStatus
status :: ZonalShiftStatus,
    -- | The identifier of a zonal shift.
    ZonalShift -> Text
zonalShiftId :: Prelude.Text
  }
  deriving (ZonalShift -> ZonalShift -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ZonalShift -> ZonalShift -> Bool
$c/= :: ZonalShift -> ZonalShift -> Bool
== :: ZonalShift -> ZonalShift -> Bool
$c== :: ZonalShift -> ZonalShift -> Bool
Prelude.Eq, ReadPrec [ZonalShift]
ReadPrec ZonalShift
Int -> ReadS ZonalShift
ReadS [ZonalShift]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ZonalShift]
$creadListPrec :: ReadPrec [ZonalShift]
readPrec :: ReadPrec ZonalShift
$creadPrec :: ReadPrec ZonalShift
readList :: ReadS [ZonalShift]
$creadList :: ReadS [ZonalShift]
readsPrec :: Int -> ReadS ZonalShift
$creadsPrec :: Int -> ReadS ZonalShift
Prelude.Read, Int -> ZonalShift -> ShowS
[ZonalShift] -> ShowS
ZonalShift -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ZonalShift] -> ShowS
$cshowList :: [ZonalShift] -> ShowS
show :: ZonalShift -> String
$cshow :: ZonalShift -> String
showsPrec :: Int -> ZonalShift -> ShowS
$cshowsPrec :: Int -> ZonalShift -> ShowS
Prelude.Show, forall x. Rep ZonalShift x -> ZonalShift
forall x. ZonalShift -> Rep ZonalShift x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ZonalShift x -> ZonalShift
$cfrom :: forall x. ZonalShift -> Rep ZonalShift x
Prelude.Generic)

-- |
-- Create a value of 'ZonalShift' 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', 'zonalShift_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', 'zonalShift_comment' - A comment that you enter about the zonal shift. Only the latest comment
-- is retained; no comment history is maintained. A new comment overwrites
-- any existing comment string.
--
-- 'expiryTime', 'zonalShift_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', 'zonalShift_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', 'zonalShift_startTime' - The time (UTC) when the zonal shift is started.
--
-- 'status', 'zonalShift_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', 'zonalShift_zonalShiftId' - The identifier of a zonal shift.
newZonalShift ::
  -- | 'awayFrom'
  Prelude.Text ->
  -- | 'comment'
  Prelude.Text ->
  -- | 'expiryTime'
  Prelude.UTCTime ->
  -- | 'resourceIdentifier'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'status'
  ZonalShiftStatus ->
  -- | 'zonalShiftId'
  Prelude.Text ->
  ZonalShift
newZonalShift :: Text
-> Text
-> UTCTime
-> Text
-> UTCTime
-> ZonalShiftStatus
-> Text
-> ZonalShift
newZonalShift
  Text
pAwayFrom_
  Text
pComment_
  UTCTime
pExpiryTime_
  Text
pResourceIdentifier_
  UTCTime
pStartTime_
  ZonalShiftStatus
pStatus_
  Text
pZonalShiftId_ =
    ZonalShift'
      { $sel:awayFrom:ZonalShift' :: Text
awayFrom = Text
pAwayFrom_,
        $sel:comment:ZonalShift' :: Text
comment = Text
pComment_,
        $sel:expiryTime:ZonalShift' :: POSIX
expiryTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pExpiryTime_,
        $sel:resourceIdentifier:ZonalShift' :: Text
resourceIdentifier = Text
pResourceIdentifier_,
        $sel:startTime:ZonalShift' :: POSIX
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:status:ZonalShift' :: ZonalShiftStatus
status = ZonalShiftStatus
pStatus_,
        $sel:zonalShiftId:ZonalShift' :: 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.
zonalShift_awayFrom :: Lens.Lens' ZonalShift Prelude.Text
zonalShift_awayFrom :: Lens' ZonalShift Text
zonalShift_awayFrom = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShift' {Text
awayFrom :: Text
$sel:awayFrom:ZonalShift' :: ZonalShift -> Text
awayFrom} -> Text
awayFrom) (\s :: ZonalShift
s@ZonalShift' {} Text
a -> ZonalShift
s {$sel:awayFrom:ZonalShift' :: Text
awayFrom = Text
a} :: ZonalShift)

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

-- | 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.
zonalShift_expiryTime :: Lens.Lens' ZonalShift Prelude.UTCTime
zonalShift_expiryTime :: Lens' ZonalShift UTCTime
zonalShift_expiryTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShift' {POSIX
expiryTime :: POSIX
$sel:expiryTime:ZonalShift' :: ZonalShift -> POSIX
expiryTime} -> POSIX
expiryTime) (\s :: ZonalShift
s@ZonalShift' {} POSIX
a -> ZonalShift
s {$sel:expiryTime:ZonalShift' :: POSIX
expiryTime = POSIX
a} :: ZonalShift) 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.
zonalShift_resourceIdentifier :: Lens.Lens' ZonalShift Prelude.Text
zonalShift_resourceIdentifier :: Lens' ZonalShift Text
zonalShift_resourceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShift' {Text
resourceIdentifier :: Text
$sel:resourceIdentifier:ZonalShift' :: ZonalShift -> Text
resourceIdentifier} -> Text
resourceIdentifier) (\s :: ZonalShift
s@ZonalShift' {} Text
a -> ZonalShift
s {$sel:resourceIdentifier:ZonalShift' :: Text
resourceIdentifier = Text
a} :: ZonalShift)

-- | The time (UTC) when the zonal shift is started.
zonalShift_startTime :: Lens.Lens' ZonalShift Prelude.UTCTime
zonalShift_startTime :: Lens' ZonalShift UTCTime
zonalShift_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShift' {POSIX
startTime :: POSIX
$sel:startTime:ZonalShift' :: ZonalShift -> POSIX
startTime} -> POSIX
startTime) (\s :: ZonalShift
s@ZonalShift' {} POSIX
a -> ZonalShift
s {$sel:startTime:ZonalShift' :: POSIX
startTime = POSIX
a} :: ZonalShift) 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.
zonalShift_status :: Lens.Lens' ZonalShift ZonalShiftStatus
zonalShift_status :: Lens' ZonalShift ZonalShiftStatus
zonalShift_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShift' {ZonalShiftStatus
status :: ZonalShiftStatus
$sel:status:ZonalShift' :: ZonalShift -> ZonalShiftStatus
status} -> ZonalShiftStatus
status) (\s :: ZonalShift
s@ZonalShift' {} ZonalShiftStatus
a -> ZonalShift
s {$sel:status:ZonalShift' :: ZonalShiftStatus
status = ZonalShiftStatus
a} :: ZonalShift)

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

instance Data.FromJSON ZonalShift where
  parseJSON :: Value -> Parser ZonalShift
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ZonalShift"
      ( \Object
x ->
          Text
-> Text
-> POSIX
-> Text
-> POSIX
-> ZonalShiftStatus
-> Text
-> ZonalShift
ZonalShift'
            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 ZonalShift where
  hashWithSalt :: Int -> ZonalShift -> Int
hashWithSalt Int
_salt ZonalShift' {Text
POSIX
ZonalShiftStatus
zonalShiftId :: Text
status :: ZonalShiftStatus
startTime :: POSIX
resourceIdentifier :: Text
expiryTime :: POSIX
comment :: Text
awayFrom :: Text
$sel:zonalShiftId:ZonalShift' :: ZonalShift -> Text
$sel:status:ZonalShift' :: ZonalShift -> ZonalShiftStatus
$sel:startTime:ZonalShift' :: ZonalShift -> POSIX
$sel:resourceIdentifier:ZonalShift' :: ZonalShift -> Text
$sel:expiryTime:ZonalShift' :: ZonalShift -> POSIX
$sel:comment:ZonalShift' :: ZonalShift -> Text
$sel:awayFrom:ZonalShift' :: ZonalShift -> 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 ZonalShift where
  rnf :: ZonalShift -> ()
rnf ZonalShift' {Text
POSIX
ZonalShiftStatus
zonalShiftId :: Text
status :: ZonalShiftStatus
startTime :: POSIX
resourceIdentifier :: Text
expiryTime :: POSIX
comment :: Text
awayFrom :: Text
$sel:zonalShiftId:ZonalShift' :: ZonalShift -> Text
$sel:status:ZonalShift' :: ZonalShift -> ZonalShiftStatus
$sel:startTime:ZonalShift' :: ZonalShift -> POSIX
$sel:resourceIdentifier:ZonalShift' :: ZonalShift -> Text
$sel:expiryTime:ZonalShift' :: ZonalShift -> POSIX
$sel:comment:ZonalShift' :: ZonalShift -> Text
$sel:awayFrom:ZonalShift' :: ZonalShift -> 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