{-# 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.MigrationHubStrategy.Types.AwsManagedResources
-- 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.MigrationHubStrategy.Types.AwsManagedResources where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubStrategy.Types.AwsManagedTargetDestination
import qualified Amazonka.Prelude as Prelude

-- | Object containing the choice of application destination that you
-- specify.
--
-- /See:/ 'newAwsManagedResources' smart constructor.
data AwsManagedResources = AwsManagedResources'
  { -- | The choice of application destination that you specify.
    AwsManagedResources -> NonEmpty AwsManagedTargetDestination
targetDestination :: Prelude.NonEmpty AwsManagedTargetDestination
  }
  deriving (AwsManagedResources -> AwsManagedResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsManagedResources -> AwsManagedResources -> Bool
$c/= :: AwsManagedResources -> AwsManagedResources -> Bool
== :: AwsManagedResources -> AwsManagedResources -> Bool
$c== :: AwsManagedResources -> AwsManagedResources -> Bool
Prelude.Eq, ReadPrec [AwsManagedResources]
ReadPrec AwsManagedResources
Int -> ReadS AwsManagedResources
ReadS [AwsManagedResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsManagedResources]
$creadListPrec :: ReadPrec [AwsManagedResources]
readPrec :: ReadPrec AwsManagedResources
$creadPrec :: ReadPrec AwsManagedResources
readList :: ReadS [AwsManagedResources]
$creadList :: ReadS [AwsManagedResources]
readsPrec :: Int -> ReadS AwsManagedResources
$creadsPrec :: Int -> ReadS AwsManagedResources
Prelude.Read, Int -> AwsManagedResources -> ShowS
[AwsManagedResources] -> ShowS
AwsManagedResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsManagedResources] -> ShowS
$cshowList :: [AwsManagedResources] -> ShowS
show :: AwsManagedResources -> String
$cshow :: AwsManagedResources -> String
showsPrec :: Int -> AwsManagedResources -> ShowS
$cshowsPrec :: Int -> AwsManagedResources -> ShowS
Prelude.Show, forall x. Rep AwsManagedResources x -> AwsManagedResources
forall x. AwsManagedResources -> Rep AwsManagedResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsManagedResources x -> AwsManagedResources
$cfrom :: forall x. AwsManagedResources -> Rep AwsManagedResources x
Prelude.Generic)

-- |
-- Create a value of 'AwsManagedResources' 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:
--
-- 'targetDestination', 'awsManagedResources_targetDestination' - The choice of application destination that you specify.
newAwsManagedResources ::
  -- | 'targetDestination'
  Prelude.NonEmpty AwsManagedTargetDestination ->
  AwsManagedResources
newAwsManagedResources :: NonEmpty AwsManagedTargetDestination -> AwsManagedResources
newAwsManagedResources NonEmpty AwsManagedTargetDestination
pTargetDestination_ =
  AwsManagedResources'
    { $sel:targetDestination:AwsManagedResources' :: NonEmpty AwsManagedTargetDestination
targetDestination =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty AwsManagedTargetDestination
pTargetDestination_
    }

-- | The choice of application destination that you specify.
awsManagedResources_targetDestination :: Lens.Lens' AwsManagedResources (Prelude.NonEmpty AwsManagedTargetDestination)
awsManagedResources_targetDestination :: Lens' AwsManagedResources (NonEmpty AwsManagedTargetDestination)
awsManagedResources_targetDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsManagedResources' {NonEmpty AwsManagedTargetDestination
targetDestination :: NonEmpty AwsManagedTargetDestination
$sel:targetDestination:AwsManagedResources' :: AwsManagedResources -> NonEmpty AwsManagedTargetDestination
targetDestination} -> NonEmpty AwsManagedTargetDestination
targetDestination) (\s :: AwsManagedResources
s@AwsManagedResources' {} NonEmpty AwsManagedTargetDestination
a -> AwsManagedResources
s {$sel:targetDestination:AwsManagedResources' :: NonEmpty AwsManagedTargetDestination
targetDestination = NonEmpty AwsManagedTargetDestination
a} :: AwsManagedResources) 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 AwsManagedResources where
  parseJSON :: Value -> Parser AwsManagedResources
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AwsManagedResources"
      ( \Object
x ->
          NonEmpty AwsManagedTargetDestination -> AwsManagedResources
AwsManagedResources'
            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
"targetDestination")
      )

instance Prelude.Hashable AwsManagedResources where
  hashWithSalt :: Int -> AwsManagedResources -> Int
hashWithSalt Int
_salt AwsManagedResources' {NonEmpty AwsManagedTargetDestination
targetDestination :: NonEmpty AwsManagedTargetDestination
$sel:targetDestination:AwsManagedResources' :: AwsManagedResources -> NonEmpty AwsManagedTargetDestination
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty AwsManagedTargetDestination
targetDestination

instance Prelude.NFData AwsManagedResources where
  rnf :: AwsManagedResources -> ()
rnf AwsManagedResources' {NonEmpty AwsManagedTargetDestination
targetDestination :: NonEmpty AwsManagedTargetDestination
$sel:targetDestination:AwsManagedResources' :: AwsManagedResources -> NonEmpty AwsManagedTargetDestination
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty AwsManagedTargetDestination
targetDestination

instance Data.ToJSON AwsManagedResources where
  toJSON :: AwsManagedResources -> Value
toJSON AwsManagedResources' {NonEmpty AwsManagedTargetDestination
targetDestination :: NonEmpty AwsManagedTargetDestination
$sel:targetDestination:AwsManagedResources' :: AwsManagedResources -> NonEmpty AwsManagedTargetDestination
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"targetDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty AwsManagedTargetDestination
targetDestination)
          ]
      )