{-# 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.GetSecurityConfiguration
-- 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)
--
-- Retrieves a specified security configuration.
module Amazonka.Glue.GetSecurityConfiguration
  ( -- * Creating a Request
    GetSecurityConfiguration (..),
    newGetSecurityConfiguration,

    -- * Request Lenses
    getSecurityConfiguration_name,

    -- * Destructuring the Response
    GetSecurityConfigurationResponse (..),
    newGetSecurityConfigurationResponse,

    -- * Response Lenses
    getSecurityConfigurationResponse_securityConfiguration,
    getSecurityConfigurationResponse_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:/ 'newGetSecurityConfiguration' smart constructor.
data GetSecurityConfiguration = GetSecurityConfiguration'
  { -- | The name of the security configuration to retrieve.
    GetSecurityConfiguration -> Text
name :: Prelude.Text
  }
  deriving (GetSecurityConfiguration -> GetSecurityConfiguration -> Bool
(GetSecurityConfiguration -> GetSecurityConfiguration -> Bool)
-> (GetSecurityConfiguration -> GetSecurityConfiguration -> Bool)
-> Eq GetSecurityConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSecurityConfiguration -> GetSecurityConfiguration -> Bool
$c/= :: GetSecurityConfiguration -> GetSecurityConfiguration -> Bool
== :: GetSecurityConfiguration -> GetSecurityConfiguration -> Bool
$c== :: GetSecurityConfiguration -> GetSecurityConfiguration -> Bool
Prelude.Eq, ReadPrec [GetSecurityConfiguration]
ReadPrec GetSecurityConfiguration
Int -> ReadS GetSecurityConfiguration
ReadS [GetSecurityConfiguration]
(Int -> ReadS GetSecurityConfiguration)
-> ReadS [GetSecurityConfiguration]
-> ReadPrec GetSecurityConfiguration
-> ReadPrec [GetSecurityConfiguration]
-> Read GetSecurityConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSecurityConfiguration]
$creadListPrec :: ReadPrec [GetSecurityConfiguration]
readPrec :: ReadPrec GetSecurityConfiguration
$creadPrec :: ReadPrec GetSecurityConfiguration
readList :: ReadS [GetSecurityConfiguration]
$creadList :: ReadS [GetSecurityConfiguration]
readsPrec :: Int -> ReadS GetSecurityConfiguration
$creadsPrec :: Int -> ReadS GetSecurityConfiguration
Prelude.Read, Int -> GetSecurityConfiguration -> ShowS
[GetSecurityConfiguration] -> ShowS
GetSecurityConfiguration -> String
(Int -> GetSecurityConfiguration -> ShowS)
-> (GetSecurityConfiguration -> String)
-> ([GetSecurityConfiguration] -> ShowS)
-> Show GetSecurityConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSecurityConfiguration] -> ShowS
$cshowList :: [GetSecurityConfiguration] -> ShowS
show :: GetSecurityConfiguration -> String
$cshow :: GetSecurityConfiguration -> String
showsPrec :: Int -> GetSecurityConfiguration -> ShowS
$cshowsPrec :: Int -> GetSecurityConfiguration -> ShowS
Prelude.Show, (forall x.
 GetSecurityConfiguration -> Rep GetSecurityConfiguration x)
-> (forall x.
    Rep GetSecurityConfiguration x -> GetSecurityConfiguration)
-> Generic GetSecurityConfiguration
forall x.
Rep GetSecurityConfiguration x -> GetSecurityConfiguration
forall x.
GetSecurityConfiguration -> Rep GetSecurityConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSecurityConfiguration x -> GetSecurityConfiguration
$cfrom :: forall x.
GetSecurityConfiguration -> Rep GetSecurityConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'GetSecurityConfiguration' 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', 'getSecurityConfiguration_name' - The name of the security configuration to retrieve.
newGetSecurityConfiguration ::
  -- | 'name'
  Prelude.Text ->
  GetSecurityConfiguration
newGetSecurityConfiguration :: Text -> GetSecurityConfiguration
newGetSecurityConfiguration Text
pName_ =
  GetSecurityConfiguration' :: Text -> GetSecurityConfiguration
