{-# 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.MigrationHubOrchestrator.Types.Tool
-- 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.MigrationHubOrchestrator.Types.Tool 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

-- | List of AWS services utilized in a migration workflow.
--
-- /See:/ 'newTool' smart constructor.
data Tool = Tool'
  { -- | The name of an AWS service.
    Tool -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The URL of an AWS service.
    Tool -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (Tool -> Tool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Tool -> Tool -> Bool
$c/= :: Tool -> Tool -> Bool
== :: Tool -> Tool -> Bool
$c== :: Tool -> Tool -> Bool
Prelude.Eq, ReadPrec [Tool]
ReadPrec Tool
Int -> ReadS Tool
ReadS [Tool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Tool]
$creadListPrec :: ReadPrec [Tool]
readPrec :: ReadPrec Tool
$creadPrec :: ReadPrec Tool
readList :: ReadS [Tool]
$creadList :: ReadS [Tool]
readsPrec :: Int -> ReadS Tool
$creadsPrec :: Int -> ReadS Tool
Prelude.Read, Int -> Tool -> ShowS
[Tool] -> ShowS
Tool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Tool] -> ShowS
$cshowList :: [Tool] -> ShowS
show :: Tool -> String
$cshow :: Tool -> String
showsPrec :: Int -> Tool -> ShowS
$cshowsPrec :: Int -> Tool -> ShowS
Prelude.Show, forall x. Rep Tool x -> Tool
forall x. Tool -> Rep Tool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Tool x -> Tool
$cfrom :: forall x. Tool -> Rep Tool x
Prelude.Generic)

-- |
-- Create a value of 'Tool' 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:
--
-- 'name', 'tool_name' - The name of an AWS service.
--
-- 'url', 'tool_url' - The URL of an AWS service.
newTool ::
  Tool
newTool :: Tool
newTool =
  Tool'
    { $sel:name:Tool' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:url:Tool' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of an AWS service.
tool_name :: Lens.Lens' Tool (Prelude.Maybe Prelude.Text)
tool_name :: Lens' Tool (Maybe Text)
tool_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tool' {Maybe Text
name :: Maybe Text
$sel:name:Tool' :: Tool -> Maybe Text
name} -> Maybe Text
name) (\s :: Tool
s@Tool' {} Maybe Text
a -> Tool
s {$sel:name:Tool' :: Maybe Text
name = Maybe Text
a} :: Tool)

-- | The URL of an AWS service.
tool_url :: Lens.Lens' Tool (Prelude.Maybe Prelude.Text)
tool_url :: Lens' Tool (Maybe Text)
tool_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tool' {Maybe Text
url :: Maybe Text
$sel:url:Tool' :: Tool -> Maybe Text
url} -> Maybe Text
url) (\s :: Tool
s@Tool' {} Maybe Text
a -> Tool
s {$sel:url:Tool' :: Maybe Text
url = Maybe Text
a} :: Tool)

instance Data.FromJSON Tool where
  parseJSON :: Value -> Parser Tool
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Tool"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Tool
Tool'
            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
"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
"url")
      )

instance Prelude.Hashable Tool where
  hashWithSalt :: Int -> Tool -> Int
hashWithSalt Int
_salt Tool' {Maybe Text
url :: Maybe Text
name :: Maybe Text
$sel:url:Tool' :: Tool -> Maybe Text
$sel:name:Tool' :: Tool -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url

instance Prelude.NFData Tool where
  rnf :: Tool -> ()
rnf Tool' {Maybe Text
url :: Maybe Text
name :: Maybe Text
$sel:url:Tool' :: Tool -> Maybe Text
$sel:name:Tool' :: Tool -> Maybe Text
..} =
    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 Maybe Text
url