{-# 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.MediaStore.GetMetricPolicy
(
GetMetricPolicy (..),
newGetMetricPolicy,
getMetricPolicy_containerName,
GetMetricPolicyResponse (..),
newGetMetricPolicyResponse,
getMetricPolicyResponse_httpStatus,
getMetricPolicyResponse_metricPolicy,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaStore.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetMetricPolicy = GetMetricPolicy'
{
GetMetricPolicy -> Text
containerName :: Prelude.Text
}
deriving (GetMetricPolicy -> GetMetricPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricPolicy -> GetMetricPolicy -> Bool
$c/= :: GetMetricPolicy -> GetMetricPolicy -> Bool
== :: GetMetricPolicy -> GetMetricPolicy -> Bool
$c== :: GetMetricPolicy -> GetMetricPolicy -> Bool
Prelude.Eq, ReadPrec [GetMetricPolicy]
ReadPrec GetMetricPolicy
Int -> ReadS GetMetricPolicy
ReadS [GetMetricPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricPolicy]
$creadListPrec :: ReadPrec [GetMetricPolicy]
readPrec :: ReadPrec GetMetricPolicy
$creadPrec :: ReadPrec GetMetricPolicy
readList :: ReadS [GetMetricPolicy]
$creadList :: ReadS [GetMetricPolicy]
readsPrec :: Int -> ReadS GetMetricPolicy
$creadsPrec :: Int -> ReadS GetMetricPolicy
Prelude.Read, Int -> GetMetricPolicy -> ShowS
[GetMetricPolicy] -> ShowS
GetMetricPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricPolicy] -> ShowS
$cshowList :: [GetMetricPolicy] -> ShowS
show :: GetMetricPolicy -> String
$cshow :: GetMetricPolicy -> String
showsPrec :: Int -> GetMetricPolicy -> ShowS
$cshowsPrec :: Int -> GetMetricPolicy -> ShowS
Prelude.Show, forall x. Rep GetMetricPolicy x -> GetMetricPolicy
forall x. GetMetricPolicy -> Rep GetMetricPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMetricPolicy x -> GetMetricPolicy
$cfrom :: forall x. GetMetricPolicy -> Rep GetMetricPolicy x
Prelude.Generic)
newGetMetricPolicy ::
Prelude.Text ->
GetMetricPolicy
newGetMetricPolicy :: Text -> GetMetricPolicy
newGetMetricPolicy Text
pContainerName_ =
GetMetricPolicy' {$sel:containerName:GetMetricPolicy' :: Text
containerName = Text
pContainerName_}
getMetricPolicy_containerName :: Lens.Lens' GetMetricPolicy Prelude.Text
getMetricPolicy_containerName :: Lens' GetMetricPolicy Text
getMetricPolicy_containerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricPolicy' {Text
containerName :: Text
$sel:containerName:GetMetricPolicy' :: GetMetricPolicy -> Text
containerName} -> Text
containerName) (\s :: GetMetricPolicy
s@GetMetricPolicy' {} Text
a -> GetMetricPolicy
s {$sel:containerName:GetMetricPolicy' :: Text
containerName = Text
a} :: GetMetricPolicy)
instance Core.AWSRequest GetMetricPolicy where
type
AWSResponse GetMetricPolicy =
GetMetricPolicyResponse
request :: (Service -> Service) -> GetMetricPolicy -> Request GetMetricPolicy
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 GetMetricPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMetricPolicy)))
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 ->
Int -> MetricPolicy -> GetMetricPolicyResponse
GetMetricPolicyResponse'
forall (f :: * -> *) a b. Functor 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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"MetricPolicy")
)
instance Prelude.Hashable GetMetricPolicy where
hashWithSalt :: Int -> GetMetricPolicy -> Int
hashWithSalt Int
_salt GetMetricPolicy' {Text
containerName :: Text
$sel:containerName:GetMetricPolicy' :: GetMetricPolicy -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
containerName
instance Prelude.NFData GetMetricPolicy where
rnf :: GetMetricPolicy -> ()
rnf GetMetricPolicy' {Text
containerName :: Text
$sel:containerName:GetMetricPolicy' :: GetMetricPolicy -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
containerName
instance Data.ToHeaders GetMetricPolicy where
toHeaders :: GetMetricPolicy -> 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
"MediaStore_20170901.GetMetricPolicy" ::
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 GetMetricPolicy where
toJSON :: GetMetricPolicy -> Value
toJSON GetMetricPolicy' {Text
containerName :: Text
$sel:containerName:GetMetricPolicy' :: GetMetricPolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"ContainerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
containerName)
]
)
instance Data.ToPath GetMetricPolicy where
toPath :: GetMetricPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetMetricPolicy where
toQuery :: GetMetricPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetMetricPolicyResponse = GetMetricPolicyResponse'
{
GetMetricPolicyResponse -> Int
httpStatus :: Prelude.Int,
GetMetricPolicyResponse -> MetricPolicy
metricPolicy :: MetricPolicy
}
deriving (GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool
$c/= :: GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool
== :: GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool
$c== :: GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetMetricPolicyResponse]
ReadPrec GetMetricPolicyResponse
Int -> ReadS GetMetricPolicyResponse
ReadS [GetMetricPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMetricPolicyResponse]
$creadListPrec :: ReadPrec [GetMetricPolicyResponse]
readPrec :: ReadPrec GetMetricPolicyResponse
$creadPrec :: ReadPrec GetMetricPolicyResponse
readList :: ReadS [GetMetricPolicyResponse]
$creadList :: ReadS [GetMetricPolicyResponse]
readsPrec :: Int -> ReadS GetMetricPolicyResponse
$creadsPrec :: Int -> ReadS GetMetricPolicyResponse
Prelude.Read, Int -> GetMetricPolicyResponse -> ShowS
[GetMetricPolicyResponse] -> ShowS
GetMetricPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMetricPolicyResponse] -> ShowS
$cshowList :: [GetMetricPolicyResponse] -> ShowS
show :: GetMetricPolicyResponse -> String
$cshow :: GetMetricPolicyResponse -> String
showsPrec :: Int -> GetMetricPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetMetricPolicyResponse -> ShowS
Prelude.Show, forall x. Rep GetMetricPolicyResponse x -> GetMetricPolicyResponse
forall x. GetMetricPolicyResponse -> Rep GetMetricPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMetricPolicyResponse x -> GetMetricPolicyResponse
$cfrom :: forall x. GetMetricPolicyResponse -> Rep GetMetricPolicyResponse x
Prelude.Generic)
newGetMetricPolicyResponse ::
Prelude.Int ->
MetricPolicy ->
GetMetricPolicyResponse
newGetMetricPolicyResponse :: Int -> MetricPolicy -> GetMetricPolicyResponse
newGetMetricPolicyResponse
Int
pHttpStatus_
MetricPolicy
pMetricPolicy_ =
GetMetricPolicyResponse'
{ $sel:httpStatus:GetMetricPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:metricPolicy:GetMetricPolicyResponse' :: MetricPolicy
metricPolicy = MetricPolicy
pMetricPolicy_
}
getMetricPolicyResponse_httpStatus :: Lens.Lens' GetMetricPolicyResponse Prelude.Int
getMetricPolicyResponse_httpStatus :: Lens' GetMetricPolicyResponse Int
getMetricPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMetricPolicyResponse' :: GetMetricPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMetricPolicyResponse
s@GetMetricPolicyResponse' {} Int
a -> GetMetricPolicyResponse
s {$sel:httpStatus:GetMetricPolicyResponse' :: Int
httpStatus = Int
a} :: GetMetricPolicyResponse)
getMetricPolicyResponse_metricPolicy :: Lens.Lens' GetMetricPolicyResponse MetricPolicy
getMetricPolicyResponse_metricPolicy :: Lens' GetMetricPolicyResponse MetricPolicy
getMetricPolicyResponse_metricPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMetricPolicyResponse' {MetricPolicy
metricPolicy :: MetricPolicy
$sel:metricPolicy:GetMetricPolicyResponse' :: GetMetricPolicyResponse -> MetricPolicy
metricPolicy} -> MetricPolicy
metricPolicy) (\s :: GetMetricPolicyResponse
s@GetMetricPolicyResponse' {} MetricPolicy
a -> GetMetricPolicyResponse
s {$sel:metricPolicy:GetMetricPolicyResponse' :: MetricPolicy
metricPolicy = MetricPolicy
a} :: GetMetricPolicyResponse)
instance Prelude.NFData GetMetricPolicyResponse where
rnf :: GetMetricPolicyResponse -> ()
rnf GetMetricPolicyResponse' {Int
MetricPolicy
metricPolicy :: MetricPolicy
httpStatus :: Int
$sel:metricPolicy:GetMetricPolicyResponse' :: GetMetricPolicyResponse -> MetricPolicy
$sel:httpStatus:GetMetricPolicyResponse' :: GetMetricPolicyResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MetricPolicy
metricPolicy