GetSecurityConfiguration' {$sel:name:GetSecurityConfiguration' :: Text
name = Text
pName_}

-- | The name of the security configuration to retrieve.
getSecurityConfiguration_name :: Lens.Lens' GetSecurityConfiguration Prelude.Text
getSecurityConfiguration_name :: (Text -> f Text)
-> GetSecurityConfiguration -> f GetSecurityConfiguration
getSecurityConfiguration_name = (GetSecurityConfiguration -> Text)
-> (GetSecurityConfiguration -> Text -> GetSecurityConfiguration)
-> Lens GetSecurityConfiguration GetSecurityConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecurityConfiguration' {Text
name :: Text
$sel:name:GetSecurityConfiguration' :: GetSecurityConfiguration -> Text
name} -> Text
name) (\s :: GetSecurityConfiguration
s@GetSecurityConfiguration' {} Text
a -> GetSecurityConfiguration
s {$sel:name:GetSecurityConfiguration' :: Text
name = Text
a} :: GetSecurityConfiguration)

instance Core.AWSRequest GetSecurityConfiguration where
  type
    AWSResponse GetSecurityConfiguration =
      GetSecurityConfigurationResponse
  request :: GetSecurityConfiguration -> Request GetSecurityConfiguration
request = Service
-> GetSecurityConfiguration -> Request GetSecurityConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSecurityConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSecurityConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSecurityConfiguration))
-> Logger
-> Service
-> Proxy GetSecurityConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSecurityConfiguration)))
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 SecurityConfiguration
-> Int -> GetSecurityConfigurationResponse
GetSecurityConfigurationResponse'
            (Maybe SecurityConfiguration
 -> Int -> GetSecurityConfigurationResponse)
-> Either String (Maybe SecurityConfiguration)
-> Either String (Int -> GetSecurityConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SecurityConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SecurityConfiguration")
            Either String (Int -> GetSecurityConfigurationResponse)
-> Either String Int
-> Either String GetSecurityConfigurationResponse
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 GetSecurityConfiguration

instance Prelude.NFData GetSecurityConfiguration

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

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

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

-- | /See:/ 'newGetSecurityConfigurationResponse' smart constructor.
data GetSecurityConfigurationResponse = GetSecurityConfigurationResponse'
  { -- | The requested security configuration.
    GetSecurityConfigurationResponse -> Maybe SecurityConfiguration
securityConfiguration :: Prelude.Maybe SecurityConfiguration,
    -- | The response's http status code.
    GetSecurityConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSecurityConfigurationResponse
-> GetSecurityConfigurationResponse -> Bool
(GetSecurityConfigurationResponse
 -> GetSecurityConfigurationResponse -> Bool)
-> (GetSecurityConfigurationResponse
    -> GetSecurityConfigurationResponse -> Bool)
-> Eq GetSecurityConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSecurityConfigurationResponse
-> GetSecurityConfigurationResponse -> Bool
$c/= :: GetSecurityConfigurationResponse
-> GetSecurityConfigurationResponse -> Bool
== :: GetSecurityConfigurationResponse
-> GetSecurityConfigurationResponse -> Bool
$c== :: GetSecurityConfigurationResponse
-> GetSecurityConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetSecurityConfigurationResponse]
ReadPrec GetSecurityConfigurationResponse
Int -> ReadS GetSecurityConfigurationResponse
ReadS [GetSecurityConfigurationResponse]
(Int -> ReadS GetSecurityConfigurationResponse)
-> ReadS [GetSecurityConfigurationResponse]
-> ReadPrec GetSecurityConfigurationResponse
-> ReadPrec [GetSecurityConfigurationResponse]
-> Read GetSecurityConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSecurityConfigurationResponse]
$creadListPrec :: ReadPrec [GetSecurityConfigurationResponse]
readPrec :: ReadPrec GetSecurityConfigurationResponse
$creadPrec :: ReadPrec GetSecurityConfigurationResponse
readList :: ReadS [GetSecurityConfigurationResponse]
$creadList :: ReadS [GetSecurityConfigurationResponse]
readsPrec :: Int -> ReadS GetSecurityConfigurationResponse
$creadsPrec :: Int -> ReadS GetSecurityConfigurationResponse
Prelude.Read, Int -> GetSecurityConfigurationResponse -> ShowS
[GetSecurityConfigurationResponse] -> ShowS
GetSecurityConfigurationResponse -> String
(Int -> GetSecurityConfigurationResponse -> ShowS)
-> (GetSecurityConfigurationResponse -> String)
-> ([GetSecurityConfigurationResponse] -> ShowS)
-> Show GetSecurityConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSecurityConfigurationResponse] -> ShowS
$cshowList :: [GetSecurityConfigurationResponse] -> ShowS
show :: GetSecurityConfigurationResponse -> String
$cshow :: GetSecurityConfigurationResponse -> String
showsPrec :: Int -> GetSecurityConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetSecurityConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 GetSecurityConfigurationResponse
 -> Rep GetSecurityConfigurationResponse x)
