{-# 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.Personalize.StopSolutionVersionCreation
-- 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)
--
-- Stops creating a solution version that is in a state of CREATE_PENDING
-- or CREATE IN_PROGRESS.
--
-- Depending on the current state of the solution version, the solution
-- version state changes as follows:
--
-- -   CREATE_PENDING > CREATE_STOPPED
--
--     or
--
-- -   CREATE_IN_PROGRESS > CREATE_STOPPING > CREATE_STOPPED
--
-- You are billed for all of the training completed up until you stop the
-- solution version creation. You cannot resume creating a solution version
-- once it has been stopped.
module Amazonka.Personalize.StopSolutionVersionCreation
  ( -- * Creating a Request
    StopSolutionVersionCreation (..),
    newStopSolutionVersionCreation,

    -- * Request Lenses
    stopSolutionVersionCreation_solutionVersionArn,

    -- * Destructuring the Response
    StopSolutionVersionCreationResponse (..),
    newStopSolutionVersionCreationResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newStopSolutionVersionCreation' smart constructor.
data StopSolutionVersionCreation = StopSolutionVersionCreation'
  { -- | The Amazon Resource Name (ARN) of the solution version you want to stop
    -- creating.
    StopSolutionVersionCreation -> Text
solutionVersionArn :: Prelude.Text
  }
  deriving (StopSolutionVersionCreation -> StopSolutionVersionCreation -> Bool
(StopSolutionVersionCreation
 -> StopSolutionVersionCreation -> Bool)
-> (StopSolutionVersionCreation
    -> StopSolutionVersionCreation -> Bool)
-> Eq StopSolutionVersionCreation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopSolutionVersionCreation -> StopSolutionVersionCreation -> Bool
$c/= :: StopSolutionVersionCreation -> StopSolutionVersionCreation -> Bool
== :: StopSolutionVersionCreation -> StopSolutionVersionCreation -> Bool
$c== :: StopSolutionVersionCreation -> StopSolutionVersionCreation -> Bool
Prelude.Eq, ReadPrec [StopSolutionVersionCreation]
ReadPrec StopSolutionVersionCreation
Int -> ReadS StopSolutionVersionCreation
ReadS [StopSolutionVersionCreation]
(Int -> ReadS StopSolutionVersionCreation)
-> ReadS [StopSolutionVersionCreation]
-> ReadPrec StopSolutionVersionCreation
-> ReadPrec [StopSolutionVersionCreation]
-> Read StopSolutionVersionCreation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopSolutionVersionCreation]
$creadListPrec :: ReadPrec [StopSolutionVersionCreation]
readPrec :: ReadPrec StopSolutionVersionCreation
$creadPrec :: ReadPrec StopSolutionVersionCreation
readList :: ReadS [StopSolutionVersionCreation]
$creadList :: ReadS [StopSolutionVersionCreation]
readsPrec :: Int -> ReadS StopSolutionVersionCreation
$creadsPrec :: Int -> ReadS StopSolutionVersionCreation
Prelude.Read, Int -> StopSolutionVersionCreation -> ShowS
[StopSolutionVersionCreation] -> ShowS
StopSolutionVersionCreation -> String
(Int -> StopSolutionVersionCreation -> ShowS)
-> (StopSolutionVersionCreation -> String)
-> ([StopSolutionVersionCreation] -> ShowS)
-> Show StopSolutionVersionCreation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopSolutionVersionCreation] -> ShowS
$cshowList :: [StopSolutionVersionCreation] -> ShowS
show :: StopSolutionVersionCreation -> String
$cshow :: StopSolutionVersionCreation -> String
showsPrec :: Int -> StopSolutionVersionCreation -> ShowS
$cshowsPrec :: Int -> StopSolutionVersionCreation -> ShowS
Prelude.Show, (forall x.
 StopSolutionVersionCreation -> Rep StopSolutionVersionCreation x)
-> (forall x.
    Rep StopSolutionVersionCreation x -> StopSolutionVersionCreation)
-> Generic StopSolutionVersionCreation
forall x.
Rep StopSolutionVersionCreation x -> StopSolutionVersionCreation
forall x.
StopSolutionVersionCreation -> Rep StopSolutionVersionCreation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopSolutionVersionCreation x -> StopSolutionVersionCreation
$cfrom :: forall x.
StopSolutionVersionCreation -> Rep StopSolutionVersionCreation x
Prelude.Generic)

-- |
-- Create a value of 'StopSolutionVersionCreation' 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:
--
-- 'solutionVersionArn', 'stopSolutionVersionCreation_solutionVersionArn' - The Amazon Resource Name (ARN) of the solution version you want to stop
-- creating.
newStopSolutionVersionCreation ::
  -- | 'solutionVersionArn'
  Prelude.Text ->
  StopSolutionVersionCreation
newStopSolutionVersionCreation :: Text -> StopSolutionVersionCreation
newStopSolutionVersionCreation Text
pSolutionVersionArn_ =
  StopSolutionVersionCreation' :: Text -> StopSolutionVersionCreation
StopSolutionVersionCreation'
    { $sel:solutionVersionArn:StopSolutionVersionCreation' :: Text
solutionVersionArn =
        Text
pSolutionVersionArn_
    }

-- | The Amazon Resource Name (ARN) of the solution version you want to stop
-- creating.
stopSolutionVersionCreation_solutionVersionArn :: Lens.Lens' StopSolutionVersionCreation Prelude.Text
stopSolutionVersionCreation_solutionVersionArn :: (Text -> f Text)
-> StopSolutionVersionCreation -> f StopSolutionVersionCreation
stopSolutionVersionCreation_solutionVersionArn = (StopSolutionVersionCreation -> Text)
-> (StopSolutionVersionCreation
    -> Text -> StopSolutionVersionCreation)
-> Lens
     StopSolutionVersionCreation StopSolutionVersionCreation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopSolutionVersionCreation' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:StopSolutionVersionCreation' :: StopSolutionVersionCreation -> Text
solutionVersionArn} -> Text
solutionVersionArn) (\s :: StopSolutionVersionCreation
s@StopSolutionVersionCreation' {} Text
a -> StopSolutionVersionCreation
s {$sel:solutionVersionArn:StopSolutionVersionCreation' :: Text
solutionVersionArn = Text
a} :: StopSolutionVersionCreation)

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

instance Prelude.Hashable StopSolutionVersionCreation

instance Prelude.NFData StopSolutionVersionCreation

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

instance Core.ToJSON StopSolutionVersionCreation where
  toJSON :: StopSolutionVersionCreation -> Value
toJSON StopSolutionVersionCreation' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:StopSolutionVersionCreation' :: StopSolutionVersionCreation -> 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
"solutionVersionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
solutionVersionArn)
          ]
      )

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

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

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

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

instance
  Prelude.NFData
    StopSolutionVersionCreationResponse