{-# 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.Glue.UpdateBlueprint
-- 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)
--
-- Updates a registered blueprint.
module Amazonka.Glue.UpdateBlueprint
  ( -- * Creating a Request
    UpdateBlueprint (..),
    newUpdateBlueprint,

    -- * Request Lenses
    updateBlueprint_description,
    updateBlueprint_name,
    updateBlueprint_blueprintLocation,

    -- * Destructuring the Response
    UpdateBlueprintResponse (..),
    newUpdateBlueprintResponse,

    -- * Response Lenses
    updateBlueprintResponse_name,
    updateBlueprintResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateBlueprint' smart constructor.
data UpdateBlueprint = UpdateBlueprint'
  { -- | A description of the blueprint.
    UpdateBlueprint -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the blueprint.
    UpdateBlueprint -> Text
name :: Prelude.Text,
    -- | Specifies a path in Amazon S3 where the blueprint is published.
    UpdateBlueprint -> Text
blueprintLocation :: Prelude.Text
  }
  deriving (UpdateBlueprint -> UpdateBlueprint -> Bool
(UpdateBlueprint -> UpdateBlueprint -> Bool)
-> (UpdateBlueprint -> UpdateBlueprint -> Bool)
-> Eq UpdateBlueprint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBlueprint -> UpdateBlueprint -> Bool
$c/= :: UpdateBlueprint -> UpdateBlueprint -> Bool
== :: UpdateBlueprint -> UpdateBlueprint -> Bool
$c== :: UpdateBlueprint -> UpdateBlueprint -> Bool
Prelude.Eq, ReadPrec [UpdateBlueprint]
ReadPrec UpdateBlueprint
Int -> ReadS UpdateBlueprint
ReadS [UpdateBlueprint]
(Int -> ReadS UpdateBlueprint)
-> ReadS [UpdateBlueprint]
-> ReadPrec UpdateBlueprint
-> ReadPrec [UpdateBlueprint]
-> Read UpdateBlueprint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBlueprint]
$creadListPrec :: ReadPrec [UpdateBlueprint]
readPrec :: ReadPrec UpdateBlueprint
$creadPrec :: ReadPrec UpdateBlueprint
readList :: ReadS [UpdateBlueprint]
$creadList :: ReadS [UpdateBlueprint]
readsPrec :: Int -> ReadS UpdateBlueprint
$creadsPrec :: Int -> ReadS UpdateBlueprint
Prelude.Read, Int -> UpdateBlueprint -> ShowS
[UpdateBlueprint] -> ShowS
UpdateBlueprint -> String
(Int -> UpdateBlueprint -> ShowS)
-> (UpdateBlueprint -> String)
-> ([UpdateBlueprint] -> ShowS)
-> Show UpdateBlueprint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBlueprint] -> ShowS
$cshowList :: [UpdateBlueprint] -> ShowS
show :: UpdateBlueprint -> String
$cshow :: UpdateBlueprint -> String
showsPrec :: Int -> UpdateBlueprint -> ShowS
$cshowsPrec :: Int -> UpdateBlueprint -> ShowS
Prelude.Show, (forall x. UpdateBlueprint -> Rep UpdateBlueprint x)
-> (forall x. Rep UpdateBlueprint x -> UpdateBlueprint)
-> Generic UpdateBlueprint
forall x. Rep UpdateBlueprint x -> UpdateBlueprint
forall x. UpdateBlueprint -> Rep UpdateBlueprint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBlueprint x -> UpdateBlueprint
$cfrom :: forall x. UpdateBlueprint -> Rep UpdateBlueprint x
Prelude.Generic)

-- |
-- Create a value of 'UpdateBlueprint' 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', 'updateBlueprint_description' - A description of the blueprint.
--
-- 'name', 'updateBlueprint_name' - The name of the blueprint.
--
-- 'blueprintLocation', 'updateBlueprint_blueprintLocation' - Specifies a path in Amazon S3 where the blueprint is published.
newUpdateBlueprint ::
  -- | 'name'
  Prelude.Text ->
  -- | 'blueprintLocation'
  Prelude.Text ->
  UpdateBlueprint
newUpdateBlueprint :: Text -> Text -> UpdateBlueprint
newUpdateBlueprint Text
pName_ Text
pBlueprintLocation_ =
  UpdateBlueprint' :: Maybe Text -> Text -> Text -> UpdateBlueprint
UpdateBlueprint'
    { $sel:description:UpdateBlueprint' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateBlueprint' :: Text
name = Text
pName_,
      $sel:blueprintLocation:UpdateBlueprint' :: Text
blueprintLocation = Text
pBlueprintLocation_
    }

-- | A description of the blueprint.
updateBlueprint_description :: Lens.Lens' UpdateBlueprint (Prelude.Maybe Prelude.Text)
updateBlueprint_description :: (Maybe Text -> f (Maybe Text))
-> UpdateBlueprint -> f UpdateBlueprint
updateBlueprint_description = (UpdateBlueprint -> Maybe Text)
-> (UpdateBlueprint -> Maybe Text -> UpdateBlueprint)
-> Lens UpdateBlueprint UpdateBlueprint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBlueprint' {Maybe Text
description :: Maybe Text
$sel:description:UpdateBlueprint' :: UpdateBlueprint -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateBlueprint
s@UpdateBlueprint' {} Maybe Text
a -> UpdateBlueprint
s {$sel:description:UpdateBlueprint' :: Maybe Text
description = Maybe Text
a} :: UpdateBlueprint)

-- | The name of the blueprint.
updateBlueprint_name :: Lens.Lens' UpdateBlueprint Prelude.Text
updateBlueprint_name :: (Text -> f Text) -> UpdateBlueprint -> f UpdateBlueprint
updateBlueprint_name = (UpdateBlueprint -> Text)
-> (UpdateBlueprint -> Text -> UpdateBlueprint)
-> Lens UpdateBlueprint UpdateBlueprint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBlueprint' {Text
name :: Text
$sel:name:UpdateBlueprint' :: UpdateBlueprint -> Text
name} -> Text
name) (\s :: UpdateBlueprint
s@UpdateBlueprint' {} Text
a -> UpdateBlueprint
s {$sel:name:UpdateBlueprint' :: Text
name = Text
a} :: UpdateBlueprint)

-- | Specifies a path in Amazon S3 where the blueprint is published.
updateBlueprint_blueprintLocation :: Lens.Lens' UpdateBlueprint Prelude.Text
updateBlueprint_blueprintLocation :: (Text -> f Text) -> UpdateBlueprint -> f UpdateBlueprint
updateBlueprint_blueprintLocation = (UpdateBlueprint -> Text)
-> (UpdateBlueprint -> Text -> UpdateBlueprint)
-> Lens UpdateBlueprint UpdateBlueprint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBlueprint' {Text
blueprintLocation :: Text
$sel:blueprintLocation:UpdateBlueprint' :: UpdateBlueprint -> Text
blueprintLocation} -> Text
blueprintLocation) (\s :: UpdateBlueprint
s@UpdateBlueprint' {} Text
a -> UpdateBlueprint
s {$sel:blueprintLocation:UpdateBlueprint' :: Text
blueprintLocation = Text
a} :: UpdateBlueprint)

instance Core.AWSRequest UpdateBlueprint where
  type
    AWSResponse UpdateBlueprint =
      UpdateBlueprintResponse
  request :: UpdateBlueprint -> Request UpdateBlueprint
request = Service -> UpdateBlueprint -> Request UpdateBlueprint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateBlueprint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateBlueprint)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateBlueprint))
-> Logger
-> Service
-> Proxy UpdateBlueprint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateBlueprint)))
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 -> UpdateBlueprintResponse
UpdateBlueprintResponse'
            (Maybe Text -> Int -> UpdateBlueprintResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateBlueprintResponse)
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
"Name")
            Either String (Int -> UpdateBlueprintResponse)
-> Either String Int -> Either String UpdateBlueprintResponse
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 UpdateBlueprint

instance Prelude.NFData UpdateBlueprint

instance Core.ToHeaders UpdateBlueprint where
  toHeaders :: UpdateBlueprint -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateBlueprint -> 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
"AWSGlue.UpdateBlueprint" :: 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 UpdateBlueprint where
  toJSON :: UpdateBlueprint -> Value
toJSON UpdateBlueprint' {Maybe Text
Text
blueprintLocation :: Text
name :: Text
description :: Maybe Text
$sel:blueprintLocation:UpdateBlueprint' :: UpdateBlueprint -> Text
$sel:name:UpdateBlueprint' :: UpdateBlueprint -> Text
$sel:description:UpdateBlueprint' :: UpdateBlueprint -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"BlueprintLocation" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
blueprintLocation)
          ]
      )

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

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

