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