-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings for AWS General API Version 0.1 -- -- Bindings for AWS General API including AWS Signature V4. -- -- API Version: 1.0 -- -- http://docs.aws.amazon.com/general/latest/gr/ @package aws-general @version 0.1 -- | Bindings for AWS General Reference -- -- API Version: 1.0 -- -- http://docs.aws.amazon.com/general/latest/gr/ module Aws.General class AwsType a where fromText = parseOnly $ parse <* eof toText :: (AwsType a, IsString b, Monoid b) => a -> b parse :: (AwsType a, Monad m, CharParsing m) => m a fromText :: AwsType a => Text -> Either String a data GeneralVersion GeneralVersion_1_0 :: GeneralVersion generalVersionToText :: IsString a => GeneralVersion -> a parseGeneralVersion :: CharParsing m => m GeneralVersion data SignatureVersion SignatureVersion2 :: SignatureVersion SignatureVersion4 :: SignatureVersion signatureVersionToText :: IsString a => SignatureVersion -> a parseSignatureVersion :: CharParsing m => m SignatureVersion data SignatureMethod SignatureMethodSha1 :: SignatureMethod SignatureMethodSha256 :: SignatureMethod signatureMethodToText :: IsString a => SignatureMethod -> a parseSignatureMethod :: CharParsing m => m SignatureMethod -- | Region -- -- http://docs.aws.amazon.com/general/1.0/gr/rande.html -- -- The relation between regions and service endpoints is not bijective -- for all AWS services. Not all AWS services support all regions. Some -- services don't use the concept of region at all. data Region ApNortheast1 :: Region ApSoutheast1 :: Region ApSoutheast2 :: Region EuWest1 :: Region SaEast1 :: Region UsEast1 :: Region UsWest1 :: Region UsWest2 :: Region regionToText :: IsString a => Region -> a parseRegion :: CharParsing m => m Region -- | AWS Account Id -- -- -- http://docs.aws.amazon.com/general/1.0/gr/acct-identifiers.html. -- -- This is actually a 12 digit number. newtype AccountId AccountId :: Text -> AccountId accountIdToText :: IsString a => AccountId -> a parseAccountId :: CharParsing m => m AccountId -- | AWS Canonical User ID -- -- -- http://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html. -- -- This is actually a long hexadecimal number newtype CanonicalUserId CanonicalUserId :: Text -> CanonicalUserId canonicalUserIdToText :: IsString a => CanonicalUserId -> a parseCanonicalUserId :: CharParsing m => m CanonicalUserId -- | AWS Service Namespaces -- -- -- http://docs.aws.amazon.com/general/1.0/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces data ServiceNamespace ServiceNamespaceAwsPortal :: ServiceNamespace ServiceNamespaceAutoscaling :: ServiceNamespace ServiceNamespaceCloudformation :: ServiceNamespace ServiceNamespaceCloudfront :: ServiceNamespace ServiceNamespaceCloudwatch :: ServiceNamespace ServiceNamespaceDynamodb :: ServiceNamespace -- | Amazon EC2 and Amazon VPC ServiceNamespaceEc2 :: ServiceNamespace ServiceNamespaceElasticbeanstalk :: ServiceNamespace ServiceNamespaceElasticloadbalancing :: ServiceNamespace ServiceNamespaceElasticmapreduce :: ServiceNamespace ServiceNamespaceElasticache :: ServiceNamespace ServiceNamespaceGlacier :: ServiceNamespace ServiceNamespaceIam :: ServiceNamespace ServiceNamespaceKinesis :: ServiceNamespace ServiceNamespaceAwsMarketplaceManagement :: ServiceNamespace ServiceNamespaceOpsworks :: ServiceNamespace ServiceNamespaceRds :: ServiceNamespace ServiceNamespaceRedshift :: ServiceNamespace ServiceNamespaceRoute53 :: ServiceNamespace ServiceNamespaceS3 :: ServiceNamespace ServiceNamespaceSes :: ServiceNamespace ServiceNamespaceSdb :: ServiceNamespace ServiceNamespaceSqs :: ServiceNamespace ServiceNamespaceSns :: ServiceNamespace ServiceNamespaceStoragegateway :: ServiceNamespace ServiceNamespaceSts :: ServiceNamespace ServiceNamespaceSupport :: ServiceNamespace ServiceNamespaceSwf :: ServiceNamespace -- | For testing purposes (see -- http://docs.aws.amazon.com/general/1.0/gr/signature-v4-test-suite.html) ServiceNamespaceHost :: ServiceNamespace serviceNamespaceToText :: IsString a => ServiceNamespace -> a parseServiceNamespace :: CharParsing m => m ServiceNamespace -- | Amazon Resource Names -- -- -- http://docs.aws.amazon.com/general/1.0/gr/aws-arns-and-namespaces.html -- -- From the specification it is not clear if elements of -- arnResource can be empty. Though examples given in the -- specification do not inlcude such a case, our parser allows it. data Arn Arn :: ServiceNamespace -> Maybe Region -> Maybe AccountId -> [Text] -> Arn arnService :: Arn -> ServiceNamespace arnRegion :: Arn -> Maybe Region arnAccount :: Arn -> Maybe AccountId -- | expected to be non-empty. Elements are separated by only :. -- / is not treated specially. arnResource :: Arn -> [Text] arnToText :: (IsString a, Monoid a) => Arn -> a parseArn :: CharParsing m => m Arn instance Typeable GeneralVersion instance Typeable SignatureVersion instance Typeable SignatureMethod instance Typeable Region instance Typeable AccountId instance Typeable CanonicalUserId instance Typeable ServiceNamespace instance Typeable Arn instance Show GeneralVersion instance Read GeneralVersion instance Eq GeneralVersion instance Ord GeneralVersion instance Enum GeneralVersion instance Bounded GeneralVersion instance Show SignatureVersion instance Read SignatureVersion instance Eq SignatureVersion instance Ord SignatureVersion instance Enum SignatureVersion instance Bounded SignatureVersion instance Show SignatureMethod instance Read SignatureMethod instance Eq SignatureMethod instance Ord SignatureMethod instance Enum SignatureMethod instance Bounded SignatureMethod instance Show Region instance Read Region instance Eq Region instance Ord Region instance Enum Region instance Bounded Region instance Show AccountId instance Read AccountId instance Eq AccountId instance Ord AccountId instance IsString AccountId instance Show CanonicalUserId instance Read CanonicalUserId instance Eq CanonicalUserId instance Ord CanonicalUserId instance IsString CanonicalUserId instance Show ServiceNamespace instance Read ServiceNamespace instance Eq ServiceNamespace instance Ord ServiceNamespace instance Enum ServiceNamespace instance Bounded ServiceNamespace instance Show Arn instance Read Arn instance Eq Arn instance Ord Arn instance Arbitrary Arn instance FromJSON Arn instance ToJSON Arn instance AwsType Arn instance Arbitrary ServiceNamespace instance Hashable ServiceNamespace instance AwsType ServiceNamespace instance Arbitrary CanonicalUserId instance AwsType CanonicalUserId instance Arbitrary AccountId instance AwsType AccountId instance Arbitrary Region instance Hashable Region instance AwsType Region instance Arbitrary SignatureMethod instance AwsType SignatureMethod instance Arbitrary SignatureVersion instance AwsType SignatureVersion instance Arbitrary GeneralVersion instance AwsType GeneralVersion -- | AWS Signature Version 4 -- -- API Version: 1.0 -- -- -- http://docs.aws.amazon.com/general/1.0/gr/signature-version-4.html module Aws.SignatureV4 data GeneralVersion GeneralVersion_1_0 :: GeneralVersion generalVersionToText :: IsString a => GeneralVersion -> a parseGeneralVersion :: CharParsing m => m GeneralVersion signatureVersion :: IsString a => a -- | AWS access credentials. -- -- This type is isomorphic to the Credential type from the -- aws package. You may use the following function to get a -- SignatureV4Credential from a Credential: -- --
-- cred2credv4 :: Credential -> SignatureV4Credential -- cred2credv4 (Credential a b c) = SignatureV4Credential a b c --data SignatureV4Credentials SignatureV4Credentials :: ByteString -> ByteString -> IORef [SigV4Key] -> SignatureV4Credentials sigV4AccessKeyId :: SignatureV4Credentials -> ByteString sigV4SecretAccessKey :: SignatureV4Credentials -> ByteString -- | used internally for caching the singing key sigV4SigningKeys :: SignatureV4Credentials -> IORef [SigV4Key] newCredentials :: (Functor m, MonadIO m) => ByteString -> ByteString -> m SignatureV4Credentials -- | Compute an AWS Signature Version 4 -- -- This version computes the derivied signing key each time it is invoked -- -- The request headers must include the host header. The -- query must include the Action parameter. -- -- The x-amz-date header is generated by the code. A possibly -- existing x-amz-date header or date header is -- replaced. signPostRequest :: SignatureV4Credentials -> Region -> ServiceNamespace -> UTCTime -> Method -> UriPath -> UriQuery -> RequestHeaders -> ByteString -> Either String RequestHeaders -- | Compute an AWS Signature Version 4 -- -- This version computes the derivied signing key each time it is invoked -- -- The request headers must include the host header. The -- query must include the Action parameter. signGetRequest :: SignatureV4Credentials -> Region -> ServiceNamespace -> UTCTime -> Method -> UriPath -> UriQuery -> RequestHeaders -> ByteString -> Either String UriQuery -- | The request headers must include the host header. The -- query must include the Action parameter. -- -- The x-amz-date header is generated by the code. A possibly -- existing x-amz-date header or date header is -- replaced. signPostRequestIO :: SignatureV4Credentials -> Region -> ServiceNamespace -> UTCTime -> Method -> UriPath -> UriQuery -> RequestHeaders -> ByteString -> IO (Either String RequestHeaders) -- | The request headers must include the host header. The -- query must include the Action parameter. signGetRequestIO :: SignatureV4Credentials -> Region -> ServiceNamespace -> UTCTime -> Method -> UriPath -> UriQuery -> RequestHeaders -> ByteString -> IO (Either String UriQuery) data AuthorizationInfo AuthorizationInfo :: !ByteString -> !ByteString -> !ByteString -> !UTCTime -> !ByteString -> AuthorizationInfo authzInfoAlgorithm :: AuthorizationInfo -> !ByteString authzInfoCredential :: AuthorizationInfo -> !ByteString authzInfoSignedHeaders :: AuthorizationInfo -> !ByteString authzInfoDate :: AuthorizationInfo -> !UTCTime authzInfoSignature :: AuthorizationInfo -> !ByteString authorizationInfo :: SignatureV4Credentials -> CredentialScope -> SignedHeaders -> UTCTime -> Signature -> AuthorizationInfo authorizationInfoQuery :: AuthorizationInfo -> UriQuery authorizationInfoHeader :: AuthorizationInfo -> RequestHeaders -- | Normalization of the date header breaks the AWS test suite, since the -- tests in that test suite use an invalid date. -- -- Date normalization is enabled by default but can be turned of via the -- cabal (compiletime) flag normalize-signature-v4-date. dateNormalizationEnabled :: Bool -- | We only support SHA256 since SHA1 has been deprecated signingAlgorithm :: IsString a => a type UriPath = [Text] type UriQuery = QueryText -- | Normalize URI Path according to RFC 3986 (6.2.2) normalizeUriPath :: UriPath -> UriPath -- | Normalize URI Query according to RFC 3986 (6.2.2) normalizeUriQuery :: UriQuery -> UriQuery newtype CanonicalUri CanonicalUri :: ByteString -> CanonicalUri -- | Compute canonical URI -- -- -- http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html -- -- The input is assumed to be an absolute URI. If the first segment is -- .. it is kept as is. Most likely such an URI is invalid. canonicalUri :: UriPath -> UriQuery -> CanonicalUri newtype CanonicalHeaders CanonicalHeaders :: ByteString -> CanonicalHeaders -- | Compute canonical HTTP headers -- -- -- http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html -- -- It is assumed (and not checked) that the header values comform with -- the definitions in RFC 2661. In particular non-comformant usage of -- quotation characters may lead to invalid results. canonicalHeaders :: RequestHeaders -> CanonicalHeaders data SignedHeaders -- | Compute signed headers -- -- -- http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html signedHeaders :: RequestHeaders -> SignedHeaders newtype CanonicalRequest CanonicalRequest :: ByteString -> CanonicalRequest -- | Create Canonical Request for AWS Signature Version 4 -- -- -- http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-canonical-request.html -- -- This functions performs normalization of the URI and the Headers which -- is expensive. We should consider providing an alternate version of -- this function that bypasses these steps and simply assumes that the -- input is already canonical. canonicalRequest :: Method -> UriPath -> UriQuery -> RequestHeaders -> ByteString -> CanonicalRequest data HashedCanonicalRequest hashedCanonicalRequest :: CanonicalRequest -> HashedCanonicalRequest data CredentialScope CredentialScope :: !UTCTime -> !Region -> !ServiceNamespace -> CredentialScope credentialScopeDate :: CredentialScope -> !UTCTime credentialScopeRegion :: CredentialScope -> !Region credentialScopeService :: CredentialScope -> !ServiceNamespace credentialScopeToText :: (IsString a, Monoid a) => CredentialScope -> a newtype StringToSign StringToSign :: ByteString -> StringToSign -- | Create the String to Sign for AWS Signature Version 4 -- -- -- http://docs.aws.amazon.com/general/1.0/gr/sigv4-create-string-to-sign.html stringToSign :: UTCTime -> CredentialScope -> CanonicalRequest -> StringToSign -- | This key can be computed once and cached. It is valid for all requests -- to the same service and the region till 00:00:00 UTC time. newtype SigningKey SigningKey :: ByteString -> SigningKey -- | Derive the signing key -- -- -- http://docs.aws.amazon.com/general/1.0/gr/sigv4-calculate-signature.html signingKey :: SignatureV4Credentials -> CredentialScope -> SigningKey newtype Signature Signature :: ByteString -> Signature -- | Compute an AWS Signature Version 4 -- -- -- http://docs.aws.amazon.com/general/1.0/gr/sigv4-calculate-signature.html requestSignature :: SigningKey -> StringToSign -> Signature instance Typeable SignatureV4Credentials instance Typeable CanonicalUri instance Typeable CanonicalHeaders instance Typeable SignedHeaders instance Typeable CanonicalRequest instance Typeable HashedCanonicalRequest instance Typeable CredentialScope instance Typeable StringToSign instance Typeable SigningKey instance Typeable Signature instance Show CanonicalUri instance Read CanonicalUri instance Eq CanonicalUri instance Ord CanonicalUri instance Show CanonicalHeaders instance Read CanonicalHeaders instance Eq CanonicalHeaders instance Ord CanonicalHeaders instance Show SignedHeaders instance Read SignedHeaders instance Eq SignedHeaders instance Ord SignedHeaders instance Show CanonicalRequest instance Read CanonicalRequest instance Eq CanonicalRequest instance Ord CanonicalRequest instance Show HashedCanonicalRequest instance Read HashedCanonicalRequest instance Eq HashedCanonicalRequest instance Ord HashedCanonicalRequest instance Show CredentialScope instance Read CredentialScope instance Show StringToSign instance Read StringToSign instance Eq StringToSign instance Ord StringToSign instance Show SigningKey instance Read SigningKey instance Eq SigningKey instance Ord SigningKey instance Show Signature instance Read Signature instance Eq Signature instance Ord Signature instance Arbitrary CredentialScope instance AwsType CredentialScope instance Eq CredentialScope