-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Comprehensive Amazon Web Services SDK
--
-- This client library contains request and response logic to communicate
-- with Amazon Web Service compatible APIs using the types supplied by
-- the various amazonka-* service libraries. See the AWS
-- category on Hackage for supported services.
--
-- To get started, import the desired amazonka-* library (such
-- as Network.AWS.MachineLearning) and one of the following:
--
--
--
-- GHC 7.8.4 and higher is officially supported.
@package amazonka
@version 1.1.0
-- | Re-exports some of the underlying textual and byte serialisation
-- mechanisms for convenience.
--
-- Many of the AWS identifiers like S3's ObjectVersionId or
-- ETag, as well as any nullary sum types such as Region
-- have ToText and ToByteString instances, making it
-- convenient to use the type classes to convert a value to its textual
-- representation.
module Network.AWS.Data
class FromText a
parser :: FromText a => Parser a
fromText :: FromText a => Text -> Either String a
matchCI :: Text -> a -> Parser a
class ToText a
toText :: ToText a => a -> Text
class ToByteString a
toBS :: ToByteString a => a -> ByteString
class ToLog a
-- | Convert a value to a loggable builder.
build :: ToLog a => a -> Builder
-- | This module contains functions for presigning requests using
-- MonadIO and not one of the AWS specific transformers.
--
-- It is intended for use directly with Network.AWS.Auth when only
-- presigning and no other AWS actions are required.
module Network.AWS.Presign
-- | Presign an URL that is valid from the specified time until the number
-- of seconds expiry has elapsed.
--
-- See: presign, presignWith
presignURL :: (MonadIO m, AWSPresigner (Sg (Sv a)), AWSRequest a) => Auth -> Region -> UTCTime -> Seconds -> a -> m ByteString
-- | Presign an HTTP request that is valid from the specified time until
-- the number of seconds expiry has elapsed.
--
-- This requires the Service signer to be an instance of
-- AWSPresigner. Not all signing algorithms support this.
--
-- See: presignWith
presign :: (MonadIO m, AWSPresigner (Sg (Sv a)), AWSRequest a) => Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
-- | A variant of presign that allows specifying the Service
-- definition used to configure the request.
presignWith :: (MonadIO m, AWSPresigner (Sg s), AWSRequest a) => (Service (Sv a) -> Service s) -> Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
-- | This module contains functions for retrieving various EC2 metadata
-- from an instance's local metadata endpoint using MonadIO and
-- not one of the AWS specific transformers.
--
-- It is intended to be used when you need to make metadata calls prior
-- to initialisation of the Env.
module Network.AWS.EC2.Metadata
-- | Test whether the underlying host is running on EC2 by making an HTTP
-- request to http://instance-data/latest.
isEC2 :: MonadIO m => Manager -> m Bool
-- | Retrieve the specified Dynamic data.
--
-- Throws HttpException if HTTP communication fails.
dynamic :: (MonadIO m, MonadThrow m) => Manager -> Dynamic -> m ByteString
-- | Retrieve the specified Metadata.
--
-- Throws HttpException if HTTP communication fails.
metadata :: (MonadIO m, MonadThrow m) => Manager -> Metadata -> m ByteString
-- | Retrieve the user data. Returns Nothing if no user data is
-- assigned to the instance.
--
-- Throws HttpException if HTTP communication fails.
userdata :: (MonadIO m, MonadCatch m) => Manager -> m (Maybe ByteString)
data Dynamic
-- | Value showing whether the customer has enabled detailed one-minute
-- monitoring in CloudWatch.
--
-- Valid values: enabled | disabled.
FWS :: Dynamic
-- | JSON containing instance attributes, such as instance-id, private IP
-- address, etc.
Document :: Dynamic
-- | Used to verify the document's authenticity and content against the
-- signature.
PKCS7 :: Dynamic
Signature :: Dynamic
data Metadata
-- | The AMI ID used to launch the instance.
AMIId :: Metadata
-- | If you started more than one instance at the same time, this value
-- indicates the order in which the instance was launched. The value of
-- the first instance launched is 0.
AMILaunchIndex :: Metadata
-- | The path to the AMI's manifest file in Amazon S3. If you used an
-- Amazon EBS-backed AMI to launch the instance, the returned result is
-- unknown.
AMIManifestPath :: Metadata
-- | The AMI IDs of any instances that were rebundled to create this AMI.
-- This value will only exist if the AMI manifest file contained an
-- ancestor-amis key.
AncestorAMIIds :: Metadata
-- | See: Mapping
BlockDevice :: !Mapping -> Metadata
-- | The private hostname of the instance. In cases where multiple network
-- interfaces are present, this refers to the eth0 device (the device for
-- which the device number is 0).
Hostname :: Metadata
-- | See: Info
IAM :: !Info -> Metadata
-- | Notifies the instance that it should reboot in preparation for
-- bundling. Valid values: none | shutdown | bundle-pending.
InstanceAction :: Metadata
-- | The ID of this instance.
InstanceId :: Metadata
-- | The type of instance.
--
-- See: InstanceType
InstanceType :: Metadata
-- | The ID of the kernel launched with this instance, if applicable.
KernelId :: Metadata
-- | The private DNS hostname of the instance. In cases where multiple
-- network interfaces are present, this refers to the eth0 device (the
-- device for which the device number is 0).
LocalHostname :: Metadata
-- | The private IP address of the instance. In cases where multiple
-- network interfaces are present, this refers to the eth0 device (the
-- device for which the device number is 0).
LocalIPV4 :: Metadata
-- | The instance's media access control (MAC) address. In cases where
-- multiple network interfaces are present, this refers to the eth0
-- device (the device for which the device number is 0).
MAC :: Metadata
-- | See: Interface
Network :: !Text -> !Interface -> Metadata
-- | The Availability Zone in which the instance launched.
AvailabilityZone :: Metadata
-- | Product codes associated with the instance, if any.
ProductCodes :: Metadata
-- | The instance's public DNS. If the instance is in a VPC, this category
-- is only returned if the enableDnsHostnames attribute is set to true.
-- For more information, see Using DNS with Your VPC.
PublicHostname :: Metadata
-- | The public IP address. If an Elastic IP address is associated with the
-- instance, the value returned is the Elastic IP address.
PublicIPV4 :: Metadata
-- | Public key. Only available if supplied at instance launch time.
OpenSSHKey :: Metadata
-- | The ID of the RAM disk specified at launch time, if applicable.
RAMDiskId :: Metadata
-- | ID of the reservation.
ReservationId :: Metadata
-- | The names of the security groups applied to the instance.
SecurityGroups :: Metadata
data Mapping
-- | The virtual device that contains the root/boot file system.
AMI :: Mapping
-- | The virtual devices associated with Amazon EBS volumes, if present.
-- This value is only available in metadata if it is present at launch
-- time. The N indicates the index of the Amazon EBS volume (such as ebs1
-- or ebs2).
EBS :: !Int -> Mapping
-- | The virtual devices associated with ephemeral devices, if present. The
-- N indicates the index of the ephemeral volume.
Ephemeral :: !Int -> Mapping
-- | The virtual devices or partitions associated with the root devices, or
-- partitions on the virtual device, where the root (/ or C:) file system
-- is associated with the given instance.
Root :: Mapping
-- | The virtual devices associated with swap. Not always present.
Swap :: Mapping
data Info
-- | Returns information about the last time the instance profile was
-- updated, including the instance's LastUpdated date,
-- InstanceProfileArn, and InstanceProfileId.
Info' :: Info
-- | Where role-name is the name of the IAM role associated with the
-- instance. Returns the temporary security credentials.
--
-- See: Auth for JSON deserialisation.
SecurityCredentials :: (Maybe Text) -> Info
data Interface
-- | The device number associated with that interface. Each interface must
-- have a unique device number. The device number serves as a hint to
-- device naming in the instance; for example, device-number is 2 for the
-- eth2 device.
IDeviceNumber :: Interface
-- | The private IPv4 addresses that are associated with each public-ip
-- address and assigned to that interface.
IIPV4Associations :: !Text -> Interface
-- | The interface's local hostname.
ILocalHostname :: Interface
-- | The private IP addresses associated with the interface.
ILocalIPV4s :: Interface
-- | The instance's MAC address.
IMAC :: Interface
-- | The ID of the owner of the network interface. In multiple-interface
-- environments, an interface can be attached by a third party, such as
-- Elastic Load Balancing. Traffic on an interface is always billed to
-- the interface owner.
IOwnerId :: Interface
-- | The interface's public DNS. If the instance is in a VPC, this category
-- is only returned if the enableDnsHostnames attribute is set to true.
-- For more information, see Using DNS with Your VPC.
IPublicHostname :: Interface
-- | The Elastic IP addresses associated with the interface. There may be
-- multiple IP addresses on an instance.
IPublicIPV4s :: Interface
-- | Security groups to which the network interface belongs. Returned only
-- for instances launched into a VPC.
ISecurityGroups :: Interface
-- | IDs of the security groups to which the network interface belongs.
-- Returned only for instances launched into a VPC. For more information
-- on security groups in the EC2-VPC platform, see Security Groups for
-- Your VPC.
ISecurityGroupIds :: Interface
-- | The ID of the subnet in which the interface resides. Returned only for
-- instances launched into a VPC.
ISubnetId :: Interface
-- | The CIDR block of the subnet in which the interface resides. Returned
-- only for instances launched into a VPC.
ISubnetIPV4_CIDRBlock :: Interface
-- | The ID of the VPC in which the interface resides. Returned only for
-- instances launched into a VPC.
IVPCId :: Interface
-- | The CIDR block of the VPC in which the interface resides. Returned
-- only for instances launched into a VPC.
IVPCIPV4_CIDRBlock :: Interface
instance GHC.Show.Show Network.AWS.EC2.Metadata.Metadata
instance GHC.Classes.Ord Network.AWS.EC2.Metadata.Metadata
instance GHC.Classes.Eq Network.AWS.EC2.Metadata.Metadata
instance GHC.Show.Show Network.AWS.EC2.Metadata.Info
instance GHC.Classes.Ord Network.AWS.EC2.Metadata.Info
instance GHC.Classes.Eq Network.AWS.EC2.Metadata.Info
instance GHC.Show.Show Network.AWS.EC2.Metadata.Interface
instance GHC.Classes.Ord Network.AWS.EC2.Metadata.Interface
instance GHC.Classes.Eq Network.AWS.EC2.Metadata.Interface
instance GHC.Show.Show Network.AWS.EC2.Metadata.Mapping
instance GHC.Classes.Ord Network.AWS.EC2.Metadata.Mapping
instance GHC.Classes.Eq Network.AWS.EC2.Metadata.Mapping
instance GHC.Show.Show Network.AWS.EC2.Metadata.Dynamic
instance GHC.Classes.Ord Network.AWS.EC2.Metadata.Dynamic
instance GHC.Classes.Eq Network.AWS.EC2.Metadata.Dynamic
instance Network.AWS.Data.Text.ToText Network.AWS.EC2.Metadata.Dynamic
instance Network.AWS.Data.Text.ToText Network.AWS.EC2.Metadata.Metadata
instance Network.AWS.Data.Text.ToText Network.AWS.EC2.Metadata.Mapping
instance Network.AWS.Data.Text.ToText Network.AWS.EC2.Metadata.Interface
instance Network.AWS.Data.Text.ToText Network.AWS.EC2.Metadata.Info
-- | Explicitly specify your Amazon AWS security credentials, or retrieve
-- them from the underlying OS.
--
-- The format of environment variables and the credentials file follows
-- the official AWS SDK guidelines.
module Network.AWS.Auth
-- | Retrieve authentication information via the specified
-- Credentials mechanism.
--
-- Throws AuthError when environment variables or IAM profiles
-- cannot be read, and credentials files are invalid or cannot be found.
getAuth :: (Applicative m, MonadIO m, MonadCatch m) => Manager -> Credentials -> m Auth
-- | Determines how AuthN/AuthZ information is retrieved.
data Credentials
-- | Explicit access and secret keys. See fromKeys.
FromKeys :: AccessKey -> SecretKey -> Credentials
-- | Explicit access key, secret key and a session token. See
-- fromSession.
FromSession :: AccessKey -> SecretKey -> SessionToken -> Credentials
-- | Lookup specific environment variables for access key, secret key, and
-- an optional session token respectively.
FromEnv :: Text -> Text -> (Maybe Text) -> Credentials
-- | An IAM Profile name to lookup from the local EC2 instance-data. ^
-- Environment variables to lookup for the access key, secret key and
-- optional session token.
FromProfile :: Text -> Credentials
-- | A credentials profile name (the INI section) and the path to the AWS
-- credentials file.
FromFile :: Text -> FilePath -> Credentials
-- | Attempt to credentials discovery via the following steps:
--
--
-- - Read the envAccessKey and envSecretKey from the
-- environment if they are set.
-- - Read the credentials file if credFile exists.
-- - Retrieve the first available IAM profile if running on EC2.
--
--
-- An attempt is made to resolve http://instance-data rather than
-- directly retrieving http://169.254.169.254 for IAM profile
-- information. This assists in ensuring the DNS lookup terminates
-- promptly if not running on EC2.
Discover :: Credentials
-- | An authorisation environment containing AWS credentials, and
-- potentially a reference which can be refreshed out-of-band as
-- temporary credentials expire.
data Auth :: *
-- | Default access key environment variable.
envAccessKey :: Text
-- | Default secret key environment variable.
envSecretKey :: Text
-- | Default session token environment variable.
envSessionToken :: Text
-- | Credentials INI file access key variable.
credAccessKey :: Text
-- | Credentials INI file secret key variable.
credSecretKey :: Text
-- | Credentials INI file session token variable.
credSessionToken :: Text
-- | Credentials INI default profile section variable.
credProfile :: Text
-- | Default path for the credentials file. This looks in in the
-- HOME directory as determined by the directory library.
--
--
-- - UNIXOSX: @$HOME.aws/credentials@
-- - Windows: C:/Users//<user>.awscredentials
--
--
-- Note: This does not match the default AWS SDK location of
-- %USERPROFILE%.awscredentials on Windows. (Sorry.)
credFile :: (MonadCatch m, MonadIO m) => m FilePath
-- | Explicit access and secret keys.
fromKeys :: AccessKey -> SecretKey -> Auth
-- | A session containing the access key, secret key, and a session token.
fromSession :: AccessKey -> SecretKey -> SessionToken -> Auth
-- | Retrieve access key, secret key, and a session token from the default
-- environment variables.
--
-- Throws MissingEnvError if either of the default environment
-- variables cannot be read, but not if the session token is absent.
--
-- See: envAccessKey, envSecretKey,
-- envSessionToken
fromEnv :: (Applicative m, MonadIO m, MonadThrow m) => m Auth
-- | Retrieve access key, secret key and a session token from specific
-- environment variables.
--
-- Throws MissingEnvError if either of the specified key
-- environment variables cannot be read, but not if the session token is
-- absent.
fromEnvKeys :: (Applicative m, MonadIO m, MonadThrow m) => Text -> Text -> Maybe Text -> m Auth
-- | Loads the default credentials INI file using the default
-- profile name.
--
-- Throws MissingFileError if credFile is missing, or
-- InvalidFileError if an error occurs during parsing.
--
-- See: credProfile and credFile
fromFile :: (Applicative m, MonadIO m, MonadCatch m) => m Auth
-- | Retrieve the access, secret and session token from the specified
-- section (profile) in a valid INI credentials file.
--
-- Throws MissingFileError if the specified file is missing, or
-- InvalidFileError if an error occurs during parsing.
fromFilePath :: (Applicative m, MonadIO m, MonadCatch m) => Text -> FilePath -> m Auth
-- | Retrieve the default IAM Profile from the local EC2 instance-data.
--
-- The default IAM profile is determined by Amazon as the first profile
-- found in the response from:
-- http://169.254.169.254/latest/meta-data/iam/security-credentials/
--
-- Throws RetrievalError if the HTTP call fails, or
-- InvalidIAMError if the default IAM profile cannot be read.
fromProfile :: (MonadIO m, MonadCatch m) => Manager -> m Auth
-- | Lookup a specific IAM Profile by name from the local EC2
-- instance-data.
--
-- The resulting IONewRef wrapper + timer is designed so that multiple
-- concurrent accesses of AuthEnv from the AWS
-- environment are not required to calculate expiry and sequentially
-- queue to update it.
--
-- The forked timer ensures a singular owner and pre-emptive refresh of
-- the temporary session credentials.
--
-- A weak reference is used to ensure that the forked thread will
-- eventually terminate when Auth is no longer referenced.
--
-- Throws RetrievalError if the HTTP call fails, or
-- InvalidIAMError if the specified IAM profile cannot be read.
fromProfileName :: (MonadIO m, MonadCatch m) => Manager -> Text -> m Auth
-- | Access key credential.
newtype AccessKey :: *
AccessKey :: ByteString -> AccessKey
-- | Secret key credential.
newtype SecretKey :: *
SecretKey :: ByteString -> SecretKey
-- | A session token used by STS to temporarily authorise access to an AWS
-- resource.
newtype SessionToken :: *
SessionToken :: ByteString -> SessionToken
class AsAuthError a where _RetrievalError = _AuthError . _RetrievalError _MissingEnvError = _AuthError . _MissingEnvError _MissingFileError = _AuthError . _MissingFileError _InvalidFileError = _AuthError . _InvalidFileError _InvalidIAMError = _AuthError . _InvalidIAMError
-- | A general authentication error.
_AuthError :: AsAuthError a => Prism' a AuthError
-- | An error occured while communicating over HTTP with the local metadata
-- endpoint.
_RetrievalError :: AsAuthError a => Prism' a HttpException
-- | An error occured looking up a named environment variable.
_MissingEnvError :: AsAuthError a => Prism' a Text
-- | The specified credentials file could not be found.
_MissingFileError :: AsAuthError a => Prism' a FilePath
-- | An error occured parsing the credentials file.
_InvalidFileError :: AsAuthError a => Prism' a Text
-- | The specified IAM profile could not be found or deserialised.
_InvalidIAMError :: AsAuthError a => Prism' a Text
-- | An error thrown when attempting to read AuthN/AuthZ information.
data AuthError
RetrievalError :: HttpException -> AuthError
MissingEnvError :: Text -> AuthError
MissingFileError :: FilePath -> AuthError
InvalidFileError :: Text -> AuthError
InvalidIAMError :: Text -> AuthError
instance GHC.Show.Show Network.AWS.Auth.AuthError
instance GHC.Classes.Eq Network.AWS.Auth.Credentials
instance Network.AWS.Data.Log.ToLog Network.AWS.Auth.Credentials
instance GHC.Show.Show Network.AWS.Auth.Credentials
instance GHC.Exception.Exception Network.AWS.Auth.AuthError
instance Network.AWS.Data.Log.ToLog Network.AWS.Auth.AuthError
instance Network.AWS.Auth.AsAuthError GHC.Exception.SomeException
instance Network.AWS.Auth.AsAuthError Network.AWS.Auth.AuthError
-- | Environment and AWS specific configuration for the AWS and
-- AWST monads.
module Network.AWS.Env
-- | Creates a new environment with a new Manager without debug
-- logging and uses getAuth to expand/discover the supplied
-- Credentials. Lenses from HasEnv can be used to further
-- configure the resulting Env.
--
-- Throws AuthError when environment variables or IAM profiles
-- cannot be read.
--
-- See: newEnvWith.
newEnv :: (Applicative m, MonadIO m, MonadCatch m) => Region -> Credentials -> m Env
-- | See: newEnv
--
-- Throws AuthError when environment variables or IAM profiles
-- cannot be read.
newEnvWith :: (Applicative m, MonadIO m, MonadCatch m) => Region -> Credentials -> Maybe Bool -> Manager -> m Env
-- | The environment containing the parameters required to make AWS
-- requests.
data Env
Env :: !Region -> !Logger -> !(Int -> HttpException -> IO Bool) -> !(Maybe RetryPolicy) -> !(Maybe Seconds) -> !Manager -> !(IORef (Maybe Bool)) -> !Auth -> Env
[_envRegion] :: Env -> !Region
[_envLogger] :: Env -> !Logger
[_envRetryCheck] :: Env -> !(Int -> HttpException -> IO Bool)
[_envRetryPolicy] :: Env -> !(Maybe RetryPolicy)
[_envTimeout] :: Env -> !(Maybe Seconds)
[_envManager] :: Env -> !Manager
[_envEC2] :: Env -> !(IORef (Maybe Bool))
[_envAuth] :: Env -> !Auth
class HasEnv a where envRegion = environment . lens _envRegion (\ s a -> s {_envRegion = a}) envLogger = environment . lens _envLogger (\ s a -> s {_envLogger = a}) envRetryCheck = environment . lens _envRetryCheck (\ s a -> s {_envRetryCheck = a}) envRetryPolicy = environment . lens _envRetryPolicy (\ s a -> s {_envRetryPolicy = a}) envTimeout = environment . lens _envTimeout (\ s a -> s {_envTimeout = a}) envManager = environment . lens _envManager (\ s a -> s {_envManager = a}) envAuth = environment . lens _envAuth (\ s a -> s {_envAuth = a}) envEC2 = environment . to _envEC2
environment :: HasEnv a => Lens' a Env
-- | The current region.
envRegion :: HasEnv a => Lens' a Region
-- | The function used to output log messages.
envLogger :: HasEnv a => Lens' a Logger
-- | The function used to determine if an HttpException should be
-- retried.
envRetryCheck :: HasEnv a => Lens' a (Int -> HttpException -> IO Bool)
-- | The RetryPolicy used to determine backoff/on and retry
-- delay/growth.
envRetryPolicy :: HasEnv a => Lens' a (Maybe RetryPolicy)
-- | A HTTP response timeout override to apply. This defaults to
-- Nothing, and the timeout selection is outlined below.
--
-- Timeouts are chosen by considering:
--
--
envTimeout :: HasEnv a => Lens' a (Maybe Seconds)
-- | The Manager used to create and manage open HTTP connections.
envManager :: HasEnv a => Lens' a Manager
-- | The credentials used to sign requests for authentication with AWS.
envAuth :: HasEnv a => Lens' a Auth
-- | A memoised predicate for whether the underlying host is an EC2
-- instance.
envEC2 :: HasEnv a => Getter a (IORef (Maybe Bool))
-- | Scope an action within the specific Region.
within :: (MonadReader r m, HasEnv r) => Region -> m a -> m a
-- | Scope an action such that any retry logic for the Service is
-- ignored and any requests will at most be sent once.
once :: (MonadReader r m, HasEnv r) => m a -> m a
-- | Scope an action such that any HTTP response will use this timeout
-- value.
timeout :: (MonadReader r m, HasEnv r) => Seconds -> m a -> m a
instance Network.AWS.Env.HasEnv Network.AWS.Env.Env
instance Network.AWS.Data.Log.ToLog Network.AWS.Env.Env
-- | The AWST transformer provides the environment required to
-- perform AWS operations. The transformer is intended to be used
-- directly or embedded as a layer within a transformer stack.
--
-- Network.AWS contains an IO specialised version of
-- AWST with a typeclass to assist in automatically lifting
-- operations.
module Control.Monad.Trans.AWS
-- | The AWST transformer.
data AWST m a
-- | Run an AWST action with the specified HasEnv
-- environment.
runAWST :: HasEnv r => r -> AWST m a -> m a
-- | An alias for the constraints required to send requests, which
-- AWST implicitly fulfils.
type AWSConstraint r m = (MonadCatch m, MonadResource m, MonadReader r m, HasEnv r)
-- | Creates a new environment with a new Manager without debug
-- logging and uses getAuth to expand/discover the supplied
-- Credentials. Lenses from HasEnv can be used to further
-- configure the resulting Env.
--
-- Throws AuthError when environment variables or IAM profiles
-- cannot be read.
--
-- See: newEnvWith.
newEnv :: (Applicative m, MonadIO m, MonadCatch m) => Region -> Credentials -> m Env
-- | The environment containing the parameters required to make AWS
-- requests.
data Env
class HasEnv a where envRegion = environment . lens _envRegion (\ s a -> s {_envRegion = a}) envLogger = environment . lens _envLogger (\ s a -> s {_envLogger = a}) envRetryCheck = environment . lens _envRetryCheck (\ s a -> s {_envRetryCheck = a}) envRetryPolicy = environment . lens _envRetryPolicy (\ s a -> s {_envRetryPolicy = a}) envTimeout = environment . lens _envTimeout (\ s a -> s {_envTimeout = a}) envManager = environment . lens _envManager (\ s a -> s {_envManager = a}) envAuth = environment . lens _envAuth (\ s a -> s {_envAuth = a}) envEC2 = environment . to _envEC2
environment :: HasEnv a => Lens' a Env
-- | The current region.
envRegion :: HasEnv a => Lens' a Region
-- | The function used to output log messages.
envLogger :: HasEnv a => Lens' a Logger
-- | The function used to determine if an HttpException should be
-- retried.
envRetryCheck :: HasEnv a => Lens' a (Int -> HttpException -> IO Bool)
-- | The RetryPolicy used to determine backoff/on and retry
-- delay/growth.
envRetryPolicy :: HasEnv a => Lens' a (Maybe RetryPolicy)
-- | A HTTP response timeout override to apply. This defaults to
-- Nothing, and the timeout selection is outlined below.
--
-- Timeouts are chosen by considering:
--
--
envTimeout :: HasEnv a => Lens' a (Maybe Seconds)
-- | The Manager used to create and manage open HTTP connections.
envManager :: HasEnv a => Lens' a Manager
-- | The credentials used to sign requests for authentication with AWS.
envAuth :: HasEnv a => Lens' a Auth
-- | A memoised predicate for whether the underlying host is an EC2
-- instance.
envEC2 :: HasEnv a => Getter a (IORef (Maybe Bool))
-- | Determines how AuthN/AuthZ information is retrieved.
data Credentials
-- | Explicit access and secret keys. See fromKeys.
FromKeys :: AccessKey -> SecretKey -> Credentials
-- | Explicit access key, secret key and a session token. See
-- fromSession.
FromSession :: AccessKey -> SecretKey -> SessionToken -> Credentials
-- | Lookup specific environment variables for access key, secret key, and
-- an optional session token respectively.
FromEnv :: Text -> Text -> (Maybe Text) -> Credentials
-- | An IAM Profile name to lookup from the local EC2 instance-data. ^
-- Environment variables to lookup for the access key, secret key and
-- optional session token.
FromProfile :: Text -> Credentials
-- | A credentials profile name (the INI section) and the path to the AWS
-- credentials file.
FromFile :: Text -> FilePath -> Credentials
-- | Attempt to credentials discovery via the following steps:
--
--
-- - Read the envAccessKey and envSecretKey from the
-- environment if they are set.
-- - Read the credentials file if credFile exists.
-- - Retrieve the first available IAM profile if running on EC2.
--
--
-- An attempt is made to resolve http://instance-data rather than
-- directly retrieving http://169.254.169.254 for IAM profile
-- information. This assists in ensuring the DNS lookup terminates
-- promptly if not running on EC2.
Discover :: Credentials
-- | The sum of available AWS regions.
data Region :: *
-- | Europe / eu-west-1
Ireland :: Region
-- | Europe / eu-central-1
Frankfurt :: Region
-- | Asia Pacific / ap-northeast-1
Tokyo :: Region
-- | Asia Pacific / ap-southeast-1
Singapore :: Region
-- | Asia Pacific / ap-southeast-2
Sydney :: Region
-- | China / cn-north-1
Beijing :: Region
-- | US / us-east-1
NorthVirginia :: Region
-- | US / us-west-1
NorthCalifornia :: Region
-- | US / us-west-2
Oregon :: Region
-- | AWS GovCloud / us-gov-west-1
GovCloud :: Region
-- | AWS GovCloud (FIPS 140-2) S3 Only / fips-us-gov-west-1
GovCloudFIPS :: Region
-- | South America / sa-east-1
SaoPaulo :: Region
-- | Send a request, returning the associated response if successful.
--
-- Throws Error.
--
-- See: sendWith
send :: (AWSConstraint r m, AWSRequest a) => a -> m (Rs a)
-- | Repeatedly send a request, automatically setting markers and
-- paginating over multiple responses while available.
--
-- Throws Error.
--
-- See: paginateWith
paginate :: (AWSConstraint r m, AWSPager a) => a -> Source m (Rs a)
-- | Poll the API with the supplied request until a specific Wait
-- condition is fulfilled.
--
-- Throws Error.
--
-- See: awaitWith
await :: (AWSConstraint r m, AWSRequest a) => Wait a -> a -> m ()
-- | Scope an action within the specific Region.
within :: (MonadReader r m, HasEnv r) => Region -> m a -> m a
-- | Scope an action such that any retry logic for the Service is
-- ignored and any requests will at most be sent once.
once :: (MonadReader r m, HasEnv r) => m a -> m a
-- | Scope an action such that any HTTP response will use this timeout
-- value.
timeout :: (MonadReader r m, HasEnv r) => Seconds -> m a -> m a
-- | A variant of send that allows modifying the default
-- Service definition used to configure the request.
--
-- Throws Error.
sendWith :: (AWSConstraint r m, AWSSigner (Sg s), AWSRequest a) => (Service (Sv a) -> Service s) -> a -> m (Rs a)
-- | A variant of paginate that allows modifying the default
-- Service definition used to configure the request.
--
-- Throws Error.
paginateWith :: (AWSConstraint r m, AWSSigner (Sg s), AWSPager a) => (Service (Sv a) -> Service s) -> a -> Source m (Rs a)
-- | A variant of await that allows modifying the default
-- Service definition used to configure the request.
--
-- Throws Error.
awaitWith :: (AWSConstraint r m, AWSSigner (Sg s), AWSRequest a) => (Service (Sv a) -> Service s) -> Wait a -> a -> m ()
-- | A variant of presign that allows specifying the Service
-- definition used to configure the request.
presignWith :: (MonadIO m, MonadReader r m, HasEnv r, AWSPresigner (Sg s), AWSRequest a) => (Service (Sv a) -> Service s) -> UTCTime -> Seconds -> a -> m ClientRequest
-- | Anything that can be safely converted to a RqBody.
class ToBody a
-- | Convert a value to a request body.
toBody :: ToBody a => a -> RqBody
-- | Construct a RqBody from a source, manually specifying the
-- SHA256 hash and file size.
sourceBody :: Digest SHA256 -> Int64 -> Source (ResourceT IO) ByteString -> RqBody
-- | Construct a RqBody from a Handle, manually specifying
-- the SHA256 hash and file size.
sourceHandle :: Digest SHA256 -> Int64 -> Handle -> RqBody
-- | Construct a RqBody from a FilePath, manually specifying
-- the SHA256 hash and file size.
sourceFile :: Digest SHA256 -> Int64 -> FilePath -> RqBody
-- | Construct a RqBody from a FilePath, calculating the
-- SHA256 hash and file size.
--
-- Note: While this function will perform in constant space, it
-- will enumerate the entirety of the file contents _twice_. Firstly to
-- calculate the SHA256 and lastly to stream the contents to the socket
-- during sending.
sourceFileIO :: MonadIO m => FilePath -> m RqBody
-- | Connect a Sink to a reponse body.
sinkBody :: MonadResource m => RsBody -> Sink ByteString m a -> m a
-- | Convenience function for obtaining the size of a file.
getFileSize :: MonadIO m => FilePath -> m Int64
sinkMD5 :: Monad m => Consumer ByteString m (Digest MD5)
sinkSHA256 :: Monad m => Consumer ByteString m (Digest SHA256)
-- | Presign an URL that is valid from the specified time until the number
-- of seconds expiry has elapsed.
--
-- See: presign, presignWith
presignURL :: (MonadIO m, MonadReader r m, HasEnv r, AWSPresigner (Sg (Sv a)), AWSRequest a) => UTCTime -> Seconds -> a -> m ByteString
-- | Presign an HTTP request that is valid from the specified time until
-- the number of seconds expiry has elapsed.
--
-- See: presignWith
presign :: (MonadIO m, MonadReader r m, HasEnv r, AWSPresigner (Sg (Sv a)), AWSRequest a) => UTCTime -> Seconds -> a -> m ClientRequest
-- | Test whether the underlying host is running on EC2. This is memoised
-- and any external check occurs for the first invocation only.
isEC2 :: (MonadIO m, MonadReader r m, HasEnv r) => m Bool
-- | Retrieve the specified Dynamic data.
--
-- Throws HttpException.
dynamic :: (MonadIO m, MonadThrow m, MonadReader r m, HasEnv r) => Dynamic -> m ByteString
-- | Retrieve the specified Metadata.
--
-- Throws HttpException.
metadata :: (MonadIO m, MonadThrow m, MonadReader r m, HasEnv r) => Metadata -> m ByteString
-- | Retrieve the user data. Returns Nothing if no user data is
-- assigned to the instance.
--
-- Throws HttpException.
userdata :: (MonadIO m, MonadCatch m, MonadReader r m, HasEnv r) => m (Maybe ByteString)
data Dynamic
-- | Value showing whether the customer has enabled detailed one-minute
-- monitoring in CloudWatch.
--
-- Valid values: enabled | disabled.
FWS :: Dynamic
-- | JSON containing instance attributes, such as instance-id, private IP
-- address, etc.
Document :: Dynamic
-- | Used to verify the document's authenticity and content against the
-- signature.
PKCS7 :: Dynamic
Signature :: Dynamic
data Metadata
-- | The AMI ID used to launch the instance.
AMIId :: Metadata
-- | If you started more than one instance at the same time, this value
-- indicates the order in which the instance was launched. The value of
-- the first instance launched is 0.
AMILaunchIndex :: Metadata
-- | The path to the AMI's manifest file in Amazon S3. If you used an
-- Amazon EBS-backed AMI to launch the instance, the returned result is
-- unknown.
AMIManifestPath :: Metadata
-- | The AMI IDs of any instances that were rebundled to create this AMI.
-- This value will only exist if the AMI manifest file contained an
-- ancestor-amis key.
AncestorAMIIds :: Metadata
-- | See: Mapping
BlockDevice :: !Mapping -> Metadata
-- | The private hostname of the instance. In cases where multiple network
-- interfaces are present, this refers to the eth0 device (the device for
-- which the device number is 0).
Hostname :: Metadata
-- | See: Info
IAM :: !Info -> Metadata
-- | Notifies the instance that it should reboot in preparation for
-- bundling. Valid values: none | shutdown | bundle-pending.
InstanceAction :: Metadata
-- | The ID of this instance.
InstanceId :: Metadata
-- | The type of instance.
--
-- See: InstanceType
InstanceType :: Metadata
-- | The ID of the kernel launched with this instance, if applicable.
KernelId :: Metadata
-- | The private DNS hostname of the instance. In cases where multiple
-- network interfaces are present, this refers to the eth0 device (the
-- device for which the device number is 0).
LocalHostname :: Metadata
-- | The private IP address of the instance. In cases where multiple
-- network interfaces are present, this refers to the eth0 device (the
-- device for which the device number is 0).
LocalIPV4 :: Metadata
-- | The instance's media access control (MAC) address. In cases where
-- multiple network interfaces are present, this refers to the eth0
-- device (the device for which the device number is 0).
MAC :: Metadata
-- | See: Interface
Network :: !Text -> !Interface -> Metadata
-- | The Availability Zone in which the instance launched.
AvailabilityZone :: Metadata
-- | Product codes associated with the instance, if any.
ProductCodes :: Metadata
-- | The instance's public DNS. If the instance is in a VPC, this category
-- is only returned if the enableDnsHostnames attribute is set to true.
-- For more information, see Using DNS with Your VPC.
PublicHostname :: Metadata
-- | The public IP address. If an Elastic IP address is associated with the
-- instance, the value returned is the Elastic IP address.
PublicIPV4 :: Metadata
-- | Public key. Only available if supplied at instance launch time.
OpenSSHKey :: Metadata
-- | The ID of the RAM disk specified at launch time, if applicable.
RAMDiskId :: Metadata
-- | ID of the reservation.
ReservationId :: Metadata
-- | The names of the security groups applied to the instance.
SecurityGroups :: Metadata
class AsError a
-- | A general Amazonka error.
_Error :: AsError a => Prism' a Error
-- | An error occured while communicating over HTTP with a remote service.
_TransportError :: AsError a => Prism' a HttpException
-- | A serialisation error occured when attempting to deserialise a
-- response.
_SerializeError :: AsError a => Prism' a SerializeError
-- | A service specific error returned by the remote service.
_ServiceError :: AsError a => Prism' a ServiceError
class AsAuthError a where _RetrievalError = _AuthError . _RetrievalError _MissingEnvError = _AuthError . _MissingEnvError _MissingFileError = _AuthError . _MissingFileError _InvalidFileError = _AuthError . _InvalidFileError _InvalidIAMError = _AuthError . _InvalidIAMError
-- | A general authentication error.
_AuthError :: AsAuthError a => Prism' a AuthError
-- | An error occured while communicating over HTTP with the local metadata
-- endpoint.
_RetrievalError :: AsAuthError a => Prism' a HttpException
-- | An error occured looking up a named environment variable.
_MissingEnvError :: AsAuthError a => Prism' a Text
-- | The specified credentials file could not be found.
_MissingFileError :: AsAuthError a => Prism' a FilePath
-- | An error occured parsing the credentials file.
_InvalidFileError :: AsAuthError a => Prism' a Text
-- | The specified IAM profile could not be found or deserialised.
_InvalidIAMError :: AsAuthError a => Prism' a Text
-- | A variant of try that takes a Prism (or any Fold)
-- to select which exceptions are caught (c.f. tryJust,
-- catchJust). If the Exception does not match the
-- predicate, it is re-thrown.
--
--
-- trying :: MonadCatch m => Prism' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Lens' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Traversal' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Iso' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Getter SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Fold SomeException a -> m r -> m (Either a r)
--
trying :: MonadCatch m => Getting (First a) SomeException a -> m r -> m (Either a r)
-- | Catch exceptions that match a given Prism (or any Fold,
-- really).
--
--
-- >>> catching _AssertionFailed (assert False (return "uncaught")) $ \ _ -> return "caught"
-- "caught"
--
--
--
-- catching :: MonadCatch m => Prism' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Lens' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Traversal' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Iso' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Getter SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Fold SomeException a -> m r -> (a -> m r) -> m r
--
catching :: MonadCatch m => Getting (First a) SomeException a -> m r -> (a -> m r) -> m r
-- | A function threaded through various request and serialisation routines
-- to log informational and debug messages.
type Logger = LogLevel -> Builder -> IO ()
data LogLevel :: *
-- | Error messages only.
Error :: LogLevel
-- | Info messages supplied by the user - this level is not emitted by the
-- library.
Info :: LogLevel
-- | Useful debug information + info + error levels.
Debug :: LogLevel
-- | Includes potentially sensitive signing metadata, and non-streaming
-- response bodies.
Trace :: LogLevel
-- | This is a primitive logger which can be used to log builds to a
-- Handle.
--
-- Note: A more sophisticated logging library such as
-- tinylog or fast-logger should be used in production
-- code.
newLogger :: MonadIO m => LogLevel -> Handle -> m Logger
-- | An opaque request body containing a SHA256 hash.
data RqBody :: *
-- | A streaming, exception safe response body.
data RsBody :: *
-- | Unwrap a ResourceT transformer, and call all registered release
-- actions.
--
-- Note that there is some reference counting involved due to
-- resourceForkIO. If multiple threads are sharing the same
-- collection of resources, only the last call to runResourceT
-- will deallocate the resources.
--
-- Since 0.3.0
runResourceT :: MonadBaseControl IO m => ResourceT m a -> m a
instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader Network.AWS.Env.Env (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.AWS.AWST m)
instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Trans.AWS.AWST m)
instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.AWS.AWST m)
instance GHC.Base.Alternative m => GHC.Base.Alternative (Control.Monad.Trans.AWS.AWST m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (Control.Monad.Trans.AWS.AWST m)
instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Trans.Control.MonadTransControl Control.Monad.Trans.AWS.AWST
instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Trans.Class.MonadTrans Control.Monad.Trans.AWS.AWST
instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Trans.AWS.AWST m)
instance Control.Monad.Morph.MFunctor Control.Monad.Trans.AWS.AWST
-- | This module provides a simple AWS monad and a set of operations
-- which can be performed against remote Amazon Web Services APIs, for
-- use with the types supplied by the various amazonka-*
-- libraries.
--
-- A MonadAWS typeclass is used as a function constraint to
-- provide automatic lifting of functions when embedding AWS as a
-- layer inside your own application stack.
--
-- Control.Monad.Trans.AWS contains the underlying AWST
-- transformer.
module Network.AWS
-- | A specialisation of the AWST transformer.
type AWS = AWST (ResourceT IO)
-- | Monads in which AWS actions may be embedded.
class (Functor m, Applicative m, Monad m) => MonadAWS m
-- | Lift a computation to the AWS monad.
liftAWS :: MonadAWS m => AWS a -> m a
-- | Run the AWS monad. Any outstanding HTTP responses'
-- ResumableSource will be closed when the ResourceT
-- computation is unwrapped with runResourceT.
--
-- Throws Error, which will include HTTPExceptions,
-- serialisation errors, or any particular errors returned by the
-- respective AWS service.
--
-- See: runAWST, runResourceT.
runAWS :: (MonadResource m, HasEnv r) => r -> AWS a -> m a
-- | Creates a new environment with a new Manager without debug
-- logging and uses getAuth to expand/discover the supplied
-- Credentials. Lenses from HasEnv can be used to further
-- configure the resulting Env.
--
-- Throws AuthError when environment variables or IAM profiles
-- cannot be read.
--
-- See: newEnvWith.
newEnv :: (Applicative m, MonadIO m, MonadCatch m) => Region -> Credentials -> m Env
-- | The environment containing the parameters required to make AWS
-- requests.
data Env
class HasEnv a where envRegion = environment . lens _envRegion (\ s a -> s {_envRegion = a}) envLogger = environment . lens _envLogger (\ s a -> s {_envLogger = a}) envRetryCheck = environment . lens _envRetryCheck (\ s a -> s {_envRetryCheck = a}) envRetryPolicy = environment . lens _envRetryPolicy (\ s a -> s {_envRetryPolicy = a}) envTimeout = environment . lens _envTimeout (\ s a -> s {_envTimeout = a}) envManager = environment . lens _envManager (\ s a -> s {_envManager = a}) envAuth = environment . lens _envAuth (\ s a -> s {_envAuth = a}) envEC2 = environment . to _envEC2
environment :: HasEnv a => Lens' a Env
-- | The current region.
envRegion :: HasEnv a => Lens' a Region
-- | The function used to output log messages.
envLogger :: HasEnv a => Lens' a Logger
-- | The function used to determine if an HttpException should be
-- retried.
envRetryCheck :: HasEnv a => Lens' a (Int -> HttpException -> IO Bool)
-- | The RetryPolicy used to determine backoff/on and retry
-- delay/growth.
envRetryPolicy :: HasEnv a => Lens' a (Maybe RetryPolicy)
-- | A HTTP response timeout override to apply. This defaults to
-- Nothing, and the timeout selection is outlined below.
--
-- Timeouts are chosen by considering:
--
--
envTimeout :: HasEnv a => Lens' a (Maybe Seconds)
-- | The Manager used to create and manage open HTTP connections.
envManager :: HasEnv a => Lens' a Manager
-- | The credentials used to sign requests for authentication with AWS.
envAuth :: HasEnv a => Lens' a Auth
-- | A memoised predicate for whether the underlying host is an EC2
-- instance.
envEC2 :: HasEnv a => Getter a (IORef (Maybe Bool))
-- | Determines how AuthN/AuthZ information is retrieved.
data Credentials
-- | Explicit access and secret keys. See fromKeys.
FromKeys :: AccessKey -> SecretKey -> Credentials
-- | Explicit access key, secret key and a session token. See
-- fromSession.
FromSession :: AccessKey -> SecretKey -> SessionToken -> Credentials
-- | Lookup specific environment variables for access key, secret key, and
-- an optional session token respectively.
FromEnv :: Text -> Text -> (Maybe Text) -> Credentials
-- | An IAM Profile name to lookup from the local EC2 instance-data. ^
-- Environment variables to lookup for the access key, secret key and
-- optional session token.
FromProfile :: Text -> Credentials
-- | A credentials profile name (the INI section) and the path to the AWS
-- credentials file.
FromFile :: Text -> FilePath -> Credentials
-- | Attempt to credentials discovery via the following steps:
--
--
-- - Read the envAccessKey and envSecretKey from the
-- environment if they are set.
-- - Read the credentials file if credFile exists.
-- - Retrieve the first available IAM profile if running on EC2.
--
--
-- An attempt is made to resolve http://instance-data rather than
-- directly retrieving http://169.254.169.254 for IAM profile
-- information. This assists in ensuring the DNS lookup terminates
-- promptly if not running on EC2.
Discover :: Credentials
-- | The sum of available AWS regions.
data Region :: *
-- | Europe / eu-west-1
Ireland :: Region
-- | Europe / eu-central-1
Frankfurt :: Region
-- | Asia Pacific / ap-northeast-1
Tokyo :: Region
-- | Asia Pacific / ap-southeast-1
Singapore :: Region
-- | Asia Pacific / ap-southeast-2
Sydney :: Region
-- | China / cn-north-1
Beijing :: Region
-- | US / us-east-1
NorthVirginia :: Region
-- | US / us-west-1
NorthCalifornia :: Region
-- | US / us-west-2
Oregon :: Region
-- | AWS GovCloud / us-gov-west-1
GovCloud :: Region
-- | AWS GovCloud (FIPS 140-2) S3 Only / fips-us-gov-west-1
GovCloudFIPS :: Region
-- | South America / sa-east-1
SaoPaulo :: Region
-- | Send a request, returning the associated response if successful.
--
-- See: sendWith
send :: (MonadAWS m, AWSRequest a) => a -> m (Rs a)
-- | Repeatedly send a request, automatically setting markers and
-- paginating over multiple responses while available.
--
-- See: paginateWith
paginate :: (MonadAWS m, AWSPager a) => a -> Source m (Rs a)
-- | Poll the API with the supplied request until a specific Wait
-- condition is fulfilled.
--
-- See: awaitWith
await :: (MonadAWS m, AWSRequest a) => Wait a -> a -> m ()
-- | Scope an action within the specific Region.
within :: MonadAWS m => Region -> AWS a -> m a
-- | Scope an action such that any retry logic for the Service is
-- ignored and any requests will at most be sent once.
once :: MonadAWS m => AWS a -> m a
-- | Scope an action such that any HTTP response will use this timeout
-- value.
timeout :: MonadAWS m => Seconds -> AWS a -> m a
-- | Anything that can be safely converted to a RqBody.
class ToBody a
-- | Convert a value to a request body.
toBody :: ToBody a => a -> RqBody
-- | Construct a RqBody from a source, manually specifying the
-- SHA256 hash and file size.
sourceBody :: Digest SHA256 -> Int64 -> Source (ResourceT IO) ByteString -> RqBody
-- | Construct a RqBody from a Handle, manually specifying
-- the SHA256 hash and file size.
sourceHandle :: Digest SHA256 -> Int64 -> Handle -> RqBody
-- | Construct a RqBody from a FilePath, manually specifying
-- the SHA256 hash and file size.
sourceFile :: Digest SHA256 -> Int64 -> FilePath -> RqBody
-- | Construct a RqBody from a FilePath, calculating the
-- SHA256 hash and file size.
--
-- Note: While this function will perform in constant space, it
-- will enumerate the entirety of the file contents _twice_. Firstly to
-- calculate the SHA256 and lastly to stream the contents to the socket
-- during sending.
sourceFileIO :: MonadIO m => FilePath -> m RqBody
-- | Connect a Sink to a reponse body.
sinkBody :: MonadResource m => RsBody -> Sink ByteString m a -> m a
-- | Convenience function for obtaining the size of a file.
getFileSize :: MonadIO m => FilePath -> m Int64
sinkMD5 :: Monad m => Consumer ByteString m (Digest MD5)
sinkSHA256 :: Monad m => Consumer ByteString m (Digest SHA256)
-- | Presign an URL that is valid from the specified time until the number
-- of seconds expiry has elapsed.
--
-- See: presign, presignWith
presignURL :: (MonadAWS m, AWSPresigner (Sg (Sv a)), AWSRequest a) => UTCTime -> Seconds -> a -> m ByteString
-- | Test whether the underlying host is running on EC2. This is memoised
-- and an HTTP request is made to the host's metadata endpoint for the
-- first call only.
isEC2 :: MonadAWS m => m Bool
-- | Retrieve the specified Dynamic data.
dynamic :: MonadAWS m => Dynamic -> m ByteString
-- | Retrieve the specified Metadata.
metadata :: MonadAWS m => Metadata -> m ByteString
-- | Retrieve the user data. Returns Nothing if no user data is
-- assigned to the instance.
userdata :: MonadAWS m => m (Maybe ByteString)
data Dynamic
-- | Value showing whether the customer has enabled detailed one-minute
-- monitoring in CloudWatch.
--
-- Valid values: enabled | disabled.
FWS :: Dynamic
-- | JSON containing instance attributes, such as instance-id, private IP
-- address, etc.
Document :: Dynamic
-- | Used to verify the document's authenticity and content against the
-- signature.
PKCS7 :: Dynamic
Signature :: Dynamic
data Metadata
-- | The AMI ID used to launch the instance.
AMIId :: Metadata
-- | If you started more than one instance at the same time, this value
-- indicates the order in which the instance was launched. The value of
-- the first instance launched is 0.
AMILaunchIndex :: Metadata
-- | The path to the AMI's manifest file in Amazon S3. If you used an
-- Amazon EBS-backed AMI to launch the instance, the returned result is
-- unknown.
AMIManifestPath :: Metadata
-- | The AMI IDs of any instances that were rebundled to create this AMI.
-- This value will only exist if the AMI manifest file contained an
-- ancestor-amis key.
AncestorAMIIds :: Metadata
-- | See: Mapping
BlockDevice :: !Mapping -> Metadata
-- | The private hostname of the instance. In cases where multiple network
-- interfaces are present, this refers to the eth0 device (the device for
-- which the device number is 0).
Hostname :: Metadata
-- | See: Info
IAM :: !Info -> Metadata
-- | Notifies the instance that it should reboot in preparation for
-- bundling. Valid values: none | shutdown | bundle-pending.
InstanceAction :: Metadata
-- | The ID of this instance.
InstanceId :: Metadata
-- | The type of instance.
--
-- See: InstanceType
InstanceType :: Metadata
-- | The ID of the kernel launched with this instance, if applicable.
KernelId :: Metadata
-- | The private DNS hostname of the instance. In cases where multiple
-- network interfaces are present, this refers to the eth0 device (the
-- device for which the device number is 0).
LocalHostname :: Metadata
-- | The private IP address of the instance. In cases where multiple
-- network interfaces are present, this refers to the eth0 device (the
-- device for which the device number is 0).
LocalIPV4 :: Metadata
-- | The instance's media access control (MAC) address. In cases where
-- multiple network interfaces are present, this refers to the eth0
-- device (the device for which the device number is 0).
MAC :: Metadata
-- | See: Interface
Network :: !Text -> !Interface -> Metadata
-- | The Availability Zone in which the instance launched.
AvailabilityZone :: Metadata
-- | Product codes associated with the instance, if any.
ProductCodes :: Metadata
-- | The instance's public DNS. If the instance is in a VPC, this category
-- is only returned if the enableDnsHostnames attribute is set to true.
-- For more information, see Using DNS with Your VPC.
PublicHostname :: Metadata
-- | The public IP address. If an Elastic IP address is associated with the
-- instance, the value returned is the Elastic IP address.
PublicIPV4 :: Metadata
-- | Public key. Only available if supplied at instance launch time.
OpenSSHKey :: Metadata
-- | The ID of the RAM disk specified at launch time, if applicable.
RAMDiskId :: Metadata
-- | ID of the reservation.
ReservationId :: Metadata
-- | The names of the security groups applied to the instance.
SecurityGroups :: Metadata
class AsError a
-- | A general Amazonka error.
_Error :: AsError a => Prism' a Error
-- | An error occured while communicating over HTTP with a remote service.
_TransportError :: AsError a => Prism' a HttpException
-- | A serialisation error occured when attempting to deserialise a
-- response.
_SerializeError :: AsError a => Prism' a SerializeError
-- | A service specific error returned by the remote service.
_ServiceError :: AsError a => Prism' a ServiceError
class AsAuthError a where _RetrievalError = _AuthError . _RetrievalError _MissingEnvError = _AuthError . _MissingEnvError _MissingFileError = _AuthError . _MissingFileError _InvalidFileError = _AuthError . _InvalidFileError _InvalidIAMError = _AuthError . _InvalidIAMError
-- | A general authentication error.
_AuthError :: AsAuthError a => Prism' a AuthError
-- | An error occured while communicating over HTTP with the local metadata
-- endpoint.
_RetrievalError :: AsAuthError a => Prism' a HttpException
-- | An error occured looking up a named environment variable.
_MissingEnvError :: AsAuthError a => Prism' a Text
-- | The specified credentials file could not be found.
_MissingFileError :: AsAuthError a => Prism' a FilePath
-- | An error occured parsing the credentials file.
_InvalidFileError :: AsAuthError a => Prism' a Text
-- | The specified IAM profile could not be found or deserialised.
_InvalidIAMError :: AsAuthError a => Prism' a Text
-- | A variant of try that takes a Prism (or any Fold)
-- to select which exceptions are caught (c.f. tryJust,
-- catchJust). If the Exception does not match the
-- predicate, it is re-thrown.
--
--
-- trying :: MonadCatch m => Prism' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Lens' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Traversal' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Iso' SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Getter SomeException a -> m r -> m (Either a r)
-- trying :: MonadCatch m => Fold SomeException a -> m r -> m (Either a r)
--
trying :: MonadCatch m => Getting (First a) SomeException a -> m r -> m (Either a r)
-- | Catch exceptions that match a given Prism (or any Fold,
-- really).
--
--
-- >>> catching _AssertionFailed (assert False (return "uncaught")) $ \ _ -> return "caught"
-- "caught"
--
--
--
-- catching :: MonadCatch m => Prism' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Lens' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Traversal' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Iso' SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Getter SomeException a -> m r -> (a -> m r) -> m r
-- catching :: MonadCatch m => Fold SomeException a -> m r -> (a -> m r) -> m r
--
catching :: MonadCatch m => Getting (First a) SomeException a -> m r -> (a -> m r) -> m r
-- | A function threaded through various request and serialisation routines
-- to log informational and debug messages.
type Logger = LogLevel -> Builder -> IO ()
data LogLevel :: *
-- | Error messages only.
Error :: LogLevel
-- | Info messages supplied by the user - this level is not emitted by the
-- library.
Info :: LogLevel
-- | Useful debug information + info + error levels.
Debug :: LogLevel
-- | Includes potentially sensitive signing metadata, and non-streaming
-- response bodies.
Trace :: LogLevel
-- | This is a primitive logger which can be used to log builds to a
-- Handle.
--
-- Note: A more sophisticated logging library such as
-- tinylog or fast-logger should be used in production
-- code.
newLogger :: MonadIO m => LogLevel -> Handle -> m Logger
-- | An opaque request body containing a SHA256 hash.
data RqBody :: *
-- | A streaming, exception safe response body.
data RsBody :: *
-- | Unwrap a ResourceT transformer, and call all registered release
-- actions.
--
-- Note that there is some reference counting involved due to
-- resourceForkIO. If multiple threads are sharing the same
-- collection of resources, only the last call to runResourceT
-- will deallocate the resources.
--
-- Since 0.3.0
runResourceT :: MonadBaseControl IO m => ResourceT m a -> m a
instance Network.AWS.MonadAWS Network.AWS.AWS
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.Identity.IdentityT m)
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.List.ListT m)
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.Maybe.MaybeT m)
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.Except.ExceptT e m)
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.Cont.ContT r m)
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.Reader.ReaderT r m)
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.State.Strict.StateT s m)
instance Network.AWS.MonadAWS m => Network.AWS.MonadAWS (Control.Monad.Trans.State.Lazy.StateT s m)
instance (GHC.Base.Monoid w, Network.AWS.MonadAWS m) => Network.AWS.MonadAWS (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Base.Monoid w, Network.AWS.MonadAWS m) => Network.AWS.MonadAWS (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (GHC.Base.Monoid w, Network.AWS.MonadAWS m) => Network.AWS.MonadAWS (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Base.Monoid w, Network.AWS.MonadAWS m) => Network.AWS.MonadAWS (Control.Monad.Trans.RWS.Lazy.RWST r w s m)