{-# 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.ChimeSDKIdentity.DescribeAppInstanceAdmin
-- 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)
--
-- Returns the full details of an @AppInstanceAdmin@.
module Amazonka.ChimeSDKIdentity.DescribeAppInstanceAdmin
  ( -- * Creating a Request
    DescribeAppInstanceAdmin (..),
    newDescribeAppInstanceAdmin,

    -- * Request Lenses
    describeAppInstanceAdmin_appInstanceAdminArn,
    describeAppInstanceAdmin_appInstanceArn,

    -- * Destructuring the Response
    DescribeAppInstanceAdminResponse (..),
    newDescribeAppInstanceAdminResponse,

    -- * Response Lenses
    describeAppInstanceAdminResponse_appInstanceAdmin,
    describeAppInstanceAdminResponse_httpStatus,
  )
where

import Amazonka.ChimeSDKIdentity.Types
import qualified Amazonka.Core as Core
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:/ 'newDescribeAppInstanceAdmin' smart constructor.
data DescribeAppInstanceAdmin = DescribeAppInstanceAdmin'
  { -- | The ARN of the @AppInstanceAdmin@.
    DescribeAppInstanceAdmin -> Text
appInstanceAdminArn :: Prelude.Text,
    -- | The ARN of the @AppInstance@.
    DescribeAppInstanceAdmin -> Text
appInstanceArn :: Prelude.Text
  }
  deriving (DescribeAppInstanceAdmin -> DescribeAppInstanceAdmin -> Bool
(DescribeAppInstanceAdmin -> DescribeAppInstanceAdmin -> Bool)
-> (DescribeAppInstanceAdmin -> DescribeAppInstanceAdmin -> Bool)
-> Eq DescribeAppInstanceAdmin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAppInstanceAdmin -> DescribeAppInstanceAdmin -> Bool
$c/= :: DescribeAppInstanceAdmin -> DescribeAppInstanceAdmin -> Bool
== :: DescribeAppInstanceAdmin -> DescribeAppInstanceAdmin -> Bool
$c== :: DescribeAppInstanceAdmin -> DescribeAppInstanceAdmin -> Bool
Prelude.Eq, ReadPrec [DescribeAppInstanceAdmin]
ReadPrec DescribeAppInstanceAdmin
Int -> ReadS DescribeAppInstanceAdmin
ReadS [DescribeAppInstanceAdmin]
(Int -> ReadS DescribeAppInstanceAdmin)
-> ReadS [DescribeAppInstanceAdmin]
-> ReadPrec DescribeAppInstanceAdmin
-> ReadPrec [DescribeAppInstanceAdmin]
-> Read DescribeAppInstanceAdmin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAppInstanceAdmin]
$creadListPrec :: ReadPrec [DescribeAppInstanceAdmin]
readPrec :: ReadPrec DescribeAppInstanceAdmin
$creadPrec :: ReadPrec DescribeAppInstanceAdmin
readList :: ReadS [DescribeAppInstanceAdmin]
$creadList :: ReadS [DescribeAppInstanceAdmin]
readsPrec :: Int -> ReadS DescribeAppInstanceAdmin
$creadsPrec :: Int -> ReadS DescribeAppInstanceAdmin
Prelude.Read, Int -> DescribeAppInstanceAdmin -> ShowS
[DescribeAppInstanceAdmin] -> ShowS
DescribeAppInstanceAdmin -> String
(Int -> DescribeAppInstanceAdmin -> ShowS)
-> (DescribeAppInstanceAdmin -> String)
-> ([DescribeAppInstanceAdmin] -> ShowS)
-> Show DescribeAppInstanceAdmin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAppInstanceAdmin] -> ShowS
$cshowList :: [DescribeAppInstanceAdmin] -> ShowS
show :: DescribeAppInstanceAdmin -> String
$cshow :: DescribeAppInstanceAdmin -> String
showsPrec :: Int -> DescribeAppInstanceAdmin -> ShowS
$cshowsPrec :: Int -> DescribeAppInstanceAdmin -> ShowS
Prelude.Show, (forall x.
 DescribeAppInstanceAdmin -> Rep DescribeAppInstanceAdmin x)
-> (forall x.
    Rep DescribeAppInstanceAdmin x -> DescribeAppInstanceAdmin)
-> Generic DescribeAppInstanceAdmin
forall x.
Rep DescribeAppInstanceAdmin x -> DescribeAppInstanceAdmin
forall x.
DescribeAppInstanceAdmin -> Rep DescribeAppInstanceAdmin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAppInstanceAdmin x -> DescribeAppInstanceAdmin
$cfrom :: forall x.
DescribeAppInstanceAdmin -> Rep DescribeAppInstanceAdmin x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAppInstanceAdmin' 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:
--
-- 'appInstanceAdminArn', 'describeAppInstanceAdmin_appInstanceAdminArn' - The ARN of the @AppInstanceAdmin@.
--
-- 'appInstanceArn', 'describeAppInstanceAdmin_appInstanceArn' - The ARN of the @AppInstance@.
newDescribeAppInstanceAdmin ::
  -- | 'appInstanceAdminArn'
  Prelude.Text ->
  -- | 'appInstanceArn'
  Prelude.Text ->
  DescribeAppInstanceAdmin
