{-# 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.WellArchitected.UpdateWorkloadShare
(
UpdateWorkloadShare (..),
newUpdateWorkloadShare,
updateWorkloadShare_shareId,
updateWorkloadShare_workloadId,
updateWorkloadShare_permissionType,
UpdateWorkloadShareResponse (..),
newUpdateWorkloadShareResponse,
updateWorkloadShareResponse_workloadShare,
updateWorkloadShareResponse_workloadId,
updateWorkloadShareResponse_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.WellArchitected.Types
data UpdateWorkloadShare = UpdateWorkloadShare'
{ UpdateWorkloadShare -> Text
shareId :: Prelude.Text,
UpdateWorkloadShare -> Text
workloadId :: Prelude.Text,
UpdateWorkloadShare -> PermissionType
permissionType :: PermissionType
}
deriving (UpdateWorkloadShare -> UpdateWorkloadShare -> Bool
(UpdateWorkloadShare -> UpdateWorkloadShare -> Bool)
-> (UpdateWorkloadShare -> UpdateWorkloadShare -> Bool)
-> Eq UpdateWorkloadShare
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkloadShare -> UpdateWorkloadShare -> Bool
$c/= :: UpdateWorkloadShare -> UpdateWorkloadShare -> Bool
== :: UpdateWorkloadShare -> UpdateWorkloadShare -> Bool
$c== :: UpdateWorkloadShare -> UpdateWorkloadShare -> Bool
Prelude.Eq, ReadPrec [UpdateWorkloadShare]
ReadPrec UpdateWorkloadShare
Int -> ReadS UpdateWorkloadShare
ReadS [UpdateWorkloadShare]
(Int -> ReadS UpdateWorkloadShare)
-> ReadS [UpdateWorkloadShare]
-> ReadPrec UpdateWorkloadShare
-> ReadPrec [UpdateWorkloadShare]
-> Read UpdateWorkloadShare
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkloadShare]
$creadListPrec :: ReadPrec [UpdateWorkloadShare]
readPrec :: ReadPrec UpdateWorkloadShare
$creadPrec :: ReadPrec UpdateWorkloadShare
readList :: ReadS [UpdateWorkloadShare]
$creadList :: ReadS [UpdateWorkloadShare]
readsPrec :: Int -> ReadS UpdateWorkloadShare
$creadsPrec :: Int -> ReadS UpdateWorkloadShare
Prelude.Read, Int -> UpdateWorkloadShare -> ShowS
[UpdateWorkloadShare] -> ShowS
UpdateWorkloadShare -> String
(Int -> UpdateWorkloadShare -> ShowS)
-> (UpdateWorkloadShare -> String)
-> ([UpdateWorkloadShare] -> ShowS)
-> Show UpdateWorkloadShare
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkloadShare] -> ShowS
$cshowList :: [UpdateWorkloadShare] -> ShowS
show :: UpdateWorkloadShare -> String
$cshow :: UpdateWorkloadShare -> String
showsPrec :: Int -> UpdateWorkloadShare -> ShowS
$cshowsPrec :: Int -> UpdateWorkloadShare -> ShowS
Prelude.Show, (forall x. UpdateWorkloadShare -> Rep UpdateWorkloadShare x)
-> (forall x. Rep UpdateWorkloadShare x -> UpdateWorkloadShare)
-> Generic UpdateWorkloadShare
forall x. Rep UpdateWorkloadShare x -> UpdateWorkloadShare
forall x. UpdateWorkloadShare -> Rep UpdateWorkloadShare x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkloadShare x -> UpdateWorkloadShare
$cfrom :: forall x. UpdateWorkloadShare -> Rep UpdateWorkloadShare x
Prelude.Generic)
newUpdateWorkloadShare ::
Prelude.Text ->
Prelude.Text ->
PermissionType ->
UpdateWorkloadShare
newUpdateWorkloadShare :: Text -> Text -> PermissionType -> UpdateWorkloadShare
newUpdateWorkloadShare
Text
pShareId_
Text
pWorkloadId_
PermissionType
pPermissionType_ =
UpdateWorkloadShare' :: Text -> Text -> PermissionType -> UpdateWorkloadShare
UpdateWorkloadShare'
{ $sel:shareId:UpdateWorkloadShare' :: Text
shareId = Text
pShareId_,
$sel:workloadId:UpdateWorkloadShare' :: Text
workloadId = Text
pWorkloadId_,
$sel:permissionType:UpdateWorkloadShare' :: PermissionType
permissionType = PermissionType
pPermissionType_
}
updateWorkloadShare_shareId :: Lens.Lens' UpdateWorkloadShare Prelude.Text
updateWorkloadShare_shareId :: (Text -> f Text) -> UpdateWorkloadShare -> f UpdateWorkloadShare
updateWorkloadShare_shareId = (UpdateWorkloadShare -> Text)
-> (UpdateWorkloadShare -> Text -> UpdateWorkloadShare)
-> Lens UpdateWorkloadShare UpdateWorkloadShare Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkloadShare' {Text
shareId :: Text
$sel:shareId:UpdateWorkloadShare' :: UpdateWorkloadShare -> Text
shareId} -> Text
shareId) (\s :: UpdateWorkloadShare
s@UpdateWorkloadShare' {} Text
a -> UpdateWorkloadShare
s {$sel:shareId:UpdateWorkloadShare' :: Text
shareId = Text
a} :: UpdateWorkloadShare)
updateWorkloadShare_workloadId :: Lens.Lens' UpdateWorkloadShare Prelude.Text
updateWorkloadShare_workloadId :: (Text -> f Text) -> UpdateWorkloadShare -> f UpdateWorkloadShare
updateWorkloadShare_workloadId = (UpdateWorkloadShare -> Text)
-> (UpdateWorkloadShare -> Text -> UpdateWorkloadShare)
-> Lens UpdateWorkloadShare UpdateWorkloadShare Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkloadShare' {Text
workloadId :: Text
$sel:workloadId:UpdateWorkloadShare' :: UpdateWorkloadShare -> Text
workloadId} -> Text
workloadId) (\s :: UpdateWorkloadShare
s@UpdateWorkloadShare' {} Text
a -> UpdateWorkloadShare
s {$sel:workloadId:UpdateWorkloadShare' :: Text
workloadId = Text
a} :: UpdateWorkloadShare)
updateWorkloadShare_permissionType :: Lens.Lens' UpdateWorkloadShare PermissionType
updateWorkloadShare_permissionType :: (PermissionType -> f PermissionType)
-> UpdateWorkloadShare -> f UpdateWorkloadShare
updateWorkloadShare_permissionType = (UpdateWorkloadShare -> PermissionType)
-> (UpdateWorkloadShare -> PermissionType -> UpdateWorkloadShare)
-> Lens
UpdateWorkloadShare
UpdateWorkloadShare
PermissionType
PermissionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkloadShare' {PermissionType
permissionType :: PermissionType
$sel:permissionType:UpdateWorkloadShare' :: UpdateWorkloadShare -> PermissionType
permissionType} -> PermissionType
permissionType) (\s :: UpdateWorkloadShare
s@UpdateWorkloadShare' {} PermissionType
a -> UpdateWorkloadShare
s {$sel:permissionType:UpdateWorkloadShare' :: PermissionType
permissionType = PermissionType
a} :: UpdateWorkloadShare)
instance Core.AWSRequest UpdateWorkloadShare where
type
AWSResponse UpdateWorkloadShare =
UpdateWorkloadShareResponse
request :: UpdateWorkloadShare -> Request UpdateWorkloadShare
request = Service -> UpdateWorkloadShare -> Request UpdateWorkloadShare
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateWorkloadShare
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateWorkloadShare)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateWorkloadShare))
-> Logger
-> Service
-> Proxy UpdateWorkloadShare
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateWorkloadShare)))
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 WorkloadShare
-> Maybe Text -> Int -> UpdateWorkloadShareResponse
UpdateWorkloadShareResponse'
(Maybe WorkloadShare
-> Maybe Text -> Int -> UpdateWorkloadShareResponse)
-> Either String (Maybe WorkloadShare)
-> Either String (Maybe Text -> Int -> UpdateWorkloadShareResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe WorkloadShare)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"WorkloadShare")
Either String (Maybe Text -> Int -> UpdateWorkloadShareResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateWorkloadShareResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"WorkloadId")
Either String (Int -> UpdateWorkloadShareResponse)
-> Either String Int -> Either String UpdateWorkloadShareResponse
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 UpdateWorkloadShare
instance Prelude.NFData UpdateWorkloadShare
instance Core.ToHeaders UpdateWorkloadShare where
toHeaders :: UpdateWorkloadShare -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateWorkloadShare -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateWorkloadShare where
toJSON :: UpdateWorkloadShare -> Value
toJSON UpdateWorkloadShare' {Text
PermissionType
permissionType :: PermissionType
workloadId :: Text
shareId :: Text
$sel:permissionType:UpdateWorkloadShare' :: UpdateWorkloadShare -> PermissionType
$sel:workloadId:UpdateWorkloadShare' :: UpdateWorkloadShare -> Text
$sel:shareId:UpdateWorkloadShare' :: UpdateWorkloadShare -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"PermissionType" Text -> PermissionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PermissionType
permissionType)
]
)
instance Core.ToPath UpdateWorkloadShare where
toPath :: UpdateWorkloadShare -> ByteString
toPath UpdateWorkloadShare' {Text
PermissionType
permissionType :: PermissionType
workloadId :: Text
shareId :: Text
$sel:permissionType:UpdateWorkloadShare' :: UpdateWorkloadShare -> PermissionType
$sel:workloadId:UpdateWorkloadShare' :: UpdateWorkloadShare -> Text
$sel:shareId:UpdateWorkloadShare' :: UpdateWorkloadShare -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/workloads/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workloadId,
ByteString
"/shares/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
shareId
]
instance Core.ToQuery UpdateWorkloadShare where
toQuery :: UpdateWorkloadShare -> QueryString
toQuery = QueryString -> UpdateWorkloadShare -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateWorkloadShareResponse = UpdateWorkloadShareResponse'
{ UpdateWorkloadShareResponse -> Maybe WorkloadShare
workloadShare :: Prelude.Maybe WorkloadShare,
UpdateWorkloadShareResponse -> Maybe Text
workloadId :: Prelude.Maybe Prelude.Text,
UpdateWorkloadShareResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateWorkloadShareResponse -> UpdateWorkloadShareResponse -> Bool
(UpdateWorkloadShareResponse
-> UpdateWorkloadShareResponse -> Bool)
-> (UpdateWorkloadShareResponse
-> UpdateWorkloadShareResponse -> Bool)
-> Eq UpdateWorkloadShareResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkloadShareResponse -> UpdateWorkloadShareResponse -> Bool
$c/= :: UpdateWorkloadShareResponse -> UpdateWorkloadShareResponse -> Bool
== :: UpdateWorkloadShareResponse -> UpdateWorkloadShareResponse -> Bool
$c== :: UpdateWorkloadShareResponse -> UpdateWorkloadShareResponse -> Bool
Prelude.Eq, ReadPrec [UpdateWorkloadShareResponse]
ReadPrec UpdateWorkloadShareResponse
Int -> ReadS UpdateWorkloadShareResponse
ReadS [UpdateWorkloadShareResponse]
(Int -> ReadS UpdateWorkloadShareResponse)
-> ReadS [UpdateWorkloadShareResponse]
-> ReadPrec UpdateWorkloadShareResponse
-> ReadPrec [UpdateWorkloadShareResponse]
-> Read UpdateWorkloadShareResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkloadShareResponse]
$creadListPrec :: ReadPrec [UpdateWorkloadShareResponse]
readPrec :: ReadPrec UpdateWorkloadShareResponse
$creadPrec :: ReadPrec UpdateWorkloadShareResponse
readList :: ReadS [UpdateWorkloadShareResponse]
$creadList :: ReadS [UpdateWorkloadShareResponse]
readsPrec :: Int -> ReadS UpdateWorkloadShareResponse
$creadsPrec :: Int -> ReadS UpdateWorkloadShareResponse
Prelude.Read, Int -> UpdateWorkloadShareResponse -> ShowS
[UpdateWorkloadShareResponse] -> ShowS
UpdateWorkloadShareResponse -> String
(Int -> UpdateWorkloadShareResponse -> ShowS)
-> (UpdateWorkloadShareResponse -> String)
-> ([UpdateWorkloadShareResponse] -> ShowS)
-> Show UpdateWorkloadShareResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkloadShareResponse] -> ShowS
$cshowList :: [UpdateWorkloadShareResponse] -> ShowS
show :: UpdateWorkloadShareResponse -> String
$cshow :: UpdateWorkloadShareResponse -> String
showsPrec :: Int -> UpdateWorkloadShareResponse -> ShowS
$cshowsPrec :: Int -> UpdateWorkloadShareResponse -> ShowS
Prelude.Show, (forall x.
UpdateWorkloadShareResponse -> Rep UpdateWorkloadShareResponse x)
-> (forall x.
Rep UpdateWorkloadShareResponse x -> UpdateWorkloadShareResponse)
-> Generic UpdateWorkloadShareResponse
forall x.
Rep UpdateWorkloadShareResponse x -> UpdateWorkloadShareResponse
forall x.
UpdateWorkloadShareResponse -> Rep UpdateWorkloadShareResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateWorkloadShareResponse x -> UpdateWorkloadShareResponse
$cfrom :: forall x.
UpdateWorkloadShareResponse -> Rep UpdateWorkloadShareResponse x
Prelude.Generic)
newUpdateWorkloadShareResponse ::
Prelude.Int ->
UpdateWorkloadShareResponse
newUpdateWorkloadShareResponse :: Int -> UpdateWorkloadShareResponse
newUpdateWorkloadShareResponse Int
pHttpStatus_ =
UpdateWorkloadShareResponse' :: Maybe WorkloadShare
-> Maybe Text -> Int -> UpdateWorkloadShareResponse
UpdateWorkloadShareResponse'
{ $sel:workloadShare:UpdateWorkloadShareResponse' :: Maybe WorkloadShare
workloadShare =
Maybe WorkloadShare
forall a. Maybe a
Prelude.Nothing,
$sel:workloadId:UpdateWorkloadShareResponse' :: Maybe Text
workloadId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateWorkloadShareResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateWorkloadShareResponse_workloadShare :: Lens.Lens' UpdateWorkloadShareResponse (Prelude.Maybe WorkloadShare)
updateWorkloadShareResponse_workloadShare :: (Maybe WorkloadShare -> f (Maybe WorkloadShare))
-> UpdateWorkloadShareResponse -> f UpdateWorkloadShareResponse
updateWorkloadShareResponse_workloadShare = (UpdateWorkloadShareResponse -> Maybe WorkloadShare)
-> (UpdateWorkloadShareResponse
-> Maybe WorkloadShare -> UpdateWorkloadShareResponse)
-> Lens
UpdateWorkloadShareResponse
UpdateWorkloadShareResponse
(Maybe WorkloadShare)
(Maybe WorkloadShare)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkloadShareResponse' {Maybe WorkloadShare
workloadShare :: Maybe WorkloadShare
$sel:workloadShare:UpdateWorkloadShareResponse' :: UpdateWorkloadShareResponse -> Maybe WorkloadShare
workloadShare} -> Maybe WorkloadShare
workloadShare) (\s :: UpdateWorkloadShareResponse
s@UpdateWorkloadShareResponse' {} Maybe WorkloadShare
a -> UpdateWorkloadShareResponse
s {$sel:workloadShare:UpdateWorkloadShareResponse' :: Maybe WorkloadShare
workloadShare = Maybe WorkloadShare
a} :: UpdateWorkloadShareResponse)
updateWorkloadShareResponse_workloadId :: Lens.Lens' UpdateWorkloadShareResponse (Prelude.Maybe Prelude.Text)
updateWorkloadShareResponse_workloadId :: (Maybe Text -> f (Maybe Text))
-> UpdateWorkloadShareResponse -> f UpdateWorkloadShareResponse
updateWorkloadShareResponse_workloadId = (UpdateWorkloadShareResponse -> Maybe Text)
-> (UpdateWorkloadShareResponse
-> Maybe Text -> UpdateWorkloadShareResponse)
-> Lens
UpdateWorkloadShareResponse
UpdateWorkloadShareResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkloadShareResponse' {Maybe Text
workloadId :: Maybe Text
$sel:workloadId:UpdateWorkloadShareResponse' :: UpdateWorkloadShareResponse -> Maybe Text
workloadId} -> Maybe Text
workloadId) (\s :: UpdateWorkloadShareResponse
s@UpdateWorkloadShareResponse' {} Maybe Text
a -> UpdateWorkloadShareResponse
s {$sel:workloadId:UpdateWorkloadShareResponse' :: Maybe Text
workloadId = Maybe Text
a} :: UpdateWorkloadShareResponse)
updateWorkloadShareResponse_httpStatus :: Lens.Lens' UpdateWorkloadShareResponse Prelude.Int
updateWorkloadShareResponse_httpStatus :: (Int -> f Int)
-> UpdateWorkloadShareResponse -> f UpdateWorkloadShareResponse
updateWorkloadShareResponse_httpStatus = (UpdateWorkloadShareResponse -> Int)
-> (UpdateWorkloadShareResponse
-> Int -> UpdateWorkloadShareResponse)
-> Lens
UpdateWorkloadShareResponse UpdateWorkloadShareResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkloadShareResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateWorkloadShareResponse' :: UpdateWorkloadShareResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateWorkloadShareResponse
s@UpdateWorkloadShareResponse' {} Int
a -> UpdateWorkloadShareResponse
s {$sel:httpStatus:UpdateWorkloadShareResponse' :: Int
httpStatus = Int
a} :: UpdateWorkloadShareResponse)
instance Prelude.NFData UpdateWorkloadShareResponse