{-# 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.AppStream.UpdateEntitlement
(
UpdateEntitlement (..),
newUpdateEntitlement,
updateEntitlement_appVisibility,
updateEntitlement_attributes,
updateEntitlement_description,
updateEntitlement_name,
updateEntitlement_stackName,
UpdateEntitlementResponse (..),
newUpdateEntitlementResponse,
updateEntitlementResponse_entitlement,
updateEntitlementResponse_httpStatus,
)
where
import Amazonka.AppStream.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 UpdateEntitlement = UpdateEntitlement'
{
UpdateEntitlement -> Maybe AppVisibility
appVisibility :: Prelude.Maybe AppVisibility,
UpdateEntitlement -> Maybe (NonEmpty EntitlementAttribute)
attributes :: Prelude.Maybe (Prelude.NonEmpty EntitlementAttribute),
UpdateEntitlement -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateEntitlement -> Text
name :: Prelude.Text,
UpdateEntitlement -> Text
stackName :: Prelude.Text
}
deriving (UpdateEntitlement -> UpdateEntitlement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEntitlement -> UpdateEntitlement -> Bool
$c/= :: UpdateEntitlement -> UpdateEntitlement -> Bool
== :: UpdateEntitlement -> UpdateEntitlement -> Bool
$c== :: UpdateEntitlement -> UpdateEntitlement -> Bool
Prelude.Eq, ReadPrec [UpdateEntitlement]
ReadPrec UpdateEntitlement
Int -> ReadS UpdateEntitlement
ReadS [UpdateEntitlement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEntitlement]
$creadListPrec :: ReadPrec [UpdateEntitlement]
readPrec :: ReadPrec UpdateEntitlement
$creadPrec :: ReadPrec UpdateEntitlement
readList :: ReadS [UpdateEntitlement]
$creadList :: ReadS [UpdateEntitlement]
readsPrec :: Int -> ReadS UpdateEntitlement
$creadsPrec :: Int -> ReadS UpdateEntitlement
Prelude.Read, Int -> UpdateEntitlement -> ShowS
[UpdateEntitlement] -> ShowS
UpdateEntitlement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEntitlement] -> ShowS
$cshowList :: [UpdateEntitlement] -> ShowS
show :: UpdateEntitlement -> String
$cshow :: UpdateEntitlement -> String
showsPrec :: Int -> UpdateEntitlement -> ShowS
$cshowsPrec :: Int -> UpdateEntitlement -> ShowS
Prelude.Show, forall x. Rep UpdateEntitlement x -> UpdateEntitlement
forall x. UpdateEntitlement -> Rep UpdateEntitlement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateEntitlement x -> UpdateEntitlement
$cfrom :: forall x. UpdateEntitlement -> Rep UpdateEntitlement x
Prelude.Generic)
newUpdateEntitlement ::
Prelude.Text ->
Prelude.Text ->
UpdateEntitlement
newUpdateEntitlement :: Text -> Text -> UpdateEntitlement
newUpdateEntitlement Text
pName_ Text
pStackName_ =
UpdateEntitlement'
{ $sel:appVisibility:UpdateEntitlement' :: Maybe AppVisibility
appVisibility = forall a. Maybe a
Prelude.Nothing,
$sel:attributes:UpdateEntitlement' :: Maybe (NonEmpty EntitlementAttribute)
attributes = forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateEntitlement' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateEntitlement' :: Text
name = Text
pName_,
$sel:stackName:UpdateEntitlement' :: Text
stackName = Text
pStackName_
}
updateEntitlement_appVisibility :: Lens.Lens' UpdateEntitlement (Prelude.Maybe AppVisibility)
updateEntitlement_appVisibility :: Lens' UpdateEntitlement (Maybe AppVisibility)
updateEntitlement_appVisibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEntitlement' {Maybe AppVisibility
appVisibility :: Maybe AppVisibility
$sel:appVisibility:UpdateEntitlement' :: UpdateEntitlement -> Maybe AppVisibility
appVisibility} -> Maybe AppVisibility
appVisibility) (\s :: UpdateEntitlement
s@UpdateEntitlement' {} Maybe AppVisibility
a -> UpdateEntitlement
s {$sel:appVisibility:UpdateEntitlement' :: Maybe AppVisibility
appVisibility = Maybe AppVisibility
a} :: UpdateEntitlement)
updateEntitlement_attributes :: Lens.Lens' UpdateEntitlement (Prelude.Maybe (Prelude.NonEmpty EntitlementAttribute))
updateEntitlement_attributes :: Lens' UpdateEntitlement (Maybe (NonEmpty EntitlementAttribute))
updateEntitlement_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEntitlement' {Maybe (NonEmpty EntitlementAttribute)
attributes :: Maybe (NonEmpty EntitlementAttribute)
$sel:attributes:UpdateEntitlement' :: UpdateEntitlement -> Maybe (NonEmpty EntitlementAttribute)
attributes} -> Maybe (NonEmpty EntitlementAttribute)
attributes) (\s :: UpdateEntitlement
s@UpdateEntitlement' {} Maybe (NonEmpty EntitlementAttribute)
a -> UpdateEntitlement
s {$sel:attributes:UpdateEntitlement' :: Maybe (NonEmpty EntitlementAttribute)
attributes = Maybe (NonEmpty EntitlementAttribute)
a} :: UpdateEntitlement) 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
updateEntitlement_description :: Lens.Lens' UpdateEntitlement (Prelude.Maybe Prelude.Text)
updateEntitlement_description :: Lens' UpdateEntitlement (Maybe Text)
updateEntitlement_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEntitlement' {Maybe Text
description :: Maybe Text
$sel:description:UpdateEntitlement' :: UpdateEntitlement -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateEntitlement
s@UpdateEntitlement' {} Maybe Text
a -> UpdateEntitlement
s {$sel:description:UpdateEntitlement' :: Maybe Text
description = Maybe Text
a} :: UpdateEntitlement)
updateEntitlement_name :: Lens.Lens' UpdateEntitlement Prelude.Text
updateEntitlement_name :: Lens' UpdateEntitlement Text
updateEntitlement_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEntitlement' {Text
name :: Text
$sel:name:UpdateEntitlement' :: UpdateEntitlement -> Text
name} -> Text
name) (\s :: UpdateEntitlement
s@UpdateEntitlement' {} Text
a -> UpdateEntitlement
s {$sel:name:UpdateEntitlement' :: Text
name = Text
a} :: UpdateEntitlement)
updateEntitlement_stackName :: Lens.Lens' UpdateEntitlement Prelude.Text
updateEntitlement_stackName :: Lens' UpdateEntitlement Text
updateEntitlement_stackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEntitlement' {Text
stackName :: Text
$sel:stackName:UpdateEntitlement' :: UpdateEntitlement -> Text
stackName} -> Text
stackName) (\s :: UpdateEntitlement
s@UpdateEntitlement' {} Text
a -> UpdateEntitlement
s {$sel:stackName:UpdateEntitlement' :: Text
stackName = Text
a} :: UpdateEntitlement)
instance Core.AWSRequest UpdateEntitlement where
type
AWSResponse UpdateEntitlement =
UpdateEntitlementResponse
request :: (Service -> Service)
-> UpdateEntitlement -> Request UpdateEntitlement
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 UpdateEntitlement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateEntitlement)))
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 Entitlement -> Int -> UpdateEntitlementResponse
UpdateEntitlementResponse'
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
"Entitlement")
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 UpdateEntitlement where
hashWithSalt :: Int -> UpdateEntitlement -> Int
hashWithSalt Int
_salt UpdateEntitlement' {Maybe (NonEmpty EntitlementAttribute)
Maybe Text
Maybe AppVisibility
Text
stackName :: Text
name :: Text
description :: Maybe Text
attributes :: Maybe (NonEmpty EntitlementAttribute)
appVisibility :: Maybe AppVisibility
$sel:stackName:UpdateEntitlement' :: UpdateEntitlement -> Text
$sel:name:UpdateEntitlement' :: UpdateEntitlement -> Text
$sel:description:UpdateEntitlement' :: UpdateEntitlement -> Maybe Text
$sel:attributes:UpdateEntitlement' :: UpdateEntitlement -> Maybe (NonEmpty EntitlementAttribute)
$sel:appVisibility:UpdateEntitlement' :: UpdateEntitlement -> Maybe AppVisibility
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AppVisibility
appVisibility
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty EntitlementAttribute)
attributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stackName
instance Prelude.NFData UpdateEntitlement where
rnf :: UpdateEntitlement -> ()
rnf UpdateEntitlement' {Maybe (NonEmpty EntitlementAttribute)
Maybe Text
Maybe AppVisibility
Text
stackName :: Text
name :: Text
description :: Maybe Text
attributes :: Maybe (NonEmpty EntitlementAttribute)
appVisibility :: Maybe AppVisibility
$sel:stackName:UpdateEntitlement' :: UpdateEntitlement -> Text
$sel:name:UpdateEntitlement' :: UpdateEntitlement -> Text
$sel:description:UpdateEntitlement' :: UpdateEntitlement -> Maybe Text
$sel:attributes:UpdateEntitlement' :: UpdateEntitlement -> Maybe (NonEmpty EntitlementAttribute)
$sel:appVisibility:UpdateEntitlement' :: UpdateEntitlement -> Maybe AppVisibility
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AppVisibility
appVisibility
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty EntitlementAttribute)
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stackName
instance Data.ToHeaders UpdateEntitlement where
toHeaders :: UpdateEntitlement -> 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
"PhotonAdminProxyService.UpdateEntitlement" ::
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 UpdateEntitlement where
toJSON :: UpdateEntitlement -> Value
toJSON UpdateEntitlement' {Maybe (NonEmpty EntitlementAttribute)
Maybe Text
Maybe AppVisibility
Text
stackName :: Text
name :: Text
description :: Maybe Text
attributes :: Maybe (NonEmpty EntitlementAttribute)
appVisibility :: Maybe AppVisibility
$sel:stackName:UpdateEntitlement' :: UpdateEntitlement -> Text
$sel:name:UpdateEntitlement' :: UpdateEntitlement -> Text
$sel:description:UpdateEntitlement' :: UpdateEntitlement -> Maybe Text
$sel:attributes:UpdateEntitlement' :: UpdateEntitlement -> Maybe (NonEmpty EntitlementAttribute)
$sel:appVisibility:UpdateEntitlement' :: UpdateEntitlement -> Maybe AppVisibility
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AppVisibility" 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 AppVisibility
appVisibility,
(Key
"Attributes" 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 (NonEmpty EntitlementAttribute)
attributes,
(Key
"Description" 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
description,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"StackName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
stackName)
]
)
instance Data.ToPath UpdateEntitlement where
toPath :: UpdateEntitlement -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateEntitlement where
toQuery :: UpdateEntitlement -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateEntitlementResponse = UpdateEntitlementResponse'
{
UpdateEntitlementResponse -> Maybe Entitlement
entitlement :: Prelude.Maybe Entitlement,
UpdateEntitlementResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateEntitlementResponse -> UpdateEntitlementResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEntitlementResponse -> UpdateEntitlementResponse -> Bool
$c/= :: UpdateEntitlementResponse -> UpdateEntitlementResponse -> Bool
== :: UpdateEntitlementResponse -> UpdateEntitlementResponse -> Bool
$c== :: UpdateEntitlementResponse -> UpdateEntitlementResponse -> Bool
Prelude.Eq, ReadPrec [UpdateEntitlementResponse]
ReadPrec UpdateEntitlementResponse
Int -> ReadS UpdateEntitlementResponse
ReadS [UpdateEntitlementResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEntitlementResponse]
$creadListPrec :: ReadPrec [UpdateEntitlementResponse]
readPrec :: ReadPrec UpdateEntitlementResponse
$creadPrec :: ReadPrec UpdateEntitlementResponse
readList :: ReadS [UpdateEntitlementResponse]
$creadList :: ReadS [UpdateEntitlementResponse]
readsPrec :: Int -> ReadS UpdateEntitlementResponse
$creadsPrec :: Int -> ReadS UpdateEntitlementResponse
Prelude.Read, Int -> UpdateEntitlementResponse -> ShowS
[UpdateEntitlementResponse] -> ShowS
UpdateEntitlementResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEntitlementResponse] -> ShowS
$cshowList :: [UpdateEntitlementResponse] -> ShowS
show :: UpdateEntitlementResponse -> String
$cshow :: UpdateEntitlementResponse -> String
showsPrec :: Int -> UpdateEntitlementResponse -> ShowS
$cshowsPrec :: Int -> UpdateEntitlementResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateEntitlementResponse x -> UpdateEntitlementResponse
forall x.
UpdateEntitlementResponse -> Rep UpdateEntitlementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEntitlementResponse x -> UpdateEntitlementResponse
$cfrom :: forall x.
UpdateEntitlementResponse -> Rep UpdateEntitlementResponse x
Prelude.Generic)
newUpdateEntitlementResponse ::
Prelude.Int ->
UpdateEntitlementResponse
newUpdateEntitlementResponse :: Int -> UpdateEntitlementResponse
newUpdateEntitlementResponse Int
pHttpStatus_ =
UpdateEntitlementResponse'
{ $sel:entitlement:UpdateEntitlementResponse' :: Maybe Entitlement
entitlement =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateEntitlementResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateEntitlementResponse_entitlement :: Lens.Lens' UpdateEntitlementResponse (Prelude.Maybe Entitlement)
updateEntitlementResponse_entitlement :: Lens' UpdateEntitlementResponse (Maybe Entitlement)
updateEntitlementResponse_entitlement = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEntitlementResponse' {Maybe Entitlement
entitlement :: Maybe Entitlement
$sel:entitlement:UpdateEntitlementResponse' :: UpdateEntitlementResponse -> Maybe Entitlement
entitlement} -> Maybe Entitlement
entitlement) (\s :: UpdateEntitlementResponse
s@UpdateEntitlementResponse' {} Maybe Entitlement
a -> UpdateEntitlementResponse
s {$sel:entitlement:UpdateEntitlementResponse' :: Maybe Entitlement
entitlement = Maybe Entitlement
a} :: UpdateEntitlementResponse)
updateEntitlementResponse_httpStatus :: Lens.Lens' UpdateEntitlementResponse Prelude.Int
updateEntitlementResponse_httpStatus :: Lens' UpdateEntitlementResponse Int
updateEntitlementResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEntitlementResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateEntitlementResponse' :: UpdateEntitlementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateEntitlementResponse
s@UpdateEntitlementResponse' {} Int
a -> UpdateEntitlementResponse
s {$sel:httpStatus:UpdateEntitlementResponse' :: Int
httpStatus = Int
a} :: UpdateEntitlementResponse)
instance Prelude.NFData UpdateEntitlementResponse where
rnf :: UpdateEntitlementResponse -> ()
rnf UpdateEntitlementResponse' {Int
Maybe Entitlement
httpStatus :: Int
entitlement :: Maybe Entitlement
$sel:httpStatus:UpdateEntitlementResponse' :: UpdateEntitlementResponse -> Int
$sel:entitlement:UpdateEntitlementResponse' :: UpdateEntitlementResponse -> Maybe Entitlement
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Entitlement
entitlement
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus