packages feed

amazonka-core 0.0.8 → 0.1.0

raw patch · 3 files changed

+2/−331 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Network.AWS.EC2.Metadata: AMI :: Mapping
- Network.AWS.EC2.Metadata: AMIId :: Metadata
- Network.AWS.EC2.Metadata: AMILaunchIndex :: Metadata
- Network.AWS.EC2.Metadata: AMIManifestPath :: Metadata
- Network.AWS.EC2.Metadata: AncestorAMIIds :: Metadata
- Network.AWS.EC2.Metadata: AvailabilityZone :: Metadata
- Network.AWS.EC2.Metadata: BlockDevice :: !Mapping -> Metadata
- Network.AWS.EC2.Metadata: Document :: Dynamic
- Network.AWS.EC2.Metadata: EBS :: !Int -> Mapping
- Network.AWS.EC2.Metadata: Ephemeral :: !Int -> Mapping
- Network.AWS.EC2.Metadata: FWS :: Dynamic
- Network.AWS.EC2.Metadata: Hostname :: Metadata
- Network.AWS.EC2.Metadata: IAM :: !Info -> Metadata
- Network.AWS.EC2.Metadata: IDeviceNumber :: Interface
- Network.AWS.EC2.Metadata: IIPV4Associations :: !Text -> Interface
- Network.AWS.EC2.Metadata: ILocalHostname :: Interface
- Network.AWS.EC2.Metadata: ILocalIPV4s :: Interface
- Network.AWS.EC2.Metadata: IMAC :: Interface
- Network.AWS.EC2.Metadata: IOwnerId :: Interface
- Network.AWS.EC2.Metadata: IPublicHostname :: Interface
- Network.AWS.EC2.Metadata: IPublicIPV4s :: Interface
- Network.AWS.EC2.Metadata: ISecurityGroupIds :: Interface
- Network.AWS.EC2.Metadata: ISecurityGroups :: Interface
- Network.AWS.EC2.Metadata: ISubnetIPV4_CIDRBlock :: Interface
- Network.AWS.EC2.Metadata: ISubnetId :: Interface
- Network.AWS.EC2.Metadata: IVPCIPV4_CIDRBlock :: Interface
- Network.AWS.EC2.Metadata: IVPCId :: Interface
- Network.AWS.EC2.Metadata: Info :: Info
- Network.AWS.EC2.Metadata: InstanceAction :: Metadata
- Network.AWS.EC2.Metadata: InstanceId :: Metadata
- Network.AWS.EC2.Metadata: InstanceType :: Metadata
- Network.AWS.EC2.Metadata: KernelId :: Metadata
- Network.AWS.EC2.Metadata: LocalHostname :: Metadata
- Network.AWS.EC2.Metadata: LocalIPV4 :: Metadata
- Network.AWS.EC2.Metadata: MAC :: Metadata
- Network.AWS.EC2.Metadata: Network :: !Text -> !Interface -> Metadata
- Network.AWS.EC2.Metadata: OpenSSHKey :: Metadata
- Network.AWS.EC2.Metadata: PKCS7 :: Dynamic
- Network.AWS.EC2.Metadata: ProductCodes :: Metadata
- Network.AWS.EC2.Metadata: PublicHostname :: Metadata
- Network.AWS.EC2.Metadata: PublicIPV4 :: Metadata
- Network.AWS.EC2.Metadata: RAMDiskId :: Metadata
- Network.AWS.EC2.Metadata: ReservationId :: Metadata
- Network.AWS.EC2.Metadata: Root :: Mapping
- Network.AWS.EC2.Metadata: SecurityCredentials :: (Maybe Text) -> Info
- Network.AWS.EC2.Metadata: SecurityGroups :: Metadata
- Network.AWS.EC2.Metadata: Signature :: Dynamic
- Network.AWS.EC2.Metadata: Swap :: Mapping
- Network.AWS.EC2.Metadata: data Dynamic
- Network.AWS.EC2.Metadata: data Info
- Network.AWS.EC2.Metadata: data Interface
- Network.AWS.EC2.Metadata: data Mapping
- Network.AWS.EC2.Metadata: data Metadata
- Network.AWS.EC2.Metadata: dynamic :: MonadIO m => Manager -> Dynamic -> ExceptT HttpException m ByteString
- Network.AWS.EC2.Metadata: instance Eq Info
- Network.AWS.EC2.Metadata: instance Eq Interface
- Network.AWS.EC2.Metadata: instance Eq Mapping
- Network.AWS.EC2.Metadata: instance Eq Metadata
- Network.AWS.EC2.Metadata: instance Ord Info
- Network.AWS.EC2.Metadata: instance Ord Interface
- Network.AWS.EC2.Metadata: instance Ord Mapping
- Network.AWS.EC2.Metadata: instance Ord Metadata
- Network.AWS.EC2.Metadata: instance Show Info
- Network.AWS.EC2.Metadata: instance Show Interface
- Network.AWS.EC2.Metadata: instance Show Mapping
- Network.AWS.EC2.Metadata: instance Show Metadata
- Network.AWS.EC2.Metadata: instance ToPath Dynamic
- Network.AWS.EC2.Metadata: instance ToPath Info
- Network.AWS.EC2.Metadata: instance ToPath Interface
- Network.AWS.EC2.Metadata: instance ToPath Mapping
- Network.AWS.EC2.Metadata: instance ToPath Metadata
- Network.AWS.EC2.Metadata: isEC2 :: Manager -> IO Bool
- Network.AWS.EC2.Metadata: metadata :: MonadIO m => Manager -> Metadata -> ExceptT HttpException m ByteString
- Network.AWS.EC2.Metadata: userdata :: MonadIO m => Manager -> ExceptT HttpException m (Maybe ByteString)
- Network.AWS.Types: _Errors :: Prism' (ServiceError a_aH0Y) [ServiceError a_aH0Y]
+ Network.AWS.Types: _Errors :: Prism' (ServiceError a_aCK6) [ServiceError a_aCK6]
- Network.AWS.Types: _HttpError :: Prism' (ServiceError a_aH0Y) HttpException
+ Network.AWS.Types: _HttpError :: Prism' (ServiceError a_aCK6) HttpException
- Network.AWS.Types: _SerializerError :: Prism' (ServiceError a_aH0Y) (Abbrev, String)
+ Network.AWS.Types: _SerializerError :: Prism' (ServiceError a_aCK6) (Abbrev, String)
- Network.AWS.Types: _ServiceError :: Prism' (ServiceError a_aH0Y) (Abbrev, Status, a_aH0Y)
+ Network.AWS.Types: _ServiceError :: Prism' (ServiceError a_aCK6) (Abbrev, Status, a_aCK6)
- Network.AWS.Types: rqBody :: Lens (Request a_aH0G) (Request a_aI7o) RqBody RqBody
+ Network.AWS.Types: rqBody :: Lens (Request a_aCJO) (Request a_aDQV) RqBody RqBody
- Network.AWS.Types: rqHeaders :: Lens (Request a_aH0G) (Request a_aI7p) [Header] [Header]
+ Network.AWS.Types: rqHeaders :: Lens (Request a_aCJO) (Request a_aDQW) [Header] [Header]
- Network.AWS.Types: rqMethod :: Lens (Request a_aH0G) (Request a_aI7q) StdMethod StdMethod
+ Network.AWS.Types: rqMethod :: Lens (Request a_aCJO) (Request a_aDQX) StdMethod StdMethod
- Network.AWS.Types: rqPath :: Lens (Request a_aH0G) (Request a_aI7r) ByteString ByteString
+ Network.AWS.Types: rqPath :: Lens (Request a_aCJO) (Request a_aDQY) ByteString ByteString
- Network.AWS.Types: rqQuery :: Lens (Request a_aH0G) (Request a_aI7s) Query Query
+ Network.AWS.Types: rqQuery :: Lens (Request a_aCJO) (Request a_aDQZ) Query Query

