{-# 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.SageMaker.RetryPipelineExecution
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retry the execution of the pipeline.
module Amazonka.SageMaker.RetryPipelineExecution
  ( -- * Creating a Request
    RetryPipelineExecution (..),
    newRetryPipelineExecution,

    -- * Request Lenses
    retryPipelineExecution_parallelismConfiguration,
    retryPipelineExecution_pipelineExecutionArn,
    retryPipelineExecution_clientRequestToken,

    -- * Destructuring the Response
    RetryPipelineExecutionResponse (..),
    newRetryPipelineExecutionResponse,

    -- * Response Lenses
    retryPipelineExecutionResponse_pipelineExecutionArn,
    retryPipelineExecutionResponse_httpStatus,
  )
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMaker.Types

-- | /See:/ 'newRetryPipelineExecution' smart constructor.
data RetryPipelineExecution = RetryPipelineExecution'
  { -- | This configuration, if specified, overrides the parallelism
    -- configuration of the parent pipeline.
    RetryPipelineExecution -> Maybe ParallelismConfiguration
parallelismConfiguration :: Prelude.Maybe ParallelismConfiguration,
    -- | The Amazon Resource Name (ARN) of the pipeline execution.
    RetryPipelineExecution -> Text
pipelineExecutionArn :: Prelude.Text,
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the operation. An idempotent operation completes no more
    -- than once.
    RetryPipelineExecution -> Text
clientRequestToken :: Prelude.Text
  }
  deriving (RetryPipelineExecution -> RetryPipelineExecution -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetryPipelineExecution -> RetryPipelineExecution -> Bool
$c/= :: RetryPipelineExecution -> RetryPipelineExecution -> Bool
== :: RetryPipelineExecution -> RetryPipelineExecution -> Bool
$c== :: RetryPipelineExecution -> RetryPipelineExecution -> Bool
Prelude.Eq, ReadPrec [RetryPipelineExecution]
ReadPrec RetryPipelineExecution
Int -> ReadS RetryPipelineExecution
ReadS [RetryPipelineExecution]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetryPipelineExecution]
$creadListPrec :: ReadPrec [RetryPipelineExecution]
readPrec :: ReadPrec RetryPipelineExecution
$creadPrec :: ReadPrec RetryPipelineExecution
readList :: ReadS [RetryPipelineExecution]
$creadList :: ReadS [RetryPipelineExecution]
readsPrec :: Int -> ReadS RetryPipelineExecution
$creadsPrec :: Int -> ReadS RetryPipelineExecution
Prelude.Read, Int -> RetryPipelineExecution -> ShowS
[RetryPipelineExecution] -> ShowS
RetryPipelineExecution -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetryPipelineExecution] -> ShowS
$cshowList :: [RetryPipelineExecution] -> ShowS
show :: RetryPipelineExecution -> String
$cshow :: RetryPipelineExecution -> String
showsPrec :: Int -> RetryPipelineExecution -> ShowS
$cshowsPrec :: Int -> RetryPipelineExecution -> ShowS
Prelude.Show, forall x. Rep RetryPipelineExecution x -> RetryPipelineExecution
forall x. RetryPipelineExecution -> Rep RetryPipelineExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RetryPipelineExecution x -> RetryPipelineExecution
$cfrom :: forall x. RetryPipelineExecution -> Rep RetryPipelineExecution x
Prelude.Generic)

-- |
-- Create a value of 'RetryPipelineExecution' 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:
--
-- 'parallelismConfiguration', 'retryPipelineExecution_parallelismConfiguration' - This configuration, if specified, overrides the parallelism
-- configuration of the parent pipeline.
--
-- 'pipelineExecutionArn', 'retryPipelineExecution_pipelineExecutionArn' - The Amazon Resource Name (ARN) of the pipeline execution.
--
-- 'clientRequestToken', 'retryPipelineExecution_clientRequestToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the operation. An idempotent operation completes no more
-- than once.
newRetryPipelineExecution ::
  -- | 'pipelineExecutionArn'
  Prelude.Text ->
  -- | 'clientRequestToken'
  Prelude.Text ->
  RetryPipelineExecution
