{-# 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.Grafana.DescribeWorkspaceAuthentication
-- 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)
--
-- Displays information about the authentication methods used in one Amazon
-- Managed Grafana workspace.
module Amazonka.Grafana.DescribeWorkspaceAuthentication
  ( -- * Creating a Request
    DescribeWorkspaceAuthentication (..),
    newDescribeWorkspaceAuthentication,

    -- * Request Lenses
    describeWorkspaceAuthentication_workspaceId,

    -- * Destructuring the Response
    DescribeWorkspaceAuthenticationResponse (..),
    newDescribeWorkspaceAuthenticationResponse,

    -- * Response Lenses
    describeWorkspaceAuthenticationResponse_httpStatus,
    describeWorkspaceAuthenticationResponse_authentication,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Grafana.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:/ 'newDescribeWorkspaceAuthentication' smart constructor.
data DescribeWorkspaceAuthentication = DescribeWorkspaceAuthentication'
  { -- | The ID of the workspace to return authentication information about.
    DescribeWorkspaceAuthentication -> Text
workspaceId :: Prelude.Text
  }
  deriving (DescribeWorkspaceAuthentication
-> DescribeWorkspaceAuthentication -> Bool
(DescribeWorkspaceAuthentication
 -> DescribeWorkspaceAuthentication -> Bool)
-> (DescribeWorkspaceAuthentication
    -> DescribeWorkspaceAuthentication -> Bool)
-> Eq DescribeWorkspaceAuthentication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceAuthentication
-> DescribeWorkspaceAuthentication -> Bool
$c/= :: DescribeWorkspaceAuthentication
-> DescribeWorkspaceAuthentication -> Bool
== :: DescribeWorkspaceAuthentication
-> DescribeWorkspaceAuthentication -> Bool
$c== :: DescribeWorkspaceAuthentication
-> DescribeWorkspaceAuthentication -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspaceAuthentication]
ReadPrec DescribeWorkspaceAuthentication
Int -> ReadS DescribeWorkspaceAuthentication
ReadS [DescribeWorkspaceAuthentication]
(Int -> ReadS DescribeWorkspaceAuthentication)
-> ReadS [DescribeWorkspaceAuthentication]
-> ReadPrec DescribeWorkspaceAuthentication
-> ReadPrec [DescribeWorkspaceAuthentication]
-> Read DescribeWorkspaceAuthentication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceAuthentication]
$creadListPrec :: ReadPrec [DescribeWorkspaceAuthentication]
readPrec :: ReadPrec DescribeWorkspaceAuthentication
$creadPrec :: ReadPrec DescribeWorkspaceAuthentication
readList :: ReadS [DescribeWorkspaceAuthentication]
$creadList :: ReadS [DescribeWorkspaceAuthentication]
readsPrec :: Int -> ReadS DescribeWorkspaceAuthentication
$creadsPrec :: Int -> ReadS DescribeWorkspaceAuthentication
Prelude.Read, Int -> DescribeWorkspaceAuthentication -> ShowS
[DescribeWorkspaceAuthentication] -> ShowS
DescribeWorkspaceAuthentication -> String
(Int -> DescribeWorkspaceAuthentication -> ShowS)
-> (DescribeWorkspaceAuthentication -> String)
-> ([DescribeWorkspaceAuthentication] -> ShowS)
-> Show DescribeWorkspaceAuthentication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceAuthentication] -> ShowS
$cshowList :: [DescribeWorkspaceAuthentication] -> ShowS
show :: DescribeWorkspaceAuthentication -> String
$cshow :: DescribeWorkspaceAuthentication -> String
showsPrec :: Int -> DescribeWorkspaceAuthentication -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceAuthentication -> ShowS
Prelude.Show, (forall x.
 DescribeWorkspaceAuthentication
 -> Rep DescribeWorkspaceAuthentication x)
-> (forall x.
    Rep DescribeWorkspaceAuthentication x
    -> DescribeWorkspaceAuthentication)