newDescribeAppInstanceAdmin :: Text -> Text -> DescribeAppInstanceAdmin
newDescribeAppInstanceAdmin
  Text
pAppInstanceAdminArn_
  Text
pAppInstanceArn_ =
    DescribeAppInstanceAdmin' :: Text -> Text -> DescribeAppInstanceAdmin
DescribeAppInstanceAdmin'
      { $sel:appInstanceAdminArn:DescribeAppInstanceAdmin' :: Text
appInstanceAdminArn =
          Text
pAppInstanceAdminArn_,
        $sel:appInstanceArn:DescribeAppInstanceAdmin' :: Text
appInstanceArn = Text
pAppInstanceArn_
      }

-- | The ARN of the @AppInstanceAdmin@.
describeAppInstanceAdmin_appInstanceAdminArn :: Lens.Lens' DescribeAppInstanceAdmin Prelude.Text
describeAppInstanceAdmin_appInstanceAdminArn :: (Text -> f Text)
-> DescribeAppInstanceAdmin -> f DescribeAppInstanceAdmin
describeAppInstanceAdmin_appInstanceAdminArn = (DescribeAppInstanceAdmin -> Text)
-> (DescribeAppInstanceAdmin -> Text -> DescribeAppInstanceAdmin)
-> Lens DescribeAppInstanceAdmin DescribeAppInstanceAdmin Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAppInstanceAdmin' {Text
appInstanceAdminArn :: Text
$sel:appInstanceAdminArn:DescribeAppInstanceAdmin' :: DescribeAppInstanceAdmin -> Text
appInstanceAdminArn} -> Text
appInstanceAdminArn) (\s :: DescribeAppInstanceAdmin
s@DescribeAppInstanceAdmin' {} Text
a -> DescribeAppInstanceAdmin
s {$sel:appInstanceAdminArn:DescribeAppInstanceAdmin' :: Text
appInstanceAdminArn = Text
a} :: DescribeAppInstanceAdmin)

-- | The ARN of the @AppInstance@.
describeAppInstanceAdmin_appInstanceArn :: Lens.Lens' DescribeAppInstanceAdmin Prelude.Text
describeAppInstanceAdmin_appInstanceArn :: (Text -> f Text)
-> DescribeAppInstanceAdmin -> f DescribeAppInstanceAdmin
describeAppInstanceAdmin_appInstanceArn = (DescribeAppInstanceAdmin -> Text)
-> (DescribeAppInstanceAdmin -> Text -> DescribeAppInstanceAdmin)
-> Lens DescribeAppInstanceAdmin DescribeAppInstanceAdmin Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAppInstanceAdmin' {Text
appInstanceArn :: Text
$sel:appInstanceArn:DescribeAppInstanceAdmin' :: DescribeAppInstanceAdmin -> Text
appInstanceArn} -> Text
appInstanceArn) (\s :: DescribeAppInstanceAdmin
s@DescribeAppInstanceAdmin' {} Text
a -> DescribeAppInstanceAdmin
s {$sel:appInstanceArn:DescribeAppInstanceAdmin' :: Text
appInstanceArn = Text
a} :: DescribeAppInstanceAdmin)

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

instance Prelude.NFData DescribeAppInstanceAdmin

instance Core.ToHeaders DescribeAppInstanceAdmin where
  toHeaders :: DescribeAppInstanceAdmin -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeAppInstanceAdmin -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DescribeAppInstanceAdmin where
  toPath :: DescribeAppInstanceAdmin -> ByteString
toPath DescribeAppInstanceAdmin' {Text
appInstanceArn :: Text
appInstanceAdminArn :: Text
$sel:appInstanceArn:DescribeAppInstanceAdmin' :: DescribeAppInstanceAdmin -> Text
$sel:appInstanceAdminArn:DescribeAppInstanceAdmin' :: DescribeAppInstanceAdmin -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/app-instances/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appInstanceArn,
        ByteString
"/admins/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appInstanceAdminArn
      ]

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