newRetryPipelineExecution :: Text -> Text -> RetryPipelineExecution
newRetryPipelineExecution
  Text
pPipelineExecutionArn_
  Text
pClientRequestToken_ =
    RetryPipelineExecution'
      { $sel:parallelismConfiguration:RetryPipelineExecution' :: Maybe ParallelismConfiguration
parallelismConfiguration =
          forall a. Maybe a
Prelude.Nothing,
        $sel:pipelineExecutionArn:RetryPipelineExecution' :: Text
pipelineExecutionArn = Text
pPipelineExecutionArn_,
        $sel:clientRequestToken:RetryPipelineExecution' :: Text
clientRequestToken = Text
pClientRequestToken_
      }

-- | This configuration, if specified, overrides the parallelism
-- configuration of the parent pipeline.
retryPipelineExecution_parallelismConfiguration :: Lens.Lens' RetryPipelineExecution (Prelude.Maybe ParallelismConfiguration)
retryPipelineExecution_parallelismConfiguration :: Lens' RetryPipelineExecution (Maybe ParallelismConfiguration)
retryPipelineExecution_parallelismConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryPipelineExecution' {Maybe ParallelismConfiguration
parallelismConfiguration :: Maybe ParallelismConfiguration
$sel:parallelismConfiguration:RetryPipelineExecution' :: RetryPipelineExecution -> Maybe ParallelismConfiguration
parallelismConfiguration} -> Maybe ParallelismConfiguration
parallelismConfiguration) (\s :: RetryPipelineExecution
s@RetryPipelineExecution' {} Maybe ParallelismConfiguration
a -> RetryPipelineExecution
s {$sel:parallelismConfiguration:RetryPipelineExecution' :: Maybe ParallelismConfiguration
parallelismConfiguration = Maybe ParallelismConfiguration
a} :: RetryPipelineExecution)

-- | The Amazon Resource Name (ARN) of the pipeline execution.
retryPipelineExecution_pipelineExecutionArn :: Lens.Lens' RetryPipelineExecution Prelude.Text
retryPipelineExecution_pipelineExecutionArn :: Lens' RetryPipelineExecution Text
retryPipelineExecution_pipelineExecutionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryPipelineExecution' {Text
pipelineExecutionArn :: Text
$sel:pipelineExecutionArn:RetryPipelineExecution' :: RetryPipelineExecution -> Text
pipelineExecutionArn} -> Text
pipelineExecutionArn) (\s :: RetryPipelineExecution
s@RetryPipelineExecution' {} Text
a -> RetryPipelineExecution
s {$sel:pipelineExecutionArn:RetryPipelineExecution' :: Text
pipelineExecutionArn = Text
a} :: RetryPipelineExecution)

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the operation. An idempotent operation completes no more
-- than once.
retryPipelineExecution_clientRequestToken :: Lens.Lens' RetryPipelineExecution Prelude.Text
retryPipelineExecution_clientRequestToken :: Lens' RetryPipelineExecution Text
retryPipelineExecution_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryPipelineExecution' {Text
clientRequestToken :: Text
$sel:clientRequestToken:RetryPipelineExecution' :: RetryPipelineExecution -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: RetryPipelineExecution
s@RetryPipelineExecution' {} Text
a -> RetryPipelineExecution
s {$sel:clientRequestToken:RetryPipelineExecution' :: Text
clientRequestToken = Text
a} :: RetryPipelineExecution)

instance Core.AWSRequest RetryPipelineExecution where
  type
    AWSResponse RetryPipelineExecution =
      RetryPipelineExecutionResponse
  request :: (Service -> Service)
-> RetryPipelineExecution -> Request RetryPipelineExecution
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 RetryPipelineExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RetryPipelineExecution)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> RetryPipelineExecutionResponse
RetryPipelineExecutionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PipelineExecutionArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable RetryPipelineExecution where
  hashWithSalt :: Int -> RetryPipelineExecution -> Int
