{-# 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.ECR.GetRegistryPolicy
(
GetRegistryPolicy (..),
newGetRegistryPolicy,
GetRegistryPolicyResponse (..),
newGetRegistryPolicyResponse,
getRegistryPolicyResponse_registryId,
getRegistryPolicyResponse_policyText,
getRegistryPolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECR.Types
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 GetRegistryPolicy = GetRegistryPolicy'
{
}
deriving (GetRegistryPolicy -> GetRegistryPolicy -> Bool
(GetRegistryPolicy -> GetRegistryPolicy -> Bool)
-> (GetRegistryPolicy -> GetRegistryPolicy -> Bool)
-> Eq GetRegistryPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistryPolicy -> GetRegistryPolicy -> Bool
$c/= :: GetRegistryPolicy -> GetRegistryPolicy -> Bool
== :: GetRegistryPolicy -> GetRegistryPolicy -> Bool
$c== :: GetRegistryPolicy -> GetRegistryPolicy -> Bool
Prelude.Eq, ReadPrec [GetRegistryPolicy]
ReadPrec GetRegistryPolicy
Int -> ReadS GetRegistryPolicy
ReadS [GetRegistryPolicy]
(Int -> ReadS GetRegistryPolicy)
-> ReadS [GetRegistryPolicy]
-> ReadPrec GetRegistryPolicy
-> ReadPrec [GetRegistryPolicy]
-> Read GetRegistryPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistryPolicy]
$creadListPrec :: ReadPrec [GetRegistryPolicy]
readPrec :: ReadPrec GetRegistryPolicy
$creadPrec :: ReadPrec GetRegistryPolicy
readList :: ReadS [GetRegistryPolicy]
$creadList :: ReadS [GetRegistryPolicy]
readsPrec :: Int -> ReadS GetRegistryPolicy
$creadsPrec :: Int -> ReadS GetRegistryPolicy
Prelude.Read, Int -> GetRegistryPolicy -> ShowS
[GetRegistryPolicy] -> ShowS
GetRegistryPolicy -> String
(Int -> GetRegistryPolicy -> ShowS)
-> (GetRegistryPolicy -> String)
-> ([GetRegistryPolicy] -> ShowS)
-> Show GetRegistryPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistryPolicy] -> ShowS
$cshowList :: [GetRegistryPolicy] -> ShowS
show :: GetRegistryPolicy -> String
$cshow :: GetRegistryPolicy -> String
showsPrec :: Int -> GetRegistryPolicy -> ShowS
$cshowsPrec :: Int -> GetRegistryPolicy -> ShowS
Prelude.Show, (forall x. GetRegistryPolicy -> Rep GetRegistryPolicy x)
-> (forall x. Rep GetRegistryPolicy x -> GetRegistryPolicy)
-> Generic GetRegistryPolicy
forall x. Rep GetRegistryPolicy x -> GetRegistryPolicy
forall x. GetRegistryPolicy -> Rep GetRegistryPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRegistryPolicy x -> GetRegistryPolicy
$cfrom :: forall x. GetRegistryPolicy -> Rep GetRegistryPolicy x
Prelude.Generic)
newGetRegistryPolicy ::
GetRegistryPolicy
newGetRegistryPolicy :: GetRegistryPolicy
newGetRegistryPolicy = GetRegistryPolicy
GetRegistryPolicy'
instance Core.AWSRequest GetRegistryPolicy where
type
AWSResponse GetRegistryPolicy =
GetRegistryPolicyResponse
request :: GetRegistryPolicy -> Request GetRegistryPolicy
request = Service -> GetRegistryPolicy -> Request GetRegistryPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetRegistryPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRegistryPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRegistryPolicy))
-> Logger
-> Service
-> Proxy GetRegistryPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRegistryPolicy)))
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 Text -> Maybe Text -> Int -> GetRegistryPolicyResponse
GetRegistryPolicyResponse'
(Maybe Text -> Maybe Text -> Int -> GetRegistryPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetRegistryPolicyResponse)
forall (f :: * -> *) a b. Functor 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
"registryId")
Either String (Maybe Text -> Int -> GetRegistryPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetRegistryPolicyResponse)
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
"policyText")
Either String (Int -> GetRegistryPolicyResponse)
-> Either String Int -> Either String GetRegistryPolicyResponse
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 GetRegistryPolicy
instance Prelude.NFData GetRegistryPolicy
instance Core.ToHeaders GetRegistryPolicy where
toHeaders :: GetRegistryPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRegistryPolicy -> 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
"AmazonEC2ContainerRegistry_V20150921.GetRegistryPolicy" ::
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 GetRegistryPolicy where
toJSON :: GetRegistryPolicy -> Value
toJSON = Value -> GetRegistryPolicy -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath GetRegistryPolicy where
toPath :: GetRegistryPolicy -> ByteString
toPath = ByteString -> GetRegistryPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRegistryPolicy where
toQuery :: GetRegistryPolicy -> QueryString
toQuery = QueryString -> GetRegistryPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRegistryPolicyResponse = GetRegistryPolicyResponse'
{
GetRegistryPolicyResponse -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
GetRegistryPolicyResponse -> Maybe Text
policyText :: Prelude.Maybe Prelude.Text,
GetRegistryPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRegistryPolicyResponse -> GetRegistryPolicyResponse -> Bool
(GetRegistryPolicyResponse -> GetRegistryPolicyResponse -> Bool)
-> (GetRegistryPolicyResponse -> GetRegistryPolicyResponse -> Bool)
-> Eq GetRegistryPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegistryPolicyResponse -> GetRegistryPolicyResponse -> Bool
$c/= :: GetRegistryPolicyResponse -> GetRegistryPolicyResponse -> Bool
== :: GetRegistryPolicyResponse -> GetRegistryPolicyResponse -> Bool
$c== :: GetRegistryPolicyResponse -> GetRegistryPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetRegistryPolicyResponse]
ReadPrec GetRegistryPolicyResponse
Int -> ReadS GetRegistryPolicyResponse
ReadS [GetRegistryPolicyResponse]
(Int -> ReadS GetRegistryPolicyResponse)
-> ReadS [GetRegistryPolicyResponse]
-> ReadPrec GetRegistryPolicyResponse
-> ReadPrec [GetRegistryPolicyResponse]
-> Read GetRegistryPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegistryPolicyResponse]
$creadListPrec :: ReadPrec [GetRegistryPolicyResponse]
readPrec :: ReadPrec GetRegistryPolicyResponse
$creadPrec :: ReadPrec GetRegistryPolicyResponse
readList :: ReadS [GetRegistryPolicyResponse]
$creadList :: ReadS [GetRegistryPolicyResponse]
readsPrec :: Int -> ReadS GetRegistryPolicyResponse
$creadsPrec :: Int -> ReadS GetRegistryPolicyResponse
Prelude.Read, Int -> GetRegistryPolicyResponse -> ShowS
[GetRegistryPolicyResponse] -> ShowS
GetRegistryPolicyResponse -> String
(Int -> GetRegistryPolicyResponse -> ShowS)
-> (GetRegistryPolicyResponse -> String)
-> ([GetRegistryPolicyResponse] -> ShowS)
-> Show GetRegistryPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegistryPolicyResponse] -> ShowS
$cshowList :: [GetRegistryPolicyResponse] -> ShowS
show :: GetRegistryPolicyResponse -> String
$cshow :: GetRegistryPolicyResponse -> String
showsPrec :: Int -> GetRegistryPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetRegistryPolicyResponse -> ShowS
Prelude.Show, (forall x.
GetRegistryPolicyResponse -> Rep GetRegistryPolicyResponse x)
-> (forall x.
Rep GetRegistryPolicyResponse x -> GetRegistryPolicyResponse)
-> Generic GetRegistryPolicyResponse
forall x.
Rep GetRegistryPolicyResponse x -> GetRegistryPolicyResponse
forall x.
GetRegistryPolicyResponse -> Rep GetRegistryPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRegistryPolicyResponse x -> GetRegistryPolicyResponse
$cfrom :: forall x.
GetRegistryPolicyResponse -> Rep GetRegistryPolicyResponse x
Prelude.Generic)
newGetRegistryPolicyResponse ::
Prelude.Int ->
GetRegistryPolicyResponse
newGetRegistryPolicyResponse :: Int -> GetRegistryPolicyResponse
newGetRegistryPolicyResponse Int
pHttpStatus_ =
GetRegistryPolicyResponse' :: Maybe Text -> Maybe Text -> Int -> GetRegistryPolicyResponse
GetRegistryPolicyResponse'
{ $sel:registryId:GetRegistryPolicyResponse' :: Maybe Text
registryId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policyText:GetRegistryPolicyResponse' :: Maybe Text
policyText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRegistryPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRegistryPolicyResponse_registryId :: Lens.Lens' GetRegistryPolicyResponse (Prelude.Maybe Prelude.Text)
getRegistryPolicyResponse_registryId :: (Maybe Text -> f (Maybe Text))
-> GetRegistryPolicyResponse -> f GetRegistryPolicyResponse
getRegistryPolicyResponse_registryId = (GetRegistryPolicyResponse -> Maybe Text)
-> (GetRegistryPolicyResponse
-> Maybe Text -> GetRegistryPolicyResponse)
-> Lens
GetRegistryPolicyResponse
GetRegistryPolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryPolicyResponse' {Maybe Text
registryId :: Maybe Text
$sel:registryId:GetRegistryPolicyResponse' :: GetRegistryPolicyResponse -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: GetRegistryPolicyResponse
s@GetRegistryPolicyResponse' {} Maybe Text
a -> GetRegistryPolicyResponse
s {$sel:registryId:GetRegistryPolicyResponse' :: Maybe Text
registryId = Maybe Text
a} :: GetRegistryPolicyResponse)
getRegistryPolicyResponse_policyText :: Lens.Lens' GetRegistryPolicyResponse (Prelude.Maybe Prelude.Text)
getRegistryPolicyResponse_policyText :: (Maybe Text -> f (Maybe Text))
-> GetRegistryPolicyResponse -> f GetRegistryPolicyResponse
getRegistryPolicyResponse_policyText = (GetRegistryPolicyResponse -> Maybe Text)
-> (GetRegistryPolicyResponse
-> Maybe Text -> GetRegistryPolicyResponse)
-> Lens
GetRegistryPolicyResponse
GetRegistryPolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryPolicyResponse' {Maybe Text
policyText :: Maybe Text
$sel:policyText:GetRegistryPolicyResponse' :: GetRegistryPolicyResponse -> Maybe Text
policyText} -> Maybe Text
policyText) (\s :: GetRegistryPolicyResponse
s@GetRegistryPolicyResponse' {} Maybe Text
a -> GetRegistryPolicyResponse
s {$sel:policyText:GetRegistryPolicyResponse' :: Maybe Text
policyText = Maybe Text
a} :: GetRegistryPolicyResponse)
getRegistryPolicyResponse_httpStatus :: Lens.Lens' GetRegistryPolicyResponse Prelude.Int
getRegistryPolicyResponse_httpStatus :: (Int -> f Int)
-> GetRegistryPolicyResponse -> f GetRegistryPolicyResponse
getRegistryPolicyResponse_httpStatus = (GetRegistryPolicyResponse -> Int)
-> (GetRegistryPolicyResponse -> Int -> GetRegistryPolicyResponse)
-> Lens GetRegistryPolicyResponse GetRegistryPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegistryPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRegistryPolicyResponse' :: GetRegistryPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRegistryPolicyResponse
s@GetRegistryPolicyResponse' {} Int
a -> GetRegistryPolicyResponse
s {$sel:httpStatus:GetRegistryPolicyResponse' :: Int
httpStatus = Int
a} :: GetRegistryPolicyResponse)
instance Prelude.NFData GetRegistryPolicyResponse