{-# 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.Proton.GetRepository
(
GetRepository (..),
newGetRepository,
getRepository_name,
getRepository_provider,
GetRepositoryResponse (..),
newGetRepositoryResponse,
getRepositoryResponse_httpStatus,
getRepositoryResponse_repository,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetRepository = GetRepository'
{
GetRepository -> Text
name :: Prelude.Text,
GetRepository -> RepositoryProvider
provider :: RepositoryProvider
}
deriving (GetRepository -> GetRepository -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRepository -> GetRepository -> Bool
$c/= :: GetRepository -> GetRepository -> Bool
== :: GetRepository -> GetRepository -> Bool
$c== :: GetRepository -> GetRepository -> Bool
Prelude.Eq, ReadPrec [GetRepository]
ReadPrec GetRepository
Int -> ReadS GetRepository
ReadS [GetRepository]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRepository]
$creadListPrec :: ReadPrec [GetRepository]
readPrec :: ReadPrec GetRepository
$creadPrec :: ReadPrec GetRepository
readList :: ReadS [GetRepository]
$creadList :: ReadS [GetRepository]
readsPrec :: Int -> ReadS GetRepository
$creadsPrec :: Int -> ReadS GetRepository
Prelude.Read, Int -> GetRepository -> ShowS
[GetRepository] -> ShowS
GetRepository -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRepository] -> ShowS
$cshowList :: [GetRepository] -> ShowS
show :: GetRepository -> String
$cshow :: GetRepository -> String
showsPrec :: Int -> GetRepository -> ShowS
$cshowsPrec :: Int -> GetRepository -> ShowS
Prelude.Show, forall x. Rep GetRepository x -> GetRepository
forall x. GetRepository -> Rep GetRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRepository x -> GetRepository
$cfrom :: forall x. GetRepository -> Rep GetRepository x
Prelude.Generic)
newGetRepository ::
Prelude.Text ->
RepositoryProvider ->
GetRepository
newGetRepository :: Text -> RepositoryProvider -> GetRepository
newGetRepository Text
pName_ RepositoryProvider
pProvider_ =
GetRepository'
{ $sel:name:GetRepository' :: Text
name = Text
pName_,
$sel:provider:GetRepository' :: RepositoryProvider
provider = RepositoryProvider
pProvider_
}
getRepository_name :: Lens.Lens' GetRepository Prelude.Text
getRepository_name :: Lens' GetRepository Text
getRepository_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepository' {Text
name :: Text
$sel:name:GetRepository' :: GetRepository -> Text
name} -> Text
name) (\s :: GetRepository
s@GetRepository' {} Text
a -> GetRepository
s {$sel:name:GetRepository' :: Text
name = Text
a} :: GetRepository)
getRepository_provider :: Lens.Lens' GetRepository RepositoryProvider
getRepository_provider :: Lens' GetRepository RepositoryProvider
getRepository_provider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepository' {RepositoryProvider
provider :: RepositoryProvider
$sel:provider:GetRepository' :: GetRepository -> RepositoryProvider
provider} -> RepositoryProvider
provider) (\s :: GetRepository
s@GetRepository' {} RepositoryProvider
a -> GetRepository
s {$sel:provider:GetRepository' :: RepositoryProvider
provider = RepositoryProvider
a} :: GetRepository)
instance Core.AWSRequest GetRepository where
type
AWSResponse GetRepository =
GetRepositoryResponse
request :: (Service -> Service) -> GetRepository -> Request GetRepository
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 GetRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRepository)))
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 -> Repository -> GetRepositoryResponse
GetRepositoryResponse'
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
"repository")
)
instance Prelude.Hashable GetRepository where
hashWithSalt :: Int -> GetRepository -> Int
hashWithSalt Int
_salt GetRepository' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
$sel:provider:GetRepository' :: GetRepository -> RepositoryProvider
$sel:name:GetRepository' :: GetRepository -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RepositoryProvider
provider
instance Prelude.NFData GetRepository where
rnf :: GetRepository -> ()
rnf GetRepository' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
$sel:provider:GetRepository' :: GetRepository -> RepositoryProvider
$sel:name:GetRepository' :: GetRepository -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RepositoryProvider
provider
instance Data.ToHeaders GetRepository where
toHeaders :: GetRepository -> 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
"AwsProton20200720.GetRepository" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetRepository where
toJSON :: GetRepository -> Value
toJSON GetRepository' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
$sel:provider:GetRepository' :: GetRepository -> RepositoryProvider
$sel:name:GetRepository' :: GetRepository -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"provider" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RepositoryProvider
provider)
]
)
instance Data.ToPath GetRepository where
toPath :: GetRepository -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetRepository where
toQuery :: GetRepository -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetRepositoryResponse = GetRepositoryResponse'
{
GetRepositoryResponse -> Int
httpStatus :: Prelude.Int,
GetRepositoryResponse -> Repository
repository :: Repository
}
deriving (GetRepositoryResponse -> GetRepositoryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRepositoryResponse -> GetRepositoryResponse -> Bool
$c/= :: GetRepositoryResponse -> GetRepositoryResponse -> Bool
== :: GetRepositoryResponse -> GetRepositoryResponse -> Bool
$c== :: GetRepositoryResponse -> GetRepositoryResponse -> Bool
Prelude.Eq, ReadPrec [GetRepositoryResponse]
ReadPrec GetRepositoryResponse
Int -> ReadS GetRepositoryResponse
ReadS [GetRepositoryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRepositoryResponse]
$creadListPrec :: ReadPrec [GetRepositoryResponse]
readPrec :: ReadPrec GetRepositoryResponse
$creadPrec :: ReadPrec GetRepositoryResponse
readList :: ReadS [GetRepositoryResponse]
$creadList :: ReadS [GetRepositoryResponse]
readsPrec :: Int -> ReadS GetRepositoryResponse
$creadsPrec :: Int -> ReadS GetRepositoryResponse
Prelude.Read, Int -> GetRepositoryResponse -> ShowS
[GetRepositoryResponse] -> ShowS
GetRepositoryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRepositoryResponse] -> ShowS
$cshowList :: [GetRepositoryResponse] -> ShowS
show :: GetRepositoryResponse -> String
$cshow :: GetRepositoryResponse -> String
showsPrec :: Int -> GetRepositoryResponse -> ShowS
$cshowsPrec :: Int -> GetRepositoryResponse -> ShowS
Prelude.Show, forall x. Rep GetRepositoryResponse x -> GetRepositoryResponse
forall x. GetRepositoryResponse -> Rep GetRepositoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRepositoryResponse x -> GetRepositoryResponse
$cfrom :: forall x. GetRepositoryResponse -> Rep GetRepositoryResponse x
Prelude.Generic)
newGetRepositoryResponse ::
Prelude.Int ->
Repository ->
GetRepositoryResponse
newGetRepositoryResponse :: Int -> Repository -> GetRepositoryResponse
newGetRepositoryResponse Int
pHttpStatus_ Repository
pRepository_ =
GetRepositoryResponse'
{ $sel:httpStatus:GetRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:repository:GetRepositoryResponse' :: Repository
repository = Repository
pRepository_
}
getRepositoryResponse_httpStatus :: Lens.Lens' GetRepositoryResponse Prelude.Int
getRepositoryResponse_httpStatus :: Lens' GetRepositoryResponse Int
getRepositoryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepositoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRepositoryResponse' :: GetRepositoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRepositoryResponse
s@GetRepositoryResponse' {} Int
a -> GetRepositoryResponse
s {$sel:httpStatus:GetRepositoryResponse' :: Int
httpStatus = Int
a} :: GetRepositoryResponse)
getRepositoryResponse_repository :: Lens.Lens' GetRepositoryResponse Repository
getRepositoryResponse_repository :: Lens' GetRepositoryResponse Repository
getRepositoryResponse_repository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepositoryResponse' {Repository
repository :: Repository
$sel:repository:GetRepositoryResponse' :: GetRepositoryResponse -> Repository
repository} -> Repository
repository) (\s :: GetRepositoryResponse
s@GetRepositoryResponse' {} Repository
a -> GetRepositoryResponse
s {$sel:repository:GetRepositoryResponse' :: Repository
repository = Repository
a} :: GetRepositoryResponse)
instance Prelude.NFData GetRepositoryResponse where
rnf :: GetRepositoryResponse -> ()
rnf GetRepositoryResponse' {Int
Repository
repository :: Repository
httpStatus :: Int
$sel:repository:GetRepositoryResponse' :: GetRepositoryResponse -> Repository
$sel:httpStatus:GetRepositoryResponse' :: GetRepositoryResponse -> 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 Repository
repository