{-# 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.ZonalShiftInResource
-- 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.ZonalShiftInResource where

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

-- | A complex structure that lists the zonal shifts for a managed resource
-- and their statuses for the resource.
--
-- /See:/ 'newZonalShiftInResource' smart constructor.
data ZonalShiftInResource = ZonalShiftInResource'
  { -- | An @appliedStatus@ for a zonal shift for a resource can have one of two
    -- values: @APPLIED@ or @NOT_APPLIED@.
    ZonalShiftInResource -> AppliedStatus
appliedStatus :: AppliedStatus,
    -- | 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.
    ZonalShiftInResource -> 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.
    ZonalShiftInResource -> 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.
    ZonalShiftInResource -> 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.
    ZonalShiftInResource -> Text
resourceIdentifier :: Prelude.Text,
    -- | The time (UTC) when the zonal shift is started.
    ZonalShiftInResource -> POSIX
startTime :: Data.POSIX,
    -- | The identifier of a zonal shift.
    ZonalShiftInResource -> Text
zonalShiftId :: Prelude.Text
  }
  deriving (ZonalShiftInResource -> ZonalShiftInResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ZonalShiftInResource -> ZonalShiftInResource -> Bool
$c/= :: ZonalShiftInResource -> ZonalShiftInResource -> Bool
== :: ZonalShiftInResource -> ZonalShiftInResource -> Bool
$c== :: ZonalShiftInResource -> ZonalShiftInResource -> Bool
Prelude.Eq, ReadPrec [ZonalShiftInResource]
ReadPrec ZonalShiftInResource
Int -> ReadS ZonalShiftInResource
ReadS [ZonalShiftInResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ZonalShiftInResource]
$creadListPrec :: ReadPrec [ZonalShiftInResource]
readPrec :: ReadPrec ZonalShiftInResource
$creadPrec :: ReadPrec ZonalShiftInResource
readList :: ReadS [ZonalShiftInResource]
$creadList :: ReadS [ZonalShiftInResource]
readsPrec :: Int -> ReadS ZonalShiftInResource
$creadsPrec :: Int -> ReadS ZonalShiftInResource
Prelude.Read, Int -> ZonalShiftInResource -> ShowS
[ZonalShiftInResource] -> ShowS
ZonalShiftInResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ZonalShiftInResource] -> ShowS
$cshowList :: [ZonalShiftInResource] -> ShowS
show :: ZonalShiftInResource -> String
$cshow :: ZonalShiftInResource -> String
showsPrec :: Int -> ZonalShiftInResource -> ShowS
$cshowsPrec :: Int -> ZonalShiftInResource -> ShowS
Prelude.Show, forall x. Rep ZonalShiftInResource x -> ZonalShiftInResource
forall x. ZonalShiftInResource -> Rep ZonalShiftInResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ZonalShiftInResource x -> ZonalShiftInResource
$cfrom :: forall x. ZonalShiftInResource -> Rep ZonalShiftInResource x
Prelude.Generic)

-- |
-- Create a value of 'ZonalShiftInResource' 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:
--
-- 'appliedStatus', 'zonalShiftInResource_appliedStatus' - An @appliedStatus@ for a zonal shift for a resource can have one of two
-- values: @APPLIED@ or @NOT_APPLIED@.
--
-- 'awayFrom', 'zonalShiftInResource_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', 'zonalShiftInResource_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', 'zonalShiftInResource_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', 'zonalShiftInResource_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', 'zonalShiftInResource_startTime' - The time (UTC) when the zonal shift is started.
--
-- 'zonalShiftId', 'zonalShiftInResource_zonalShiftId' - The identifier of a zonal shift.
newZonalShiftInResource ::
  -- | 'appliedStatus'
  AppliedStatus ->
  -- | 'awayFrom'
  Prelude.Text ->
  -- | 'comment'
  Prelude.Text ->
  -- | 'expiryTime'
  Prelude.UTCTime ->
  -- | 'resourceIdentifier'
  Prelude.Text ->
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'zonalShiftId'
  Prelude.Text ->
  ZonalShiftInResource
newZonalShiftInResource :: AppliedStatus
-> Text
-> Text
-> UTCTime
-> Text
-> UTCTime
-> Text
-> ZonalShiftInResource
newZonalShiftInResource
  AppliedStatus
pAppliedStatus_
  Text
pAwayFrom_
  Text
pComment_
  UTCTime
pExpiryTime_
  Text
pResourceIdentifier_
  UTCTime
pStartTime_
  Text
pZonalShiftId_ =
    ZonalShiftInResource'
      { $sel:appliedStatus:ZonalShiftInResource' :: AppliedStatus
appliedStatus =
          AppliedStatus
pAppliedStatus_,
        $sel:awayFrom:ZonalShiftInResource' :: Text
awayFrom = Text
pAwayFrom_,
        $sel:comment:ZonalShiftInResource' :: Text
comment = Text
pComment_,
        $sel:expiryTime:ZonalShiftInResource' :: POSIX
expiryTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pExpiryTime_,
        $sel:resourceIdentifier:ZonalShiftInResource' :: Text
resourceIdentifier = Text
pResourceIdentifier_,
        $sel:startTime:ZonalShiftInResource' :: POSIX
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:zonalShiftId:ZonalShiftInResource' :: Text
zonalShiftId = Text
pZonalShiftId_
      }