-- | /See:/ 'newUpdateBlueprintResponse' smart constructor.
data UpdateBlueprintResponse = UpdateBlueprintResponse'
  { -- | Returns the name of the blueprint that was updated.
    UpdateBlueprintResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateBlueprintResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateBlueprintResponse -> UpdateBlueprintResponse -> Bool
(UpdateBlueprintResponse -> UpdateBlueprintResponse -> Bool)
-> (UpdateBlueprintResponse -> UpdateBlueprintResponse -> Bool)
-> Eq UpdateBlueprintResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBlueprintResponse -> UpdateBlueprintResponse -> Bool
$c/= :: UpdateBlueprintResponse -> UpdateBlueprintResponse -> Bool
== :: UpdateBlueprintResponse -> UpdateBlueprintResponse -> Bool
$c== :: UpdateBlueprintResponse -> UpdateBlueprintResponse -> Bool
Prelude.Eq, ReadPrec [UpdateBlueprintResponse]
ReadPrec UpdateBlueprintResponse
Int -> ReadS UpdateBlueprintResponse
ReadS [UpdateBlueprintResponse]
(Int -> ReadS UpdateBlueprintResponse)
-> ReadS [UpdateBlueprintResponse]
-> ReadPrec UpdateBlueprintResponse
-> ReadPrec [UpdateBlueprintResponse]
-> Read UpdateBlueprintResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBlueprintResponse]
$creadListPrec :: ReadPrec [UpdateBlueprintResponse]
readPrec :: ReadPrec UpdateBlueprintResponse
$creadPrec :: ReadPrec UpdateBlueprintResponse
readList :: ReadS [UpdateBlueprintResponse]
$creadList :: ReadS [UpdateBlueprintResponse]
readsPrec :: Int -> ReadS UpdateBlueprintResponse
$creadsPrec :: Int -> ReadS UpdateBlueprintResponse
Prelude.Read, Int -> UpdateBlueprintResponse -> ShowS
[UpdateBlueprintResponse] -> ShowS
UpdateBlueprintResponse -> String
(Int -> UpdateBlueprintResponse -> ShowS)
-> (UpdateBlueprintResponse -> String)
-> ([UpdateBlueprintResponse] -> ShowS)
-> Show UpdateBlueprintResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBlueprintResponse] -> ShowS
$cshowList :: [UpdateBlueprintResponse] -> ShowS
show :: UpdateBlueprintResponse -> String
$cshow :: UpdateBlueprintResponse -> String
showsPrec :: Int -> UpdateBlueprintResponse -> ShowS
$cshowsPrec :: Int -> UpdateBlueprintResponse -> ShowS
Prelude.Show, (forall x.
 UpdateBlueprintResponse -> Rep UpdateBlueprintResponse x)
-> (forall x.
    Rep UpdateBlueprintResponse x -> UpdateBlueprintResponse)
-> Generic UpdateBlueprintResponse
forall x. Rep UpdateBlueprintResponse x -> UpdateBlueprintResponse
forall x. UpdateBlueprintResponse -> Rep UpdateBlueprintResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBlueprintResponse x -> UpdateBlueprintResponse
$cfrom :: forall x. UpdateBlueprintResponse -> Rep UpdateBlueprintResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateBlueprintResponse' 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', 'updateBlueprintResponse_name' - Returns the name of the blueprint that was updated.
--
-- 'httpStatus', 'updateBlueprintResponse_httpStatus' - The response's http status code.
newUpdateBlueprintResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateBlueprintResponse
newUpdateBlueprintResponse :: Int -> UpdateBlueprintResponse
newUpdateBlueprintResponse Int
pHttpStatus_ =
  UpdateBlueprintResponse' :: Maybe Text -> Int -> UpdateBlueprintResponse
UpdateBlueprintResponse'
    { $sel:name:UpdateBlueprintResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateBlueprintResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns the name of the blueprint that was updated.
updateBlueprintResponse_name :: Lens.Lens' UpdateBlueprintResponse (Prelude.Maybe Prelude.Text)
updateBlueprintResponse_name :: (Maybe Text -> f (Maybe Text))
-> UpdateBlueprintResponse -> f UpdateBlueprintResponse
updateBlueprintResponse_name = (UpdateBlueprintResponse -> Maybe Text)
-> (UpdateBlueprintResponse
    -> Maybe Text -> UpdateBlueprintResponse)
-> Lens
     UpdateBlueprintResponse
     UpdateBlueprintResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBlueprintResponse' {Maybe Text
name :: Maybe Text
$sel:name:UpdateBlueprintResponse' :: UpdateBlueprintResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateBlueprintResponse
s@UpdateBlueprintResponse' {} Maybe Text
a -> UpdateBlueprintResponse
s {$sel:name:UpdateBlueprintResponse' :: Maybe Text
name = Maybe Text
a} :: UpdateBlueprintResponse)

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

instance Prelude.NFData UpdateBlueprintResponse