-- | /See:/ 'newDescribeAppInstanceAdminResponse' smart constructor.
data DescribeAppInstanceAdminResponse = DescribeAppInstanceAdminResponse'
  { -- | The ARN and name of the @AppInstanceUser@, the ARN of the @AppInstance@,
    -- and the created and last-updated timestamps. All timestamps use epoch
    -- milliseconds.
    DescribeAppInstanceAdminResponse -> Maybe AppInstanceAdmin
appInstanceAdmin :: Prelude.Maybe AppInstanceAdmin,
    -- | The response's http status code.
    DescribeAppInstanceAdminResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAppInstanceAdminResponse
-> DescribeAppInstanceAdminResponse -> Bool
(DescribeAppInstanceAdminResponse
 -> DescribeAppInstanceAdminResponse -> Bool)
-> (DescribeAppInstanceAdminResponse
    -> DescribeAppInstanceAdminResponse -> Bool)
-> Eq DescribeAppInstanceAdminResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAppInstanceAdminResponse
-> DescribeAppInstanceAdminResponse -> Bool
$c/= :: DescribeAppInstanceAdminResponse
-> DescribeAppInstanceAdminResponse -> Bool
== :: DescribeAppInstanceAdminResponse
-> DescribeAppInstanceAdminResponse -> Bool
$c== :: DescribeAppInstanceAdminResponse
-> DescribeAppInstanceAdminResponse -> Bool
Prelude.Eq, Int -> DescribeAppInstanceAdminResponse -> ShowS
[DescribeAppInstanceAdminResponse] -> ShowS
DescribeAppInstanceAdminResponse -> String
(Int -> DescribeAppInstanceAdminResponse -> ShowS)
-> (DescribeAppInstanceAdminResponse -> String)
-> ([DescribeAppInstanceAdminResponse] -> ShowS)
-> Show DescribeAppInstanceAdminResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAppInstanceAdminResponse] -> ShowS
$cshowList :: [DescribeAppInstanceAdminResponse] -> ShowS
show :: DescribeAppInstanceAdminResponse -> String
$cshow :: DescribeAppInstanceAdminResponse -> String
showsPrec :: Int -> DescribeAppInstanceAdminResponse -> ShowS
$cshowsPrec :: Int -> DescribeAppInstanceAdminResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAppInstanceAdminResponse
 -> Rep DescribeAppInstanceAdminResponse x)
-> (forall x.
    Rep DescribeAppInstanceAdminResponse x
    -> DescribeAppInstanceAdminResponse)
-> Generic DescribeAppInstanceAdminResponse
forall x.
Rep DescribeAppInstanceAdminResponse x
-> DescribeAppInstanceAdminResponse
forall x.
DescribeAppInstanceAdminResponse
-> Rep DescribeAppInstanceAdminResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAppInstanceAdminResponse x
-> DescribeAppInstanceAdminResponse
$cfrom :: forall x.
DescribeAppInstanceAdminResponse
-> Rep DescribeAppInstanceAdminResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAppInstanceAdminResponse' 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:
--
-- 'appInstanceAdmin', 'describeAppInstanceAdminResponse_appInstanceAdmin' - The ARN and name of the @AppInstanceUser@, the ARN of the @AppInstance@,
-- and the created and last-updated timestamps. All timestamps use epoch
-- milliseconds.
--
-- 'httpStatus', 'describeAppInstanceAdminResponse_httpStatus' - The response's http status code.
newDescribeAppInstanceAdminResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAppInstanceAdminResponse
newDescribeAppInstanceAdminResponse :: Int -> DescribeAppInstanceAdminResponse
newDescribeAppInstanceAdminResponse Int
pHttpStatus_ =
  DescribeAppInstanceAdminResponse' :: Maybe AppInstanceAdmin -> Int -> DescribeAppInstanceAdminResponse
DescribeAppInstanceAdminResponse'
    { $sel:appInstanceAdmin:DescribeAppInstanceAdminResponse' :: Maybe AppInstanceAdmin
appInstanceAdmin =
        Maybe AppInstanceAdmin
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAppInstanceAdminResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN and name of the @AppInstanceUser@, the ARN of the @AppInstance@,
-- and the created and last-updated timestamps. All timestamps use epoch
-- milliseconds.
describeAppInstanceAdminResponse_appInstanceAdmin :: Lens.Lens' DescribeAppInstanceAdminResponse (Prelude.Maybe AppInstanceAdmin)
describeAppInstanceAdminResponse_appInstanceAdmin :: (Maybe AppInstanceAdmin -> f (Maybe AppInstanceAdmin))
-> DescribeAppInstanceAdminResponse
-> f DescribeAppInstanceAdminResponse
describeAppInstanceAdminResponse_appInstanceAdmin = (DescribeAppInstanceAdminResponse -> Maybe AppInstanceAdmin)
-> (DescribeAppInstanceAdminResponse
    -> Maybe AppInstanceAdmin -> DescribeAppInstanceAdminResponse)
-> Lens
     DescribeAppInstanceAdminResponse
     DescribeAppInstanceAdminResponse
     (Maybe AppInstanceAdmin)
     (Maybe AppInstanceAdmin)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAppInstanceAdminResponse' {Maybe AppInstanceAdmin
appInstanceAdmin :: Maybe AppInstanceAdmin
$sel:appInstanceAdmin:DescribeAppInstanceAdminResponse' :: DescribeAppInstanceAdminResponse -> Maybe AppInstanceAdmin
appInstanceAdmin} -> Maybe AppInstanceAdmin
appInstanceAdmin) (\s :: DescribeAppInstanceAdminResponse
s@DescribeAppInstanceAdminResponse' {} Maybe AppInstanceAdmin
a -> DescribeAppInstanceAdminResponse
s {$sel:appInstanceAdmin:DescribeAppInstanceAdminResponse' :: Maybe AppInstanceAdmin
appInstanceAdmin = Maybe AppInstanceAdmin
a} :: DescribeAppInstanceAdminResponse)

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

instance
  Prelude.NFData
    DescribeAppInstanceAdminResponse