{-# 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.CloudDirectory.DetachPolicy
(
DetachPolicy (..),
newDetachPolicy,
detachPolicy_directoryArn,
detachPolicy_policyReference,
detachPolicy_objectReference,
DetachPolicyResponse (..),
newDetachPolicyResponse,
detachPolicyResponse_httpStatus,
)
where
import Amazonka.CloudDirectory.Types
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
data DetachPolicy = DetachPolicy'
{
DetachPolicy -> Text
directoryArn :: Prelude.Text,
DetachPolicy -> ObjectReference
policyReference :: ObjectReference,
DetachPolicy -> ObjectReference
objectReference :: ObjectReference
}
deriving (DetachPolicy -> DetachPolicy -> Bool
(DetachPolicy -> DetachPolicy -> Bool)
-> (DetachPolicy -> DetachPolicy -> Bool) -> Eq DetachPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachPolicy -> DetachPolicy -> Bool
$c/= :: DetachPolicy -> DetachPolicy -> Bool
== :: DetachPolicy -> DetachPolicy -> Bool
$c== :: DetachPolicy -> DetachPolicy -> Bool
Prelude.Eq, ReadPrec [DetachPolicy]
ReadPrec DetachPolicy
Int -> ReadS DetachPolicy
ReadS [DetachPolicy]
(Int -> ReadS DetachPolicy)
-> ReadS [DetachPolicy]
-> ReadPrec DetachPolicy
-> ReadPrec [DetachPolicy]
-> Read DetachPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachPolicy]
$creadListPrec :: ReadPrec [DetachPolicy]
readPrec :: ReadPrec DetachPolicy
$creadPrec :: ReadPrec DetachPolicy
readList :: ReadS [DetachPolicy]
$creadList :: ReadS [DetachPolicy]
readsPrec :: Int -> ReadS DetachPolicy
$creadsPrec :: Int -> ReadS DetachPolicy
Prelude.Read, Int -> DetachPolicy -> ShowS
[DetachPolicy] -> ShowS
DetachPolicy -> String
(Int -> DetachPolicy -> ShowS)
-> (DetachPolicy -> String)
-> ([DetachPolicy] -> ShowS)
-> Show DetachPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachPolicy] -> ShowS
$cshowList :: [DetachPolicy] -> ShowS
show :: DetachPolicy -> String
$cshow :: DetachPolicy -> String
showsPrec :: Int -> DetachPolicy -> ShowS
$cshowsPrec :: Int -> DetachPolicy -> ShowS
Prelude.Show, (forall x. DetachPolicy -> Rep DetachPolicy x)
-> (forall x. Rep DetachPolicy x -> DetachPolicy)
-> Generic DetachPolicy
forall x. Rep DetachPolicy x -> DetachPolicy
forall x. DetachPolicy -> Rep DetachPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetachPolicy x -> DetachPolicy
$cfrom :: forall x. DetachPolicy -> Rep DetachPolicy x
Prelude.Generic)
newDetachPolicy ::
Prelude.Text ->
ObjectReference ->
ObjectReference ->
DetachPolicy
newDetachPolicy :: Text -> ObjectReference -> ObjectReference -> DetachPolicy
newDetachPolicy
Text
pDirectoryArn_
ObjectReference
pPolicyReference_
ObjectReference
pObjectReference_ =
DetachPolicy' :: Text -> ObjectReference -> ObjectReference -> DetachPolicy
DetachPolicy'
{ $sel:directoryArn:DetachPolicy' :: Text
directoryArn = Text
pDirectoryArn_,
$sel:policyReference:DetachPolicy' :: ObjectReference
policyReference = ObjectReference
pPolicyReference_,
$sel:objectReference:DetachPolicy' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
}
detachPolicy_directoryArn :: Lens.Lens' DetachPolicy Prelude.Text
detachPolicy_directoryArn :: (Text -> f Text) -> DetachPolicy -> f DetachPolicy
detachPolicy_directoryArn = (DetachPolicy -> Text)
-> (DetachPolicy -> Text -> DetachPolicy)
-> Lens DetachPolicy DetachPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachPolicy' {Text
directoryArn :: Text
$sel:directoryArn:DetachPolicy' :: DetachPolicy -> Text
directoryArn} -> Text
directoryArn) (\s :: DetachPolicy
s@DetachPolicy' {} Text
a -> DetachPolicy
s {$sel:directoryArn:DetachPolicy' :: Text
directoryArn = Text
a} :: DetachPolicy)
detachPolicy_policyReference :: Lens.Lens' DetachPolicy ObjectReference
detachPolicy_policyReference :: (ObjectReference -> f ObjectReference)
-> DetachPolicy -> f DetachPolicy
detachPolicy_policyReference = (DetachPolicy -> ObjectReference)
-> (DetachPolicy -> ObjectReference -> DetachPolicy)
-> Lens DetachPolicy DetachPolicy ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachPolicy' {ObjectReference
policyReference :: ObjectReference
$sel:policyReference:DetachPolicy' :: DetachPolicy -> ObjectReference
policyReference} -> ObjectReference
policyReference) (\s :: DetachPolicy
s@DetachPolicy' {} ObjectReference
a -> DetachPolicy
s {$sel:policyReference:DetachPolicy' :: ObjectReference
policyReference = ObjectReference
a} :: DetachPolicy)
detachPolicy_objectReference :: Lens.Lens' DetachPolicy ObjectReference
detachPolicy_objectReference :: (ObjectReference -> f ObjectReference)
-> DetachPolicy -> f DetachPolicy
detachPolicy_objectReference = (DetachPolicy -> ObjectReference)
-> (DetachPolicy -> ObjectReference -> DetachPolicy)
-> Lens DetachPolicy DetachPolicy ObjectReference ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachPolicy' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:DetachPolicy' :: DetachPolicy -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: DetachPolicy
s@DetachPolicy' {} ObjectReference
a -> DetachPolicy
s {$sel:objectReference:DetachPolicy' :: ObjectReference
objectReference = ObjectReference
a} :: DetachPolicy)
instance Core.AWSRequest DetachPolicy where
type AWSResponse DetachPolicy = DetachPolicyResponse
request :: DetachPolicy -> Request DetachPolicy
request = Service -> DetachPolicy -> Request DetachPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DetachPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetachPolicy)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DetachPolicy))
-> Logger
-> Service
-> Proxy DetachPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DetachPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> DetachPolicyResponse
DetachPolicyResponse'
(Int -> DetachPolicyResponse)
-> Either String Int -> Either String DetachPolicyResponse
forall (f :: * -> *) a b. Functor 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 DetachPolicy
instance Prelude.NFData DetachPolicy
instance Core.ToHeaders DetachPolicy where
toHeaders :: DetachPolicy -> ResponseHeaders
toHeaders DetachPolicy' {Text
ObjectReference
objectReference :: ObjectReference
policyReference :: ObjectReference
directoryArn :: Text
$sel:objectReference:DetachPolicy' :: DetachPolicy -> ObjectReference
$sel:policyReference:DetachPolicy' :: DetachPolicy -> ObjectReference
$sel:directoryArn:DetachPolicy' :: DetachPolicy -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
directoryArn]
instance Core.ToJSON DetachPolicy where
toJSON :: DetachPolicy -> Value
toJSON DetachPolicy' {Text
ObjectReference
objectReference :: ObjectReference
policyReference :: ObjectReference
directoryArn :: Text
$sel:objectReference:DetachPolicy' :: DetachPolicy -> ObjectReference
$sel:policyReference:DetachPolicy' :: DetachPolicy -> ObjectReference
$sel:directoryArn:DetachPolicy' :: DetachPolicy -> 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
"PolicyReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
policyReference),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference)
]
)
instance Core.ToPath DetachPolicy where
toPath :: DetachPolicy -> ByteString
toPath =
ByteString -> DetachPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/policy/detach"
instance Core.ToQuery DetachPolicy where
toQuery :: DetachPolicy -> QueryString
toQuery = QueryString -> DetachPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DetachPolicyResponse = DetachPolicyResponse'
{
DetachPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetachPolicyResponse -> DetachPolicyResponse -> Bool
(DetachPolicyResponse -> DetachPolicyResponse -> Bool)
-> (DetachPolicyResponse -> DetachPolicyResponse -> Bool)
-> Eq DetachPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachPolicyResponse -> DetachPolicyResponse -> Bool
$c/= :: DetachPolicyResponse -> DetachPolicyResponse -> Bool
== :: DetachPolicyResponse -> DetachPolicyResponse -> Bool
$c== :: DetachPolicyResponse -> DetachPolicyResponse -> Bool
Prelude.Eq, ReadPrec [DetachPolicyResponse]
ReadPrec DetachPolicyResponse
Int -> ReadS DetachPolicyResponse
ReadS [DetachPolicyResponse]
(Int -> ReadS DetachPolicyResponse)
-> ReadS [DetachPolicyResponse]
-> ReadPrec DetachPolicyResponse
-> ReadPrec [DetachPolicyResponse]
-> Read DetachPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachPolicyResponse]
$creadListPrec :: ReadPrec [DetachPolicyResponse]
readPrec :: ReadPrec DetachPolicyResponse
$creadPrec :: ReadPrec DetachPolicyResponse
readList :: ReadS [DetachPolicyResponse]
$creadList :: ReadS [DetachPolicyResponse]
readsPrec :: Int -> ReadS DetachPolicyResponse
$creadsPrec :: Int -> ReadS DetachPolicyResponse
Prelude.Read, Int -> DetachPolicyResponse -> ShowS
[DetachPolicyResponse] -> ShowS
DetachPolicyResponse -> String
(Int -> DetachPolicyResponse -> ShowS)
-> (DetachPolicyResponse -> String)
-> ([DetachPolicyResponse] -> ShowS)
-> Show DetachPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachPolicyResponse] -> ShowS
$cshowList :: [DetachPolicyResponse] -> ShowS
show :: DetachPolicyResponse -> String
$cshow :: DetachPolicyResponse -> String
showsPrec :: Int -> DetachPolicyResponse -> ShowS
$cshowsPrec :: Int -> DetachPolicyResponse -> ShowS
Prelude.Show, (forall x. DetachPolicyResponse -> Rep DetachPolicyResponse x)
-> (forall x. Rep DetachPolicyResponse x -> DetachPolicyResponse)
-> Generic DetachPolicyResponse
forall x. Rep DetachPolicyResponse x -> DetachPolicyResponse
forall x. DetachPolicyResponse -> Rep DetachPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetachPolicyResponse x -> DetachPolicyResponse
$cfrom :: forall x. DetachPolicyResponse -> Rep DetachPolicyResponse x
Prelude.Generic)
newDetachPolicyResponse ::
Prelude.Int ->
DetachPolicyResponse
newDetachPolicyResponse :: Int -> DetachPolicyResponse
newDetachPolicyResponse Int
pHttpStatus_ =
DetachPolicyResponse' :: Int -> DetachPolicyResponse
DetachPolicyResponse' {$sel:httpStatus:DetachPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_}
detachPolicyResponse_httpStatus :: Lens.Lens' DetachPolicyResponse Prelude.Int
detachPolicyResponse_httpStatus :: (Int -> f Int) -> DetachPolicyResponse -> f DetachPolicyResponse
detachPolicyResponse_httpStatus = (DetachPolicyResponse -> Int)
-> (DetachPolicyResponse -> Int -> DetachPolicyResponse)
-> Lens DetachPolicyResponse DetachPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetachPolicyResponse' :: DetachPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetachPolicyResponse
s@DetachPolicyResponse' {} Int
a -> DetachPolicyResponse
s {$sel:httpStatus:DetachPolicyResponse' :: Int
httpStatus = Int
a} :: DetachPolicyResponse)
instance Prelude.NFData DetachPolicyResponse