hashWithSalt Int
_salt RetryPipelineExecution' {Maybe ParallelismConfiguration
Text
clientRequestToken :: Text
pipelineExecutionArn :: Text
parallelismConfiguration :: Maybe ParallelismConfiguration
$sel:clientRequestToken:RetryPipelineExecution' :: RetryPipelineExecution -> Text
$sel:pipelineExecutionArn:RetryPipelineExecution' :: RetryPipelineExecution -> Text
$sel:parallelismConfiguration:RetryPipelineExecution' :: RetryPipelineExecution -> Maybe ParallelismConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ParallelismConfiguration
parallelismConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pipelineExecutionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientRequestToken

instance Prelude.NFData RetryPipelineExecution where
  rnf :: RetryPipelineExecution -> ()
rnf RetryPipelineExecution' {Maybe ParallelismConfiguration
Text
clientRequestToken :: Text
pipelineExecutionArn :: Text
parallelismConfiguration :: Maybe ParallelismConfiguration
$sel:clientRequestToken:RetryPipelineExecution' :: RetryPipelineExecution -> Text
$sel:pipelineExecutionArn:RetryPipelineExecution' :: RetryPipelineExecution -> Text
$sel:parallelismConfiguration:RetryPipelineExecution' :: RetryPipelineExecution -> Maybe ParallelismConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ParallelismConfiguration
parallelismConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
pipelineExecutionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clientRequestToken

instance Data.ToHeaders RetryPipelineExecution where
  toHeaders :: RetryPipelineExecution -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SageMaker.RetryPipelineExecution" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON RetryPipelineExecution where
  toJSON :: RetryPipelineExecution -> Value
toJSON RetryPipelineExecution' {Maybe ParallelismConfiguration
Text
clientRequestToken :: Text
pipelineExecutionArn :: Text
parallelismConfiguration :: Maybe ParallelismConfiguration
$sel:clientRequestToken:RetryPipelineExecution' :: RetryPipelineExecution -> Text
$sel:pipelineExecutionArn:RetryPipelineExecution' :: RetryPipelineExecution -> Text
$sel:parallelismConfiguration:RetryPipelineExecution' :: RetryPipelineExecution -> Maybe ParallelismConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ParallelismConfiguration" 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 ParallelismConfiguration
parallelismConfiguration,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"PipelineExecutionArn"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
pipelineExecutionArn
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ClientRequestToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clientRequestToken)
          ]
      )

instance Data.ToPath RetryPipelineExecution where
  toPath :: RetryPipelineExecution -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newRetryPipelineExecutionResponse' smart constructor.
data RetryPipelineExecutionResponse = RetryPipelineExecutionResponse'
  { -- | The Amazon Resource Name (ARN) of the pipeline execution.
    RetryPipelineExecutionResponse -> Maybe Text
pipelineExecutionArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    RetryPipelineExecutionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RetryPipelineExecutionResponse
-> RetryPipelineExecutionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetryPipelineExecutionResponse
-> RetryPipelineExecutionResponse -> Bool
$c/= :: RetryPipelineExecutionResponse
-> RetryPipelineExecutionResponse -> Bool
== :: RetryPipelineExecutionResponse
-> RetryPipelineExecutionResponse -> Bool
$c== :: RetryPipelineExecutionResponse
-> RetryPipelineExecutionResponse -> Bool
Prelude.Eq, ReadPrec [RetryPipelineExecutionResponse]
ReadPrec RetryPipelineExecutionResponse
Int -> ReadS RetryPipelineExecutionResponse
ReadS [RetryPipelineExecutionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetryPipelineExecutionResponse]
$creadListPrec :: ReadPrec [RetryPipelineExecutionResponse]
readPrec :: ReadPrec RetryPipelineExecutionResponse
$creadPrec :: ReadPrec RetryPipelineExecutionResponse
readList :: ReadS [RetryPipelineExecutionResponse]
$creadList :: ReadS [RetryPipelineExecutionResponse]
readsPrec :: Int -> ReadS RetryPipelineExecutionResponse
$creadsPrec :: Int -> ReadS RetryPipelineExecutionResponse
Prelude.Read, Int -> RetryPipelineExecutionResponse -> ShowS
[RetryPipelineExecutionResponse] -> ShowS
RetryPipelineExecutionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetryPipelineExecutionResponse] -> ShowS
$cshowList :: [RetryPipelineExecutionResponse] -> ShowS
show :: RetryPipelineExecutionResponse -> String
$cshow :: RetryPipelineExecutionResponse -> String
showsPrec :: Int -> RetryPipelineExecutionResponse -> ShowS
$cshowsPrec :: Int -> RetryPipelineExecutionResponse -> ShowS
Prelude.Show, forall x.
Rep RetryPipelineExecutionResponse x
-> RetryPipelineExecutionResponse
forall x.
RetryPipelineExecutionResponse
-> Rep RetryPipelineExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RetryPipelineExecutionResponse x
-> RetryPipelineExecutionResponse
$cfrom :: forall x.
RetryPipelineExecutionResponse
-> Rep RetryPipelineExecutionResponse x
Prelude.Generic)

