gogol-0.4.0: Comprehensive Google Services SDK.

Copyright(c) 2015-2016 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay@gmail.com>
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.Google.Env

Description

Environment and Google specific configuration for the Network.Google monad.

Synopsis

Documentation

data Env (s :: [Symbol]) Source #

The environment containing the parameters required to make Google requests.

Constructors

Env 
Instances
HasEnv s (Env s) Source # 
Instance details

Defined in Network.Google.Env

MonadReader (Env s) (Google s) Source # 
Instance details

Defined in Network.Google

Methods

ask :: Google s (Env s) #

local :: (Env s -> Env s) -> Google s a -> Google s a #

reader :: (Env s -> a) -> Google s a #

class HasEnv s a | a -> s where Source #

Minimal complete definition

environment

Methods

environment :: Lens' a (Env s) Source #

envOverride :: Lens' a (Dual (Endo ServiceConfig)) Source #

The currently applied overrides to all Service configuration.

envLogger :: Lens' a Logger Source #

The function used to output log messages.

envManager :: Lens' a Manager Source #

The Manager used to create and manage open HTTP connections.

envStore :: Lens' a (Store s) Source #

The credential store used to sign requests for authentication with Google.

envScopes :: Lens' a (Proxy s) Source #

The authorised OAuth2 scopes.

See: allow, !, and the related scopes available for each service.

configure :: HasEnv s a => (ServiceConfig -> ServiceConfig) -> a -> a Source #

Provide a function which will be added to the stack of overrides, which are applied to all service configurations. This provides a way to configure any request that is sent using the modified Env.

See: override.

override :: HasEnv s a => ServiceConfig -> a -> a Source #

Override a specific ServiceConfig. All requests belonging to the supplied service will use this configuration instead of the default.

Typically you would override a modified version of the default ServiceConfig for the desired service:

override (gmailService & serviceHost .~ "localhost") env

Or when using Network.Google with Control.Monad.Reader or Control.Lens.Zoom and the ServiceConfig lenses:

local (override (computeService & serviceHost .~ "localhost")) $ do
   ...

See: configure.

timeout :: (MonadReader r m, HasEnv s r) => Seconds -> m a -> m a Source #

Scope an action such that any HTTP response will use this timeout value.

Default timeouts are chosen by considering:

  • This timeout, if set.
  • The related Service timeout for the sent request if set. (Default 70s)
  • The envManager timeout, if set.
  • The ClientRequest timeout. (Default 30s)

newEnv :: (MonadIO m, MonadCatch m, AllowScopes s) => m (Env s) Source #

Creates a new environment with a newly initialized Manager, without logging. and Credentials that are determined by calling getApplicationDefault. Use newEnvWith to supply custom credentials such as an OAuthClient and OAuthCode.

The Allowed OAuthScopes are used to authorize any service_account that is found with the appropriate scopes. See the top-level module of each individual gogol-* library for a list of available scopes, such as Network.Google.Compute.authComputeScope. Lenses from HasEnv can be used to further configure the resulting Env.

See: newEnvWith, getApplicationDefault.

newEnvWith :: (MonadIO m, MonadCatch m, AllowScopes s) => Credentials s -> Logger -> Manager -> m (Env s) Source #

Create a new environment.

See: newEnv.