Safe Haskell | None |
---|---|
Language | Haskell2010 |
- getObject :: Text -> Text -> Cloud GCP LbsResponse
- listObjects :: Text -> Cloud GCP LbsResponse
- putObject :: Text -> Text -> ByteString -> Cloud GCP LbsResponse
- scopesDefault :: [Text]
- evalCloudIO :: Handle c -> Cloud c a -> IO a
- liftCloudIO :: HasCredentials c => IO a -> Cloud c a
- createHandle :: HasCredentials c => Credentials c -> Options c -> IO (Handle c)
- data GCP
- data GCPServiceAccount = GCPServiceAccount {}
- newtype Cloud c a = Cloud {}
- class HasCredentials c where
- type Credentials c
- type Options c
- type TokenContent c
- data Token c = Token {
- tToken :: TokenContent c
- tTime :: UTCTime
- data Handle c = Handle {
- credentials :: Credentials c
- token :: TVar (Maybe (Token c))
- options :: Options c
- parseRSAPrivateKey :: MonadThrow m => Text -> m PrivateKey
- data KeyException
- data JWTError
- data TokenExchangeException
- data CloudException
Google Cloud Storage
getObject :: Text -> Text -> Cloud GCP LbsResponse Source #
`getObject b p` retrieves the contents of a GCS object (of full path p
) in bucket b
listObjects :: Text -> Cloud GCP LbsResponse Source #
`listObjects b` retrieves a list of objects stored in bucket b
putObject :: Text -> Text -> ByteString -> Cloud GCP LbsResponse Source #
`putObject b p body` uploads a bytestring body
into a GCS object (of full path p
) in bucket b
GCP Authentication scopes
scopesDefault :: [Text] Source #
OAuth2 scopes for the various Google Cloud Platform services.
Please refer to
https://developers.google.com/identity/protocols/googlescopes
for the full list
Running Cloud programs
liftCloudIO :: HasCredentials c => IO a -> Cloud c a Source #
Lift an `IO a` action into the Cloud
monad, and catch synchronous exceptions, while rethrowing the asynchronous ones to IO
createHandle :: HasCredentials c => Credentials c -> Options c -> IO (Handle c) Source #
Create a Handle
with an empty token
Types
data GCPServiceAccount Source #
Credentials for Google Cloud Platform
GCPServiceAccount | |
|
The main type of the library. It can easily be re-used in libraries that interface with more than one cloud API provider because its type parameter c
lets us be declare distinct behaviours for each.
Monad (Cloud c) Source # | |
Functor (Cloud c) Source # | |
Applicative (Cloud c) Source # | |
HasCredentials c => Alternative (Cloud c) Source # | |
HasCredentials c => MonadIO (Cloud c) Source # | |
HasCredentials c => MonadRandom (Cloud c) Source # | the whole point of this parametrization is to have a distinct MonadHttp for each API provider/DSP instance HasCredentials c => MonadHttp (Boo c) where handleHttpException = throwM |
HasCredentials c => MonadThrow (Cloud c) Source # | |
HasCredentials c => MonadCatch (Cloud c) Source # | |
MonadHttp (Cloud GCP) # | We can provide a custom http exception handler rather than throwing exceptions with this instance |
HasCredentials c => MonadReader (Handle c) (Cloud c) Source # | |
Authentication
class HasCredentials c where Source #
tokenFetch :: Cloud c (Token c) Source #
Handle | |
|
HasCredentials c => MonadReader (Handle c) (Cloud c) Source # | |
Private key
parseRSAPrivateKey :: MonadThrow m => Text -> m PrivateKey Source #
Parse a chunk of text into an RSA private key. For Google Cloud Platform , this is the private key associated with the user's "service account" (for server-to-server API use)
https://console.cloud.google.com/apis/credentials
Note: do not supply the RSA header and footer or any newlines (they will be inserted by this function).
Exceptions
data KeyException Source #
Authentication key exceptions
Errors associated with JWT-encoded token request
data TokenExchangeException Source #
Token exchange exceptions
NotFound !String | Something went wrong with the request, token not found |
APICredentialsNotFound !String |
data CloudException Source #
Cloud API exception