{-# 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.SelfManageResources
-- 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.SelfManageResources 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.SelfManageTargetDestination
import qualified Amazonka.Prelude as Prelude

-- | Self-managed resources.
--
-- /See:/ 'newSelfManageResources' smart constructor.
data SelfManageResources = SelfManageResources'
  { -- | Self-managed resources target destination.
    SelfManageResources -> NonEmpty SelfManageTargetDestination
targetDestination :: Prelude.NonEmpty SelfManageTargetDestination
  }
  deriving (SelfManageResources -> SelfManageResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelfManageResources -> SelfManageResources -> Bool
$c/= :: SelfManageResources -> SelfManageResources -> Bool
== :: SelfManageResources -> SelfManageResources -> Bool
$c== :: SelfManageResources -> SelfManageResources -> Bool
Prelude.Eq, ReadPrec [SelfManageResources]
ReadPrec SelfManageResources
Int -> ReadS SelfManageResources
ReadS [SelfManageResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelfManageResources]
$creadListPrec :: ReadPrec [SelfManageResources]
readPrec :: ReadPrec SelfManageResources
$creadPrec :: ReadPrec SelfManageResources
readList :: ReadS [SelfManageResources]
$creadList :: ReadS [SelfManageResources]
readsPrec :: Int -> ReadS SelfManageResources
$creadsPrec :: Int -> ReadS SelfManageResources
Prelude.Read, Int -> SelfManageResources -> ShowS
[SelfManageResources] -> ShowS
SelfManageResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelfManageResources] -> ShowS
$cshowList :: [SelfManageResources] -> ShowS
show :: SelfManageResources -> String
$cshow :: SelfManageResources -> String
showsPrec :: Int -> SelfManageResources -> ShowS
$cshowsPrec :: Int -> SelfManageResources -> ShowS
Prelude.Show, forall x. Rep SelfManageResources x -> SelfManageResources
forall x. SelfManageResources -> Rep SelfManageResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelfManageResources x -> SelfManageResources
$cfrom :: forall x. SelfManageResources -> Rep SelfManageResources x
Prelude.Generic)

-- |
-- Create a value of 'SelfManageResources' 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', 'selfManageResources_targetDestination' - Self-managed resources target destination.
newSelfManageResources ::
  -- | 'targetDestination'
  Prelude.NonEmpty SelfManageTargetDestination ->
  SelfManageResources
newSelfManageResources :: NonEmpty SelfManageTargetDestination -> SelfManageResources
newSelfManageResources NonEmpty SelfManageTargetDestination
pTargetDestination_ =
  SelfManageResources'
    { $sel:targetDestination:SelfManageResources' :: NonEmpty SelfManageTargetDestination
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 SelfManageTargetDestination
pTargetDestination_
    }

-- | Self-managed resources target destination.
selfManageResources_targetDestination :: Lens.Lens' SelfManageResources (Prelude.NonEmpty SelfManageTargetDestination)
selfManageResources_targetDestination :: Lens' SelfManageResources (NonEmpty SelfManageTargetDestination)
selfManageResources_targetDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelfManageResources' {NonEmpty SelfManageTargetDestination
targetDestination :: NonEmpty SelfManageTargetDestination
$sel:targetDestination:SelfManageResources' :: SelfManageResources -> NonEmpty SelfManageTargetDestination
targetDestination} -> NonEmpty SelfManageTargetDestination
targetDestination) (\s :: SelfManageResources
s@SelfManageResources' {} NonEmpty SelfManageTargetDestination
a -> SelfManageResources
s {$sel:targetDestination:SelfManageResources' :: NonEmpty SelfManageTargetDestination
targetDestination = NonEmpty SelfManageTargetDestination
a} :: SelfManageResources) 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 SelfManageResources where
  parseJSON :: Value -> Parser SelfManageResources
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SelfManageResources"
      ( \Object
x ->
          NonEmpty SelfManageTargetDestination -> SelfManageResources
SelfManageResources'
            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 SelfManageResources where
  hashWithSalt :: Int -> SelfManageResources -> Int
hashWithSalt Int
_salt SelfManageResources' {NonEmpty SelfManageTargetDestination
targetDestination :: NonEmpty SelfManageTargetDestination
$sel:targetDestination:SelfManageResources' :: SelfManageResources -> NonEmpty SelfManageTargetDestination
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty SelfManageTargetDestination
targetDestination

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

instance Data.ToJSON SelfManageResources where
  toJSON :: SelfManageResources -> Value
toJSON SelfManageResources' {NonEmpty SelfManageTargetDestination
targetDestination :: NonEmpty SelfManageTargetDestination
$sel:targetDestination:SelfManageResources' :: SelfManageResources -> NonEmpty SelfManageTargetDestination
..} =
    [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 SelfManageTargetDestination
targetDestination)
          ]
      )