{-# 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.CloudFront.GetPublicKey
(
GetPublicKey (..),
newGetPublicKey,
getPublicKey_id,
GetPublicKeyResponse (..),
newGetPublicKeyResponse,
getPublicKeyResponse_eTag,
getPublicKeyResponse_publicKey,
getPublicKeyResponse_httpStatus,
)
where
import Amazonka.CloudFront.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetPublicKey = GetPublicKey'
{
GetPublicKey -> Text
id :: Prelude.Text
}
deriving (GetPublicKey -> GetPublicKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPublicKey -> GetPublicKey -> Bool
$c/= :: GetPublicKey -> GetPublicKey -> Bool
== :: GetPublicKey -> GetPublicKey -> Bool
$c== :: GetPublicKey -> GetPublicKey -> Bool
Prelude.Eq, ReadPrec [GetPublicKey]
ReadPrec GetPublicKey
Int -> ReadS GetPublicKey
ReadS [GetPublicKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPublicKey]
$creadListPrec :: ReadPrec [GetPublicKey]
readPrec :: ReadPrec GetPublicKey
$creadPrec :: ReadPrec GetPublicKey
readList :: ReadS [GetPublicKey]
$creadList :: ReadS [GetPublicKey]
readsPrec :: Int -> ReadS GetPublicKey
$creadsPrec :: Int -> ReadS GetPublicKey
Prelude.Read, Int -> GetPublicKey -> ShowS
[GetPublicKey] -> ShowS
GetPublicKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPublicKey] -> ShowS
$cshowList :: [GetPublicKey] -> ShowS
show :: GetPublicKey -> String
$cshow :: GetPublicKey -> String
showsPrec :: Int -> GetPublicKey -> ShowS
$cshowsPrec :: Int -> GetPublicKey -> ShowS
Prelude.Show, forall x. Rep GetPublicKey x -> GetPublicKey
forall x. GetPublicKey -> Rep GetPublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPublicKey x -> GetPublicKey
$cfrom :: forall x. GetPublicKey -> Rep GetPublicKey x
Prelude.Generic)
newGetPublicKey ::
Prelude.Text ->
GetPublicKey
newGetPublicKey :: Text -> GetPublicKey
newGetPublicKey Text
pId_ = GetPublicKey' {$sel:id:GetPublicKey' :: Text
id = Text
pId_}
getPublicKey_id :: Lens.Lens' GetPublicKey Prelude.Text
getPublicKey_id :: Lens' GetPublicKey Text
getPublicKey_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPublicKey' {Text
id :: Text
$sel:id:GetPublicKey' :: GetPublicKey -> Text
id} -> Text
id) (\s :: GetPublicKey
s@GetPublicKey' {} Text
a -> GetPublicKey
s {$sel:id:GetPublicKey' :: Text
id = Text
a} :: GetPublicKey)
instance Core.AWSRequest GetPublicKey where
type AWSResponse GetPublicKey = GetPublicKeyResponse
request :: (Service -> Service) -> GetPublicKey -> Request GetPublicKey
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetPublicKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPublicKey)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Maybe PublicKey -> Int -> GetPublicKeyResponse
GetPublicKeyResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"ETag")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetPublicKey where
hashWithSalt :: Int -> GetPublicKey -> Int
hashWithSalt Int
_salt GetPublicKey' {Text
id :: Text
$sel:id:GetPublicKey' :: GetPublicKey -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetPublicKey where
rnf :: GetPublicKey -> ()
rnf GetPublicKey' {Text
id :: Text
$sel:id:GetPublicKey' :: GetPublicKey -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetPublicKey where
toHeaders :: GetPublicKey -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetPublicKey where
toPath :: GetPublicKey -> ByteString
toPath GetPublicKey' {Text
id :: Text
$sel:id:GetPublicKey' :: GetPublicKey -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2020-05-31/public-key/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]
instance Data.ToQuery GetPublicKey where
toQuery :: GetPublicKey -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetPublicKeyResponse = GetPublicKeyResponse'
{
GetPublicKeyResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
GetPublicKeyResponse -> Maybe PublicKey
publicKey :: Prelude.Maybe PublicKey,
GetPublicKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPublicKeyResponse -> GetPublicKeyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPublicKeyResponse -> GetPublicKeyResponse -> Bool
$c/= :: GetPublicKeyResponse -> GetPublicKeyResponse -> Bool
== :: GetPublicKeyResponse -> GetPublicKeyResponse -> Bool
$c== :: GetPublicKeyResponse -> GetPublicKeyResponse -> Bool
Prelude.Eq, ReadPrec [GetPublicKeyResponse]
ReadPrec GetPublicKeyResponse
Int -> ReadS GetPublicKeyResponse
ReadS [GetPublicKeyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPublicKeyResponse]
$creadListPrec :: ReadPrec [GetPublicKeyResponse]
readPrec :: ReadPrec GetPublicKeyResponse
$creadPrec :: ReadPrec GetPublicKeyResponse
readList :: ReadS [GetPublicKeyResponse]
$creadList :: ReadS [GetPublicKeyResponse]
readsPrec :: Int -> ReadS GetPublicKeyResponse
$creadsPrec :: Int -> ReadS GetPublicKeyResponse
Prelude.Read, Int -> GetPublicKeyResponse -> ShowS
[GetPublicKeyResponse] -> ShowS
GetPublicKeyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPublicKeyResponse] -> ShowS
$cshowList :: [GetPublicKeyResponse] -> ShowS
show :: GetPublicKeyResponse -> String
$cshow :: GetPublicKeyResponse -> String
showsPrec :: Int -> GetPublicKeyResponse -> ShowS
$cshowsPrec :: Int -> GetPublicKeyResponse -> ShowS
Prelude.Show, forall x. Rep GetPublicKeyResponse x -> GetPublicKeyResponse
forall x. GetPublicKeyResponse -> Rep GetPublicKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPublicKeyResponse x -> GetPublicKeyResponse
$cfrom :: forall x. GetPublicKeyResponse -> Rep GetPublicKeyResponse x
Prelude.Generic)
newGetPublicKeyResponse ::
Prelude.Int ->
GetPublicKeyResponse
newGetPublicKeyResponse :: Int -> GetPublicKeyResponse
newGetPublicKeyResponse Int
pHttpStatus_ =
GetPublicKeyResponse'
{ $sel:eTag:GetPublicKeyResponse' :: Maybe Text
eTag = forall a. Maybe a
Prelude.Nothing,
$sel:publicKey:GetPublicKeyResponse' :: Maybe PublicKey
publicKey = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPublicKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPublicKeyResponse_eTag :: Lens.Lens' GetPublicKeyResponse (Prelude.Maybe Prelude.Text)
getPublicKeyResponse_eTag :: Lens' GetPublicKeyResponse (Maybe Text)
getPublicKeyResponse_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPublicKeyResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:GetPublicKeyResponse' :: GetPublicKeyResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: GetPublicKeyResponse
s@GetPublicKeyResponse' {} Maybe Text
a -> GetPublicKeyResponse
s {$sel:eTag:GetPublicKeyResponse' :: Maybe Text
eTag = Maybe Text
a} :: GetPublicKeyResponse)
getPublicKeyResponse_publicKey :: Lens.Lens' GetPublicKeyResponse (Prelude.Maybe PublicKey)
getPublicKeyResponse_publicKey :: Lens' GetPublicKeyResponse (Maybe PublicKey)
getPublicKeyResponse_publicKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPublicKeyResponse' {Maybe PublicKey
publicKey :: Maybe PublicKey
$sel:publicKey:GetPublicKeyResponse' :: GetPublicKeyResponse -> Maybe PublicKey
publicKey} -> Maybe PublicKey
publicKey) (\s :: GetPublicKeyResponse
s@GetPublicKeyResponse' {} Maybe PublicKey
a -> GetPublicKeyResponse
s {$sel:publicKey:GetPublicKeyResponse' :: Maybe PublicKey
publicKey = Maybe PublicKey
a} :: GetPublicKeyResponse)
getPublicKeyResponse_httpStatus :: Lens.Lens' GetPublicKeyResponse Prelude.Int
getPublicKeyResponse_httpStatus :: Lens' GetPublicKeyResponse Int
getPublicKeyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPublicKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPublicKeyResponse' :: GetPublicKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPublicKeyResponse
s@GetPublicKeyResponse' {} Int
a -> GetPublicKeyResponse
s {$sel:httpStatus:GetPublicKeyResponse' :: Int
httpStatus = Int
a} :: GetPublicKeyResponse)
instance Prelude.NFData GetPublicKeyResponse where
rnf :: GetPublicKeyResponse -> ()
rnf GetPublicKeyResponse' {Int
Maybe Text
Maybe PublicKey
httpStatus :: Int
publicKey :: Maybe PublicKey
eTag :: Maybe Text
$sel:httpStatus:GetPublicKeyResponse' :: GetPublicKeyResponse -> Int
$sel:publicKey:GetPublicKeyResponse' :: GetPublicKeyResponse -> Maybe PublicKey
$sel:eTag:GetPublicKeyResponse' :: GetPublicKeyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eTag
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PublicKey
publicKey
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus