{-# 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.Lens as Lens
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
(GetMetricPolicy -> GetMetricPolicy -> Bool)
-> (GetMetricPolicy -> GetMetricPolicy -> Bool)
-> Eq GetMetricPolicy
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]
(Int -> ReadS GetMetricPolicy)
-> ReadS [GetMetricPolicy]
-> ReadPrec GetMetricPolicy
-> ReadPrec [GetMetricPolicy]
-> Read 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
(Int -> GetMetricPolicy -> ShowS)
-> (GetMetricPolicy -> String)
-> ([GetMetricPolicy] -> ShowS)
-> Show GetMetricPolicy
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. GetMetricPolicy -> Rep GetMetricPolicy x)
-> (forall x. Rep GetMetricPolicy x -> GetMetricPolicy)
-> Generic GetMetricPolicy
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' :: Text -> GetMetricPolicy
GetMetricPolicy' {$sel:containerName:GetMetricPolicy' :: Text
containerName = Text
pContainerName_}
getMetricPolicy_containerName :: Lens.Lens' GetMetricPolicy Prelude.Text
getMetricPolicy_containerName :: (Text -> f Text) -> GetMetricPolicy -> f GetMetricPolicy
getMetricPolicy_containerName = (GetMetricPolicy -> Text)
-> (GetMetricPolicy -> Text -> GetMetricPolicy)
-> Lens GetMetricPolicy GetMetricPolicy Text Text
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 :: GetMetricPolicy -> Request GetMetricPolicy
request = Service -> GetMetricPolicy -> Request GetMetricPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetMetricPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMetricPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetMetricPolicy))
-> Logger
-> Service
-> Proxy GetMetricPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMetricPolicy)))
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 ->
Int -> MetricPolicy -> GetMetricPolicyResponse
GetMetricPolicyResponse'
(Int -> MetricPolicy -> GetMetricPolicyResponse)
-> Either String Int
-> Either String (MetricPolicy -> GetMetricPolicyResponse)
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))
Either String (MetricPolicy -> GetMetricPolicyResponse)
-> Either String MetricPolicy
-> Either String GetMetricPolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String MetricPolicy
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"MetricPolicy")
)
instance Prelude.Hashable GetMetricPolicy
instance Prelude.NFData GetMetricPolicy
instance Core.ToHeaders GetMetricPolicy where
toHeaders :: GetMetricPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetMetricPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"MediaStore_20170901.GetMetricPolicy" ::
Prelude.ByteString
),
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 GetMetricPolicy where
toJSON :: GetMetricPolicy -> Value
toJSON GetMetricPolicy' {Text
containerName :: Text
$sel:containerName:GetMetricPolicy' :: GetMetricPolicy -> 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
"ContainerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerName)
]
)
instance Core.ToPath GetMetricPolicy where
toPath :: GetMetricPolicy -> ByteString
toPath = ByteString -> GetMetricPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetMetricPolicy where
toQuery :: GetMetricPolicy -> QueryString
toQuery = QueryString -> GetMetricPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMetricPolicyResponse = GetMetricPolicyResponse'
{
GetMetricPolicyResponse -> Int
httpStatus :: Prelude.Int,
GetMetricPolicyResponse -> MetricPolicy
metricPolicy :: MetricPolicy
}
deriving (GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool
(GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool)
-> (GetMetricPolicyResponse -> GetMetricPolicyResponse -> Bool)
-> Eq GetMetricPolicyResponse
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]
(Int -> ReadS GetMetricPolicyResponse)
-> ReadS [GetMetricPolicyResponse]
-> ReadPrec GetMetricPolicyResponse
-> ReadPrec [GetMetricPolicyResponse]
-> Read 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
(Int -> GetMetricPolicyResponse -> ShowS)
-> (GetMetricPolicyResponse -> String)
-> ([GetMetricPolicyResponse] -> ShowS)
-> Show GetMetricPolicyResponse
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.
GetMetricPolicyResponse -> Rep GetMetricPolicyResponse x)
-> (forall x.
Rep GetMetricPolicyResponse x -> GetMetricPolicyResponse)
-> Generic GetMetricPolicyResponse
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' :: Int -> MetricPolicy -> GetMetricPolicyResponse
GetMetricPolicyResponse'
{ $sel:httpStatus:GetMetricPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:metricPolicy:GetMetricPolicyResponse' :: MetricPolicy
metricPolicy = MetricPolicy
pMetricPolicy_
}
getMetricPolicyResponse_httpStatus :: Lens.Lens' GetMetricPolicyResponse Prelude.Int
getMetricPolicyResponse_httpStatus :: (Int -> f Int)
-> GetMetricPolicyResponse -> f GetMetricPolicyResponse
getMetricPolicyResponse_httpStatus = (GetMetricPolicyResponse -> Int)
-> (GetMetricPolicyResponse -> Int -> GetMetricPolicyResponse)
-> Lens GetMetricPolicyResponse GetMetricPolicyResponse Int Int
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 :: (MetricPolicy -> f MetricPolicy)
-> GetMetricPolicyResponse -> f GetMetricPolicyResponse
getMetricPolicyResponse_metricPolicy = (GetMetricPolicyResponse -> MetricPolicy)
-> (GetMetricPolicyResponse
-> MetricPolicy -> GetMetricPolicyResponse)
-> Lens
GetMetricPolicyResponse
GetMetricPolicyResponse
MetricPolicy
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