-> Generic DescribeWorkspaceAuthentication
forall x.
Rep DescribeWorkspaceAuthentication x
-> DescribeWorkspaceAuthentication
forall x.
DescribeWorkspaceAuthentication
-> Rep DescribeWorkspaceAuthentication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkspaceAuthentication x
-> DescribeWorkspaceAuthentication
$cfrom :: forall x.
DescribeWorkspaceAuthentication
-> Rep DescribeWorkspaceAuthentication x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkspaceAuthentication' 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:
--
-- 'workspaceId', 'describeWorkspaceAuthentication_workspaceId' - The ID of the workspace to return authentication information about.
newDescribeWorkspaceAuthentication ::
  -- | 'workspaceId'
  Prelude.Text ->
  DescribeWorkspaceAuthentication
newDescribeWorkspaceAuthentication :: Text -> DescribeWorkspaceAuthentication
newDescribeWorkspaceAuthentication Text
pWorkspaceId_ =
  DescribeWorkspaceAuthentication' :: Text -> DescribeWorkspaceAuthentication
DescribeWorkspaceAuthentication'
    { $sel:workspaceId:DescribeWorkspaceAuthentication' :: Text
workspaceId =
        Text
pWorkspaceId_
    }

-- | The ID of the workspace to return authentication information about.
describeWorkspaceAuthentication_workspaceId :: Lens.Lens' DescribeWorkspaceAuthentication Prelude.Text
describeWorkspaceAuthentication_workspaceId :: (Text -> f Text)
-> DescribeWorkspaceAuthentication
-> f DescribeWorkspaceAuthentication
describeWorkspaceAuthentication_workspaceId = (DescribeWorkspaceAuthentication -> Text)
-> (DescribeWorkspaceAuthentication
    -> Text -> DescribeWorkspaceAuthentication)
-> Lens
     DescribeWorkspaceAuthentication
     DescribeWorkspaceAuthentication
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceAuthentication' {Text
workspaceId :: Text
$sel:workspaceId:DescribeWorkspaceAuthentication' :: DescribeWorkspaceAuthentication -> Text
workspaceId} -> Text
workspaceId) (\s :: DescribeWorkspaceAuthentication
s@DescribeWorkspaceAuthentication' {} Text
a -> DescribeWorkspaceAuthentication
s {$sel:workspaceId:DescribeWorkspaceAuthentication' :: Text
workspaceId = Text
a} :: DescribeWorkspaceAuthentication)

instance
  Core.AWSRequest
    DescribeWorkspaceAuthentication
  where
  type
    AWSResponse DescribeWorkspaceAuthentication =
      DescribeWorkspaceAuthenticationResponse
  request :: DescribeWorkspaceAuthentication
-> Request DescribeWorkspaceAuthentication
request = Service
-> DescribeWorkspaceAuthentication
-> Request DescribeWorkspaceAuthentication
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeWorkspaceAuthentication
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeWorkspaceAuthentication)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeWorkspaceAuthentication))
-> Logger
-> Service
-> Proxy DescribeWorkspaceAuthentication
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeWorkspaceAuthentication)))
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 ->
          Int
-> AuthenticationDescription
-> DescribeWorkspaceAuthenticationResponse
DescribeWorkspaceAuthenticationResponse'
            (Int
 -> AuthenticationDescription
 -> DescribeWorkspaceAuthenticationResponse)
-> Either String Int
-> Either
     String
     (AuthenticationDescription
      -> DescribeWorkspaceAuthenticationResponse)
forall (f :: * -> *) a b. Functor 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))
            Either
  String
  (AuthenticationDescription
   -> DescribeWorkspaceAuthenticationResponse)
-> Either String AuthenticationDescription
-> Either String DescribeWorkspaceAuthenticationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AuthenticationDescription
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"authentication")
      )

instance
  Prelude.Hashable
    DescribeWorkspaceAuthentication

instance
  Prelude.NFData
    DescribeWorkspaceAuthentication

