{-# 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.Lightsail.GetCertificates
(
GetCertificates (..),
newGetCertificates,
getCertificates_certificateStatuses,
getCertificates_certificateName,
getCertificates_includeCertificateDetails,
GetCertificatesResponse (..),
newGetCertificatesResponse,
getCertificatesResponse_certificates,
getCertificatesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetCertificates = GetCertificates'
{
GetCertificates -> Maybe [CertificateStatus]
certificateStatuses :: Prelude.Maybe [CertificateStatus],
GetCertificates -> Maybe Text
certificateName :: Prelude.Maybe Prelude.Text,
GetCertificates -> Maybe Bool
includeCertificateDetails :: Prelude.Maybe Prelude.Bool
}
deriving (GetCertificates -> GetCertificates -> Bool
(GetCertificates -> GetCertificates -> Bool)
-> (GetCertificates -> GetCertificates -> Bool)
-> Eq GetCertificates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCertificates -> GetCertificates -> Bool
$c/= :: GetCertificates -> GetCertificates -> Bool
== :: GetCertificates -> GetCertificates -> Bool
$c== :: GetCertificates -> GetCertificates -> Bool
Prelude.Eq, ReadPrec [GetCertificates]
ReadPrec GetCertificates
Int -> ReadS GetCertificates
ReadS [GetCertificates]
(Int -> ReadS GetCertificates)
-> ReadS [GetCertificates]
-> ReadPrec GetCertificates
-> ReadPrec [GetCertificates]
-> Read GetCertificates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCertificates]
$creadListPrec :: ReadPrec [GetCertificates]
readPrec :: ReadPrec GetCertificates
$creadPrec :: ReadPrec GetCertificates
readList :: ReadS [GetCertificates]
$creadList :: ReadS [GetCertificates]
readsPrec :: Int -> ReadS GetCertificates
$creadsPrec :: Int -> ReadS GetCertificates
Prelude.Read, Int -> GetCertificates -> ShowS
[GetCertificates] -> ShowS
GetCertificates -> String
(Int -> GetCertificates -> ShowS)
-> (GetCertificates -> String)
-> ([GetCertificates] -> ShowS)
-> Show GetCertificates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCertificates] -> ShowS
$cshowList :: [GetCertificates] -> ShowS
show :: GetCertificates -> String
$cshow :: GetCertificates -> String
showsPrec :: Int -> GetCertificates -> ShowS
$cshowsPrec :: Int -> GetCertificates -> ShowS
Prelude.Show, (forall x. GetCertificates -> Rep GetCertificates x)
-> (forall x. Rep GetCertificates x -> GetCertificates)
-> Generic GetCertificates
forall x. Rep GetCertificates x -> GetCertificates
forall x. GetCertificates -> Rep GetCertificates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCertificates x -> GetCertificates
$cfrom :: forall x. GetCertificates -> Rep GetCertificates x
Prelude.Generic)
newGetCertificates ::
GetCertificates
newGetCertificates :: GetCertificates
newGetCertificates =
GetCertificates' :: Maybe [CertificateStatus]
-> Maybe Text -> Maybe Bool -> GetCertificates
GetCertificates'
{ $sel:certificateStatuses:GetCertificates' :: Maybe [CertificateStatus]
certificateStatuses =
Maybe [CertificateStatus]
forall a. Maybe a
Prelude.Nothing,
$sel:certificateName:GetCertificates' :: Maybe Text
certificateName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:includeCertificateDetails:GetCertificates' :: Maybe Bool
includeCertificateDetails = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
getCertificates_certificateStatuses :: Lens.Lens' GetCertificates (Prelude.Maybe [CertificateStatus])
getCertificates_certificateStatuses :: (Maybe [CertificateStatus] -> f (Maybe [CertificateStatus]))
-> GetCertificates -> f GetCertificates
getCertificates_certificateStatuses = (GetCertificates -> Maybe [CertificateStatus])
-> (GetCertificates
-> Maybe [CertificateStatus] -> GetCertificates)
-> Lens
GetCertificates
GetCertificates
(Maybe [CertificateStatus])
(Maybe [CertificateStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificates' {Maybe [CertificateStatus]
certificateStatuses :: Maybe [CertificateStatus]
$sel:certificateStatuses:GetCertificates' :: GetCertificates -> Maybe [CertificateStatus]
certificateStatuses} -> Maybe [CertificateStatus]
certificateStatuses) (\s :: GetCertificates
s@GetCertificates' {} Maybe [CertificateStatus]
a -> GetCertificates
s {$sel:certificateStatuses:GetCertificates' :: Maybe [CertificateStatus]
certificateStatuses = Maybe [CertificateStatus]
a} :: GetCertificates) ((Maybe [CertificateStatus] -> f (Maybe [CertificateStatus]))
-> GetCertificates -> f GetCertificates)
-> ((Maybe [CertificateStatus] -> f (Maybe [CertificateStatus]))
-> Maybe [CertificateStatus] -> f (Maybe [CertificateStatus]))
-> (Maybe [CertificateStatus] -> f (Maybe [CertificateStatus]))
-> GetCertificates
-> f GetCertificates
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[CertificateStatus]
[CertificateStatus]
[CertificateStatus]
[CertificateStatus]
-> Iso
(Maybe [CertificateStatus])
(Maybe [CertificateStatus])
(Maybe [CertificateStatus])
(Maybe [CertificateStatus])
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
[CertificateStatus]
[CertificateStatus]
[CertificateStatus]
[CertificateStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCertificates_certificateName :: Lens.Lens' GetCertificates (Prelude.Maybe Prelude.Text)
getCertificates_certificateName :: (Maybe Text -> f (Maybe Text))
-> GetCertificates -> f GetCertificates
getCertificates_certificateName = (GetCertificates -> Maybe Text)
-> (GetCertificates -> Maybe Text -> GetCertificates)
-> Lens GetCertificates GetCertificates (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificates' {Maybe Text
certificateName :: Maybe Text
$sel:certificateName:GetCertificates' :: GetCertificates -> Maybe Text
certificateName} -> Maybe Text
certificateName) (\s :: GetCertificates
s@GetCertificates' {} Maybe Text
a -> GetCertificates
s {$sel:certificateName:GetCertificates' :: Maybe Text
certificateName = Maybe Text
a} :: GetCertificates)
getCertificates_includeCertificateDetails :: Lens.Lens' GetCertificates (Prelude.Maybe Prelude.Bool)
getCertificates_includeCertificateDetails :: (Maybe Bool -> f (Maybe Bool))
-> GetCertificates -> f GetCertificates
getCertificates_includeCertificateDetails = (GetCertificates -> Maybe Bool)
-> (GetCertificates -> Maybe Bool -> GetCertificates)
-> Lens GetCertificates GetCertificates (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificates' {Maybe Bool
includeCertificateDetails :: Maybe Bool
$sel:includeCertificateDetails:GetCertificates' :: GetCertificates -> Maybe Bool
includeCertificateDetails} -> Maybe Bool
includeCertificateDetails) (\s :: GetCertificates
s@GetCertificates' {} Maybe Bool
a -> GetCertificates
s {$sel:includeCertificateDetails:GetCertificates' :: Maybe Bool
includeCertificateDetails = Maybe Bool
a} :: GetCertificates)
instance Core.AWSRequest GetCertificates where
type
AWSResponse GetCertificates =
GetCertificatesResponse
request :: GetCertificates -> Request GetCertificates
request = Service -> GetCertificates -> Request GetCertificates
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCertificates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCertificates)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCertificates))
-> Logger
-> Service
-> Proxy GetCertificates
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCertificates)))
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 [CertificateSummary] -> Int -> GetCertificatesResponse
GetCertificatesResponse'
(Maybe [CertificateSummary] -> Int -> GetCertificatesResponse)
-> Either String (Maybe [CertificateSummary])
-> Either String (Int -> GetCertificatesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [CertificateSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"certificates" Either String (Maybe (Maybe [CertificateSummary]))
-> Maybe [CertificateSummary]
-> Either String (Maybe [CertificateSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CertificateSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetCertificatesResponse)
-> Either String Int -> Either String GetCertificatesResponse
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 GetCertificates
instance Prelude.NFData GetCertificates
instance Core.ToHeaders GetCertificates where
toHeaders :: GetCertificates -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCertificates -> 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
"Lightsail_20161128.GetCertificates" ::
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 GetCertificates where
toJSON :: GetCertificates -> Value
toJSON GetCertificates' {Maybe Bool
Maybe [CertificateStatus]
Maybe Text
includeCertificateDetails :: Maybe Bool
certificateName :: Maybe Text
certificateStatuses :: Maybe [CertificateStatus]
$sel:includeCertificateDetails:GetCertificates' :: GetCertificates -> Maybe Bool
$sel:certificateName:GetCertificates' :: GetCertificates -> Maybe Text
$sel:certificateStatuses:GetCertificates' :: GetCertificates -> Maybe [CertificateStatus]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"certificateStatuses" Text -> [CertificateStatus] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([CertificateStatus] -> Pair)
-> Maybe [CertificateStatus] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CertificateStatus]
certificateStatuses,
(Text
"certificateName" 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
certificateName,
(Text
"includeCertificateDetails" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeCertificateDetails
]
)
instance Core.ToPath GetCertificates where
toPath :: GetCertificates -> ByteString
toPath = ByteString -> GetCertificates -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCertificates where
toQuery :: GetCertificates -> QueryString
toQuery = QueryString -> GetCertificates -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCertificatesResponse = GetCertificatesResponse'
{
GetCertificatesResponse -> Maybe [CertificateSummary]
certificates :: Prelude.Maybe [CertificateSummary],
GetCertificatesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCertificatesResponse -> GetCertificatesResponse -> Bool
(GetCertificatesResponse -> GetCertificatesResponse -> Bool)
-> (GetCertificatesResponse -> GetCertificatesResponse -> Bool)
-> Eq GetCertificatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCertificatesResponse -> GetCertificatesResponse -> Bool
$c/= :: GetCertificatesResponse -> GetCertificatesResponse -> Bool
== :: GetCertificatesResponse -> GetCertificatesResponse -> Bool
$c== :: GetCertificatesResponse -> GetCertificatesResponse -> Bool
Prelude.Eq, ReadPrec [GetCertificatesResponse]
ReadPrec GetCertificatesResponse
Int -> ReadS GetCertificatesResponse
ReadS [GetCertificatesResponse]
(Int -> ReadS GetCertificatesResponse)
-> ReadS [GetCertificatesResponse]
-> ReadPrec GetCertificatesResponse
-> ReadPrec [GetCertificatesResponse]
-> Read GetCertificatesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCertificatesResponse]
$creadListPrec :: ReadPrec [GetCertificatesResponse]
readPrec :: ReadPrec GetCertificatesResponse
$creadPrec :: ReadPrec GetCertificatesResponse
readList :: ReadS [GetCertificatesResponse]
$creadList :: ReadS [GetCertificatesResponse]
readsPrec :: Int -> ReadS GetCertificatesResponse
$creadsPrec :: Int -> ReadS GetCertificatesResponse
Prelude.Read, Int -> GetCertificatesResponse -> ShowS
[GetCertificatesResponse] -> ShowS
GetCertificatesResponse -> String
(Int -> GetCertificatesResponse -> ShowS)
-> (GetCertificatesResponse -> String)
-> ([GetCertificatesResponse] -> ShowS)
-> Show GetCertificatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCertificatesResponse] -> ShowS
$cshowList :: [GetCertificatesResponse] -> ShowS
show :: GetCertificatesResponse -> String
$cshow :: GetCertificatesResponse -> String
showsPrec :: Int -> GetCertificatesResponse -> ShowS
$cshowsPrec :: Int -> GetCertificatesResponse -> ShowS
Prelude.Show, (forall x.
GetCertificatesResponse -> Rep GetCertificatesResponse x)
-> (forall x.
Rep GetCertificatesResponse x -> GetCertificatesResponse)
-> Generic GetCertificatesResponse
forall x. Rep GetCertificatesResponse x -> GetCertificatesResponse
forall x. GetCertificatesResponse -> Rep GetCertificatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCertificatesResponse x -> GetCertificatesResponse
$cfrom :: forall x. GetCertificatesResponse -> Rep GetCertificatesResponse x
Prelude.Generic)
newGetCertificatesResponse ::
Prelude.Int ->
GetCertificatesResponse
newGetCertificatesResponse :: Int -> GetCertificatesResponse
newGetCertificatesResponse Int
pHttpStatus_ =
GetCertificatesResponse' :: Maybe [CertificateSummary] -> Int -> GetCertificatesResponse
GetCertificatesResponse'
{ $sel:certificates:GetCertificatesResponse' :: Maybe [CertificateSummary]
certificates =
Maybe [CertificateSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCertificatesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCertificatesResponse_certificates :: Lens.Lens' GetCertificatesResponse (Prelude.Maybe [CertificateSummary])
getCertificatesResponse_certificates :: (Maybe [CertificateSummary] -> f (Maybe [CertificateSummary]))
-> GetCertificatesResponse -> f GetCertificatesResponse
getCertificatesResponse_certificates = (GetCertificatesResponse -> Maybe [CertificateSummary])
-> (GetCertificatesResponse
-> Maybe [CertificateSummary] -> GetCertificatesResponse)
-> Lens
GetCertificatesResponse
GetCertificatesResponse
(Maybe [CertificateSummary])
(Maybe [CertificateSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificatesResponse' {Maybe [CertificateSummary]
certificates :: Maybe [CertificateSummary]
$sel:certificates:GetCertificatesResponse' :: GetCertificatesResponse -> Maybe [CertificateSummary]
certificates} -> Maybe [CertificateSummary]
certificates) (\s :: GetCertificatesResponse
s@GetCertificatesResponse' {} Maybe [CertificateSummary]
a -> GetCertificatesResponse
s {$sel:certificates:GetCertificatesResponse' :: Maybe [CertificateSummary]
certificates = Maybe [CertificateSummary]
a} :: GetCertificatesResponse) ((Maybe [CertificateSummary] -> f (Maybe [CertificateSummary]))
-> GetCertificatesResponse -> f GetCertificatesResponse)
-> ((Maybe [CertificateSummary] -> f (Maybe [CertificateSummary]))
-> Maybe [CertificateSummary] -> f (Maybe [CertificateSummary]))
-> (Maybe [CertificateSummary] -> f (Maybe [CertificateSummary]))
-> GetCertificatesResponse
-> f GetCertificatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[CertificateSummary]
[CertificateSummary]
[CertificateSummary]
[CertificateSummary]
-> Iso
(Maybe [CertificateSummary])
(Maybe [CertificateSummary])
(Maybe [CertificateSummary])
(Maybe [CertificateSummary])
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
[CertificateSummary]
[CertificateSummary]
[CertificateSummary]
[CertificateSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCertificatesResponse_httpStatus :: Lens.Lens' GetCertificatesResponse Prelude.Int
getCertificatesResponse_httpStatus :: (Int -> f Int)
-> GetCertificatesResponse -> f GetCertificatesResponse
getCertificatesResponse_httpStatus = (GetCertificatesResponse -> Int)
-> (GetCertificatesResponse -> Int -> GetCertificatesResponse)
-> Lens GetCertificatesResponse GetCertificatesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCertificatesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCertificatesResponse' :: GetCertificatesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCertificatesResponse
s@GetCertificatesResponse' {} Int
a -> GetCertificatesResponse
s {$sel:httpStatus:GetCertificatesResponse' :: Int
httpStatus = Int
a} :: GetCertificatesResponse)
instance Prelude.NFData GetCertificatesResponse