Safe Haskell | None |
---|
Jenkins REST API interface
- data Jenkins a
- data ConnectInfo = ConnectInfo {}
- defaultConnectInfo :: ConnectInfo
- data Result e v
- = Error e
- | Disconnect
- | Result v
- runJenkins :: ConnectInfo -> Jenkins a -> IO (Result HttpException a)
- runJenkinsThrowing :: ConnectInfo -> Jenkins a -> IO (Result e a)
- get :: Method Complete f -> Jenkins ByteString
- post :: (forall f. Method Complete f) -> ByteString -> Jenkins ()
- post_ :: (forall f. Method Complete f) -> Jenkins ()
- concurrently :: Jenkins a -> Jenkins b -> Jenkins (a, b)
- io :: MonadIO m => IO a -> m a
- disconnect :: Jenkins a
- with :: (Request -> Request) -> Jenkins a -> Jenkins a
- module Jenkins.Rest.Method
- postXML :: (forall f. Method Complete f) -> Document -> Jenkins ()
- concurrentlys :: Foldable f => f (Jenkins a) -> Jenkins [a]
- concurrentlys_ :: Foldable f => f (Jenkins a) -> Jenkins ()
- reload :: Jenkins a
- restart :: Jenkins a
- forceRestart :: Jenkins a
- jenkinsUrl :: Lens' ConnectInfo String
- jenkinsPort :: Lens' ConnectInfo Int
- jenkinsUser :: Lens' ConnectInfo Text
- jenkinsApiToken :: Lens' ConnectInfo Text
- jenkinsPassword :: Lens' ConnectInfo Text
- _Error :: Prism (Result e a) (Result e' a) e e'
- _Disconnect :: Prism' (Result e a) ()
- _Result :: Prism (Result e a) (Result e b) a b
- data Request
- data HttpException
Query Jenkins
Jenkins REST API query sequence description
data ConnectInfo Source
Jenkins connection settings
_jenkinsApiToken
may be user's password, Jenkins
does not make any distinction between these concepts
ConnectInfo | |
|
defaultConnectInfo :: ConnectInfoSource
Default Jenkins connection settings
defaultConnectInfo = ConnectInfo { _jenkinsUrl = "http://example.com/jenkins" , _jenkinsPort = 8080 , _jenkinsUser = "jenkins" , _jenkinsApiToken = "" }
The result of Jenkins REST API queries
Error e | Exception |
Disconnect | The client was explicitly disconnected |
Result v | Querying successfully finished the with value |
runJenkins :: ConnectInfo -> Jenkins a -> IO (Result HttpException a)Source
Query Jenkins API using Jenkins
description
Successful result is either Disconnect
or
Result
v
If HttpException
was thrown by http-conduit
, runJenkins
catches it
and wraps in Error
. Other exceptions are not catched
runJenkinsThrowing :: ConnectInfo -> Jenkins a -> IO (Result e a)Source
Query Jenkins API using Jenkins
description
Successful result is either Disconnect
or
Result
v
No exceptions are catched, i.e.
runJenkinsThrowing ::ConnectInfo
->Jenkins
a ->IO
(Result
Void
a)
Combinators
concurrently :: Jenkins a -> Jenkins b -> Jenkins (a, b)Source
Do both queries concurrently
disconnect :: Jenkins aSource
Disconnect from Jenkins
Any following queries won't be executed
Method
module Jenkins.Rest.Method
Convenience
postXML :: (forall f. Method Complete f) -> Document -> Jenkins ()Source
POST
job's config.xml
(or any other xml, really) in xml-conduit
format
concurrentlys :: Foldable f => f (Jenkins a) -> Jenkins [a]Source
Send a list of queries concurrently
concurrentlys_ :: Foldable f => f (Jenkins a) -> Jenkins ()Source
Send a list of queries concurrently
ignoring their results
Note: exceptions are still raised
Restart jenkins safely
Calls /safeRestart
and disconnects
/safeRestart
allows all running jobs to complete
forceRestart :: Jenkins aSource
Force jenkins to restart without waiting for running jobs to finish
Calls /restart
and disconnects
Optics
jenkinsUrl :: Lens' ConnectInfo StringSource
A lens into Jenkins URL
jenkinsPort :: Lens' ConnectInfo IntSource
A lens into Jenkins port
jenkinsUser :: Lens' ConnectInfo TextSource
A lens into Jenkins user
jenkinsApiToken :: Lens' ConnectInfo TextSource
A lens into Jenkins user API token
jenkinsPassword :: Lens' ConnectInfo TextSource
A lens into Jenkins password
jenkinsPassword = jenkinsApiToken
_Disconnect :: Prism' (Result e a) ()Source
A prism into disconnect
Reexports
data Request
All information on how to connect to a host and what should be sent in the HTTP request.
If you simply wish to download from a URL, see parseUrl
.
The constructor for this data type is not exposed. Instead, you should use
either the def
method to retrieve a default instance, or parseUrl
to
construct from a URL, and then use the records below to make modifications.
This approach allows http-client to add configuration options without
breaking backwards compatibility.
For example, to construct a POST request, you could do something like:
initReq <- parseUrl "http://www.example.com/path" let req = initReq { method = "POST" }
For more information, please see http://www.yesodweb.com/book/settings-types.
Since 0.1.0