-- | An @appliedStatus@ for a zonal shift for a resource can have one of two
-- values: @APPLIED@ or @NOT_APPLIED@.
zonalShiftInResource_appliedStatus :: Lens.Lens' ZonalShiftInResource AppliedStatus
zonalShiftInResource_appliedStatus :: Lens' ZonalShiftInResource AppliedStatus
zonalShiftInResource_appliedStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftInResource' {AppliedStatus
appliedStatus :: AppliedStatus
$sel:appliedStatus:ZonalShiftInResource' :: ZonalShiftInResource -> AppliedStatus
appliedStatus} -> AppliedStatus
appliedStatus) (\s :: ZonalShiftInResource
s@ZonalShiftInResource' {} AppliedStatus
a -> ZonalShiftInResource
s {$sel:appliedStatus:ZonalShiftInResource' :: AppliedStatus
appliedStatus = AppliedStatus
a} :: ZonalShiftInResource)

-- | 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.
zonalShiftInResource_awayFrom :: Lens.Lens' ZonalShiftInResource Prelude.Text
zonalShiftInResource_awayFrom :: Lens' ZonalShiftInResource Text
zonalShiftInResource_awayFrom = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftInResource' {Text
awayFrom :: Text
$sel:awayFrom:ZonalShiftInResource' :: ZonalShiftInResource -> Text
awayFrom} -> Text
awayFrom) (\s :: ZonalShiftInResource
s@ZonalShiftInResource' {} Text
a -> ZonalShiftInResource
s {$sel:awayFrom:ZonalShiftInResource' :: Text
awayFrom = Text
a} :: ZonalShiftInResource)

-- | 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.
zonalShiftInResource_comment :: Lens.Lens' ZonalShiftInResource Prelude.Text
zonalShiftInResource_comment :: Lens' ZonalShiftInResource Text
zonalShiftInResource_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ZonalShiftInResource' {Text
comment :: Text
$sel:comment:ZonalShiftInResource' :: ZonalShiftInResource -> Text
comment} -> Text
comment) (\s :: ZonalShiftInResource
s@ZonalShiftInResource' {} Text
a -> ZonalShiftInResource
s {$sel:comment:ZonalShiftInResource' :: Text
comment = Text
a} :: ZonalShiftInResource)

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

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

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

instance Data.FromJSON ZonalShiftInResource where
  parseJSON :: Value -> Parser ZonalShiftInResource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ZonalShiftInResource"
      ( \Object
x ->
          AppliedStatus
-> Text
-> Text
-> POSIX
-> Text
-> POSIX
-> Text
-> ZonalShiftInResource
ZonalShiftInResource'
            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
"appliedStatus")
            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
"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
"zonalShiftId")
      )

instance Prelude.Hashable ZonalShiftInResource where
  hashWithSalt :: Int -> ZonalShiftInResource -> Int
hashWithSalt Int
_salt ZonalShiftInResource' {Text
POSIX
AppliedStatus
zonalShiftId :: Text
startTime :: POSIX
resourceIdentifier :: Text
expiryTime :: POSIX
comment :: Text
awayFrom :: Text
appliedStatus :: AppliedStatus
$sel:zonalShiftId:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:startTime:ZonalShiftInResource' :: ZonalShiftInResource -> POSIX
$sel:resourceIdentifier:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:expiryTime:ZonalShiftInResource' :: ZonalShiftInResource -> POSIX
$sel:comment:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:awayFrom:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:appliedStatus:ZonalShiftInResource' :: ZonalShiftInResource -> AppliedStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AppliedStatus
appliedStatus
      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` Text
zonalShiftId

instance Prelude.NFData ZonalShiftInResource where
  rnf :: ZonalShiftInResource -> ()
rnf ZonalShiftInResource' {Text
POSIX
AppliedStatus
zonalShiftId :: Text
startTime :: POSIX
resourceIdentifier :: Text
expiryTime :: POSIX
comment :: Text
awayFrom :: Text
appliedStatus :: AppliedStatus
$sel:zonalShiftId:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:startTime:ZonalShiftInResource' :: ZonalShiftInResource -> POSIX
$sel:resourceIdentifier:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:expiryTime:ZonalShiftInResource' :: ZonalShiftInResource -> POSIX
$sel:comment:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:awayFrom:ZonalShiftInResource' :: ZonalShiftInResource -> Text
$sel:appliedStatus:ZonalShiftInResource' :: ZonalShiftInResource -> AppliedStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf AppliedStatus
appliedStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
zonalShiftId