{-# 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.Support.DescribeServices
(
DescribeServices (..),
newDescribeServices,
describeServices_serviceCodeList,
describeServices_language,
DescribeServicesResponse (..),
newDescribeServicesResponse,
describeServicesResponse_services,
describeServicesResponse_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.Support.Types
data DescribeServices = DescribeServices'
{
DescribeServices -> Maybe [Text]
serviceCodeList :: Prelude.Maybe [Prelude.Text],
DescribeServices -> Maybe Text
language :: Prelude.Maybe Prelude.Text
}
deriving (DescribeServices -> DescribeServices -> Bool
(DescribeServices -> DescribeServices -> Bool)
-> (DescribeServices -> DescribeServices -> Bool)
-> Eq DescribeServices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeServices -> DescribeServices -> Bool
$c/= :: DescribeServices -> DescribeServices -> Bool
== :: DescribeServices -> DescribeServices -> Bool
$c== :: DescribeServices -> DescribeServices -> Bool
Prelude.Eq, ReadPrec [DescribeServices]
ReadPrec DescribeServices
Int -> ReadS DescribeServices
ReadS [DescribeServices]
(Int -> ReadS DescribeServices)
-> ReadS [DescribeServices]
-> ReadPrec DescribeServices
-> ReadPrec [DescribeServices]
-> Read DescribeServices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeServices]
$creadListPrec :: ReadPrec [DescribeServices]
readPrec :: ReadPrec DescribeServices
$creadPrec :: ReadPrec DescribeServices
readList :: ReadS [DescribeServices]
$creadList :: ReadS [DescribeServices]
readsPrec :: Int -> ReadS DescribeServices
$creadsPrec :: Int -> ReadS DescribeServices
Prelude.Read, Int -> DescribeServices -> ShowS
[DescribeServices] -> ShowS
DescribeServices -> String
(Int -> DescribeServices -> ShowS)
-> (DescribeServices -> String)
-> ([DescribeServices] -> ShowS)
-> Show DescribeServices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeServices] -> ShowS
$cshowList :: [DescribeServices] -> ShowS
show :: DescribeServices -> String
$cshow :: DescribeServices -> String
showsPrec :: Int -> DescribeServices -> ShowS
$cshowsPrec :: Int -> DescribeServices -> ShowS
Prelude.Show, (forall x. DescribeServices -> Rep DescribeServices x)
-> (forall x. Rep DescribeServices x -> DescribeServices)
-> Generic DescribeServices
forall x. Rep DescribeServices x -> DescribeServices
forall x. DescribeServices -> Rep DescribeServices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeServices x -> DescribeServices
$cfrom :: forall x. DescribeServices -> Rep DescribeServices x
Prelude.Generic)
newDescribeServices ::
DescribeServices
newDescribeServices :: DescribeServices
newDescribeServices =
DescribeServices' :: Maybe [Text] -> Maybe Text -> DescribeServices
DescribeServices'
{ $sel:serviceCodeList:DescribeServices' :: Maybe [Text]
serviceCodeList =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:language:DescribeServices' :: Maybe Text
language = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
describeServices_serviceCodeList :: Lens.Lens' DescribeServices (Prelude.Maybe [Prelude.Text])
describeServices_serviceCodeList :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeServices -> f DescribeServices
describeServices_serviceCodeList = (DescribeServices -> Maybe [Text])
-> (DescribeServices -> Maybe [Text] -> DescribeServices)
-> Lens
DescribeServices DescribeServices (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServices' {Maybe [Text]
serviceCodeList :: Maybe [Text]
$sel:serviceCodeList:DescribeServices' :: DescribeServices -> Maybe [Text]
serviceCodeList} -> Maybe [Text]
serviceCodeList) (\s :: DescribeServices
s@DescribeServices' {} Maybe [Text]
a -> DescribeServices
s {$sel:serviceCodeList:DescribeServices' :: Maybe [Text]
serviceCodeList = Maybe [Text]
a} :: DescribeServices) ((Maybe [Text] -> f (Maybe [Text]))
-> DescribeServices -> f DescribeServices)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeServices
-> f DescribeServices
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeServices_language :: Lens.Lens' DescribeServices (Prelude.Maybe Prelude.Text)
describeServices_language :: (Maybe Text -> f (Maybe Text))
-> DescribeServices -> f DescribeServices
describeServices_language = (DescribeServices -> Maybe Text)
-> (DescribeServices -> Maybe Text -> DescribeServices)
-> Lens DescribeServices DescribeServices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServices' {Maybe Text
language :: Maybe Text
$sel:language:DescribeServices' :: DescribeServices -> Maybe Text
language} -> Maybe Text
language) (\s :: DescribeServices
s@DescribeServices' {} Maybe Text
a -> DescribeServices
s {$sel:language:DescribeServices' :: Maybe Text
language = Maybe Text
a} :: DescribeServices)
instance Core.AWSRequest DescribeServices where
type
AWSResponse DescribeServices =
DescribeServicesResponse
request :: DescribeServices -> Request DescribeServices
request = Service -> DescribeServices -> Request DescribeServices
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeServices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeServices)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeServices))
-> Logger
-> Service
-> Proxy DescribeServices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeServices)))
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 [SupportService] -> Int -> DescribeServicesResponse
DescribeServicesResponse'
(Maybe [SupportService] -> Int -> DescribeServicesResponse)
-> Either String (Maybe [SupportService])
-> Either String (Int -> DescribeServicesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [SupportService]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"services" Either String (Maybe (Maybe [SupportService]))
-> Maybe [SupportService] -> Either String (Maybe [SupportService])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SupportService]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeServicesResponse)
-> Either String Int -> Either String DescribeServicesResponse
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 DescribeServices
instance Prelude.NFData DescribeServices
instance Core.ToHeaders DescribeServices where
toHeaders :: DescribeServices -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeServices -> 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
"AWSSupport_20130415.DescribeServices" ::
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 DescribeServices where
toJSON :: DescribeServices -> Value
toJSON DescribeServices' {Maybe [Text]
Maybe Text
language :: Maybe Text
serviceCodeList :: Maybe [Text]
$sel:language:DescribeServices' :: DescribeServices -> Maybe Text
$sel:serviceCodeList:DescribeServices' :: DescribeServices -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"serviceCodeList" 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]
serviceCodeList,
(Text
"language" 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
language
]
)
instance Core.ToPath DescribeServices where
toPath :: DescribeServices -> ByteString
toPath = ByteString -> DescribeServices -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeServices where
toQuery :: DescribeServices -> QueryString
toQuery = QueryString -> DescribeServices -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeServicesResponse = DescribeServicesResponse'
{
DescribeServicesResponse -> Maybe [SupportService]
services :: Prelude.Maybe [SupportService],
DescribeServicesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeServicesResponse -> DescribeServicesResponse -> Bool
(DescribeServicesResponse -> DescribeServicesResponse -> Bool)
-> (DescribeServicesResponse -> DescribeServicesResponse -> Bool)
-> Eq DescribeServicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeServicesResponse -> DescribeServicesResponse -> Bool
$c/= :: DescribeServicesResponse -> DescribeServicesResponse -> Bool
== :: DescribeServicesResponse -> DescribeServicesResponse -> Bool
$c== :: DescribeServicesResponse -> DescribeServicesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeServicesResponse]
ReadPrec DescribeServicesResponse
Int -> ReadS DescribeServicesResponse
ReadS [DescribeServicesResponse]
(Int -> ReadS DescribeServicesResponse)
-> ReadS [DescribeServicesResponse]
-> ReadPrec DescribeServicesResponse
-> ReadPrec [DescribeServicesResponse]
-> Read DescribeServicesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeServicesResponse]
$creadListPrec :: ReadPrec [DescribeServicesResponse]
readPrec :: ReadPrec DescribeServicesResponse
$creadPrec :: ReadPrec DescribeServicesResponse
readList :: ReadS [DescribeServicesResponse]
$creadList :: ReadS [DescribeServicesResponse]
readsPrec :: Int -> ReadS DescribeServicesResponse
$creadsPrec :: Int -> ReadS DescribeServicesResponse
Prelude.Read, Int -> DescribeServicesResponse -> ShowS
[DescribeServicesResponse] -> ShowS
DescribeServicesResponse -> String
(Int -> DescribeServicesResponse -> ShowS)
-> (DescribeServicesResponse -> String)
-> ([DescribeServicesResponse] -> ShowS)
-> Show DescribeServicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeServicesResponse] -> ShowS
$cshowList :: [DescribeServicesResponse] -> ShowS
show :: DescribeServicesResponse -> String
$cshow :: DescribeServicesResponse -> String
showsPrec :: Int -> DescribeServicesResponse -> ShowS
$cshowsPrec :: Int -> DescribeServicesResponse -> ShowS
Prelude.Show, (forall x.
DescribeServicesResponse -> Rep DescribeServicesResponse x)
-> (forall x.
Rep DescribeServicesResponse x -> DescribeServicesResponse)
-> Generic DescribeServicesResponse
forall x.
Rep DescribeServicesResponse x -> DescribeServicesResponse
forall x.
DescribeServicesResponse -> Rep DescribeServicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeServicesResponse x -> DescribeServicesResponse
$cfrom :: forall x.
DescribeServicesResponse -> Rep DescribeServicesResponse x
Prelude.Generic)
newDescribeServicesResponse ::
Prelude.Int ->
DescribeServicesResponse
newDescribeServicesResponse :: Int -> DescribeServicesResponse
newDescribeServicesResponse Int
pHttpStatus_ =
DescribeServicesResponse' :: Maybe [SupportService] -> Int -> DescribeServicesResponse
DescribeServicesResponse'
{ $sel:services:DescribeServicesResponse' :: Maybe [SupportService]
services =
Maybe [SupportService]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeServicesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeServicesResponse_services :: Lens.Lens' DescribeServicesResponse (Prelude.Maybe [SupportService])
describeServicesResponse_services :: (Maybe [SupportService] -> f (Maybe [SupportService]))
-> DescribeServicesResponse -> f DescribeServicesResponse
describeServicesResponse_services = (DescribeServicesResponse -> Maybe [SupportService])
-> (DescribeServicesResponse
-> Maybe [SupportService] -> DescribeServicesResponse)
-> Lens
DescribeServicesResponse
DescribeServicesResponse
(Maybe [SupportService])
(Maybe [SupportService])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServicesResponse' {Maybe [SupportService]
services :: Maybe [SupportService]
$sel:services:DescribeServicesResponse' :: DescribeServicesResponse -> Maybe [SupportService]
services} -> Maybe [SupportService]
services) (\s :: DescribeServicesResponse
s@DescribeServicesResponse' {} Maybe [SupportService]
a -> DescribeServicesResponse
s {$sel:services:DescribeServicesResponse' :: Maybe [SupportService]
services = Maybe [SupportService]
a} :: DescribeServicesResponse) ((Maybe [SupportService] -> f (Maybe [SupportService]))
-> DescribeServicesResponse -> f DescribeServicesResponse)
-> ((Maybe [SupportService] -> f (Maybe [SupportService]))
-> Maybe [SupportService] -> f (Maybe [SupportService]))
-> (Maybe [SupportService] -> f (Maybe [SupportService]))
-> DescribeServicesResponse
-> f DescribeServicesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[SupportService] [SupportService] [SupportService] [SupportService]
-> Iso
(Maybe [SupportService])
(Maybe [SupportService])
(Maybe [SupportService])
(Maybe [SupportService])
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
[SupportService] [SupportService] [SupportService] [SupportService]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeServicesResponse_httpStatus :: Lens.Lens' DescribeServicesResponse Prelude.Int
describeServicesResponse_httpStatus :: (Int -> f Int)
-> DescribeServicesResponse -> f DescribeServicesResponse
describeServicesResponse_httpStatus = (DescribeServicesResponse -> Int)
-> (DescribeServicesResponse -> Int -> DescribeServicesResponse)
-> Lens DescribeServicesResponse DescribeServicesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServicesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeServicesResponse' :: DescribeServicesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeServicesResponse
s@DescribeServicesResponse' {} Int
a -> DescribeServicesResponse
s {$sel:httpStatus:DescribeServicesResponse' :: Int
httpStatus = Int
a} :: DescribeServicesResponse)
instance Prelude.NFData DescribeServicesResponse