{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Omics.UpdateWorkflow
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates a workflow.
module Amazonka.Omics.UpdateWorkflow
  ( -- * Creating a Request
    UpdateWorkflow (..),
    newUpdateWorkflow,

    -- * Request Lenses
    updateWorkflow_description,
    updateWorkflow_name,
    updateWorkflow_id,

    -- * Destructuring the Response
    UpdateWorkflowResponse (..),
    newUpdateWorkflowResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Omics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateWorkflow' smart constructor.
data UpdateWorkflow = UpdateWorkflow'
  { -- | A description for the workflow.
    UpdateWorkflow -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A name for the workflow.
    UpdateWorkflow -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The workflow\'s ID.
    UpdateWorkflow -> Text
id :: Prelude.Text
  }
  deriving (UpdateWorkflow -> UpdateWorkflow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkflow -> UpdateWorkflow -> Bool
$c/= :: UpdateWorkflow -> UpdateWorkflow -> Bool
== :: UpdateWorkflow -> UpdateWorkflow -> Bool
$c== :: UpdateWorkflow -> UpdateWorkflow -> Bool
Prelude.Eq, ReadPrec [UpdateWorkflow]
ReadPrec UpdateWorkflow
Int -> ReadS UpdateWorkflow
ReadS [UpdateWorkflow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkflow]
$creadListPrec :: ReadPrec [UpdateWorkflow]
readPrec :: ReadPrec UpdateWorkflow
$creadPrec :: ReadPrec UpdateWorkflow
readList :: ReadS [UpdateWorkflow]
$creadList :: ReadS [UpdateWorkflow]
readsPrec :: Int -> ReadS UpdateWorkflow
$creadsPrec :: Int -> ReadS UpdateWorkflow
Prelude.Read, Int -> UpdateWorkflow -> ShowS
[UpdateWorkflow] -> ShowS
UpdateWorkflow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkflow] -> ShowS
$cshowList :: [UpdateWorkflow] -> ShowS
show :: UpdateWorkflow -> String
$cshow :: UpdateWorkflow -> String
showsPrec :: Int -> UpdateWorkflow -> ShowS
$cshowsPrec :: Int -> UpdateWorkflow -> ShowS
Prelude.Show, forall x. Rep UpdateWorkflow x -> UpdateWorkflow
forall x. UpdateWorkflow -> Rep UpdateWorkflow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkflow x -> UpdateWorkflow
$cfrom :: forall x. UpdateWorkflow -> Rep UpdateWorkflow x
Prelude.Generic)

-- |
-- Create a value of 'UpdateWorkflow' 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:
--
-- 'description', 'updateWorkflow_description' - A description for the workflow.
--
-- 'name', 'updateWorkflow_name' - A name for the workflow.
--
-- 'id', 'updateWorkflow_id' - The workflow\'s ID.
newUpdateWorkflow ::
  -- | 'id'
  Prelude.Text ->
  UpdateWorkflow
newUpdateWorkflow :: Text -> UpdateWorkflow
newUpdateWorkflow Text
pId_ =
  UpdateWorkflow'
    { $sel:description:UpdateWorkflow' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateWorkflow' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:id:UpdateWorkflow' :: Text
id = Text
pId_
    }

-- | A description for the workflow.
updateWorkflow_description :: Lens.Lens' UpdateWorkflow (Prelude.Maybe Prelude.Text)
updateWorkflow_description :: Lens' UpdateWorkflow (Maybe Text)
updateWorkflow_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkflow' {Maybe Text
description :: Maybe Text
$sel:description:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateWorkflow
s@UpdateWorkflow' {} Maybe Text
a -> UpdateWorkflow
s {$sel:description:UpdateWorkflow' :: Maybe Text
description = Maybe Text
a} :: UpdateWorkflow)

-- | A name for the workflow.
updateWorkflow_name :: Lens.Lens' UpdateWorkflow (Prelude.Maybe Prelude.Text)
updateWorkflow_name :: Lens' UpdateWorkflow (Maybe Text)
updateWorkflow_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkflow' {Maybe Text
name :: Maybe Text
$sel:name:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateWorkflow
s@UpdateWorkflow' {} Maybe Text
a -> UpdateWorkflow
s {$sel:name:UpdateWorkflow' :: Maybe Text
name = Maybe Text
a} :: UpdateWorkflow)

-- | The workflow\'s ID.
updateWorkflow_id :: Lens.Lens' UpdateWorkflow Prelude.Text
updateWorkflow_id :: Lens' UpdateWorkflow Text
updateWorkflow_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkflow' {Text
id :: Text
$sel:id:UpdateWorkflow' :: UpdateWorkflow -> Text
id} -> Text
id) (\s :: UpdateWorkflow
s@UpdateWorkflow' {} Text
a -> UpdateWorkflow
s {$sel:id:UpdateWorkflow' :: Text
id = Text
a} :: UpdateWorkflow)

instance Core.AWSRequest UpdateWorkflow where
  type
    AWSResponse UpdateWorkflow =
      UpdateWorkflowResponse
  request :: (Service -> Service) -> UpdateWorkflow -> Request UpdateWorkflow
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateWorkflow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateWorkflow)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull UpdateWorkflowResponse
UpdateWorkflowResponse'

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

instance Prelude.NFData UpdateWorkflow where
  rnf :: UpdateWorkflow -> ()
rnf UpdateWorkflow' {Maybe Text
Text
id :: Text
name :: Maybe Text
description :: Maybe Text
$sel:id:UpdateWorkflow' :: UpdateWorkflow -> Text
$sel:name:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
$sel:description:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      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
id

instance Data.ToHeaders UpdateWorkflow where
  toHeaders :: UpdateWorkflow -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateWorkflow where
  toJSON :: UpdateWorkflow -> Value
toJSON UpdateWorkflow' {Maybe Text
Text
id :: Text
name :: Maybe Text
description :: Maybe Text
$sel:id:UpdateWorkflow' :: UpdateWorkflow -> Text
$sel:name:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
$sel:description:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
          ]
      )

instance Data.ToPath UpdateWorkflow where
  toPath :: UpdateWorkflow -> ByteString
toPath UpdateWorkflow' {Maybe Text
Text
id :: Text
name :: Maybe Text
description :: Maybe Text
$sel:id:UpdateWorkflow' :: UpdateWorkflow -> Text
$sel:name:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
$sel:description:UpdateWorkflow' :: UpdateWorkflow -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/workflow/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]

instance Data.ToQuery UpdateWorkflow where
  toQuery :: UpdateWorkflow -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'UpdateWorkflowResponse' 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.
newUpdateWorkflowResponse ::
  UpdateWorkflowResponse
newUpdateWorkflowResponse :: UpdateWorkflowResponse
newUpdateWorkflowResponse = UpdateWorkflowResponse
UpdateWorkflowResponse'

instance Prelude.NFData UpdateWorkflowResponse where
  rnf :: UpdateWorkflowResponse -> ()
rnf UpdateWorkflowResponse
_ = ()