{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_pipelineExecutionArn,
    retryPipelineExecution_clientRequestToken,

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

    -- * Response Lenses
    retryPipelineExecutionResponse_pipelineExecutionArn,
    retryPipelineExecutionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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
(RetryPipelineExecution -> RetryPipelineExecution -> Bool)
-> (RetryPipelineExecution -> RetryPipelineExecution -> Bool)
-> Eq RetryPipelineExecution
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]
(Int -> ReadS RetryPipelineExecution)
-> ReadS [RetryPipelineExecution]
-> ReadPrec RetryPipelineExecution
-> ReadPrec [RetryPipelineExecution]
-> Read 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
(Int -> RetryPipelineExecution -> ShowS)
-> (RetryPipelineExecution -> String)
-> ([RetryPipelineExecution] -> ShowS)
-> Show RetryPipelineExecution
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. RetryPipelineExecution -> Rep RetryPipelineExecution x)
-> (forall x.
    Rep RetryPipelineExecution x -> RetryPipelineExecution)
-> Generic RetryPipelineExecution
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:
--
-- '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' :: Text -> Text -> RetryPipelineExecution
RetryPipelineExecution'
      { $sel:pipelineExecutionArn:RetryPipelineExecution' :: Text
pipelineExecutionArn =
          Text
pPipelineExecutionArn_,
        $sel:clientRequestToken:RetryPipelineExecution' :: Text
clientRequestToken = Text
pClientRequestToken_
      }

-- | The Amazon Resource Name (ARN) of the pipeline execution.
retryPipelineExecution_pipelineExecutionArn :: Lens.Lens' RetryPipelineExecution Prelude.Text
retryPipelineExecution_pipelineExecutionArn :: (Text -> f Text)
-> RetryPipelineExecution -> f RetryPipelineExecution
retryPipelineExecution_pipelineExecutionArn = (RetryPipelineExecution -> Text)
-> (RetryPipelineExecution -> Text -> RetryPipelineExecution)
-> Lens RetryPipelineExecution RetryPipelineExecution Text Text
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 :: (Text -> f Text)
-> RetryPipelineExecution -> f RetryPipelineExecution
retryPipelineExecution_clientRequestToken = (RetryPipelineExecution -> Text)
-> (RetryPipelineExecution -> Text -> RetryPipelineExecution)
-> Lens RetryPipelineExecution RetryPipelineExecution Text Text
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 :: RetryPipelineExecution -> Request RetryPipelineExecution
request = Service -> RetryPipelineExecution -> Request RetryPipelineExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RetryPipelineExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RetryPipelineExecution)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse RetryPipelineExecution))
-> Logger
-> Service
-> Proxy RetryPipelineExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RetryPipelineExecution)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> RetryPipelineExecutionResponse
RetryPipelineExecutionResponse'
            (Maybe Text -> Int -> RetryPipelineExecutionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RetryPipelineExecutionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PipelineExecutionArn")
            Either String (Int -> RetryPipelineExecutionResponse)
-> Either String Int
-> Either String RetryPipelineExecutionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable RetryPipelineExecution

instance Prelude.NFData RetryPipelineExecution

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

instance Core.ToJSON RetryPipelineExecution where
  toJSON :: RetryPipelineExecution -> Value
toJSON RetryPipelineExecution' {Text
clientRequestToken :: Text
pipelineExecutionArn :: Text
$sel:clientRequestToken:RetryPipelineExecution' :: RetryPipelineExecution -> Text
$sel:pipelineExecutionArn:RetryPipelineExecution' :: RetryPipelineExecution -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"PipelineExecutionArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pipelineExecutionArn
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ClientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientRequestToken)
          ]
      )

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

instance Core.ToQuery RetryPipelineExecution where
  toQuery :: RetryPipelineExecution -> QueryString
toQuery = QueryString -> RetryPipelineExecution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(RetryPipelineExecutionResponse
 -> RetryPipelineExecutionResponse -> Bool)
-> (RetryPipelineExecutionResponse
    -> RetryPipelineExecutionResponse -> Bool)
-> Eq RetryPipelineExecutionResponse
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]
(Int -> ReadS RetryPipelineExecutionResponse)
-> ReadS [RetryPipelineExecutionResponse]
-> ReadPrec RetryPipelineExecutionResponse
-> ReadPrec [RetryPipelineExecutionResponse]
-> Read 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
(Int -> RetryPipelineExecutionResponse -> ShowS)
-> (RetryPipelineExecutionResponse -> String)
-> ([RetryPipelineExecutionResponse] -> ShowS)
-> Show RetryPipelineExecutionResponse
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.
 RetryPipelineExecutionResponse
 -> Rep RetryPipelineExecutionResponse x)
-> (forall x.
    Rep RetryPipelineExecutionResponse x
    -> RetryPipelineExecutionResponse)
-> Generic RetryPipelineExecutionResponse
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' :: Maybe Text -> Int -> RetryPipelineExecutionResponse
RetryPipelineExecutionResponse'
    { $sel:pipelineExecutionArn:RetryPipelineExecutionResponse' :: Maybe Text
pipelineExecutionArn =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> RetryPipelineExecutionResponse
-> f RetryPipelineExecutionResponse
retryPipelineExecutionResponse_pipelineExecutionArn = (RetryPipelineExecutionResponse -> Maybe Text)
-> (RetryPipelineExecutionResponse
    -> Maybe Text -> RetryPipelineExecutionResponse)
-> Lens
     RetryPipelineExecutionResponse
     RetryPipelineExecutionResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int)
-> RetryPipelineExecutionResponse
-> f RetryPipelineExecutionResponse
retryPipelineExecutionResponse_httpStatus = (RetryPipelineExecutionResponse -> Int)
-> (RetryPipelineExecutionResponse
    -> Int -> RetryPipelineExecutionResponse)
-> Lens
     RetryPipelineExecutionResponse
     RetryPipelineExecutionResponse
     Int
     Int
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