{-# 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.DescribeAppInstance
-- 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 @AppInstance@.
module Amazonka.ChimeSDKIdentity.DescribeAppInstance
  ( -- * Creating a Request
    DescribeAppInstance (..),
    newDescribeAppInstance,

    -- * Request Lenses
    describeAppInstance_appInstanceArn,

    -- * Destructuring the Response
    DescribeAppInstanceResponse (..),
    newDescribeAppInstanceResponse,

    -- * Response Lenses
    describeAppInstanceResponse_appInstance,
    describeAppInstanceResponse_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:/ 'newDescribeAppInstance' smart constructor.
data DescribeAppInstance = DescribeAppInstance'
  { -- | The ARN of the @AppInstance@.
    DescribeAppInstance -> Text
appInstanceArn :: Prelude.Text
  }
  deriving (DescribeAppInstance -> DescribeAppInstance -> Bool
(DescribeAppInstance -> DescribeAppInstance -> Bool)
-> (DescribeAppInstance -> DescribeAppInstance -> Bool)
-> Eq DescribeAppInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAppInstance -> DescribeAppInstance -> Bool
$c/= :: DescribeAppInstance -> DescribeAppInstance -> Bool
== :: DescribeAppInstance -> DescribeAppInstance -> Bool
$c== :: DescribeAppInstance -> DescribeAppInstance -> Bool
Prelude.Eq, ReadPrec [DescribeAppInstance]
ReadPrec DescribeAppInstance
Int -> ReadS DescribeAppInstance
ReadS [DescribeAppInstance]
(Int -> ReadS DescribeAppInstance)
-> ReadS [DescribeAppInstance]
-> ReadPrec DescribeAppInstance
-> ReadPrec [DescribeAppInstance]
-> Read DescribeAppInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAppInstance]
$creadListPrec :: ReadPrec [DescribeAppInstance]
readPrec :: ReadPrec DescribeAppInstance
$creadPrec :: ReadPrec DescribeAppInstance
readList :: ReadS [DescribeAppInstance]
$creadList :: ReadS [DescribeAppInstance]
readsPrec :: Int -> ReadS DescribeAppInstance
$creadsPrec :: Int -> ReadS DescribeAppInstance
Prelude.Read, Int -> DescribeAppInstance -> ShowS
[DescribeAppInstance] -> ShowS
DescribeAppInstance -> String
(Int -> DescribeAppInstance -> ShowS)
-> (DescribeAppInstance -> String)
-> ([DescribeAppInstance] -> ShowS)
-> Show DescribeAppInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAppInstance] -> ShowS
$cshowList :: [DescribeAppInstance] -> ShowS
show :: DescribeAppInstance -> String
$cshow :: DescribeAppInstance -> String
showsPrec :: Int -> DescribeAppInstance -> ShowS
$cshowsPrec :: Int -> DescribeAppInstance -> ShowS
Prelude.Show, (forall x. DescribeAppInstance -> Rep DescribeAppInstance x)
-> (forall x. Rep DescribeAppInstance x -> DescribeAppInstance)
-> Generic DescribeAppInstance
forall x. Rep DescribeAppInstance x -> DescribeAppInstance
forall x. DescribeAppInstance -> Rep DescribeAppInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAppInstance x -> DescribeAppInstance
$cfrom :: forall x. DescribeAppInstance -> Rep DescribeAppInstance x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAppInstance' 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:
--
-- 'appInstanceArn', 'describeAppInstance_appInstanceArn' - The ARN of the @AppInstance@.
newDescribeAppInstance ::
  -- | 'appInstanceArn'
  Prelude.Text ->
  DescribeAppInstance
newDescribeAppInstance :: Text -> DescribeAppInstance
newDescribeAppInstance Text
pAppInstanceArn_ =
  DescribeAppInstance' :: Text -> DescribeAppInstance
DescribeAppInstance'
    { $sel:appInstanceArn:DescribeAppInstance' :: Text
appInstanceArn =
        Text
pAppInstanceArn_
    }

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

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

instance Prelude.NFData DescribeAppInstance

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

instance Core.ToPath DescribeAppInstance where
  toPath :: DescribeAppInstance -> ByteString
toPath DescribeAppInstance' {Text
appInstanceArn :: Text
$sel:appInstanceArn:DescribeAppInstance' :: DescribeAppInstance -> 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]

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

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

-- |
-- Create a value of 'DescribeAppInstanceResponse' 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:
--
-- 'appInstance', 'describeAppInstanceResponse_appInstance' - The ARN, metadata, created and last-updated timestamps, and the name of
-- the @AppInstance@. All timestamps use epoch milliseconds.
--
-- 'httpStatus', 'describeAppInstanceResponse_httpStatus' - The response's http status code.
newDescribeAppInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAppInstanceResponse
newDescribeAppInstanceResponse :: Int -> DescribeAppInstanceResponse
newDescribeAppInstanceResponse Int
pHttpStatus_ =
  DescribeAppInstanceResponse' :: Maybe AppInstance -> Int -> DescribeAppInstanceResponse
DescribeAppInstanceResponse'
    { $sel:appInstance:DescribeAppInstanceResponse' :: Maybe AppInstance
appInstance =
        Maybe AppInstance
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAppInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance Prelude.NFData DescribeAppInstanceResponse