{-# 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.Wisdom.GetAssistantAssociation
-- 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 information about an assistant association.
module Amazonka.Wisdom.GetAssistantAssociation
  ( -- * Creating a Request
    GetAssistantAssociation (..),
    newGetAssistantAssociation,

    -- * Request Lenses
    getAssistantAssociation_assistantAssociationId,
    getAssistantAssociation_assistantId,

    -- * Destructuring the Response
    GetAssistantAssociationResponse (..),
    newGetAssistantAssociationResponse,

    -- * Response Lenses
    getAssistantAssociationResponse_assistantAssociation,
    getAssistantAssociationResponse_httpStatus,
  )
where

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
import Amazonka.Wisdom.Types

-- | /See:/ 'newGetAssistantAssociation' smart constructor.
data GetAssistantAssociation = GetAssistantAssociation'
  { -- | The identifier of the assistant association. Can be either the ID or the
    -- ARN. URLs cannot contain the ARN.
    GetAssistantAssociation -> Text
assistantAssociationId :: Prelude.Text,
    -- | The identifier of the Wisdom assistant. Can be either the ID or the ARN.
    -- URLs cannot contain the ARN.
    GetAssistantAssociation -> Text
assistantId :: Prelude.Text
  }
  deriving (GetAssistantAssociation -> GetAssistantAssociation -> Bool
(GetAssistantAssociation -> GetAssistantAssociation -> Bool)
-> (GetAssistantAssociation -> GetAssistantAssociation -> Bool)
-> Eq GetAssistantAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAssistantAssociation -> GetAssistantAssociation -> Bool
$c/= :: GetAssistantAssociation -> GetAssistantAssociation -> Bool
== :: GetAssistantAssociation -> GetAssistantAssociation -> Bool
$c== :: GetAssistantAssociation -> GetAssistantAssociation -> Bool
Prelude.Eq, ReadPrec [GetAssistantAssociation]
ReadPrec GetAssistantAssociation
Int -> ReadS GetAssistantAssociation
ReadS [GetAssistantAssociation]
(Int -> ReadS GetAssistantAssociation)
-> ReadS [GetAssistantAssociation]
-> ReadPrec GetAssistantAssociation
-> ReadPrec [GetAssistantAssociation]
-> Read GetAssistantAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAssistantAssociation]
$creadListPrec :: ReadPrec [GetAssistantAssociation]
readPrec :: ReadPrec GetAssistantAssociation
$creadPrec :: ReadPrec GetAssistantAssociation
readList :: ReadS [GetAssistantAssociation]
$creadList :: ReadS [GetAssistantAssociation]
readsPrec :: Int -> ReadS GetAssistantAssociation
$creadsPrec :: Int -> ReadS GetAssistantAssociation
Prelude.Read, Int -> GetAssistantAssociation -> ShowS
[GetAssistantAssociation] -> ShowS
GetAssistantAssociation -> String
(Int -> GetAssistantAssociation -> ShowS)
-> (GetAssistantAssociation -> String)
-> ([GetAssistantAssociation] -> ShowS)
-> Show GetAssistantAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAssistantAssociation] -> ShowS
$cshowList :: [GetAssistantAssociation] -> ShowS
show :: GetAssistantAssociation -> String
$cshow :: GetAssistantAssociation -> String
showsPrec :: Int -> GetAssistantAssociation -> ShowS
$cshowsPrec :: Int -> GetAssistantAssociation -> ShowS
Prelude.Show, (forall x.
 GetAssistantAssociation -> Rep GetAssistantAssociation x)
-> (forall x.
    Rep GetAssistantAssociation x -> GetAssistantAssociation)
-> Generic GetAssistantAssociation
forall x. Rep GetAssistantAssociation x -> GetAssistantAssociation
forall x. GetAssistantAssociation -> Rep GetAssistantAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAssistantAssociation x -> GetAssistantAssociation
$cfrom :: forall x. GetAssistantAssociation -> Rep GetAssistantAssociation x
Prelude.Generic)

-- |
-- Create a value of 'GetAssistantAssociation' 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:
--
-- 'assistantAssociationId', 'getAssistantAssociation_assistantAssociationId' - The identifier of the assistant association. Can be either the ID or the
-- ARN. URLs cannot contain the ARN.
--
-- 'assistantId', 'getAssistantAssociation_assistantId' - The identifier of the Wisdom assistant. Can be either the ID or the ARN.
-- URLs cannot contain the ARN.
newGetAssistantAssociation ::
  -- | 'assistantAssociationId'
  Prelude.Text ->
  -- | 'assistantId'
  Prelude.Text ->
  GetAssistantAssociation
newGetAssistantAssociation :: Text -> Text -> GetAssistantAssociation
newGetAssistantAssociation
  Text
pAssistantAssociationId_
  Text
pAssistantId_ =
    GetAssistantAssociation' :: Text -> Text -> GetAssistantAssociation
GetAssistantAssociation'
      { $sel:assistantAssociationId:GetAssistantAssociation' :: Text
assistantAssociationId =
          Text
pAssistantAssociationId_,
        $sel:assistantId:GetAssistantAssociation' :: Text
assistantId = Text
pAssistantId_
      }

-- | The identifier of the assistant association. Can be either the ID or the
-- ARN. URLs cannot contain the ARN.
getAssistantAssociation_assistantAssociationId :: Lens.Lens' GetAssistantAssociation Prelude.Text
getAssistantAssociation_assistantAssociationId :: (Text -> f Text)
-> GetAssistantAssociation -> f GetAssistantAssociation
getAssistantAssociation_assistantAssociationId = (GetAssistantAssociation -> Text)
-> (GetAssistantAssociation -> Text -> GetAssistantAssociation)
-> Lens GetAssistantAssociation GetAssistantAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssistantAssociation' {Text
assistantAssociationId :: Text
$sel:assistantAssociationId:GetAssistantAssociation' :: GetAssistantAssociation -> Text
assistantAssociationId} -> Text
assistantAssociationId) (\s :: GetAssistantAssociation
s@GetAssistantAssociation' {} Text
a -> GetAssistantAssociation
s {$sel:assistantAssociationId:GetAssistantAssociation' :: Text
assistantAssociationId = Text
a} :: GetAssistantAssociation)

-- | The identifier of the Wisdom assistant. Can be either the ID or the ARN.
-- URLs cannot contain the ARN.
getAssistantAssociation_assistantId :: Lens.Lens' GetAssistantAssociation Prelude.Text
getAssistantAssociation_assistantId :: (Text -> f Text)
-> GetAssistantAssociation -> f GetAssistantAssociation
getAssistantAssociation_assistantId = (GetAssistantAssociation -> Text)
-> (GetAssistantAssociation -> Text -> GetAssistantAssociation)
-> Lens GetAssistantAssociation GetAssistantAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssistantAssociation' {Text
assistantId :: Text
$sel:assistantId:GetAssistantAssociation' :: GetAssistantAssociation -> Text
assistantId} -> Text
assistantId) (\s :: GetAssistantAssociation
s@GetAssistantAssociation' {} Text
a -> GetAssistantAssociation
s {$sel:assistantId:GetAssistantAssociation' :: Text
assistantId = Text
a} :: GetAssistantAssociation)

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

instance Prelude.NFData GetAssistantAssociation

instance Core.ToHeaders GetAssistantAssociation where
  toHeaders :: GetAssistantAssociation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetAssistantAssociation -> 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 GetAssistantAssociation where
  toPath :: GetAssistantAssociation -> ByteString
toPath GetAssistantAssociation' {Text
assistantId :: Text
assistantAssociationId :: Text
$sel:assistantId:GetAssistantAssociation' :: GetAssistantAssociation -> Text
$sel:assistantAssociationId:GetAssistantAssociation' :: GetAssistantAssociation -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/assistants/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
assistantId,
        ByteString
"/associations/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
assistantAssociationId
      ]

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

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

-- |
-- Create a value of 'GetAssistantAssociationResponse' 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:
--
-- 'assistantAssociation', 'getAssistantAssociationResponse_assistantAssociation' - The assistant association.
--
-- 'httpStatus', 'getAssistantAssociationResponse_httpStatus' - The response's http status code.
newGetAssistantAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAssistantAssociationResponse
newGetAssistantAssociationResponse :: Int -> GetAssistantAssociationResponse
newGetAssistantAssociationResponse Int
pHttpStatus_ =
  GetAssistantAssociationResponse' :: Maybe AssistantAssociationData
-> Int -> GetAssistantAssociationResponse
GetAssistantAssociationResponse'
    { $sel:assistantAssociation:GetAssistantAssociationResponse' :: Maybe AssistantAssociationData
assistantAssociation =
        Maybe AssistantAssociationData
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAssistantAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The assistant association.
getAssistantAssociationResponse_assistantAssociation :: Lens.Lens' GetAssistantAssociationResponse (Prelude.Maybe AssistantAssociationData)
getAssistantAssociationResponse_assistantAssociation :: (Maybe AssistantAssociationData
 -> f (Maybe AssistantAssociationData))
-> GetAssistantAssociationResponse
-> f GetAssistantAssociationResponse
getAssistantAssociationResponse_assistantAssociation = (GetAssistantAssociationResponse -> Maybe AssistantAssociationData)
-> (GetAssistantAssociationResponse
    -> Maybe AssistantAssociationData
    -> GetAssistantAssociationResponse)
-> Lens
     GetAssistantAssociationResponse
     GetAssistantAssociationResponse
     (Maybe AssistantAssociationData)
     (Maybe AssistantAssociationData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssistantAssociationResponse' {Maybe AssistantAssociationData
assistantAssociation :: Maybe AssistantAssociationData
$sel:assistantAssociation:GetAssistantAssociationResponse' :: GetAssistantAssociationResponse -> Maybe AssistantAssociationData
assistantAssociation} -> Maybe AssistantAssociationData
assistantAssociation) (\s :: GetAssistantAssociationResponse
s@GetAssistantAssociationResponse' {} Maybe AssistantAssociationData
a -> GetAssistantAssociationResponse
s {$sel:assistantAssociation:GetAssistantAssociationResponse' :: Maybe AssistantAssociationData
assistantAssociation = Maybe AssistantAssociationData
a} :: GetAssistantAssociationResponse)

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

instance
  Prelude.NFData
    GetAssistantAssociationResponse