-- |
-- Create a value of 'RetryPipelineExecutionResponse' 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:
--
-- 'pipelineExecutionArn', 'retryPipelineExecutionResponse_pipelineExecutionArn' - The Amazon Resource Name (ARN) of the pipeline execution.
--
-- 'httpStatus', 'retryPipelineExecutionResponse_httpStatus' - The response's http status code.
newRetryPipelineExecutionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RetryPipelineExecutionResponse
newRetryPipelineExecutionResponse :: Int -> RetryPipelineExecutionResponse
newRetryPipelineExecutionResponse Int
pHttpStatus_ =
  RetryPipelineExecutionResponse'
    { $sel:pipelineExecutionArn:RetryPipelineExecutionResponse' :: Maybe Text
pipelineExecutionArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RetryPipelineExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the pipeline execution.
retryPipelineExecutionResponse_pipelineExecutionArn :: Lens.Lens' RetryPipelineExecutionResponse (Prelude.Maybe Prelude.Text)
retryPipelineExecutionResponse_pipelineExecutionArn :: Lens' RetryPipelineExecutionResponse (Maybe Text)
retryPipelineExecutionResponse_pipelineExecutionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryPipelineExecutionResponse' {Maybe Text
pipelineExecutionArn :: Maybe Text
$sel:pipelineExecutionArn:RetryPipelineExecutionResponse' :: RetryPipelineExecutionResponse -> Maybe Text
pipelineExecutionArn} -> Maybe Text
pipelineExecutionArn) (\s :: RetryPipelineExecutionResponse
s@RetryPipelineExecutionResponse' {} Maybe Text
a -> RetryPipelineExecutionResponse
s {$sel:pipelineExecutionArn:RetryPipelineExecutionResponse' :: Maybe Text
pipelineExecutionArn = Maybe Text
a} :: RetryPipelineExecutionResponse)

-- | The response's http status code.
retryPipelineExecutionResponse_httpStatus :: Lens.Lens' RetryPipelineExecutionResponse Prelude.Int
retryPipelineExecutionResponse_httpStatus :: Lens' RetryPipelineExecutionResponse Int
retryPipelineExecutionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetryPipelineExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:RetryPipelineExecutionResponse' :: RetryPipelineExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RetryPipelineExecutionResponse
s@RetryPipelineExecutionResponse' {} Int
a -> RetryPipelineExecutionResponse
s {$sel:httpStatus:RetryPipelineExecutionResponse' :: Int
httpStatus = Int
a} :: RetryPipelineExecutionResponse)

instance
  Prelude.NFData
    RetryPipelineExecutionResponse
  where
  rnf :: RetryPipelineExecutionResponse -> ()
rnf RetryPipelineExecutionResponse' {Int
Maybe Text
httpStatus :: Int
pipelineExecutionArn :: Maybe Text
$sel:httpStatus:RetryPipelineExecutionResponse' :: RetryPipelineExecutionResponse -> Int
$sel:pipelineExecutionArn:RetryPipelineExecutionResponse' :: RetryPipelineExecutionResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pipelineExecutionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus