{-# 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.CodeCommit.GetRepositoryTriggers
(
GetRepositoryTriggers (..),
newGetRepositoryTriggers,
getRepositoryTriggers_repositoryName,
GetRepositoryTriggersResponse (..),
newGetRepositoryTriggersResponse,
getRepositoryTriggersResponse_configurationId,
getRepositoryTriggersResponse_triggers,
getRepositoryTriggersResponse_httpStatus,
)
where
import Amazonka.CodeCommit.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 GetRepositoryTriggers = GetRepositoryTriggers'
{
GetRepositoryTriggers -> Text
repositoryName :: Prelude.Text
}
deriving (GetRepositoryTriggers -> GetRepositoryTriggers -> Bool
(GetRepositoryTriggers -> GetRepositoryTriggers -> Bool)
-> (GetRepositoryTriggers -> GetRepositoryTriggers -> Bool)
-> Eq GetRepositoryTriggers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRepositoryTriggers -> GetRepositoryTriggers -> Bool
$c/= :: GetRepositoryTriggers -> GetRepositoryTriggers -> Bool
== :: GetRepositoryTriggers -> GetRepositoryTriggers -> Bool
$c== :: GetRepositoryTriggers -> GetRepositoryTriggers -> Bool
Prelude.Eq, ReadPrec [GetRepositoryTriggers]
ReadPrec GetRepositoryTriggers
Int -> ReadS GetRepositoryTriggers
ReadS [GetRepositoryTriggers]
(Int -> ReadS GetRepositoryTriggers)
-> ReadS [GetRepositoryTriggers]
-> ReadPrec GetRepositoryTriggers
-> ReadPrec [GetRepositoryTriggers]
-> Read GetRepositoryTriggers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRepositoryTriggers]
$creadListPrec :: ReadPrec [GetRepositoryTriggers]
readPrec :: ReadPrec GetRepositoryTriggers
$creadPrec :: ReadPrec GetRepositoryTriggers
readList :: ReadS [GetRepositoryTriggers]
$creadList :: ReadS [GetRepositoryTriggers]
readsPrec :: Int -> ReadS GetRepositoryTriggers
$creadsPrec :: Int -> ReadS GetRepositoryTriggers
Prelude.Read, Int -> GetRepositoryTriggers -> ShowS
[GetRepositoryTriggers] -> ShowS
GetRepositoryTriggers -> String
(Int -> GetRepositoryTriggers -> ShowS)
-> (GetRepositoryTriggers -> String)
-> ([GetRepositoryTriggers] -> ShowS)
-> Show GetRepositoryTriggers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRepositoryTriggers] -> ShowS
$cshowList :: [GetRepositoryTriggers] -> ShowS
show :: GetRepositoryTriggers -> String
$cshow :: GetRepositoryTriggers -> String
showsPrec :: Int -> GetRepositoryTriggers -> ShowS
$cshowsPrec :: Int -> GetRepositoryTriggers -> ShowS
Prelude.Show, (forall x. GetRepositoryTriggers -> Rep GetRepositoryTriggers x)
-> (forall x. Rep GetRepositoryTriggers x -> GetRepositoryTriggers)
-> Generic GetRepositoryTriggers
forall x. Rep GetRepositoryTriggers x -> GetRepositoryTriggers
forall x. GetRepositoryTriggers -> Rep GetRepositoryTriggers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRepositoryTriggers x -> GetRepositoryTriggers
$cfrom :: forall x. GetRepositoryTriggers -> Rep GetRepositoryTriggers x
Prelude.Generic)
newGetRepositoryTriggers ::
Prelude.Text ->
GetRepositoryTriggers
newGetRepositoryTriggers :: Text -> GetRepositoryTriggers
newGetRepositoryTriggers Text
pRepositoryName_ =
GetRepositoryTriggers' :: Text -> GetRepositoryTriggers
GetRepositoryTriggers'
{ $sel:repositoryName:GetRepositoryTriggers' :: Text
repositoryName =
Text
pRepositoryName_
}
getRepositoryTriggers_repositoryName :: Lens.Lens' GetRepositoryTriggers Prelude.Text
getRepositoryTriggers_repositoryName :: (Text -> f Text)
-> GetRepositoryTriggers -> f GetRepositoryTriggers
getRepositoryTriggers_repositoryName = (GetRepositoryTriggers -> Text)
-> (GetRepositoryTriggers -> Text -> GetRepositoryTriggers)
-> Lens GetRepositoryTriggers GetRepositoryTriggers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepositoryTriggers' {Text
repositoryName :: Text
$sel:repositoryName:GetRepositoryTriggers' :: GetRepositoryTriggers -> Text
repositoryName} -> Text
repositoryName) (\s :: GetRepositoryTriggers
s@GetRepositoryTriggers' {} Text
a -> GetRepositoryTriggers
s {$sel:repositoryName:GetRepositoryTriggers' :: Text
repositoryName = Text
a} :: GetRepositoryTriggers)
instance Core.AWSRequest GetRepositoryTriggers where
type
AWSResponse GetRepositoryTriggers =
GetRepositoryTriggersResponse
request :: GetRepositoryTriggers -> Request GetRepositoryTriggers
request = Service -> GetRepositoryTriggers -> Request GetRepositoryTriggers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetRepositoryTriggers
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRepositoryTriggers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRepositoryTriggers))
-> Logger
-> Service
-> Proxy GetRepositoryTriggers
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRepositoryTriggers)))
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 [RepositoryTrigger]
-> Int
-> GetRepositoryTriggersResponse
GetRepositoryTriggersResponse'
(Maybe Text
-> Maybe [RepositoryTrigger]
-> Int
-> GetRepositoryTriggersResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [RepositoryTrigger] -> Int -> GetRepositoryTriggersResponse)
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
"configurationId")
Either
String
(Maybe [RepositoryTrigger] -> Int -> GetRepositoryTriggersResponse)
-> Either String (Maybe [RepositoryTrigger])
-> Either String (Int -> GetRepositoryTriggersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [RepositoryTrigger]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"triggers" Either String (Maybe (Maybe [RepositoryTrigger]))
-> Maybe [RepositoryTrigger]
-> Either String (Maybe [RepositoryTrigger])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RepositoryTrigger]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetRepositoryTriggersResponse)
-> Either String Int -> Either String GetRepositoryTriggersResponse
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 GetRepositoryTriggers
instance Prelude.NFData GetRepositoryTriggers
instance Core.ToHeaders GetRepositoryTriggers where
toHeaders :: GetRepositoryTriggers -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRepositoryTriggers -> 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
"CodeCommit_20150413.GetRepositoryTriggers" ::
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 GetRepositoryTriggers where
toJSON :: GetRepositoryTriggers -> Value
toJSON GetRepositoryTriggers' {Text
repositoryName :: Text
$sel:repositoryName:GetRepositoryTriggers' :: GetRepositoryTriggers -> 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
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName)
]
)
instance Core.ToPath GetRepositoryTriggers where
toPath :: GetRepositoryTriggers -> ByteString
toPath = ByteString -> GetRepositoryTriggers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRepositoryTriggers where
toQuery :: GetRepositoryTriggers -> QueryString
toQuery = QueryString -> GetRepositoryTriggers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRepositoryTriggersResponse = GetRepositoryTriggersResponse'
{
GetRepositoryTriggersResponse -> Maybe Text
configurationId :: Prelude.Maybe Prelude.Text,
GetRepositoryTriggersResponse -> Maybe [RepositoryTrigger]
triggers :: Prelude.Maybe [RepositoryTrigger],
GetRepositoryTriggersResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRepositoryTriggersResponse
-> GetRepositoryTriggersResponse -> Bool
(GetRepositoryTriggersResponse
-> GetRepositoryTriggersResponse -> Bool)
-> (GetRepositoryTriggersResponse
-> GetRepositoryTriggersResponse -> Bool)
-> Eq GetRepositoryTriggersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRepositoryTriggersResponse
-> GetRepositoryTriggersResponse -> Bool
$c/= :: GetRepositoryTriggersResponse
-> GetRepositoryTriggersResponse -> Bool
== :: GetRepositoryTriggersResponse
-> GetRepositoryTriggersResponse -> Bool
$c== :: GetRepositoryTriggersResponse
-> GetRepositoryTriggersResponse -> Bool
Prelude.Eq, ReadPrec [GetRepositoryTriggersResponse]
ReadPrec GetRepositoryTriggersResponse
Int -> ReadS GetRepositoryTriggersResponse
ReadS [GetRepositoryTriggersResponse]
(Int -> ReadS GetRepositoryTriggersResponse)
-> ReadS [GetRepositoryTriggersResponse]
-> ReadPrec GetRepositoryTriggersResponse
-> ReadPrec [GetRepositoryTriggersResponse]
-> Read GetRepositoryTriggersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRepositoryTriggersResponse]
$creadListPrec :: ReadPrec [GetRepositoryTriggersResponse]
readPrec :: ReadPrec GetRepositoryTriggersResponse
$creadPrec :: ReadPrec GetRepositoryTriggersResponse
readList :: ReadS [GetRepositoryTriggersResponse]
$creadList :: ReadS [GetRepositoryTriggersResponse]
readsPrec :: Int -> ReadS GetRepositoryTriggersResponse
$creadsPrec :: Int -> ReadS GetRepositoryTriggersResponse
Prelude.Read, Int -> GetRepositoryTriggersResponse -> ShowS
[GetRepositoryTriggersResponse] -> ShowS
GetRepositoryTriggersResponse -> String
(Int -> GetRepositoryTriggersResponse -> ShowS)
-> (GetRepositoryTriggersResponse -> String)
-> ([GetRepositoryTriggersResponse] -> ShowS)
-> Show GetRepositoryTriggersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRepositoryTriggersResponse] -> ShowS
$cshowList :: [GetRepositoryTriggersResponse] -> ShowS
show :: GetRepositoryTriggersResponse -> String
$cshow :: GetRepositoryTriggersResponse -> String
showsPrec :: Int -> GetRepositoryTriggersResponse -> ShowS
$cshowsPrec :: Int -> GetRepositoryTriggersResponse -> ShowS
Prelude.Show, (forall x.
GetRepositoryTriggersResponse
-> Rep GetRepositoryTriggersResponse x)
-> (forall x.
Rep GetRepositoryTriggersResponse x
-> GetRepositoryTriggersResponse)
-> Generic GetRepositoryTriggersResponse
forall x.
Rep GetRepositoryTriggersResponse x
-> GetRepositoryTriggersResponse
forall x.
GetRepositoryTriggersResponse
-> Rep GetRepositoryTriggersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRepositoryTriggersResponse x
-> GetRepositoryTriggersResponse
$cfrom :: forall x.
GetRepositoryTriggersResponse
-> Rep GetRepositoryTriggersResponse x
Prelude.Generic)
newGetRepositoryTriggersResponse ::
Prelude.Int ->
GetRepositoryTriggersResponse
newGetRepositoryTriggersResponse :: Int -> GetRepositoryTriggersResponse
newGetRepositoryTriggersResponse Int
pHttpStatus_ =
GetRepositoryTriggersResponse' :: Maybe Text
-> Maybe [RepositoryTrigger]
-> Int
-> GetRepositoryTriggersResponse
GetRepositoryTriggersResponse'
{ $sel:configurationId:GetRepositoryTriggersResponse' :: Maybe Text
configurationId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:triggers:GetRepositoryTriggersResponse' :: Maybe [RepositoryTrigger]
triggers = Maybe [RepositoryTrigger]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRepositoryTriggersResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRepositoryTriggersResponse_configurationId :: Lens.Lens' GetRepositoryTriggersResponse (Prelude.Maybe Prelude.Text)
getRepositoryTriggersResponse_configurationId :: (Maybe Text -> f (Maybe Text))
-> GetRepositoryTriggersResponse -> f GetRepositoryTriggersResponse
getRepositoryTriggersResponse_configurationId = (GetRepositoryTriggersResponse -> Maybe Text)
-> (GetRepositoryTriggersResponse
-> Maybe Text -> GetRepositoryTriggersResponse)
-> Lens
GetRepositoryTriggersResponse
GetRepositoryTriggersResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepositoryTriggersResponse' {Maybe Text
configurationId :: Maybe Text
$sel:configurationId:GetRepositoryTriggersResponse' :: GetRepositoryTriggersResponse -> Maybe Text
configurationId} -> Maybe Text
configurationId) (\s :: GetRepositoryTriggersResponse
s@GetRepositoryTriggersResponse' {} Maybe Text
a -> GetRepositoryTriggersResponse
s {$sel:configurationId:GetRepositoryTriggersResponse' :: Maybe Text
configurationId = Maybe Text
a} :: GetRepositoryTriggersResponse)
getRepositoryTriggersResponse_triggers :: Lens.Lens' GetRepositoryTriggersResponse (Prelude.Maybe [RepositoryTrigger])
getRepositoryTriggersResponse_triggers :: (Maybe [RepositoryTrigger] -> f (Maybe [RepositoryTrigger]))
-> GetRepositoryTriggersResponse -> f GetRepositoryTriggersResponse
getRepositoryTriggersResponse_triggers = (GetRepositoryTriggersResponse -> Maybe [RepositoryTrigger])
-> (GetRepositoryTriggersResponse
-> Maybe [RepositoryTrigger] -> GetRepositoryTriggersResponse)
-> Lens
GetRepositoryTriggersResponse
GetRepositoryTriggersResponse
(Maybe [RepositoryTrigger])
(Maybe [RepositoryTrigger])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepositoryTriggersResponse' {Maybe [RepositoryTrigger]
triggers :: Maybe [RepositoryTrigger]
$sel:triggers:GetRepositoryTriggersResponse' :: GetRepositoryTriggersResponse -> Maybe [RepositoryTrigger]
triggers} -> Maybe [RepositoryTrigger]
triggers) (\s :: GetRepositoryTriggersResponse
s@GetRepositoryTriggersResponse' {} Maybe [RepositoryTrigger]
a -> GetRepositoryTriggersResponse
s {$sel:triggers:GetRepositoryTriggersResponse' :: Maybe [RepositoryTrigger]
triggers = Maybe [RepositoryTrigger]
a} :: GetRepositoryTriggersResponse) ((Maybe [RepositoryTrigger] -> f (Maybe [RepositoryTrigger]))
-> GetRepositoryTriggersResponse
-> f GetRepositoryTriggersResponse)
-> ((Maybe [RepositoryTrigger] -> f (Maybe [RepositoryTrigger]))
-> Maybe [RepositoryTrigger] -> f (Maybe [RepositoryTrigger]))
-> (Maybe [RepositoryTrigger] -> f (Maybe [RepositoryTrigger]))
-> GetRepositoryTriggersResponse
-> f GetRepositoryTriggersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[RepositoryTrigger]
[RepositoryTrigger]
[RepositoryTrigger]
[RepositoryTrigger]
-> Iso
(Maybe [RepositoryTrigger])
(Maybe [RepositoryTrigger])
(Maybe [RepositoryTrigger])
(Maybe [RepositoryTrigger])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[RepositoryTrigger]
[RepositoryTrigger]
[RepositoryTrigger]
[RepositoryTrigger]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getRepositoryTriggersResponse_httpStatus :: Lens.Lens' GetRepositoryTriggersResponse Prelude.Int
getRepositoryTriggersResponse_httpStatus :: (Int -> f Int)
-> GetRepositoryTriggersResponse -> f GetRepositoryTriggersResponse
getRepositoryTriggersResponse_httpStatus = (GetRepositoryTriggersResponse -> Int)
-> (GetRepositoryTriggersResponse
-> Int -> GetRepositoryTriggersResponse)
-> Lens
GetRepositoryTriggersResponse GetRepositoryTriggersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRepositoryTriggersResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRepositoryTriggersResponse' :: GetRepositoryTriggersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRepositoryTriggersResponse
s@GetRepositoryTriggersResponse' {} Int
a -> GetRepositoryTriggersResponse
s {$sel:httpStatus:GetRepositoryTriggersResponse' :: Int
httpStatus = Int
a} :: GetRepositoryTriggersResponse)
instance Prelude.NFData GetRepositoryTriggersResponse