{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
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
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]
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
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.
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' {$sel:name:GetSecurityConfiguration' :: Text
name = Text
pName_}

-- | The name of the security configuration to retrieve.
getSecurityConfiguration_name :: Lens.Lens' GetSecurityConfiguration Prelude.Text
getSecurityConfiguration_name :: Lens' GetSecurityConfiguration Text
getSecurityConfiguration_name = 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 :: (Service -> Service)
-> GetSecurityConfiguration -> Request GetSecurityConfiguration
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 GetSecurityConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSecurityConfiguration)))
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 SecurityConfiguration
-> Int -> GetSecurityConfigurationResponse
GetSecurityConfigurationResponse'
            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
"SecurityConfiguration")
            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 GetSecurityConfiguration where
  hashWithSalt :: Int -> GetSecurityConfiguration -> Int
hashWithSalt Int
_salt GetSecurityConfiguration' {Text
name :: Text
$sel:name:GetSecurityConfiguration' :: GetSecurityConfiguration -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData GetSecurityConfiguration where
  rnf :: GetSecurityConfiguration -> ()
rnf GetSecurityConfiguration' {Text
name :: Text
$sel:name:GetSecurityConfiguration' :: GetSecurityConfiguration -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders GetSecurityConfiguration where
  toHeaders :: GetSecurityConfiguration -> 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
"AWSGlue.GetSecurityConfiguration" ::
                          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 GetSecurityConfiguration where
  toJSON :: GetSecurityConfiguration -> Value
toJSON GetSecurityConfiguration' {Text
name :: Text
$sel:name:GetSecurityConfiguration' :: GetSecurityConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

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

instance Data.ToQuery GetSecurityConfiguration where
  toQuery :: GetSecurityConfiguration -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:securityConfiguration:GetSecurityConfigurationResponse' :: Maybe SecurityConfiguration
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 :: Lens'
  GetSecurityConfigurationResponse (Maybe SecurityConfiguration)
getSecurityConfigurationResponse_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 :: Lens' GetSecurityConfigurationResponse Int
getSecurityConfigurationResponse_httpStatus = 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
  where
  rnf :: GetSecurityConfigurationResponse -> ()
rnf GetSecurityConfigurationResponse' {Int
Maybe SecurityConfiguration
httpStatus :: Int
securityConfiguration :: Maybe SecurityConfiguration
$sel:httpStatus:GetSecurityConfigurationResponse' :: GetSecurityConfigurationResponse -> Int
$sel:securityConfiguration:GetSecurityConfigurationResponse' :: GetSecurityConfigurationResponse -> Maybe SecurityConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SecurityConfiguration
securityConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus