{-# 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 #-}
module Amazonka.DirectConnect.DescribeLoa
(
DescribeLoa (..),
newDescribeLoa,
describeLoa_loaContentType,
describeLoa_providerName,
describeLoa_connectionId,
DescribeLoaResponse (..),
newDescribeLoaResponse,
describeLoaResponse_loaContent,
describeLoaResponse_loaContentType,
describeLoaResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.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
data DescribeLoa = DescribeLoa'
{
DescribeLoa -> Maybe LoaContentType
loaContentType :: Prelude.Maybe LoaContentType,
DescribeLoa -> Maybe Text
providerName :: Prelude.Maybe Prelude.Text,
DescribeLoa -> Text
connectionId :: Prelude.Text
}
deriving (DescribeLoa -> DescribeLoa -> Bool
(DescribeLoa -> DescribeLoa -> Bool)
-> (DescribeLoa -> DescribeLoa -> Bool) -> Eq DescribeLoa
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLoa -> DescribeLoa -> Bool
$c/= :: DescribeLoa -> DescribeLoa -> Bool
== :: DescribeLoa -> DescribeLoa -> Bool
$c== :: DescribeLoa -> DescribeLoa -> Bool
Prelude.Eq, ReadPrec [DescribeLoa]
ReadPrec DescribeLoa
Int -> ReadS DescribeLoa
ReadS [DescribeLoa]
(Int -> ReadS DescribeLoa)
-> ReadS [DescribeLoa]
-> ReadPrec DescribeLoa
-> ReadPrec [DescribeLoa]
-> Read DescribeLoa
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLoa]
$creadListPrec :: ReadPrec [DescribeLoa]
readPrec :: ReadPrec DescribeLoa
$creadPrec :: ReadPrec DescribeLoa
readList :: ReadS [DescribeLoa]
$creadList :: ReadS [DescribeLoa]
readsPrec :: Int -> ReadS DescribeLoa
$creadsPrec :: Int -> ReadS DescribeLoa
Prelude.Read, Int -> DescribeLoa -> ShowS
[DescribeLoa] -> ShowS
DescribeLoa -> String
(Int -> DescribeLoa -> ShowS)
-> (DescribeLoa -> String)
-> ([DescribeLoa] -> ShowS)
-> Show DescribeLoa
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLoa] -> ShowS
$cshowList :: [DescribeLoa] -> ShowS
show :: DescribeLoa -> String
$cshow :: DescribeLoa -> String
showsPrec :: Int -> DescribeLoa -> ShowS
$cshowsPrec :: Int -> DescribeLoa -> ShowS
Prelude.Show, (forall x. DescribeLoa -> Rep DescribeLoa x)
-> (forall x. Rep DescribeLoa x -> DescribeLoa)
-> Generic DescribeLoa
forall x. Rep DescribeLoa x -> DescribeLoa
forall x. DescribeLoa -> Rep DescribeLoa x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeLoa x -> DescribeLoa
$cfrom :: forall x. DescribeLoa -> Rep DescribeLoa x
Prelude.Generic)
newDescribeLoa ::
Prelude.Text ->
DescribeLoa
newDescribeLoa :: Text -> DescribeLoa
newDescribeLoa Text
pConnectionId_ =
DescribeLoa' :: Maybe LoaContentType -> Maybe Text -> Text -> DescribeLoa
DescribeLoa'
{ $sel:loaContentType:DescribeLoa' :: Maybe LoaContentType
loaContentType = Maybe LoaContentType
forall a. Maybe a
Prelude.Nothing,
$sel:providerName:DescribeLoa' :: Maybe Text
providerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:connectionId:DescribeLoa' :: Text
connectionId = Text
pConnectionId_
}
describeLoa_loaContentType :: Lens.Lens' DescribeLoa (Prelude.Maybe LoaContentType)
describeLoa_loaContentType :: (Maybe LoaContentType -> f (Maybe LoaContentType))
-> DescribeLoa -> f DescribeLoa
describeLoa_loaContentType = (DescribeLoa -> Maybe LoaContentType)
-> (DescribeLoa -> Maybe LoaContentType -> DescribeLoa)
-> Lens
DescribeLoa
DescribeLoa
(Maybe LoaContentType)
(Maybe LoaContentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoa' {Maybe LoaContentType
loaContentType :: Maybe LoaContentType
$sel:loaContentType:DescribeLoa' :: DescribeLoa -> Maybe LoaContentType
loaContentType} -> Maybe LoaContentType
loaContentType) (\s :: DescribeLoa
s@DescribeLoa' {} Maybe LoaContentType
a -> DescribeLoa
s {$sel:loaContentType:DescribeLoa' :: Maybe LoaContentType
loaContentType = Maybe LoaContentType
a} :: DescribeLoa)
describeLoa_providerName :: Lens.Lens' DescribeLoa (Prelude.Maybe Prelude.Text)
describeLoa_providerName :: (Maybe Text -> f (Maybe Text)) -> DescribeLoa -> f DescribeLoa
describeLoa_providerName = (DescribeLoa -> Maybe Text)
-> (DescribeLoa -> Maybe Text -> DescribeLoa)
-> Lens DescribeLoa DescribeLoa (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoa' {Maybe Text
providerName :: Maybe Text
$sel:providerName:DescribeLoa' :: DescribeLoa -> Maybe Text
providerName} -> Maybe Text
providerName) (\s :: DescribeLoa
s@DescribeLoa' {} Maybe Text
a -> DescribeLoa
s {$sel:providerName:DescribeLoa' :: Maybe Text
providerName = Maybe Text
a} :: DescribeLoa)
describeLoa_connectionId :: Lens.Lens' DescribeLoa Prelude.Text
describeLoa_connectionId :: (Text -> f Text) -> DescribeLoa -> f DescribeLoa
describeLoa_connectionId = (DescribeLoa -> Text)
-> (DescribeLoa -> Text -> DescribeLoa)
-> Lens DescribeLoa DescribeLoa Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoa' {Text
connectionId :: Text
$sel:connectionId:DescribeLoa' :: DescribeLoa -> Text
connectionId} -> Text
connectionId) (\s :: DescribeLoa
s@DescribeLoa' {} Text
a -> DescribeLoa
s {$sel:connectionId:DescribeLoa' :: Text
connectionId = Text
a} :: DescribeLoa)
instance Core.AWSRequest DescribeLoa where
type AWSResponse DescribeLoa = DescribeLoaResponse
request :: DescribeLoa -> Request DescribeLoa
request = Service -> DescribeLoa -> Request DescribeLoa
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeLoa
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeLoa)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeLoa))
-> Logger
-> Service
-> Proxy DescribeLoa
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeLoa)))
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 Base64 -> Maybe LoaContentType -> Int -> DescribeLoaResponse
DescribeLoaResponse'
(Maybe Base64
-> Maybe LoaContentType -> Int -> DescribeLoaResponse)
-> Either String (Maybe Base64)
-> Either
String (Maybe LoaContentType -> Int -> DescribeLoaResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Base64)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"loaContent")
Either String (Maybe LoaContentType -> Int -> DescribeLoaResponse)
-> Either String (Maybe LoaContentType)
-> Either String (Int -> DescribeLoaResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe LoaContentType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"loaContentType")
Either String (Int -> DescribeLoaResponse)
-> Either String Int -> Either String DescribeLoaResponse
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 DescribeLoa
instance Prelude.NFData DescribeLoa
instance Core.ToHeaders DescribeLoa where
toHeaders :: DescribeLoa -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeLoa -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OvertureService.DescribeLoa" ::
Prelude.ByteString
),
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.ToJSON DescribeLoa where
toJSON :: DescribeLoa -> Value
toJSON DescribeLoa' {Maybe Text
Maybe LoaContentType
Text
connectionId :: Text
providerName :: Maybe Text
loaContentType :: Maybe LoaContentType
$sel:connectionId:DescribeLoa' :: DescribeLoa -> Text
$sel:providerName:DescribeLoa' :: DescribeLoa -> Maybe Text
$sel:loaContentType:DescribeLoa' :: DescribeLoa -> Maybe LoaContentType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"loaContentType" Text -> LoaContentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(LoaContentType -> Pair) -> Maybe LoaContentType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoaContentType
loaContentType,
(Text
"providerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
providerName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"connectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionId)
]
)
instance Core.ToPath DescribeLoa where
toPath :: DescribeLoa -> ByteString
toPath = ByteString -> DescribeLoa -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeLoa where
toQuery :: DescribeLoa -> QueryString
toQuery = QueryString -> DescribeLoa -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeLoaResponse = DescribeLoaResponse'
{
DescribeLoaResponse -> Maybe Base64
loaContent :: Prelude.Maybe Core.Base64,
DescribeLoaResponse -> Maybe LoaContentType
loaContentType :: Prelude.Maybe LoaContentType,
DescribeLoaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeLoaResponse -> DescribeLoaResponse -> Bool
(DescribeLoaResponse -> DescribeLoaResponse -> Bool)
-> (DescribeLoaResponse -> DescribeLoaResponse -> Bool)
-> Eq DescribeLoaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLoaResponse -> DescribeLoaResponse -> Bool
$c/= :: DescribeLoaResponse -> DescribeLoaResponse -> Bool
== :: DescribeLoaResponse -> DescribeLoaResponse -> Bool
$c== :: DescribeLoaResponse -> DescribeLoaResponse -> Bool
Prelude.Eq, ReadPrec [DescribeLoaResponse]
ReadPrec DescribeLoaResponse
Int -> ReadS DescribeLoaResponse
ReadS [DescribeLoaResponse]
(Int -> ReadS DescribeLoaResponse)
-> ReadS [DescribeLoaResponse]
-> ReadPrec DescribeLoaResponse
-> ReadPrec [DescribeLoaResponse]
-> Read DescribeLoaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLoaResponse]
$creadListPrec :: ReadPrec [DescribeLoaResponse]
readPrec :: ReadPrec DescribeLoaResponse
$creadPrec :: ReadPrec DescribeLoaResponse
readList :: ReadS [DescribeLoaResponse]
$creadList :: ReadS [DescribeLoaResponse]
readsPrec :: Int -> ReadS DescribeLoaResponse
$creadsPrec :: Int -> ReadS DescribeLoaResponse
Prelude.Read, Int -> DescribeLoaResponse -> ShowS
[DescribeLoaResponse] -> ShowS
DescribeLoaResponse -> String
(Int -> DescribeLoaResponse -> ShowS)
-> (DescribeLoaResponse -> String)
-> ([DescribeLoaResponse] -> ShowS)
-> Show DescribeLoaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLoaResponse] -> ShowS
$cshowList :: [DescribeLoaResponse] -> ShowS
show :: DescribeLoaResponse -> String
$cshow :: DescribeLoaResponse -> String
showsPrec :: Int -> DescribeLoaResponse -> ShowS
$cshowsPrec :: Int -> DescribeLoaResponse -> ShowS
Prelude.Show, (forall x. DescribeLoaResponse -> Rep DescribeLoaResponse x)
-> (forall x. Rep DescribeLoaResponse x -> DescribeLoaResponse)
-> Generic DescribeLoaResponse
forall x. Rep DescribeLoaResponse x -> DescribeLoaResponse
forall x. DescribeLoaResponse -> Rep DescribeLoaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeLoaResponse x -> DescribeLoaResponse
$cfrom :: forall x. DescribeLoaResponse -> Rep DescribeLoaResponse x
Prelude.Generic)
newDescribeLoaResponse ::
Prelude.Int ->
DescribeLoaResponse
newDescribeLoaResponse :: Int -> DescribeLoaResponse
newDescribeLoaResponse Int
pHttpStatus_ =
DescribeLoaResponse' :: Maybe Base64 -> Maybe LoaContentType -> Int -> DescribeLoaResponse
DescribeLoaResponse'
{ $sel:loaContent:DescribeLoaResponse' :: Maybe Base64
loaContent = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:loaContentType:DescribeLoaResponse' :: Maybe LoaContentType
loaContentType = Maybe LoaContentType
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeLoaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeLoaResponse_loaContent :: Lens.Lens' DescribeLoaResponse (Prelude.Maybe Prelude.ByteString)
describeLoaResponse_loaContent :: (Maybe ByteString -> f (Maybe ByteString))
-> DescribeLoaResponse -> f DescribeLoaResponse
describeLoaResponse_loaContent = (DescribeLoaResponse -> Maybe Base64)
-> (DescribeLoaResponse -> Maybe Base64 -> DescribeLoaResponse)
-> Lens
DescribeLoaResponse
DescribeLoaResponse
(Maybe Base64)
(Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoaResponse' {Maybe Base64
loaContent :: Maybe Base64
$sel:loaContent:DescribeLoaResponse' :: DescribeLoaResponse -> Maybe Base64
loaContent} -> Maybe Base64
loaContent) (\s :: DescribeLoaResponse
s@DescribeLoaResponse' {} Maybe Base64
a -> DescribeLoaResponse
s {$sel:loaContent:DescribeLoaResponse' :: Maybe Base64
loaContent = Maybe Base64
a} :: DescribeLoaResponse) ((Maybe Base64 -> f (Maybe Base64))
-> DescribeLoaResponse -> f DescribeLoaResponse)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> DescribeLoaResponse
-> f DescribeLoaResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
(Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64
describeLoaResponse_loaContentType :: Lens.Lens' DescribeLoaResponse (Prelude.Maybe LoaContentType)
describeLoaResponse_loaContentType :: (Maybe LoaContentType -> f (Maybe LoaContentType))
-> DescribeLoaResponse -> f DescribeLoaResponse
describeLoaResponse_loaContentType = (DescribeLoaResponse -> Maybe LoaContentType)
-> (DescribeLoaResponse
-> Maybe LoaContentType -> DescribeLoaResponse)
-> Lens
DescribeLoaResponse
DescribeLoaResponse
(Maybe LoaContentType)
(Maybe LoaContentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoaResponse' {Maybe LoaContentType
loaContentType :: Maybe LoaContentType
$sel:loaContentType:DescribeLoaResponse' :: DescribeLoaResponse -> Maybe LoaContentType
loaContentType} -> Maybe LoaContentType
loaContentType) (\s :: DescribeLoaResponse
s@DescribeLoaResponse' {} Maybe LoaContentType
a -> DescribeLoaResponse
s {$sel:loaContentType:DescribeLoaResponse' :: Maybe LoaContentType
loaContentType = Maybe LoaContentType
a} :: DescribeLoaResponse)
describeLoaResponse_httpStatus :: Lens.Lens' DescribeLoaResponse Prelude.Int
describeLoaResponse_httpStatus :: (Int -> f Int) -> DescribeLoaResponse -> f DescribeLoaResponse
describeLoaResponse_httpStatus = (DescribeLoaResponse -> Int)
-> (DescribeLoaResponse -> Int -> DescribeLoaResponse)
-> Lens DescribeLoaResponse DescribeLoaResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLoaResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeLoaResponse' :: DescribeLoaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeLoaResponse
s@DescribeLoaResponse' {} Int
a -> DescribeLoaResponse
s {$sel:httpStatus:DescribeLoaResponse' :: Int
httpStatus = Int
a} :: DescribeLoaResponse)
instance Prelude.NFData DescribeLoaResponse