{-# 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.ServiceCatalog.DescribePortfolio
(
DescribePortfolio (..),
newDescribePortfolio,
describePortfolio_acceptLanguage,
describePortfolio_id,
DescribePortfolioResponse (..),
newDescribePortfolioResponse,
describePortfolioResponse_budgets,
describePortfolioResponse_portfolioDetail,
describePortfolioResponse_tagOptions,
describePortfolioResponse_tags,
describePortfolioResponse_httpStatus,
)
where
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
import Amazonka.ServiceCatalog.Types
data DescribePortfolio = DescribePortfolio'
{
DescribePortfolio -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
DescribePortfolio -> Text
id :: Prelude.Text
}
deriving (DescribePortfolio -> DescribePortfolio -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePortfolio -> DescribePortfolio -> Bool
$c/= :: DescribePortfolio -> DescribePortfolio -> Bool
== :: DescribePortfolio -> DescribePortfolio -> Bool
$c== :: DescribePortfolio -> DescribePortfolio -> Bool
Prelude.Eq, ReadPrec [DescribePortfolio]
ReadPrec DescribePortfolio
Int -> ReadS DescribePortfolio
ReadS [DescribePortfolio]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePortfolio]
$creadListPrec :: ReadPrec [DescribePortfolio]
readPrec :: ReadPrec DescribePortfolio
$creadPrec :: ReadPrec DescribePortfolio
readList :: ReadS [DescribePortfolio]
$creadList :: ReadS [DescribePortfolio]
readsPrec :: Int -> ReadS DescribePortfolio
$creadsPrec :: Int -> ReadS DescribePortfolio
Prelude.Read, Int -> DescribePortfolio -> ShowS
[DescribePortfolio] -> ShowS
DescribePortfolio -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePortfolio] -> ShowS
$cshowList :: [DescribePortfolio] -> ShowS
show :: DescribePortfolio -> String
$cshow :: DescribePortfolio -> String
showsPrec :: Int -> DescribePortfolio -> ShowS
$cshowsPrec :: Int -> DescribePortfolio -> ShowS
Prelude.Show, forall x. Rep DescribePortfolio x -> DescribePortfolio
forall x. DescribePortfolio -> Rep DescribePortfolio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePortfolio x -> DescribePortfolio
$cfrom :: forall x. DescribePortfolio -> Rep DescribePortfolio x
Prelude.Generic)
newDescribePortfolio ::
Prelude.Text ->
DescribePortfolio
newDescribePortfolio :: Text -> DescribePortfolio
newDescribePortfolio Text
pId_ =
DescribePortfolio'
{ $sel:acceptLanguage:DescribePortfolio' :: Maybe Text
acceptLanguage =
forall a. Maybe a
Prelude.Nothing,
$sel:id:DescribePortfolio' :: Text
id = Text
pId_
}
describePortfolio_acceptLanguage :: Lens.Lens' DescribePortfolio (Prelude.Maybe Prelude.Text)
describePortfolio_acceptLanguage :: Lens' DescribePortfolio (Maybe Text)
describePortfolio_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePortfolio' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:DescribePortfolio' :: DescribePortfolio -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: DescribePortfolio
s@DescribePortfolio' {} Maybe Text
a -> DescribePortfolio
s {$sel:acceptLanguage:DescribePortfolio' :: Maybe Text
acceptLanguage = Maybe Text
a} :: DescribePortfolio)
describePortfolio_id :: Lens.Lens' DescribePortfolio Prelude.Text
describePortfolio_id :: Lens' DescribePortfolio Text
describePortfolio_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePortfolio' {Text
id :: Text
$sel:id:DescribePortfolio' :: DescribePortfolio -> Text
id} -> Text
id) (\s :: DescribePortfolio
s@DescribePortfolio' {} Text
a -> DescribePortfolio
s {$sel:id:DescribePortfolio' :: Text
id = Text
a} :: DescribePortfolio)
instance Core.AWSRequest DescribePortfolio where
type
AWSResponse DescribePortfolio =
DescribePortfolioResponse
request :: (Service -> Service)
-> DescribePortfolio -> Request DescribePortfolio
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribePortfolio
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribePortfolio)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [BudgetDetail]
-> Maybe PortfolioDetail
-> Maybe [TagOptionDetail]
-> Maybe [Tag]
-> Int
-> DescribePortfolioResponse
DescribePortfolioResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Budgets" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PortfolioDetail")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TagOptions" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Tags" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 DescribePortfolio where
hashWithSalt :: Int -> DescribePortfolio -> Int
hashWithSalt Int
_salt DescribePortfolio' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DescribePortfolio' :: DescribePortfolio -> Text
$sel:acceptLanguage:DescribePortfolio' :: DescribePortfolio -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData DescribePortfolio where
rnf :: DescribePortfolio -> ()
rnf DescribePortfolio' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DescribePortfolio' :: DescribePortfolio -> Text
$sel:acceptLanguage:DescribePortfolio' :: DescribePortfolio -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders DescribePortfolio where
toHeaders :: DescribePortfolio -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWS242ServiceCatalogService.DescribePortfolio" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON DescribePortfolio where
toJSON :: DescribePortfolio -> Value
toJSON DescribePortfolio' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DescribePortfolio' :: DescribePortfolio -> Text
$sel:acceptLanguage:DescribePortfolio' :: DescribePortfolio -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
]
)
instance Data.ToPath DescribePortfolio where
toPath :: DescribePortfolio -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery DescribePortfolio where
toQuery :: DescribePortfolio -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DescribePortfolioResponse = DescribePortfolioResponse'
{
DescribePortfolioResponse -> Maybe [BudgetDetail]
budgets :: Prelude.Maybe [BudgetDetail],
DescribePortfolioResponse -> Maybe PortfolioDetail
portfolioDetail :: Prelude.Maybe PortfolioDetail,
DescribePortfolioResponse -> Maybe [TagOptionDetail]
tagOptions :: Prelude.Maybe [TagOptionDetail],
DescribePortfolioResponse -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
DescribePortfolioResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribePortfolioResponse -> DescribePortfolioResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePortfolioResponse -> DescribePortfolioResponse -> Bool
$c/= :: DescribePortfolioResponse -> DescribePortfolioResponse -> Bool
== :: DescribePortfolioResponse -> DescribePortfolioResponse -> Bool
$c== :: DescribePortfolioResponse -> DescribePortfolioResponse -> Bool
Prelude.Eq, ReadPrec [DescribePortfolioResponse]
ReadPrec DescribePortfolioResponse
Int -> ReadS DescribePortfolioResponse
ReadS [DescribePortfolioResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePortfolioResponse]
$creadListPrec :: ReadPrec [DescribePortfolioResponse]
readPrec :: ReadPrec DescribePortfolioResponse
$creadPrec :: ReadPrec DescribePortfolioResponse
readList :: ReadS [DescribePortfolioResponse]
$creadList :: ReadS [DescribePortfolioResponse]
readsPrec :: Int -> ReadS DescribePortfolioResponse
$creadsPrec :: Int -> ReadS DescribePortfolioResponse
Prelude.Read, Int -> DescribePortfolioResponse -> ShowS
[DescribePortfolioResponse] -> ShowS
DescribePortfolioResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePortfolioResponse] -> ShowS
$cshowList :: [DescribePortfolioResponse] -> ShowS
show :: DescribePortfolioResponse -> String
$cshow :: DescribePortfolioResponse -> String
showsPrec :: Int -> DescribePortfolioResponse -> ShowS
$cshowsPrec :: Int -> DescribePortfolioResponse -> ShowS
Prelude.Show, forall x.
Rep DescribePortfolioResponse x -> DescribePortfolioResponse
forall x.
DescribePortfolioResponse -> Rep DescribePortfolioResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePortfolioResponse x -> DescribePortfolioResponse
$cfrom :: forall x.
DescribePortfolioResponse -> Rep DescribePortfolioResponse x
Prelude.Generic)
newDescribePortfolioResponse ::
Prelude.Int ->
DescribePortfolioResponse
newDescribePortfolioResponse :: Int -> DescribePortfolioResponse
newDescribePortfolioResponse Int
pHttpStatus_ =
DescribePortfolioResponse'
{ $sel:budgets:DescribePortfolioResponse' :: Maybe [BudgetDetail]
budgets =
forall a. Maybe a
Prelude.Nothing,
$sel:portfolioDetail:DescribePortfolioResponse' :: Maybe PortfolioDetail
portfolioDetail = forall a. Maybe a
Prelude.Nothing,
$sel:tagOptions:DescribePortfolioResponse' :: Maybe [TagOptionDetail]
tagOptions = forall a. Maybe a
Prelude.Nothing,
$sel:tags:DescribePortfolioResponse' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribePortfolioResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describePortfolioResponse_budgets :: Lens.Lens' DescribePortfolioResponse (Prelude.Maybe [BudgetDetail])
describePortfolioResponse_budgets :: Lens' DescribePortfolioResponse (Maybe [BudgetDetail])
describePortfolioResponse_budgets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePortfolioResponse' {Maybe [BudgetDetail]
budgets :: Maybe [BudgetDetail]
$sel:budgets:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe [BudgetDetail]
budgets} -> Maybe [BudgetDetail]
budgets) (\s :: DescribePortfolioResponse
s@DescribePortfolioResponse' {} Maybe [BudgetDetail]
a -> DescribePortfolioResponse
s {$sel:budgets:DescribePortfolioResponse' :: Maybe [BudgetDetail]
budgets = Maybe [BudgetDetail]
a} :: DescribePortfolioResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describePortfolioResponse_portfolioDetail :: Lens.Lens' DescribePortfolioResponse (Prelude.Maybe PortfolioDetail)
describePortfolioResponse_portfolioDetail :: Lens' DescribePortfolioResponse (Maybe PortfolioDetail)
describePortfolioResponse_portfolioDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePortfolioResponse' {Maybe PortfolioDetail
portfolioDetail :: Maybe PortfolioDetail
$sel:portfolioDetail:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe PortfolioDetail
portfolioDetail} -> Maybe PortfolioDetail
portfolioDetail) (\s :: DescribePortfolioResponse
s@DescribePortfolioResponse' {} Maybe PortfolioDetail
a -> DescribePortfolioResponse
s {$sel:portfolioDetail:DescribePortfolioResponse' :: Maybe PortfolioDetail
portfolioDetail = Maybe PortfolioDetail
a} :: DescribePortfolioResponse)
describePortfolioResponse_tagOptions :: Lens.Lens' DescribePortfolioResponse (Prelude.Maybe [TagOptionDetail])
describePortfolioResponse_tagOptions :: Lens' DescribePortfolioResponse (Maybe [TagOptionDetail])
describePortfolioResponse_tagOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePortfolioResponse' {Maybe [TagOptionDetail]
tagOptions :: Maybe [TagOptionDetail]
$sel:tagOptions:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe [TagOptionDetail]
tagOptions} -> Maybe [TagOptionDetail]
tagOptions) (\s :: DescribePortfolioResponse
s@DescribePortfolioResponse' {} Maybe [TagOptionDetail]
a -> DescribePortfolioResponse
s {$sel:tagOptions:DescribePortfolioResponse' :: Maybe [TagOptionDetail]
tagOptions = Maybe [TagOptionDetail]
a} :: DescribePortfolioResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describePortfolioResponse_tags :: Lens.Lens' DescribePortfolioResponse (Prelude.Maybe [Tag])
describePortfolioResponse_tags :: Lens' DescribePortfolioResponse (Maybe [Tag])
describePortfolioResponse_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePortfolioResponse' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: DescribePortfolioResponse
s@DescribePortfolioResponse' {} Maybe [Tag]
a -> DescribePortfolioResponse
s {$sel:tags:DescribePortfolioResponse' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: DescribePortfolioResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describePortfolioResponse_httpStatus :: Lens.Lens' DescribePortfolioResponse Prelude.Int
describePortfolioResponse_httpStatus :: Lens' DescribePortfolioResponse Int
describePortfolioResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePortfolioResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribePortfolioResponse' :: DescribePortfolioResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribePortfolioResponse
s@DescribePortfolioResponse' {} Int
a -> DescribePortfolioResponse
s {$sel:httpStatus:DescribePortfolioResponse' :: Int
httpStatus = Int
a} :: DescribePortfolioResponse)
instance Prelude.NFData DescribePortfolioResponse where
rnf :: DescribePortfolioResponse -> ()
rnf DescribePortfolioResponse' {Int
Maybe [BudgetDetail]
Maybe [Tag]
Maybe [TagOptionDetail]
Maybe PortfolioDetail
httpStatus :: Int
tags :: Maybe [Tag]
tagOptions :: Maybe [TagOptionDetail]
portfolioDetail :: Maybe PortfolioDetail
budgets :: Maybe [BudgetDetail]
$sel:httpStatus:DescribePortfolioResponse' :: DescribePortfolioResponse -> Int
$sel:tags:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe [Tag]
$sel:tagOptions:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe [TagOptionDetail]
$sel:portfolioDetail:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe PortfolioDetail
$sel:budgets:DescribePortfolioResponse' :: DescribePortfolioResponse -> Maybe [BudgetDetail]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [BudgetDetail]
budgets
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PortfolioDetail
portfolioDetail
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TagOptionDetail]
tagOptions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus