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

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 for a managed resource in an account.
--
-- A managed resource is a Network Load Balancer or Application Load
-- Balancer that has been registered with Route 53 ARC by Elastic Load
-- Balancing. You can start a zonal shift in Route 53 ARC for a managed
-- resource to temporarily move traffic for the resource away from an
-- Availability Zone in an AWS Region.
--
-- 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.
--
-- /See:/ 'newManagedResourceSummary' smart constructor.
data ManagedResourceSummary = ManagedResourceSummary'
  { -- | The Amazon Resource Name (ARN) for the managed resource.
    ManagedResourceSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the managed resource.
    ManagedResourceSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Availability Zones that a resource is deployed in.
    ManagedResourceSummary -> [Text]
availabilityZones :: [Prelude.Text]
  }
  deriving (ManagedResourceSummary -> ManagedResourceSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
$c/= :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
== :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
$c== :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
Prelude.Eq, ReadPrec [ManagedResourceSummary]
ReadPrec ManagedResourceSummary
Int -> ReadS ManagedResourceSummary
ReadS [ManagedResourceSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManagedResourceSummary]
$creadListPrec :: ReadPrec [ManagedResourceSummary]
readPrec :: ReadPrec ManagedResourceSummary
$creadPrec :: ReadPrec ManagedResourceSummary
readList :: ReadS [ManagedResourceSummary]
$creadList :: ReadS [ManagedResourceSummary]
readsPrec :: Int -> ReadS ManagedResourceSummary
$creadsPrec :: Int -> ReadS ManagedResourceSummary
Prelude.Read, Int -> ManagedResourceSummary -> ShowS
[ManagedResourceSummary] -> ShowS
ManagedResourceSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManagedResourceSummary] -> ShowS
$cshowList :: [ManagedResourceSummary] -> ShowS
show :: ManagedResourceSummary -> String
$cshow :: ManagedResourceSummary -> String
showsPrec :: Int -> ManagedResourceSummary -> ShowS
$cshowsPrec :: Int -> ManagedResourceSummary -> ShowS
Prelude.Show, forall x. Rep ManagedResourceSummary x -> ManagedResourceSummary
forall x. ManagedResourceSummary -> Rep ManagedResourceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManagedResourceSummary x -> ManagedResourceSummary
$cfrom :: forall x. ManagedResourceSummary -> Rep ManagedResourceSummary x
Prelude.Generic)

-- |
-- Create a value of 'ManagedResourceSummary' 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:
--
-- 'arn', 'managedResourceSummary_arn' - The Amazon Resource Name (ARN) for the managed resource.
--
-- 'name', 'managedResourceSummary_name' - The name of the managed resource.
--
-- 'availabilityZones', 'managedResourceSummary_availabilityZones' - The Availability Zones that a resource is deployed in.
newManagedResourceSummary ::
  ManagedResourceSummary
newManagedResourceSummary :: ManagedResourceSummary
newManagedResourceSummary =
  ManagedResourceSummary'
    { $sel:arn:ManagedResourceSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ManagedResourceSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:availabilityZones:ManagedResourceSummary' :: [Text]
availabilityZones = forall a. Monoid a => a
Prelude.mempty
    }

-- | The Amazon Resource Name (ARN) for the managed resource.
managedResourceSummary_arn :: Lens.Lens' ManagedResourceSummary (Prelude.Maybe Prelude.Text)
managedResourceSummary_arn :: Lens' ManagedResourceSummary (Maybe Text)
managedResourceSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedResourceSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ManagedResourceSummary
s@ManagedResourceSummary' {} Maybe Text
a -> ManagedResourceSummary
s {$sel:arn:ManagedResourceSummary' :: Maybe Text
arn = Maybe Text
a} :: ManagedResourceSummary)

-- | The name of the managed resource.
managedResourceSummary_name :: Lens.Lens' ManagedResourceSummary (Prelude.Maybe Prelude.Text)
managedResourceSummary_name :: Lens' ManagedResourceSummary (Maybe Text)
managedResourceSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedResourceSummary' {Maybe Text
name :: Maybe Text
$sel:name:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: ManagedResourceSummary
s@ManagedResourceSummary' {} Maybe Text
a -> ManagedResourceSummary
s {$sel:name:ManagedResourceSummary' :: Maybe Text
name = Maybe Text
a} :: ManagedResourceSummary)

-- | The Availability Zones that a resource is deployed in.
managedResourceSummary_availabilityZones :: Lens.Lens' ManagedResourceSummary [Prelude.Text]
managedResourceSummary_availabilityZones :: Lens' ManagedResourceSummary [Text]
managedResourceSummary_availabilityZones = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedResourceSummary' {[Text]
availabilityZones :: [Text]
$sel:availabilityZones:ManagedResourceSummary' :: ManagedResourceSummary -> [Text]
availabilityZones} -> [Text]
availabilityZones) (\s :: ManagedResourceSummary
s@ManagedResourceSummary' {} [Text]
a -> ManagedResourceSummary
s {$sel:availabilityZones:ManagedResourceSummary' :: [Text]
availabilityZones = [Text]
a} :: ManagedResourceSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ManagedResourceSummary where
  parseJSON :: Value -> Parser ManagedResourceSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ManagedResourceSummary"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> [Text] -> ManagedResourceSummary
ManagedResourceSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"availabilityZones"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ManagedResourceSummary where
  hashWithSalt :: Int -> ManagedResourceSummary -> Int
hashWithSalt Int
_salt ManagedResourceSummary' {[Text]
Maybe Text
availabilityZones :: [Text]
name :: Maybe Text
arn :: Maybe Text
$sel:availabilityZones:ManagedResourceSummary' :: ManagedResourceSummary -> [Text]
$sel:name:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe Text
$sel:arn:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
availabilityZones

instance Prelude.NFData ManagedResourceSummary where
  rnf :: ManagedResourceSummary -> ()
rnf ManagedResourceSummary' {[Text]
Maybe Text
availabilityZones :: [Text]
name :: Maybe Text
arn :: Maybe Text
$sel:availabilityZones:ManagedResourceSummary' :: ManagedResourceSummary -> [Text]
$sel:name:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe Text
$sel:arn:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
availabilityZones