Files

amazonka-core.cabal view
@@ -1,5 +1,5 @@ name:                  amazonka-core-version:               0.0.8+version:               0.1.0 synopsis:              Core functionality and data types for Amazonka libraries. homepage:              https://github.com/brendanhay/amazonka license:               OtherLicense@@ -35,7 +35,6 @@      exposed-modules:           Network.AWS.Data-        , Network.AWS.EC2.Metadata         , Network.AWS.Error         , Network.AWS.Pagination         , Network.AWS.Prelude
− src/Network/AWS/EC2/Metadata.hs
@@ -1,328 +0,0 @@-{-# LANGUAGE BangPatterns      #-}-{-# LANGUAGE FlexibleContexts  #-}-{-# LANGUAGE OverloadedStrings #-}---- Module      : Network.AWS.EC2.Metadata--- Copyright   : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>--- License     : This Source Code Form is subject to the terms of---               the Mozilla Public License, v. 2.0.---               A copy of the MPL can be found in the LICENSE file or---               you can obtain it at http://mozilla.org/MPL/2.0/.--- Maintainer  : Brendan Hay <brendan.g.hay@gmail.com>--- Stability   : experimental--- Portability : non-portable (GHC extensions)---- | Retrieve an EC2 instance's local metadata.-module Network.AWS.EC2.Metadata-    (-    -- * Requests-    -- ** Running on EC2-      isEC2--    -- ** Dynamic-    , Dynamic   (..)-    , dynamic--    -- ** Metadata-    , Metadata  (..)-    , Mapping   (..)-    , Info      (..)-    , Interface (..)-    , metadata--    -- ** User data-    , userdata-    ) where--import           Control.Applicative-import           Control.Exception-import           Control.Monad-import           Control.Monad.Except-import           Data.ByteString            (ByteString)-import qualified Data.ByteString.Char8      as BS-import qualified Data.ByteString.Lazy       as LBS-import           Data.Maybe-import           Data.Monoid-import           Data.Text                  (Text)-import qualified Data.Text                  as Text-import           Network.AWS.Data-import           Network.HTTP.Client-import           Network.HTTP.Types         (status404)--data Dynamic-    = FWS-    -- ^ Value showing whether the customer has enabled detailed one-minute-    -- monitoring in CloudWatch.-    ---    -- Valid values: enabled | disabled.-    | Document-    -- ^ JSON containing instance attributes, such as instance-id,-    -- private IP address, etc.-    | PKCS7-    -- ^ Used to verify the document's authenticity and content against the-    -- signature.-    | Signature--instance ToPath Dynamic where-    toPath x = case x of-       FWS       -> "fws/instance-monitoring"-       Document  -> "instance-identity/document"-       PKCS7     -> "instance-identity/pkcs7"-       Signature -> "instance-identity/signature"--data Metadata-    = AMIId-    -- ^ The AMI ID used to launch the instance.-    | AMILaunchIndex-    -- ^ 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.-    | AMIManifestPath-    -- ^ 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.-    | AncestorAMIIds-    -- ^ 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.-    | BlockDevice !Mapping-    -- ^ See: 'Mapping'-    | Hostname-    -- ^ 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).-    | IAM !Info-    -- ^ See: 'Info'-    | InstanceAction-    -- ^ Notifies the instance that it should reboot in preparation for bundling.-    -- Valid values: none | shutdown | bundle-pending.-    | InstanceId-    -- ^ The ID of this instance.-    | InstanceType-    -- ^ The type of instance.-    ---    -- See: @InstanceType@-    | KernelId-    -- ^ The ID of the kernel launched with this instance, if applicable.-    | LocalHostname-    -- ^ 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).-    | LocalIPV4-    -- ^ 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).-    | MAC-    -- ^ 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).-    | Network !Text !Interface-    -- ^ See: 'Interface'-    | AvailabilityZone-    -- ^ The Availability Zone in which the instance launched.-    | ProductCodes-    -- ^ Product codes associated with the instance, if any.-    | PublicHostname-    -- ^ 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.-    | PublicIPV4-    -- ^ The public IP address. If an Elastic IP address is associated with the-    -- instance, the value returned is the Elastic IP address.-    | OpenSSHKey-    -- ^ Public key. Only available if supplied at instance launch time.-    | RAMDiskId-    -- ^ The ID of the RAM disk specified at launch time, if applicable.-    | ReservationId-    -- ^ ID of the reservation.-    | SecurityGroups-    -- ^ The names of the security groups applied to the instance.-      deriving (Eq, Ord, Show)--instance ToPath Metadata where-    toPath x = case x of-        AMIId            -> "ami-id"-        AMILaunchIndex   -> "ami-launch-index"-        AMIManifestPath  -> "ami-manifest-path"-        AncestorAMIIds   -> "ancestor-ami-ids"-        BlockDevice m    -> "block-device-mapping/" <> toPath m-        Hostname         -> "hostname"-        IAM m            -> "iam/" <> toPath m-        InstanceAction   -> "instance-action"-        InstanceId       -> "instance-id"-        InstanceType     -> "instance-type"-        KernelId         -> "kernel-id"-        LocalHostname    -> "local-hostname"-        LocalIPV4        -> "local-ipv4"-        MAC              -> "mac"-        Network n m      -> "network/interfaces/macs/" <> n <> "/" <> toPath m-        AvailabilityZone -> "placement/availability-zone"-        ProductCodes     -> "product-codes"-        PublicHostname   -> "public-hostname"-        PublicIPV4       -> "public-ipv4"-        OpenSSHKey       -> "public-keys/0/openssh-key"-        RAMDiskId        -> "ramdisk-id"-        ReservationId    -> "reservation-id"-        SecurityGroups   -> "security-groups"--data Mapping-    = AMI-    -- ^ The virtual device that contains the root/boot file system.-    | EBS !Int-    -- ^ 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).-    | Ephemeral !Int-    -- ^ The virtual devices associated with ephemeral devices, if present.-    -- The N indicates the index of the ephemeral volume.-    | Root-    -- ^ 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.-    | Swap-    -- ^ The virtual devices associated with swap. Not always present.-      deriving (Eq, Ord, Show)--instance ToPath Mapping where-    toPath x = case x of-        AMI         -> "ami"-        EBS       n -> "ebs"       <> toText n-        Ephemeral n -> "ephemeral" <> toText n-        Root        -> "root"-        Swap        -> "root"--data Interface-    = IDeviceNumber-    -- ^ 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.-    | IIPV4Associations !Text-    -- ^ The private IPv4 addresses that are associated with each public-ip-    -- address and assigned to that interface.-    | ILocalHostname-    -- ^ The interface's local hostname.-    | ILocalIPV4s-    -- ^ The private IP addresses associated with the interface.-    | IMAC-    -- ^ The instance's MAC address.-    | IOwnerId-    -- ^ 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.-    | IPublicHostname-    -- ^ 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.-    | IPublicIPV4s-    -- ^ The Elastic IP addresses associated with the interface. There may be-    -- multiple IP addresses on an instance.-    | ISecurityGroups-    -- ^ Security groups to which the network interface belongs. Returned only-    -- for instances launched into a VPC.-    | ISecurityGroupIds-    -- ^ 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.-    | ISubnetId-    -- ^ The ID of the subnet in which the interface resides. Returned only for-    -- instances launched into a VPC.-    | ISubnetIPV4_CIDRBlock-    -- ^ The CIDR block of the subnet in which the interface resides. Returned-    -- only for instances launched into a VPC.-    | IVPCId-    -- ^ The ID of the VPC in which the interface resides. Returned only for-    -- instances launched into a VPC.-    | IVPCIPV4_CIDRBlock-    -- ^ The CIDR block of the VPC in which the interface resides. Returned only-    -- for instances launched into a VPC.-      deriving (Eq, Ord, Show)--instance ToPath Interface where-    toPath x = case x of-        IDeviceNumber         -> "device-number"-        IIPV4Associations ip  -> "ipv4-associations/" <> ip-        ILocalHostname        -> "local-hostname"-        ILocalIPV4s           -> "local-ipv4s"-        IMAC                  -> "mac"-        IOwnerId              -> "owner-id"-        IPublicHostname       -> "public-hostname"-        IPublicIPV4s          -> "public-ipv4s"-        ISecurityGroups       -> "security-groups"-        ISecurityGroupIds     -> "security-group-ids"-        ISubnetId             -> "subnet-id"-        ISubnetIPV4_CIDRBlock -> "subnet-ipv4-cidr-block"-        IVPCId                -> "vpc-id"-        IVPCIPV4_CIDRBlock    -> "vpc-ipv4-cidr-block"--data Info-    = Info-    -- ^ Returns information about the last time the instance profile was updated,-    -- including the instance's LastUpdated date, InstanceProfileArn,-    -- and InstanceProfileId.-    | SecurityCredentials (Maybe Text)-    -- ^ Where role-name is the name of the IAM role associated with the instance.-    -- Returns the temporary security credentials.-    ---    -- See: 'Auth' for JSON deserialisation.-      deriving (Eq, Ord, Show)--instance ToPath Info where-    toPath x = case x of-        Info                  -> "info"-        SecurityCredentials r -> "security-credentials/" <> fromMaybe "" r---- | Test whether the host is running on EC2 by requesting the instance-data.-isEC2 :: Manager -> IO Bool-isEC2 m = liftIO (req `catch` err)-  where-    req = do-        !_ <- request m "http://instance-data/latest"-        return True--    err :: IOException -> IO Bool-    err = const (return False)--dynamic :: MonadIO m-        => Manager-        -> Dynamic-        -> ExceptT HttpException m ByteString-dynamic m = get m . mappend "http://169.254.169.254/latest/dynamic/" . toPath--metadata :: MonadIO m-         => Manager-         -> Metadata-         -> ExceptT HttpException m ByteString-metadata m = get m . mappend "http://169.254.169.254/latest/meta-data/" . toPath--userdata :: MonadIO m-         => Manager-         -> ExceptT HttpException m (Maybe ByteString)-userdata m = Just-    `liftM` get m "http://169.254.169.254/latest/user-data"-    `catchError` err-  where-    err (StatusCodeException s _ _)-        | status404 == s  = return Nothing-    err e                 = throwError e--get :: MonadIO m-    => Manager-    -> Text-    -> ExceptT HttpException m ByteString-get m url = ExceptT . liftIO $ req `catch` err-  where-    req = Right . strip <$> request m url--    strip bs-        | BS.isSuffixOf "\n" bs = BS.init bs-        | otherwise             = bs--    err :: HttpException -> IO (Either HttpException a)-    err = return . Left--request :: Manager -> Text -> IO ByteString-request m url = do-    rq <- parseUrl (Text.unpack url)-    rs <- httpLbs (rq { responseTimeout = Just 2 }) m-    return . LBS.toStrict $ responseBody rs
src/Network/AWS/Types.hs view
@@ -434,7 +434,7 @@             "Failure parsing Region from " ++ show e  instance ToText Region where-    toText r = case r of+    toText = \case         Ireland         -> "eu-west-1"         Frankfurt       -> "eu-central-1"         Tokyo           -> "ap-northeast-1"