instance
  Core.ToHeaders
    DescribeWorkspaceAuthentication
  where
  toHeaders :: DescribeWorkspaceAuthentication -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeWorkspaceAuthentication -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DescribeWorkspaceAuthentication where
  toPath :: DescribeWorkspaceAuthentication -> ByteString
toPath DescribeWorkspaceAuthentication' {Text
workspaceId :: Text
$sel:workspaceId:DescribeWorkspaceAuthentication' :: DescribeWorkspaceAuthentication -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workspaces/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId,
        ByteString
"/authentication"
      ]

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

-- | /See:/ 'newDescribeWorkspaceAuthenticationResponse' smart constructor.
data DescribeWorkspaceAuthenticationResponse = DescribeWorkspaceAuthenticationResponse'
  { -- | The response's http status code.
    DescribeWorkspaceAuthenticationResponse -> Int
httpStatus :: Prelude.Int,
    -- | A structure containing information about the authentication methods used
    -- in the workspace.
    DescribeWorkspaceAuthenticationResponse
-> AuthenticationDescription
authentication :: AuthenticationDescription
  }
  deriving (DescribeWorkspaceAuthenticationResponse
-> DescribeWorkspaceAuthenticationResponse -> Bool
(DescribeWorkspaceAuthenticationResponse
 -> DescribeWorkspaceAuthenticationResponse -> Bool)
-> (DescribeWorkspaceAuthenticationResponse
    -> DescribeWorkspaceAuthenticationResponse -> Bool)
-> Eq DescribeWorkspaceAuthenticationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceAuthenticationResponse
-> DescribeWorkspaceAuthenticationResponse -> Bool
$c/= :: DescribeWorkspaceAuthenticationResponse
-> DescribeWorkspaceAuthenticationResponse -> Bool
== :: DescribeWorkspaceAuthenticationResponse
-> DescribeWorkspaceAuthenticationResponse -> Bool
$c== :: DescribeWorkspaceAuthenticationResponse
-> DescribeWorkspaceAuthenticationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspaceAuthenticationResponse]
ReadPrec DescribeWorkspaceAuthenticationResponse
Int -> ReadS DescribeWorkspaceAuthenticationResponse
ReadS [DescribeWorkspaceAuthenticationResponse]
(Int -> ReadS DescribeWorkspaceAuthenticationResponse)
-> ReadS [DescribeWorkspaceAuthenticationResponse]
-> ReadPrec DescribeWorkspaceAuthenticationResponse
-> ReadPrec [DescribeWorkspaceAuthenticationResponse]
-> Read DescribeWorkspaceAuthenticationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceAuthenticationResponse]
$creadListPrec :: ReadPrec [DescribeWorkspaceAuthenticationResponse]
readPrec :: ReadPrec DescribeWorkspaceAuthenticationResponse
$creadPrec :: ReadPrec DescribeWorkspaceAuthenticationResponse
readList :: ReadS [DescribeWorkspaceAuthenticationResponse]
$creadList :: ReadS [DescribeWorkspaceAuthenticationResponse]
readsPrec :: Int -> ReadS DescribeWorkspaceAuthenticationResponse
$creadsPrec :: Int -> ReadS DescribeWorkspaceAuthenticationResponse
Prelude.Read, Int -> DescribeWorkspaceAuthenticationResponse -> ShowS
[DescribeWorkspaceAuthenticationResponse] -> ShowS
DescribeWorkspaceAuthenticationResponse -> String
(Int -> DescribeWorkspaceAuthenticationResponse -> ShowS)
-> (DescribeWorkspaceAuthenticationResponse -> String)
-> ([DescribeWorkspaceAuthenticationResponse] -> ShowS)
-> Show DescribeWorkspaceAuthenticationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceAuthenticationResponse] -> ShowS
$cshowList :: [DescribeWorkspaceAuthenticationResponse] -> ShowS
show :: DescribeWorkspaceAuthenticationResponse -> String
$cshow :: DescribeWorkspaceAuthenticationResponse -> String
showsPrec :: Int -> DescribeWorkspaceAuthenticationResponse -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceAuthenticationResponse -> ShowS
Prelude.Show, (forall x.
 DescribeWorkspaceAuthenticationResponse
 -> Rep DescribeWorkspaceAuthenticationResponse x)
