{-# 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.CodeArtifact.DescribeRepository
(
DescribeRepository (..),
newDescribeRepository,
describeRepository_domainOwner,
describeRepository_domain,
describeRepository_repository,
DescribeRepositoryResponse (..),
newDescribeRepositoryResponse,
describeRepositoryResponse_repository,
describeRepositoryResponse_httpStatus,
)
where
import Amazonka.CodeArtifact.Types
import qualified Amazonka.Core as Core
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 DescribeRepository = DescribeRepository'
{
DescribeRepository -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
DescribeRepository -> Text
domain :: Prelude.Text,
DescribeRepository -> Text
repository :: Prelude.Text
}
deriving (DescribeRepository -> DescribeRepository -> Bool
(DescribeRepository -> DescribeRepository -> Bool)
-> (DescribeRepository -> DescribeRepository -> Bool)
-> Eq DescribeRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRepository -> DescribeRepository -> Bool
$c/= :: DescribeRepository -> DescribeRepository -> Bool
== :: DescribeRepository -> DescribeRepository -> Bool
$c== :: DescribeRepository -> DescribeRepository -> Bool
Prelude.Eq, ReadPrec [DescribeRepository]
ReadPrec DescribeRepository
Int -> ReadS DescribeRepository
ReadS [DescribeRepository]
(Int -> ReadS DescribeRepository)
-> ReadS [DescribeRepository]
-> ReadPrec DescribeRepository
-> ReadPrec [DescribeRepository]
-> Read DescribeRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRepository]
$creadListPrec :: ReadPrec [DescribeRepository]
readPrec :: ReadPrec DescribeRepository
$creadPrec :: ReadPrec DescribeRepository
readList :: ReadS [DescribeRepository]
$creadList :: ReadS [DescribeRepository]
readsPrec :: Int -> ReadS DescribeRepository
$creadsPrec :: Int -> ReadS DescribeRepository
Prelude.Read, Int -> DescribeRepository -> ShowS
[DescribeRepository] -> ShowS
DescribeRepository -> String
(Int -> DescribeRepository -> ShowS)
-> (DescribeRepository -> String)
-> ([DescribeRepository] -> ShowS)
-> Show DescribeRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRepository] -> ShowS
$cshowList :: [DescribeRepository] -> ShowS
show :: DescribeRepository -> String
$cshow :: DescribeRepository -> String
showsPrec :: Int -> DescribeRepository -> ShowS
$cshowsPrec :: Int -> DescribeRepository -> ShowS
Prelude.Show, (forall x. DescribeRepository -> Rep DescribeRepository x)
-> (forall x. Rep DescribeRepository x -> DescribeRepository)
-> Generic DescribeRepository
forall x. Rep DescribeRepository x -> DescribeRepository
forall x. DescribeRepository -> Rep DescribeRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRepository x -> DescribeRepository
$cfrom :: forall x. DescribeRepository -> Rep DescribeRepository x
Prelude.Generic)
newDescribeRepository ::
Prelude.Text ->
Prelude.Text ->
DescribeRepository
newDescribeRepository :: Text -> Text -> DescribeRepository
newDescribeRepository Text
pDomain_ Text
pRepository_ =
DescribeRepository' :: Maybe Text -> Text -> Text -> DescribeRepository
DescribeRepository'
{ $sel:domainOwner:DescribeRepository' :: Maybe Text
domainOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:domain:DescribeRepository' :: Text
domain = Text
pDomain_,
$sel:repository:DescribeRepository' :: Text
repository = Text
pRepository_
}
describeRepository_domainOwner :: Lens.Lens' DescribeRepository (Prelude.Maybe Prelude.Text)
describeRepository_domainOwner :: (Maybe Text -> f (Maybe Text))
-> DescribeRepository -> f DescribeRepository
describeRepository_domainOwner = (DescribeRepository -> Maybe Text)
-> (DescribeRepository -> Maybe Text -> DescribeRepository)
-> Lens
DescribeRepository DescribeRepository (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepository' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:DescribeRepository' :: DescribeRepository -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: DescribeRepository
s@DescribeRepository' {} Maybe Text
a -> DescribeRepository
s {$sel:domainOwner:DescribeRepository' :: Maybe Text
domainOwner = Maybe Text
a} :: DescribeRepository)
describeRepository_domain :: Lens.Lens' DescribeRepository Prelude.Text
describeRepository_domain :: (Text -> f Text) -> DescribeRepository -> f DescribeRepository
describeRepository_domain = (DescribeRepository -> Text)
-> (DescribeRepository -> Text -> DescribeRepository)
-> Lens DescribeRepository DescribeRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepository' {Text
domain :: Text
$sel:domain:DescribeRepository' :: DescribeRepository -> Text
domain} -> Text
domain) (\s :: DescribeRepository
s@DescribeRepository' {} Text
a -> DescribeRepository
s {$sel:domain:DescribeRepository' :: Text
domain = Text
a} :: DescribeRepository)
describeRepository_repository :: Lens.Lens' DescribeRepository Prelude.Text
describeRepository_repository :: (Text -> f Text) -> DescribeRepository -> f DescribeRepository
describeRepository_repository = (DescribeRepository -> Text)
-> (DescribeRepository -> Text -> DescribeRepository)
-> Lens DescribeRepository DescribeRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepository' {Text
repository :: Text
$sel:repository:DescribeRepository' :: DescribeRepository -> Text
repository} -> Text
repository) (\s :: DescribeRepository
s@DescribeRepository' {} Text
a -> DescribeRepository
s {$sel:repository:DescribeRepository' :: Text
repository = Text
a} :: DescribeRepository)
instance Core.AWSRequest DescribeRepository where
type
AWSResponse DescribeRepository =
DescribeRepositoryResponse
request :: DescribeRepository -> Request DescribeRepository
request = Service -> DescribeRepository -> Request DescribeRepository
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeRepository
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeRepository)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeRepository))
-> Logger
-> Service
-> Proxy DescribeRepository
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeRepository)))
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 RepositoryDescription -> Int -> DescribeRepositoryResponse
DescribeRepositoryResponse'
(Maybe RepositoryDescription -> Int -> DescribeRepositoryResponse)
-> Either String (Maybe RepositoryDescription)
-> Either String (Int -> DescribeRepositoryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RepositoryDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repository")
Either String (Int -> DescribeRepositoryResponse)
-> Either String Int -> Either String DescribeRepositoryResponse
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 DescribeRepository
instance Prelude.NFData DescribeRepository
instance Core.ToHeaders DescribeRepository where
toHeaders :: DescribeRepository -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeRepository -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath DescribeRepository where
toPath :: DescribeRepository -> ByteString
toPath = ByteString -> DescribeRepository -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/repository"
instance Core.ToQuery DescribeRepository where
toQuery :: DescribeRepository -> QueryString
toQuery DescribeRepository' {Maybe Text
Text
repository :: Text
domain :: Text
domainOwner :: Maybe Text
$sel:repository:DescribeRepository' :: DescribeRepository -> Text
$sel:domain:DescribeRepository' :: DescribeRepository -> Text
$sel:domainOwner:DescribeRepository' :: DescribeRepository -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"domain-owner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
domainOwner,
ByteString
"domain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domain,
ByteString
"repository" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
repository
]
data DescribeRepositoryResponse = DescribeRepositoryResponse'
{
DescribeRepositoryResponse -> Maybe RepositoryDescription
repository :: Prelude.Maybe RepositoryDescription,
DescribeRepositoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeRepositoryResponse -> DescribeRepositoryResponse -> Bool
(DescribeRepositoryResponse -> DescribeRepositoryResponse -> Bool)
-> (DescribeRepositoryResponse
-> DescribeRepositoryResponse -> Bool)
-> Eq DescribeRepositoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRepositoryResponse -> DescribeRepositoryResponse -> Bool
$c/= :: DescribeRepositoryResponse -> DescribeRepositoryResponse -> Bool
== :: DescribeRepositoryResponse -> DescribeRepositoryResponse -> Bool
$c== :: DescribeRepositoryResponse -> DescribeRepositoryResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRepositoryResponse]
ReadPrec DescribeRepositoryResponse
Int -> ReadS DescribeRepositoryResponse
ReadS [DescribeRepositoryResponse]
(Int -> ReadS DescribeRepositoryResponse)
-> ReadS [DescribeRepositoryResponse]
-> ReadPrec DescribeRepositoryResponse
-> ReadPrec [DescribeRepositoryResponse]
-> Read DescribeRepositoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRepositoryResponse]
$creadListPrec :: ReadPrec [DescribeRepositoryResponse]
readPrec :: ReadPrec DescribeRepositoryResponse
$creadPrec :: ReadPrec DescribeRepositoryResponse
readList :: ReadS [DescribeRepositoryResponse]
$creadList :: ReadS [DescribeRepositoryResponse]
readsPrec :: Int -> ReadS DescribeRepositoryResponse
$creadsPrec :: Int -> ReadS DescribeRepositoryResponse
Prelude.Read, Int -> DescribeRepositoryResponse -> ShowS
[DescribeRepositoryResponse] -> ShowS
DescribeRepositoryResponse -> String
(Int -> DescribeRepositoryResponse -> ShowS)
-> (DescribeRepositoryResponse -> String)
-> ([DescribeRepositoryResponse] -> ShowS)
-> Show DescribeRepositoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRepositoryResponse] -> ShowS
$cshowList :: [DescribeRepositoryResponse] -> ShowS
show :: DescribeRepositoryResponse -> String
$cshow :: DescribeRepositoryResponse -> String
showsPrec :: Int -> DescribeRepositoryResponse -> ShowS
$cshowsPrec :: Int -> DescribeRepositoryResponse -> ShowS
Prelude.Show, (forall x.
DescribeRepositoryResponse -> Rep DescribeRepositoryResponse x)
-> (forall x.
Rep DescribeRepositoryResponse x -> DescribeRepositoryResponse)
-> Generic DescribeRepositoryResponse
forall x.
Rep DescribeRepositoryResponse x -> DescribeRepositoryResponse
forall x.
DescribeRepositoryResponse -> Rep DescribeRepositoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRepositoryResponse x -> DescribeRepositoryResponse
$cfrom :: forall x.
DescribeRepositoryResponse -> Rep DescribeRepositoryResponse x
Prelude.Generic)
newDescribeRepositoryResponse ::
Prelude.Int ->
DescribeRepositoryResponse
newDescribeRepositoryResponse :: Int -> DescribeRepositoryResponse
newDescribeRepositoryResponse Int
pHttpStatus_ =
DescribeRepositoryResponse' :: Maybe RepositoryDescription -> Int -> DescribeRepositoryResponse
DescribeRepositoryResponse'
{ $sel:repository:DescribeRepositoryResponse' :: Maybe RepositoryDescription
repository =
Maybe RepositoryDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeRepositoryResponse_repository :: Lens.Lens' DescribeRepositoryResponse (Prelude.Maybe RepositoryDescription)
describeRepositoryResponse_repository :: (Maybe RepositoryDescription -> f (Maybe RepositoryDescription))
-> DescribeRepositoryResponse -> f DescribeRepositoryResponse
describeRepositoryResponse_repository = (DescribeRepositoryResponse -> Maybe RepositoryDescription)
-> (DescribeRepositoryResponse
-> Maybe RepositoryDescription -> DescribeRepositoryResponse)
-> Lens
DescribeRepositoryResponse
DescribeRepositoryResponse
(Maybe RepositoryDescription)
(Maybe RepositoryDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositoryResponse' {Maybe RepositoryDescription
repository :: Maybe RepositoryDescription
$sel:repository:DescribeRepositoryResponse' :: DescribeRepositoryResponse -> Maybe RepositoryDescription
repository} -> Maybe RepositoryDescription
repository) (\s :: DescribeRepositoryResponse
s@DescribeRepositoryResponse' {} Maybe RepositoryDescription
a -> DescribeRepositoryResponse
s {$sel:repository:DescribeRepositoryResponse' :: Maybe RepositoryDescription
repository = Maybe RepositoryDescription
a} :: DescribeRepositoryResponse)
describeRepositoryResponse_httpStatus :: Lens.Lens' DescribeRepositoryResponse Prelude.Int
describeRepositoryResponse_httpStatus :: (Int -> f Int)
-> DescribeRepositoryResponse -> f DescribeRepositoryResponse
describeRepositoryResponse_httpStatus = (DescribeRepositoryResponse -> Int)
-> (DescribeRepositoryResponse
-> Int -> DescribeRepositoryResponse)
-> Lens
DescribeRepositoryResponse DescribeRepositoryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRepositoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeRepositoryResponse' :: DescribeRepositoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeRepositoryResponse
s@DescribeRepositoryResponse' {} Int
a -> DescribeRepositoryResponse
s {$sel:httpStatus:DescribeRepositoryResponse' :: Int
httpStatus = Int
a} :: DescribeRepositoryResponse)
instance Prelude.NFData DescribeRepositoryResponse