-> (forall x.
    Rep GetSecurityConfigurationResponse x
    -> GetSecurityConfigurationResponse)
-> Generic GetSecurityConfigurationResponse
forall x.
Rep GetSecurityConfigurationResponse x
-> GetSecurityConfigurationResponse
forall x.
GetSecurityConfigurationResponse
-> Rep GetSecurityConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSecurityConfigurationResponse x
-> GetSecurityConfigurationResponse
$cfrom :: forall x.
GetSecurityConfigurationResponse
-> Rep GetSecurityConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSecurityConfigurationResponse' 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:
--
-- 'securityConfiguration', 'getSecurityConfigurationResponse_securityConfiguration' - The requested security configuration.
--
-- 'httpStatus', 'getSecurityConfigurationResponse_httpStatus' - The response's http status code.
newGetSecurityConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSecurityConfigurationResponse
newGetSecurityConfigurationResponse :: Int -> GetSecurityConfigurationResponse
newGetSecurityConfigurationResponse Int
pHttpStatus_ =
  GetSecurityConfigurationResponse' :: Maybe SecurityConfiguration
-> Int -> GetSecurityConfigurationResponse
GetSecurityConfigurationResponse'
    { $sel:securityConfiguration:GetSecurityConfigurationResponse' :: Maybe SecurityConfiguration
securityConfiguration =
        Maybe SecurityConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSecurityConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The requested security configuration.
getSecurityConfigurationResponse_securityConfiguration :: Lens.Lens' GetSecurityConfigurationResponse (Prelude.Maybe SecurityConfiguration)
getSecurityConfigurationResponse_securityConfiguration :: (Maybe SecurityConfiguration -> f (Maybe SecurityConfiguration))
-> GetSecurityConfigurationResponse
-> f GetSecurityConfigurationResponse
getSecurityConfigurationResponse_securityConfiguration = (GetSecurityConfigurationResponse -> Maybe SecurityConfiguration)
-> (GetSecurityConfigurationResponse
    -> Maybe SecurityConfiguration -> GetSecurityConfigurationResponse)
-> Lens
     GetSecurityConfigurationResponse
     GetSecurityConfigurationResponse
     (Maybe SecurityConfiguration)
     (Maybe SecurityConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecurityConfigurationResponse' {Maybe SecurityConfiguration
securityConfiguration :: Maybe SecurityConfiguration
$sel:securityConfiguration:GetSecurityConfigurationResponse' :: GetSecurityConfigurationResponse -> Maybe SecurityConfiguration
securityConfiguration} -> Maybe SecurityConfiguration
securityConfiguration) (\s :: GetSecurityConfigurationResponse
s@GetSecurityConfigurationResponse' {} Maybe SecurityConfiguration
a -> GetSecurityConfigurationResponse
s {$sel:securityConfiguration:GetSecurityConfigurationResponse' :: Maybe SecurityConfiguration
securityConfiguration = Maybe SecurityConfiguration
a} :: GetSecurityConfigurationResponse)

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

instance
  Prelude.NFData
    GetSecurityConfigurationResponse