-> (forall x.
    Rep DescribeWorkspaceAuthenticationResponse x
    -> DescribeWorkspaceAuthenticationResponse)
-> Generic DescribeWorkspaceAuthenticationResponse
forall x.
Rep DescribeWorkspaceAuthenticationResponse x
-> DescribeWorkspaceAuthenticationResponse
forall x.
DescribeWorkspaceAuthenticationResponse
-> Rep DescribeWorkspaceAuthenticationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkspaceAuthenticationResponse x
-> DescribeWorkspaceAuthenticationResponse
$cfrom :: forall x.
DescribeWorkspaceAuthenticationResponse
-> Rep DescribeWorkspaceAuthenticationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkspaceAuthenticationResponse' 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:
--
-- 'httpStatus', 'describeWorkspaceAuthenticationResponse_httpStatus' - The response's http status code.
--
-- 'authentication', 'describeWorkspaceAuthenticationResponse_authentication' - A structure containing information about the authentication methods used
-- in the workspace.
newDescribeWorkspaceAuthenticationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'authentication'
  AuthenticationDescription ->
  DescribeWorkspaceAuthenticationResponse
newDescribeWorkspaceAuthenticationResponse :: Int
-> AuthenticationDescription
-> DescribeWorkspaceAuthenticationResponse
newDescribeWorkspaceAuthenticationResponse
  Int
pHttpStatus_
  AuthenticationDescription
pAuthentication_ =
    DescribeWorkspaceAuthenticationResponse' :: Int
-> AuthenticationDescription
-> DescribeWorkspaceAuthenticationResponse
DescribeWorkspaceAuthenticationResponse'
      { $sel:httpStatus:DescribeWorkspaceAuthenticationResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:authentication:DescribeWorkspaceAuthenticationResponse' :: AuthenticationDescription
authentication = AuthenticationDescription
pAuthentication_
      }

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

-- | A structure containing information about the authentication methods used
-- in the workspace.
describeWorkspaceAuthenticationResponse_authentication :: Lens.Lens' DescribeWorkspaceAuthenticationResponse AuthenticationDescription
describeWorkspaceAuthenticationResponse_authentication :: (AuthenticationDescription -> f AuthenticationDescription)
-> DescribeWorkspaceAuthenticationResponse
-> f DescribeWorkspaceAuthenticationResponse
describeWorkspaceAuthenticationResponse_authentication = (DescribeWorkspaceAuthenticationResponse
 -> AuthenticationDescription)
-> (DescribeWorkspaceAuthenticationResponse
    -> AuthenticationDescription
    -> DescribeWorkspaceAuthenticationResponse)
-> Lens
     DescribeWorkspaceAuthenticationResponse
     DescribeWorkspaceAuthenticationResponse
     AuthenticationDescription
     AuthenticationDescription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceAuthenticationResponse' {AuthenticationDescription
authentication :: AuthenticationDescription
$sel:authentication:DescribeWorkspaceAuthenticationResponse' :: DescribeWorkspaceAuthenticationResponse
-> AuthenticationDescription
authentication} -> AuthenticationDescription
authentication) (\s :: DescribeWorkspaceAuthenticationResponse
s@DescribeWorkspaceAuthenticationResponse' {} AuthenticationDescription
a -> DescribeWorkspaceAuthenticationResponse
s {$sel:authentication:DescribeWorkspaceAuthenticationResponse' :: AuthenticationDescription
authentication = AuthenticationDescription
a} :: DescribeWorkspaceAuthenticationResponse)

instance
  Prelude.NFData
    DescribeWorkspaceAuthenticationResponse