{-# 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.ImageBuilder.PutImagePolicy
(
PutImagePolicy (..),
newPutImagePolicy,
putImagePolicy_imageArn,
putImagePolicy_policy,
PutImagePolicyResponse (..),
newPutImagePolicyResponse,
putImagePolicyResponse_imageArn,
putImagePolicyResponse_requestId,
putImagePolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ImageBuilder.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutImagePolicy = PutImagePolicy'
{
PutImagePolicy -> Text
imageArn :: Prelude.Text,
PutImagePolicy -> Text
policy :: Prelude.Text
}
deriving (PutImagePolicy -> PutImagePolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutImagePolicy -> PutImagePolicy -> Bool
$c/= :: PutImagePolicy -> PutImagePolicy -> Bool
== :: PutImagePolicy -> PutImagePolicy -> Bool
$c== :: PutImagePolicy -> PutImagePolicy -> Bool
Prelude.Eq, ReadPrec [PutImagePolicy]
ReadPrec PutImagePolicy
Int -> ReadS PutImagePolicy
ReadS [PutImagePolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutImagePolicy]
$creadListPrec :: ReadPrec [PutImagePolicy]
readPrec :: ReadPrec PutImagePolicy
$creadPrec :: ReadPrec PutImagePolicy
readList :: ReadS [PutImagePolicy]
$creadList :: ReadS [PutImagePolicy]
readsPrec :: Int -> ReadS PutImagePolicy
$creadsPrec :: Int -> ReadS PutImagePolicy
Prelude.Read, Int -> PutImagePolicy -> ShowS
[PutImagePolicy] -> ShowS
PutImagePolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutImagePolicy] -> ShowS
$cshowList :: [PutImagePolicy] -> ShowS
show :: PutImagePolicy -> String
$cshow :: PutImagePolicy -> String
showsPrec :: Int -> PutImagePolicy -> ShowS
$cshowsPrec :: Int -> PutImagePolicy -> ShowS
Prelude.Show, forall x. Rep PutImagePolicy x -> PutImagePolicy
forall x. PutImagePolicy -> Rep PutImagePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutImagePolicy x -> PutImagePolicy
$cfrom :: forall x. PutImagePolicy -> Rep PutImagePolicy x
Prelude.Generic)
newPutImagePolicy ::
Prelude.Text ->
Prelude.Text ->
PutImagePolicy
newPutImagePolicy :: Text -> Text -> PutImagePolicy
newPutImagePolicy Text
pImageArn_ Text
pPolicy_ =
PutImagePolicy'
{ $sel:imageArn:PutImagePolicy' :: Text
imageArn = Text
pImageArn_,
$sel:policy:PutImagePolicy' :: Text
policy = Text
pPolicy_
}
putImagePolicy_imageArn :: Lens.Lens' PutImagePolicy Prelude.Text
putImagePolicy_imageArn :: Lens' PutImagePolicy Text
putImagePolicy_imageArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImagePolicy' {Text
imageArn :: Text
$sel:imageArn:PutImagePolicy' :: PutImagePolicy -> Text
imageArn} -> Text
imageArn) (\s :: PutImagePolicy
s@PutImagePolicy' {} Text
a -> PutImagePolicy
s {$sel:imageArn:PutImagePolicy' :: Text
imageArn = Text
a} :: PutImagePolicy)
putImagePolicy_policy :: Lens.Lens' PutImagePolicy Prelude.Text
putImagePolicy_policy :: Lens' PutImagePolicy Text
putImagePolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImagePolicy' {Text
policy :: Text
$sel:policy:PutImagePolicy' :: PutImagePolicy -> Text
policy} -> Text
policy) (\s :: PutImagePolicy
s@PutImagePolicy' {} Text
a -> PutImagePolicy
s {$sel:policy:PutImagePolicy' :: Text
policy = Text
a} :: PutImagePolicy)
instance Core.AWSRequest PutImagePolicy where
type
AWSResponse PutImagePolicy =
PutImagePolicyResponse
request :: (Service -> Service) -> PutImagePolicy -> Request PutImagePolicy
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutImagePolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutImagePolicy)))
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 Text -> Maybe Text -> Int -> PutImagePolicyResponse
PutImagePolicyResponse'
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
"imageArn")
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
"requestId")
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 PutImagePolicy where
hashWithSalt :: Int -> PutImagePolicy -> Int
hashWithSalt Int
_salt PutImagePolicy' {Text
policy :: Text
imageArn :: Text
$sel:policy:PutImagePolicy' :: PutImagePolicy -> Text
$sel:imageArn:PutImagePolicy' :: PutImagePolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imageArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy
instance Prelude.NFData PutImagePolicy where
rnf :: PutImagePolicy -> ()
rnf PutImagePolicy' {Text
policy :: Text
imageArn :: Text
$sel:policy:PutImagePolicy' :: PutImagePolicy -> Text
$sel:imageArn:PutImagePolicy' :: PutImagePolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
imageArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
instance Data.ToHeaders PutImagePolicy where
toHeaders :: PutImagePolicy -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON PutImagePolicy where
toJSON :: PutImagePolicy -> Value
toJSON PutImagePolicy' {Text
policy :: Text
imageArn :: Text
$sel:policy:PutImagePolicy' :: PutImagePolicy -> Text
$sel:imageArn:PutImagePolicy' :: PutImagePolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"imageArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
imageArn),
forall a. a -> Maybe a
Prelude.Just (Key
"policy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policy)
]
)
instance Data.ToPath PutImagePolicy where
toPath :: PutImagePolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/PutImagePolicy"
instance Data.ToQuery PutImagePolicy where
toQuery :: PutImagePolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutImagePolicyResponse = PutImagePolicyResponse'
{
PutImagePolicyResponse -> Maybe Text
imageArn :: Prelude.Maybe Prelude.Text,
PutImagePolicyResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
PutImagePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutImagePolicyResponse -> PutImagePolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutImagePolicyResponse -> PutImagePolicyResponse -> Bool
$c/= :: PutImagePolicyResponse -> PutImagePolicyResponse -> Bool
== :: PutImagePolicyResponse -> PutImagePolicyResponse -> Bool
$c== :: PutImagePolicyResponse -> PutImagePolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutImagePolicyResponse]
ReadPrec PutImagePolicyResponse
Int -> ReadS PutImagePolicyResponse
ReadS [PutImagePolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutImagePolicyResponse]
$creadListPrec :: ReadPrec [PutImagePolicyResponse]
readPrec :: ReadPrec PutImagePolicyResponse
$creadPrec :: ReadPrec PutImagePolicyResponse
readList :: ReadS [PutImagePolicyResponse]
$creadList :: ReadS [PutImagePolicyResponse]
readsPrec :: Int -> ReadS PutImagePolicyResponse
$creadsPrec :: Int -> ReadS PutImagePolicyResponse
Prelude.Read, Int -> PutImagePolicyResponse -> ShowS
[PutImagePolicyResponse] -> ShowS
PutImagePolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutImagePolicyResponse] -> ShowS
$cshowList :: [PutImagePolicyResponse] -> ShowS
show :: PutImagePolicyResponse -> String
$cshow :: PutImagePolicyResponse -> String
showsPrec :: Int -> PutImagePolicyResponse -> ShowS
$cshowsPrec :: Int -> PutImagePolicyResponse -> ShowS
Prelude.Show, forall x. Rep PutImagePolicyResponse x -> PutImagePolicyResponse
forall x. PutImagePolicyResponse -> Rep PutImagePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutImagePolicyResponse x -> PutImagePolicyResponse
$cfrom :: forall x. PutImagePolicyResponse -> Rep PutImagePolicyResponse x
Prelude.Generic)
newPutImagePolicyResponse ::
Prelude.Int ->
PutImagePolicyResponse
newPutImagePolicyResponse :: Int -> PutImagePolicyResponse
newPutImagePolicyResponse Int
pHttpStatus_ =
PutImagePolicyResponse'
{ $sel:imageArn:PutImagePolicyResponse' :: Maybe Text
imageArn = forall a. Maybe a
Prelude.Nothing,
$sel:requestId:PutImagePolicyResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutImagePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putImagePolicyResponse_imageArn :: Lens.Lens' PutImagePolicyResponse (Prelude.Maybe Prelude.Text)
putImagePolicyResponse_imageArn :: Lens' PutImagePolicyResponse (Maybe Text)
putImagePolicyResponse_imageArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImagePolicyResponse' {Maybe Text
imageArn :: Maybe Text
$sel:imageArn:PutImagePolicyResponse' :: PutImagePolicyResponse -> Maybe Text
imageArn} -> Maybe Text
imageArn) (\s :: PutImagePolicyResponse
s@PutImagePolicyResponse' {} Maybe Text
a -> PutImagePolicyResponse
s {$sel:imageArn:PutImagePolicyResponse' :: Maybe Text
imageArn = Maybe Text
a} :: PutImagePolicyResponse)
putImagePolicyResponse_requestId :: Lens.Lens' PutImagePolicyResponse (Prelude.Maybe Prelude.Text)
putImagePolicyResponse_requestId :: Lens' PutImagePolicyResponse (Maybe Text)
putImagePolicyResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImagePolicyResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:PutImagePolicyResponse' :: PutImagePolicyResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: PutImagePolicyResponse
s@PutImagePolicyResponse' {} Maybe Text
a -> PutImagePolicyResponse
s {$sel:requestId:PutImagePolicyResponse' :: Maybe Text
requestId = Maybe Text
a} :: PutImagePolicyResponse)
putImagePolicyResponse_httpStatus :: Lens.Lens' PutImagePolicyResponse Prelude.Int
putImagePolicyResponse_httpStatus :: Lens' PutImagePolicyResponse Int
putImagePolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutImagePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutImagePolicyResponse' :: PutImagePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutImagePolicyResponse
s@PutImagePolicyResponse' {} Int
a -> PutImagePolicyResponse
s {$sel:httpStatus:PutImagePolicyResponse' :: Int
httpStatus = Int
a} :: PutImagePolicyResponse)
instance Prelude.NFData PutImagePolicyResponse where
rnf :: PutImagePolicyResponse -> ()
rnf PutImagePolicyResponse' {Int
Maybe Text
httpStatus :: Int
requestId :: Maybe Text
imageArn :: Maybe Text
$sel:httpStatus:PutImagePolicyResponse' :: PutImagePolicyResponse -> Int
$sel:requestId:PutImagePolicyResponse' :: PutImagePolicyResponse -> Maybe Text
$sel:imageArn:PutImagePolicyResponse' :: PutImagePolicyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
imageArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus