Hello community, here is the log from the commit of package ghc-amazonka for openSUSE:Factory checked in at 2017-03-24 02:09:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-amazonka (Old) and /work/SRC/openSUSE:Factory/.ghc-amazonka.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-amazonka" Fri Mar 24 02:09:27 2017 rev:2 rq:461533 version:1.4.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-amazonka/ghc-amazonka.changes 2017-02-03 17:37:50.959442546 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-amazonka.new/ghc-amazonka.changes 2017-03-24 02:09:28.479467769 +0100 @@ -1,0 +2,5 @@ +Sun Feb 12 14:19:52 UTC 2017 - [email protected] + +- Update to version 1.4.5 with cabal2obs. + +------------------------------------------------------------------- Old: ---- amazonka-1.4.3.tar.gz New: ---- amazonka-1.4.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-amazonka.spec ++++++ --- /var/tmp/diff_new_pack.GIsZCV/_old 2017-03-24 02:09:30.031248094 +0100 +++ /var/tmp/diff_new_pack.GIsZCV/_new 2017-03-24 02:09:30.035247528 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-amazonka # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name amazonka %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.4.3 +Version: 1.4.5 Release: 0 Summary: Comprehensive Amazon Web Services SDK License: MPL-2.0 ++++++ amazonka-1.4.3.tar.gz -> amazonka-1.4.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/amazonka-1.4.3/CHANGELOG.md new/amazonka-1.4.5/CHANGELOG.md --- old/amazonka-1.4.3/CHANGELOG.md 2016-06-09 21:31:26.000000000 +0200 +++ new/amazonka-1.4.5/CHANGELOG.md 2016-12-04 16:29:21.000000000 +0100 @@ -1,7 +1,104 @@ # Change Log +## [1.4.5](https://github.com/brendanhay/amazonka/tree/1.4.5) +Released: **04 December, 2016**, Compare: [1.4.5](https://github.com/brendanhay/amazonka/compare/1.4.4...1.4.5) + +### Fixed + +- Generated Haddock documentation is now more readable/consistent. [\#331](https://github.com/brendanhay/amazonka/pull/331) +- `Expect: 100-continue` HTTP headers are now only added to S3 `PutObject` requests. [\#338](https://github.com/brendanhay/amazonka/pull/338) + +### Changed + +- Add new regions `Ohio` (us-east-2) and `Seoul` (ap-northeast-2). [\#334](https://github.com/brendanhay/amazonka/pull/334) +- The `Bombay` region has been renamed to `Mumbai`. [\#334](https://github.com/brendanhay/amazonka/pull/334) +- Route53 HostedZone and DelegateSet identifiers are now stripped, similarly to other SDKs. [\#336](https://github.com/brendanhay/amazonka/pull/336) + +### New Libraries + +- `amazonka-xray`: Analyze and debug production, distributed applications, such as those built using a microservices architecture. [Overview](https://aws.amazon.com/xray/) +- `amazonka-stepfunctions`: Coordinate the components of distributed applications and microservices using visual workflows. [Overview](https://aws.amazon.com/step-functions/) +- `amazonka-ssm`: Automate collecting system inventory, applying OS patches, creation of AMIs, and configuring OSes and applications at scale. [API Reference](http://docs.aws.amazon.com/ssm/latest/APIReference/Welcome.html) +- `amazonka-snowball` (+ `snowball-edge`): Data transport solution using secure appliances to transfer large data into and out of AWS. [Overview](https://aws.amazon.com/snowball/) +- `amazonka-shield`: DDoS protection service for web applications using ELB, CloudFront, and Route 53. [Overview](https://aws.amazon.com/shield/) +- `amazonka-rekognition`: Image analysis service for detecting objects, scenes, and faces in images. [Overview](https://aws.amazon.com/rekognition/) +- `amazonka-polly`: Turn text into lifelike speech. Supports 24 languages and 47 lifelike voices. [Overview](https://aws.amazon.com/polly/) +- `amazonka-pinpoint`: Targeted push notification campaigns to improve engagement in mobile apps. [Overview](https://aws.amazon.com/pinpoint/) +- `amazonka-opsworks-cm`: Managed Chef Automated for OpsWorks. [Overview](https://aws.amazon.com/opsworks/) +- `amazonka-lightsail`: Launch and manage a virtual private servers. [Overview](https://aws.amazon.com/lightsail/) +- `amazonka-health`: Personalized service dashboard of your AWS service health. [Overview](https://aws.amazon.com/premiumsupport/phd/) +- `amazonka-codebuild`: Continuously build and test your code, paying for what you use. [Overview](https://aws.amazon.com/codebuild/) +- `amazonka-appstream` (Version 2): Stream desktop applications to any device running a browser. [Overview](https://aws.amazon.com/appstream2/) +- `amazonka-budgets`: Plan your usage and costs. [User Guide](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/budgets-managing-costs.html) +- `amazonka-sms`: Automate, schedule, and track incremental replications of live server volumes from on premise to AWS. [Overview](https://aws.amazon.com/server-migration-service/) + +### Updated Service Definitions + +> The following services contain a large number of definition updates. +Please review the linked commit for each library for specific changes: + +- [APIGateway](https://github.com/brendanhay/amazonka/commit/1b724ac) - `amazonka-apigateway` +- [ApplicationAutoScaling](https://github.com/brendanhay/amazonka/commit/pe279d35) - `amazonka-application-autoscaling` +- [AutoScaling](https://github.com/brendanhay/amazonka/commit/ed347ed) - `amazonka-autoscaling` +- [CertificateManager](https://github.com/brendanhay/amazonka/commit/d930be6) - `amazonka-certificatemanager` +- [CloudFormation](https://github.com/brendanhay/amazonka/commit/ce82485) - `amazonka-cloudformation` +- [CloudFront](https://github.com/brendanhay/amazonka/commit/4e292a8) - `amazonka-cloudfront` +- [CloudTrail](https://github.com/brendanhay/amazonka/commit/fc26b72) - `amazonka-cloudtrail` +- [CloudWatchLogs](https://github.com/brendanhay/amazonka/commit/2eec1a3) - `amazonka-cloudwatch-logs` +- [CloudWatch](https://github.com/brendanhay/amazonka/commit/b023497) - `amazonka-cloudwatch` +- [CodeDeploy](https://github.com/brendanhay/amazonka/commit/p5f4eee6) - `amazonka-codedeploy` +- [CodePipeline](https://github.com/brendanhay/amazonka/commit/3a3ce67) - `amazonka-codepipeline` +- [CognitoIdentityProvider](https://github.com/brendanhay/amazonka/commit/388099f) - `amazonka-cognito-idp` +- [Config](https://github.com/brendanhay/amazonka/commit/84dda25) - `amazonka-config` +- [DeviceFarm](https://github.com/brendanhay/amazonka/commit/b13f2fa) - `amazonka-devicefarm` +- [DirectConnect](https://github.com/brendanhay/amazonka/commit/bd0fd3d) - `amazonka-directconnect` +- [DirectoryService](https://github.com/brendanhay/amazonka/commit/582c047) - `amazonka-ds` +- [EC2](https://github.com/brendanhay/amazonka/commit/4117a08) - `amazonka-ec2` +- [ECR](https://github.com/brendanhay/amazonka/commit/3362a22) - `amazonka-ecr` +- [ECS](https://github.com/brendanhay/amazonka/commit/c731732) - `amazonka-ecs` +- [EFS](https://github.com/brendanhay/amazonka/commit/62e9351) - `amazonka-efs` +- [ELBv2](https://github.com/brendanhay/amazonka/commit/8c5ae35) - `amazonka-elbv2` +- [EMR](https://github.com/brendanhay/amazonka/commit/0538f37) - `amazonka-emr` +- [ElastiCache](https://github.com/brendanhay/amazonka/commit/9c2e52d) - `amazonka-elasticache` +- [ElasticBeanstalk](https://github.com/brendanhay/amazonka/commit/16320d2) - `amazonka-elasticbeanstalk` +- [ElasticTranscoder](https://github.com/brendanhay/amazonka/commit/c216e5c) - `amazonka-elastictranscoder` +- [GameLift](https://github.com/brendanhay/amazonka/commit/bfd74cf) - `amazonka-gamelift` +- [Glacier](https://github.com/brendanhay/amazonka/commit/70c7268) - `amazonka-glacier` +- [IoT](https://github.com/brendanhay/amazonka/commit/25176bd) - `amazonka-iot` +- [KMS](https://github.com/brendanhay/amazonka/commit/2e28104) - `amazonka-kms` +- [KinesisAnalytics](https://github.com/brendanhay/amazonka/commit/8df7d3d) - `amazonka-kinesis-analytics` +- [Kinesis](https://github.com/brendanhay/amazonka/commit/ab93e87) - `amazonka-kinesis` +- [Lambda](https://github.com/brendanhay/amazonka/commit/570d674) - `amazonka-lambda` +- [MarketplaceMetering](https://github.com/brendanhay/amazonka/commit/d93c185) - `amazonka-marketplace-metering` +- [OpsWorks](https://github.com/brendanhay/amazonka/commit/e49f255) - `amazonka-opsworks` +- [RDS](https://github.com/brendanhay/amazonka/commit/0df4ee5) - `amazonka-rds` +- [Redshift](https://github.com/brendanhay/amazonka/commit/e0c9f54) - `amazonka-redshift` +- [Route53](https://github.com/brendanhay/amazonka/commit/1a48a46) - `amazonka-route53` +- [S3](https://github.com/brendanhay/amazonka/commit/9852585) - `amazonka-s3` +- [SES](https://github.com/brendanhay/amazonka/commit/38150dc) - `amazonka-ses` +- [SQS](https://github.com/brendanhay/amazonka/commit/ac22d92) - `amazonka-sqs` +- [ServiceCatalog](https://github.com/brendanhay/amazonka/commit/e91184d) - `amazonka-servicecatalog` +- [WAF](https://github.com/brendanhay/amazonka/commit/86bcd26) - `amazonka-waf` + + +## [1.4.4](https://github.com/brendanhay/amazonka/tree/1.4.4) +Released: **23 October, 2016**, Compare: [1.4.3](https://github.com/brendanhay/amazonka/compare/1.4.3...1.4.4) + +### Fixed [\#306](https://github.com/brendanhay/amazonka/pull/306) + +- Kinesis `SharedLevelMetrics` now correctly deserializes empty responses. [\#306](https://github.com/brendanhay/amazonka/pull/306) + +### Changed + +- `newEnv` no longer takes `Region` as a parameter and instead defaults to `us-east-1` + per other SDK behaviour. The new `Env` can be configured using the `envRegion` lens + or the `within` combinator. +- Region is now discovered via the `InstanceIdentity` metadata document. [\#308](https://github.com/brendanhay/amazonka/pull/308) +- Region can now be overridden via the `AWS_REGION` environment variable. [\#308](https://github.com/brendanhay/amazonka/pull/308) + + ## [1.4.3](https://github.com/brendanhay/amazonka/tree/1.4.3) -Released: **09 June, 2016**, Compare: [1.4.3](https://github.com/brendanhay/amazonka/compare/1.4.2...1.4.3) +Released: **09 June, 2016**, Compare: [1.4.2](https://github.com/brendanhay/amazonka/compare/1.4.2...1.4.3) ### Fixed @@ -9,14 +106,14 @@ - CloudWatchLogs `FilterLogEvents` pagination now correctly returns all results. [\#296](https://github.com/brendanhay/amazonka/issues/296) - Documentation code samples for IoT, Lambda, and Discovery are now correctly Haddock formatted. -### Changes +### Changed - Documentation is now formatted more consistently at the expense of longer line columns. - `POSIX` timestamps no longer have unecessary (and misleading) Text/XML instances. ## [1.4.2](https://github.com/brendanhay/amazonka/tree/1.4.2) -Released: **03 June, 2016**, Compare: [1.4.2](https://github.com/brendanhay/amazonka/compare/1.4.1...1.4.2) +Released: **03 June, 2016**, Compare: [1.4.1](https://github.com/brendanhay/amazonka/compare/1.4.1...1.4.2) ### Fixed @@ -24,10 +121,15 @@ - APIGateway now correctly parses and encodes `ISO8601` formatted timestamps. [\#291](https://github.com/brendanhay/amazonka/issues/291) - `~/.aws/credentials` now correctly parses with leading newlines. [\#290](https://github.com/brendanhay/amazonka/issues/290) -### Changes +### Changed - `SerializeError` now contains the unparsed response body. [\#293](https://github.com/brendanhay/amazonka/pull/293) +### New Libraries + +- `amazonka-discovery`: Discover on-premises application inventory and dependencies. [Overview](https://aws.amazon.com/application-discovery/) +- `amazonka-application-autoscaling`: General purpose scaling of AWS resources. [API Reference](http://docs.aws.amazon.com/ApplicationAutoScaling/latest/APIReference/Welcome.html) + ### Updated Service Definitions - [WorkSpaces](https://github.com/brendanhay/amazonka/commit/b869bf0) @@ -37,21 +139,16 @@ - [RDS](https://github.com/brendanhay/amazonka/commit/98edec9) - [EC2](https://github.com/brendanhay/amazonka/commit/93b6b72) -### New Libraries - -- `amazonka-discovery`: Discover on-premises application inventory and dependencies. [Overview](https://aws.amazon.com/application-discovery/) -- `amazonka-application-autoscaling`: General purpose scaling of AWS resources. [API Reference](http://docs.aws.amazon.com/ApplicationAutoScaling/latest/APIReference/Welcome.html) - ## [1.4.1](https://github.com/brendanhay/amazonka/tree/1.4.1) -Released: **09 May, 2016**, Compare: [1.4.1](https://github.com/brendanhay/amazonka/compare/1.4.0...1.4.1) +Released: **09 May, 2016**, Compare: [1.4.0](https://github.com/brendanhay/amazonka/compare/1.4.0...1.4.1) ### Fixed - AutoScaling `DescribeAutoScalingInstances` response field `LaunchConfigurationName` is now optional. [\#281](https://github.com/brendanhay/amazonka/issues/281) - SWF `PollForDecisionTask` and `PollForActivityTask` response fields are now optional. [\#285](https://github.com/brendanhay/amazonka/issues/285) -### Changes +### Changed - `NFData` instances generated for all eligible types. [\#283](https://github.com/brendanhay/amazonka/issues/283) - Additional retry cases for HTTP `5XX` response codes. [c5e494e](https://github.com/brendanhay/amazonka/commit/c5e494e2a97fcf2e9210527ed5e8547f1be898de) @@ -99,7 +196,7 @@ ## [1.4.0](https://github.com/brendanhay/amazonka/tree/1.4.0) -Released: **21 March, 2016**, Compare: [1.4.0](https://github.com/brendanhay/amazonka/compare/1.3.7...1.4.0) +Released: **21 March, 2016**, Compare: [1.3.7](https://github.com/brendanhay/amazonka/compare/1.3.7...1.4.0) ### Fixed @@ -158,13 +255,13 @@ ## [1.3.7](https://github.com/brendanhay/amazonka/tree/1.3.7) -Released: **18 December, 2015**, Compare: [1.3.7](https://github.com/brendanhay/amazonka/compare/1.3.6...1.3.7) +Released: **18 December, 2015**, Compare: [1.3.6](https://github.com/brendanhay/amazonka/compare/1.3.6...1.3.7) ### Fixed - Fix SWF `PollFor{Activity,Decision}Task` response deserialisation. [\#257](https://github.com/brendanhay/amazonka/issues/257) -### Changes +### Changed - The `ErrorCode` type constructor is now exported. [\#258](https://github.com/brendanhay/amazonka/issues/258) - Add `Bounded` instances for all enumerations with stable values. [\#255](https://github.com/brendanhay/amazonka/issues/255) @@ -189,7 +286,7 @@ ## [1.3.6](https://github.com/brendanhay/amazonka/tree/1.3.6) -Released: **18 November, 2015**, Compare: [1.3.6](https://github.com/brendanhay/amazonka/compare/1.3.5.1...1.3.6) +Released: **18 November, 2015**, Compare: [1.3.5.1](https://github.com/brendanhay/amazonka/compare/1.3.5.1...1.3.6) ### Fixed @@ -197,7 +294,7 @@ - Fix S3 `BucketLocationConstraint` type de/serialisation. [\#249](https://github.com/brendanhay/amazonka/issues/249) - Fix S3 `PutBucketACL` header vs request body serialisation. [\#241](https://github.com/brendanhay/amazonka/issues/241) -### Changes +### Changed - `await` responses now indicate request fulfillment. [\#245](https://github.com/brendanhay/amazonka/issues/245) @@ -216,7 +313,7 @@ ## [1.3.5.1](https://github.com/brendanhay/amazonka/tree/1.3.5.1) -Released: **18 November, 2015**, Compare: [1.3.5.1](https://github.com/brendanhay/amazonka/compare/1.3.5...1.3.5.1) +Released: **18 November, 2015**, Compare: [1.3.5](https://github.com/brendanhay/amazonka/compare/1.3.5...1.3.5.1) ### Fixed @@ -225,7 +322,11 @@ ## [1.3.5](https://github.com/brendanhay/amazonka/tree/1.3.5) -Released: **27 October, 2015**, Compare: [1.3.5](https://github.com/brendanhay/amazonka/compare/1.3.4...1.3.5) +Released: **27 October, 2015**, Compare: [1.3.4](https://github.com/brendanhay/amazonka/compare/1.3.4...1.3.5) + +### New Libraries + +- `amazonka-apigateway`: API Gateway Service. ### Updated Services Definitions @@ -233,13 +334,12 @@ - DynamoDB: Paginator updates. -### New Libraries - -- `amazonka-apigateway`: API Gateway Service. +## [1.3.4](https://github.com/brendanhay/amazonka/tree/1.3.4) +Released: **25 October, 2015**, Compare: [1.3.3](https://github.com/brendanhay/amazonka/compare/1.3.3...1.3.4) +### New Libraries -## [1.3.4](https://github.com/brendanhay/amazonka/tree/1.3.4) -Released: **25 October, 2015**, Compare: [1.3.4](https://github.com/brendanhay/amazonka/compare/1.3.3...1.3.4) +- `amazonka-iot-dataplane`: Internet of Things Data Plane. ### Updated Services Definitions @@ -250,10 +350,6 @@ - KMS: Multiple type, operation, and documentation updates. - S3: Minor type updates. (Server side encryption related.) -### New Libraries - -- `amazonka-iot-dataplane`: Internet of Things Data Plane. - ## [1.3.3](https://github.com/brendanhay/amazonka/tree/1.3.3) Released: **08 October, 2015**, Compare: [1.3.2.1](https://github.com/brendanhay/amazonka/compare/1.3.2.1...1.3.3) @@ -262,7 +358,16 @@ - Fix S3 `GetBucketLocation` response deserialisation. [\#228](https://github.com/brendanhay/amazonka/issues/228), [\#237](https://github.com/brendanhay/amazonka/issues/237). - `runResourceT` added to documentation example. [\#232](https://github.com/brendanhay/amazonka/issues/232). -- Add S3 infrequent access storage class. [\#234](https://github.com/brendanhay/amazonka/issues/234), [\#238](https://github.com/brendanhay/amazonka/issues/238). +- Add S3 infrequent access storage class. [\#234](https://github.com/brendanhay/amazonka/issues/234), [\#238](https://github.com/brendanhay/amazonka/issues/238) + +### New Libraries + +- `amazonka-elasticsearch`: ElasticSearch Service. +- `amazonka-inspector`: Inspector Service. +- `amazonka-iot`: Internet of Things Platform. +- `amazonka-kinesis-firehose`: Kinesis Firehose Service. +- `amazonka-marketplace-analytics`: Marketplace Commerce Analytics Service. +- `amazonka-waf`: Web Application Firewall Service. ### Updated Service Definitions @@ -276,15 +381,6 @@ - SES: Miscellaneous type and documentation updates. - WorkSpaces: Volume encryption types added. -### New Libraries - -- `amazonka-elasticsearch`: ElasticSearch Service. -- `amazonka-inspector`: Inspector Service. -- `amazonka-iot`: Internet of Things Platform. -- `amazonka-kinesis-firehose`: Kinesis Firehose Service. -- `amazonka-marketplace-analytics`: Marketplace Commerce Analytics Service. -- `amazonka-waf`: Web Application Firewall Service. - ## [1.3.2](https://github.com/brendanhay/amazonka/tree/1.3.2) Released: **18 September, 2015**, Compare: [1.3.1](https://github.com/brendanhay/amazonka/compare/1.3.1...1.3.2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/amazonka-1.4.3/amazonka.cabal new/amazonka-1.4.5/amazonka.cabal --- old/amazonka-1.4.3/amazonka.cabal 2016-06-09 21:31:26.000000000 +0200 +++ new/amazonka-1.4.5/amazonka.cabal 2016-12-04 16:29:21.000000000 +0100 @@ -1,5 +1,5 @@ name: amazonka -version: 1.4.3 +version: 1.4.5 synopsis: Comprehensive Amazon Web Services SDK. homepage: https://github.com/brendanhay/amazonka bug-reports: https://github.com/brendanhay/amazonka/issues @@ -55,14 +55,14 @@ , Network.AWS.Internal.Logger build-depends: - amazonka-core == 1.4.3.* - , base >= 4.7 && < 5 + amazonka-core == 1.4.5.* + , base >= 4.7 && < 5 , bytestring >= 0.9 , conduit >= 1.1 , conduit-extra >= 1.1 , directory >= 1.2 , exceptions >= 0.6 - , http-conduit >= 2.1.4 + , http-conduit >= 2.2 && < 3 , ini >= 0.3.5 , mmorph >= 1 , monad-control >= 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/amazonka-1.4.3/src/Control/Monad/Trans/AWS.hs new/amazonka-1.4.5/src/Control/Monad/Trans/AWS.hs --- old/amazonka-1.4.3/src/Control/Monad/Trans/AWS.hs 2016-06-09 21:31:26.000000000 +0200 +++ new/amazonka-1.4.5/src/Control/Monad/Trans/AWS.hs 2016-12-04 16:29:21.000000000 +0100 @@ -430,7 +430,7 @@ The updated configuration is then passed to the 'Env' during setup: -> e <- newEnv Frankfurt Discover <&> configure dynamo +> e <- newEnv Discover <&> configure dynamo > runResourceT . runAWS e $ do > -- This S3 operation will communicate with remote AWS APIs. > x <- send listBuckets @@ -444,7 +444,7 @@ You can also scope the 'Endpoint' modifications (or any other 'Service' configuration) to specific actions: -> e <- newEnv Ireland Discover +> e <- newEnv Discover > runResourceT . runAWS e $ do > -- Service operations here will communicate with AWS, even DynamoDB. > x <- send listTables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/amazonka-1.4.3/src/Network/AWS/Auth.hs new/amazonka-1.4.5/src/Network/AWS/Auth.hs --- old/amazonka-1.4.3/src/Network/AWS/Auth.hs 2016-06-09 21:31:26.000000000 +0200 +++ new/amazonka-1.4.5/src/Network/AWS/Auth.hs 2016-12-04 16:29:21.000000000 +0100 @@ -65,6 +65,7 @@ import Control.Monad import Control.Monad.Catch import Control.Monad.IO.Class +import Control.Monad.Trans.Maybe (MaybeT (..)) import qualified Data.ByteString.Char8 as BS8 import qualified Data.ByteString.Lazy.Char8 as LBS8 import Data.Char (isSpace) @@ -78,7 +79,7 @@ import Network.AWS.EC2.Metadata import Network.AWS.Lens (catching, catching_, exception, throwingM, _IOException) -import Network.AWS.Lens (Prism', prism) +import Network.AWS.Lens (Prism', prism, (<&>)) import Network.AWS.Prelude import Network.AWS.Types import Network.HTTP.Conduit @@ -98,10 +99,14 @@ envSessionToken :: Text -- ^ AWS_SESSION_TOKEN envSessionToken = "AWS_SESSION_TOKEN" --- | Credentials profile environment variable. +-- | Default credentials profile environment variable. envProfile :: Text -- ^ AWS_PROFILE envProfile = "AWS_PROFILE" +-- | Default region environment variable +envRegion :: Text -- ^ AWS_REGION +envRegion = "AWS_REGION" + -- | Credentials INI file access key variable. credAccessKey :: Text -- ^ aws_access_key_id credAccessKey = "aws_access_key_id" @@ -159,9 +164,9 @@ | FromSession AccessKey SecretKey SessionToken -- ^ Explicit access key, secret key and a session token. See 'fromSession'. - | FromEnv Text Text (Maybe Text) - -- ^ Lookup specific environment variables for access key, secret key, and - -- an optional session token respectively. + | FromEnv Text Text (Maybe Text) (Maybe Text) + -- ^ Lookup specific environment variables for access key, secret key, + -- an optional session token, and an optional region, respectively. | FromProfile Text -- ^ An IAM Profile name to lookup from the local EC2 instance-data. @@ -175,11 +180,12 @@ | Discover -- ^ Attempt credentials discovery via the following steps: -- - -- * Read the 'envAccessKey' and 'envSecretKey' from the environment if they are set. + -- * Read the 'envAccessKey', 'envSecretKey', and 'envRegion' from the environment if they are set. -- -- * Read the credentials file if 'credFile' exists. -- - -- * Retrieve the first available IAM profile if running on EC2. + -- * Retrieve the first available IAM profile and read + -- the 'Region' from the instance identity document, 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. @@ -189,12 +195,18 @@ instance ToLog Credentials where build = \case - FromKeys a _ -> "FromKeys " <> build a <> " ****" - FromSession a _ _ -> "FromSession " <> build a <> " **** ****" - FromEnv a s t -> "FromEnv " <> build a <> " " <> build s <> " " <> m t - FromProfile n -> "FromProfile " <> build n - FromFile n f -> "FromFile " <> build n <> " " <> build f - Discover -> "Discover" + FromKeys a _ -> + "FromKeys " <> build a <> " ****" + FromSession a _ _ -> + "FromSession " <> build a <> " **** ****" + FromEnv a s t r -> + "FromEnv " <> build a <> " " <> build s <> " " <> m t <> " " <> m r + FromProfile n -> + "FromProfile " <> build n + FromFile n f -> + "FromFile " <> build n <> " " <> build f + Discover -> + "Discover" where m (Just x) = "(Just " <> build x <> ")" m Nothing = "Nothing" @@ -206,6 +218,7 @@ data AuthError = RetrievalError HttpException | MissingEnvError Text + | InvalidEnvError Text | MissingFileError FilePath | InvalidFileError Text | InvalidIAMError Text @@ -217,6 +230,7 @@ build = \case RetrievalError e -> build e MissingEnvError e -> "[MissingEnvError] { message = " <> build e <> "}" + InvalidEnvError e -> "[InvalidEnvError] { message = " <> build e <> "}" MissingFileError f -> "[MissingFileError] { path = " <> build f <> "}" InvalidFileError e -> "[InvalidFileError] { message = " <> build e <> "}" InvalidIAMError e -> "[InvalidIAMError] { message = " <> build e <> "}" @@ -230,9 +244,12 @@ -- the local metadata endpoint. _RetrievalError :: Prism' a HttpException - -- | An error occured looking up a named environment variable. + -- | The named environment variable was not found. _MissingEnvError :: Prism' a Text + -- | An error occured parsing named environment variable's value. + _InvalidEnvError :: Prism' a Text + -- | The specified credentials file could not be found. _MissingFileError :: Prism' a FilePath @@ -244,6 +261,7 @@ _RetrievalError = _AuthError . _RetrievalError _MissingEnvError = _AuthError . _MissingEnvError + _InvalidEnvError = _AuthError . _InvalidEnvError _MissingFileError = _AuthError . _MissingFileError _InvalidFileError = _AuthError . _InvalidFileError _InvalidIAMError = _AuthError . _InvalidIAMError @@ -262,6 +280,10 @@ MissingEnvError e -> Right e x -> Left x + _InvalidEnvError = prism InvalidEnvError $ \case + InvalidEnvError e -> Right e + x -> Left x + _MissingFileError = prism MissingFileError $ \case MissingFileError f -> Right f x -> Left x @@ -281,14 +303,14 @@ getAuth :: (Applicative m, MonadIO m, MonadCatch m) => Manager -> Credentials - -> m Auth + -> m (Auth, Maybe Region) getAuth m = \case - FromKeys a s -> return (fromKeys a s) - FromSession a s t -> return (fromSession a s t) - FromEnv a s t -> fromEnvKeys a s t - FromProfile n -> fromProfileName m n - FromFile n f -> fromFilePath n f - Discover -> + FromKeys a s -> return (fromKeys a s, Nothing) + FromSession a s t -> return (fromSession a s t, Nothing) + FromEnv a s t r -> fromEnvKeys a s t r + FromProfile n -> fromProfileName m n + FromFile n f -> fromFilePath n f + Discover -> -- Don't try and catch InvalidFileError, or InvalidIAMProfile, -- let both errors propagate. catching_ _MissingEnvError fromEnv $ @@ -309,8 +331,13 @@ -- cannot be read, but not if the session token is absent. -- -- /See:/ 'envAccessKey', 'envSecretKey', 'envSessionToken' -fromEnv :: (Applicative m, MonadIO m, MonadThrow m) => m Auth -fromEnv = fromEnvKeys envAccessKey envSecretKey (Just envSessionToken) +fromEnv :: (Applicative m, MonadIO m, MonadThrow m) => m (Auth, Maybe Region) +fromEnv = + fromEnvKeys + envAccessKey + envSecretKey + (Just envSessionToken) + (Just envRegion) -- | Retrieve access key, secret key and a session token from specific -- environment variables. @@ -321,13 +348,26 @@ => Text -- ^ Access key environment variable. -> Text -- ^ Secret key environment variable. -> Maybe Text -- ^ Session token environment variable. - -> m Auth -fromEnvKeys a s t = fmap Auth $ AuthEnv - <$> (AccessKey <$> req a) - <*> (SecretKey <$> req s) - <*> (fmap SessionToken <$> opt t) - <*> pure Nothing + -> Maybe Text -- ^ Region environment variable. + -> m (Auth, Maybe Region) +fromEnvKeys access secret session region = + (,) <$> fmap Auth lookupKeys <*> lookupRegion where + lookupKeys = AuthEnv + <$> (req access <&> AccessKey . BS8.pack) + <*> (req secret <&> SecretKey . BS8.pack) + <*> (opt session <&> fmap (SessionToken . BS8.pack)) + <*> return Nothing + + lookupRegion :: (MonadIO m, MonadThrow m) => m (Maybe Region) + lookupRegion = runMaybeT $ do + k <- MaybeT (return region) + r <- MaybeT (opt region) + case fromText (Text.pack r) of + Right x -> return x + Left e -> throwM . InvalidEnvError $ + "Unable to parse ENV variable: " <> k <> ", " <> Text.pack e + req k = do m <- opt (Just k) maybe (throwM . MissingEnvError $ "Unable to read ENV variable: " <> k) @@ -335,7 +375,7 @@ m opt Nothing = return Nothing - opt (Just k) = fmap BS8.pack <$> liftIO (lookupEnv (Text.unpack k)) + opt (Just k) = liftIO (lookupEnv (Text.unpack k)) -- | Loads the default @credentials@ INI file using the default profile name. -- @@ -343,12 +383,11 @@ -- if an error occurs during parsing. -- -- /See:/ 'credProfile', 'credFile', and 'envProfile' -fromFile :: (Applicative m, MonadIO m, MonadCatch m) => m Auth +fromFile :: (Applicative m, MonadIO m, MonadCatch m) => m (Auth, Maybe Region) fromFile = do - f <- credFile - ep <- liftIO (lookupEnv (Text.unpack envProfile)) - let p = Text.pack (fromMaybe (Text.unpack credProfile) ep) - fromFilePath p f + p <- liftIO (lookupEnv (Text.unpack envProfile)) + fromFilePath (maybe credProfile Text.pack p) + =<< credFile -- | Retrieve the access, secret and session token from the specified section -- (profile) in a valid INI @credentials@ file. @@ -358,17 +397,18 @@ fromFilePath :: (Applicative m, MonadIO m, MonadCatch m) => Text -> FilePath - -> m Auth + -> m (Auth, Maybe Region) fromFilePath n f = do p <- liftIO (doesFileExist f) unless p $ throwM (MissingFileError f) - i <- liftIO (INI.readIniFile f) >>= either (invalidErr Nothing) return - fmap Auth $ AuthEnv - <$> (AccessKey <$> req credAccessKey i) - <*> (SecretKey <$> req credSecretKey i) - <*> (fmap SessionToken <$> opt credSessionToken i) - <*> pure Nothing + ini <- either (invalidErr Nothing) return =<< liftIO (INI.readIniFile f) + env <- AuthEnv + <$> (req credAccessKey ini <&> AccessKey) + <*> (req credSecretKey ini <&> SecretKey) + <*> (opt credSessionToken ini <&> fmap SessionToken) + <*> return Nothing + return (Auth env, Nothing) where req k i = case INI.lookupValue n k i of @@ -396,7 +436,7 @@ -- -- 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 +fromProfile :: (MonadIO m, MonadCatch m) => Manager -> m (Auth, Maybe Region) fromProfile m = do ls <- try $ metadata m (IAM (SecurityCredentials Nothing)) case BS8.lines `liftM` ls of @@ -419,23 +459,36 @@ -- -- 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 -fromProfileName m name = auth >>= start +fromProfileName :: (MonadIO m, MonadCatch m) + => Manager + -> Text + -> m (Auth, Maybe Region) +fromProfileName m name = do + auth <- getCredentials >>= start + reg <- getRegion + return (auth, Just reg) where - auth :: (MonadIO m, MonadCatch m) => m AuthEnv - auth = do - bs <- try $ metadata m (IAM . SecurityCredentials $ Just name) - case bs of - Left e -> throwM (RetrievalError e) - Right x -> - either (throwM . invalidErr) - return - (eitherDecode' (LBS8.fromStrict x)) + getCredentials :: (MonadIO m, MonadCatch m) => m AuthEnv + getCredentials = + try (metadata m (IAM . SecurityCredentials $ Just name)) >>= + handleErr (eitherDecode' . LBS8.fromStrict) invalidIAMErr + + getRegion :: (MonadIO m, MonadCatch m) => m Region + getRegion = + try (identity m) >>= + handleErr (fmap _region) invalidIdentityErr + + handleErr _ _ (Left e) = throwM (RetrievalError e) + handleErr f g (Right x) = either (throwM . g) return (f x) - invalidErr = InvalidIAMError + invalidIAMErr = InvalidIAMError . mappend ("Error parsing IAM profile '" <> name <> "' ") . Text.pack + invalidIdentityErr = InvalidIAMError + . mappend "Error parsing Instance Identity Document " + . Text.pack + start :: MonadIO m => AuthEnv -> m Auth start !a = liftIO $ case _authExpiry a of @@ -455,8 +508,8 @@ loop :: Weak (IORef AuthEnv) -> ThreadId -> UTCTime -> IO () loop w !p !x = do diff x <$> getCurrentTime >>= threadDelay - ea <- try auth - case ea of + env <- try getCredentials + case env of Left e -> throwTo p (RetrievalError e) Right !a -> do mr <- deRefWeak w diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/amazonka-1.4.3/src/Network/AWS/EC2/Metadata.hs new/amazonka-1.4.5/src/Network/AWS/EC2/Metadata.hs --- old/amazonka-1.4.3/src/Network/AWS/EC2/Metadata.hs 2016-06-09 21:31:26.000000000 +0200 +++ new/amazonka-1.4.5/src/Network/AWS/EC2/Metadata.hs 2016-12-04 16:29:21.000000000 +0100 @@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} -- | -- Module : Network.AWS.EC2.Metadata @@ -27,13 +28,33 @@ , dynamic , metadata , userdata + , identity -- ** Path Constructors - , Dynamic (..) - , Metadata (..) - , Mapping (..) - , Info (..) - , Interface (..) + , Dynamic (..) + , Metadata (..) + , Mapping (..) + , Info (..) + , Interface (..) + + -- ** Identity Document + , IdentityDocument (..) + + -- *** Lenses + , devpayProductCodes + , billingProducts + , version + , privateIp + , availabilityZone + , region + , instanceId + , instanceType + , accountId + , imageId + , kernelId + , ramdiskId + , architecture + , pendingTime ) where import Control.Monad @@ -43,6 +64,9 @@ import qualified Data.ByteString.Lazy as LBS import Data.Monoid import qualified Data.Text as Text +import Network.AWS.Data.JSON +import Network.AWS.Data.Time +import Network.AWS.Lens (Lens', lens, mapping) import Network.AWS.Prelude hiding (request) import Network.HTTP.Conduit @@ -55,6 +79,7 @@ | Document -- ^ JSON containing instance attributes, such as instance-id, -- private IP address, etc. + -- /See:/ 'identity', 'InstanceDocument'. | PKCS7 -- ^ Used to verify the document's authenticity and content against the -- signature. @@ -305,10 +330,122 @@ userdata m = do x <- try $ get m (latest <> "user-data") case x of - Right b -> return (Just b) - Left (StatusCodeException s _ _) - | fromEnum s == 404 -> return Nothing - Left e -> throwM e + Left (HttpExceptionRequest _ (StatusCodeException rs _)) + | fromEnum (responseStatus rs) == 404 + -> return Nothing + Left e -> throwM e + Right b -> return (Just b) + +-- | Represents an instance's identity document. +-- +-- /Note:/ Fields such as '_instanceType' are represented as unparsed 'Text' and +-- will need to be manually parsed using 'fromText' when the relevant types +-- from a library such as "Network.AWS.EC2" are brought into scope. +data IdentityDocument = IdentityDocument + { _devpayProductCodes :: Maybe Text + , _billingProducts :: Maybe Text + , _version :: Maybe Text + , _privateIp :: Maybe Text + , _availabilityZone :: Text + , _region :: !Region + , _instanceId :: Text + , _instanceType :: Text + , _accountId :: Text + , _imageId :: Maybe Text + , _kernelId :: Maybe Text + , _ramdiskId :: Maybe Text + , _architecture :: Maybe Text + , _pendingTime :: Maybe ISO8601 + } deriving (Eq, Show) + +devpayProductCodes :: Lens' IdentityDocument (Maybe Text) +devpayProductCodes = lens _devpayProductCodes (\s a -> s { _devpayProductCodes = a }) + +billingProducts :: Lens' IdentityDocument (Maybe Text) +billingProducts = lens _billingProducts (\s a -> s { _billingProducts = a }) + +version :: Lens' IdentityDocument (Maybe Text) +version = lens _version (\s a -> s { _version = a }) + +privateIp :: Lens' IdentityDocument (Maybe Text) +privateIp = lens _privateIp (\s a -> s { _privateIp = a }) + +availabilityZone :: Lens' IdentityDocument Text +availabilityZone = lens _availabilityZone (\s a -> s { _availabilityZone = a }) + +region :: Lens' IdentityDocument Region +region = lens _region (\s a -> s { _region = a }) + +instanceId :: Lens' IdentityDocument Text +instanceId = lens _instanceId (\s a -> s { _instanceId = a }) + +instanceType :: Lens' IdentityDocument Text +instanceType = lens _instanceType (\s a -> s { _instanceType = a }) + +accountId :: Lens' IdentityDocument Text +accountId = lens _accountId (\s a -> s { _accountId = a }) + +imageId :: Lens' IdentityDocument (Maybe Text) +imageId = lens _imageId (\s a -> s { _imageId = a }) + +kernelId :: Lens' IdentityDocument (Maybe Text) +kernelId = lens _kernelId (\s a -> s { _kernelId = a }) + +ramdiskId :: Lens' IdentityDocument (Maybe Text) +ramdiskId = lens _ramdiskId (\s a -> s { _ramdiskId = a }) + +architecture :: Lens' IdentityDocument (Maybe Text) +architecture = lens _architecture (\s a -> s { _architecture = a }) + +pendingTime :: Lens' IdentityDocument (Maybe UTCTime) +pendingTime = lens _pendingTime (\s a -> s { _pendingTime = a }) . mapping _Time + +instance FromJSON IdentityDocument where + parseJSON = withObject "dynamic/instance-identity/document" $ \o -> do + _devpayProductCodes <- o .:? "devpayProductCodes" + _billingProducts <- o .:? "billingProducts" + _privateIp <- o .:? "privateIp" + _version <- o .:? "version" + _availabilityZone <- o .: "availabilityZone" + _region <- o .: "region" + _instanceId <- o .: "instanceId" + _instanceType <- o .: "instanceType" + _accountId <- o .: "accountId" + _imageId <- o .:? "imageId" + _kernelId <- o .:? "kernelId" + _ramdiskId <- o .:? "ramdiskId" + _architecture <- o .:? "architecture" + _pendingTime <- o .:? "pendingTime" + pure IdentityDocument{..} + +instance ToJSON IdentityDocument where + toJSON IdentityDocument{..} = + object + [ "devpayProductCodes" .= _devpayProductCodes + , "billingProducts" .= _billingProducts + , "privateIp" .= _privateIp + , "version" .= _version + , "availabilityZone" .= _availabilityZone + , "region" .= _region + , "instanceId" .= _instanceId + , "instanceType" .= _instanceType + , "accountId" .= _accountId + , "imageId" .= _imageId + , "kernelId" .= _kernelId + , "ramdiskId" .= _ramdiskId + , "architecture" .= _architecture + ] + +-- | Retrieve the instance's identity document, detailing various EC2 metadata. +-- +-- You can alternatively retrieve the raw unparsed identity document by using +-- 'dynamic' and the 'Document' path. +-- +-- /See:/ <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html AWS Instance Identity Documents>. +identity :: (MonadIO m, MonadThrow m) + => Manager + -> m (Either String IdentityDocument) +identity m = (eitherDecode . LBS.fromStrict) `liftM` dynamic m Document get :: (MonadIO m, MonadThrow m) => Manager -> Text -> m ByteString get m url = liftIO (strip `liftM` request m url) @@ -319,6 +456,6 @@ request :: Manager -> Text -> IO ByteString request m url = do - rq <- parseUrl (Text.unpack url) + rq <- parseUrlThrow (Text.unpack url) rs <- httpLbs rq m return . LBS.toStrict $ responseBody rs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/amazonka-1.4.3/src/Network/AWS/Env.hs new/amazonka-1.4.5/src/Network/AWS/Env.hs --- old/amazonka-1.4.3/src/Network/AWS/Env.hs 2016-06-09 21:31:26.000000000 +0200 +++ new/amazonka-1.4.5/src/Network/AWS/Env.hs 2016-12-04 16:29:21.000000000 +0100 @@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} @@ -37,6 +38,7 @@ , retryConnectionFailure ) where +import Data.Maybe (fromMaybe) import Control.Applicative import Control.Monad.Catch import Control.Monad.IO.Class @@ -170,6 +172,11 @@ -- and uses 'getAuth' to expand/discover the supplied 'Credentials'. -- Lenses from 'HasEnv' can be used to further configure the resulting 'Env'. -- +-- /Since:/ @1.5.0@ - The region is now retrieved from the @AWS_REGION@ environment +-- variable (identical to official SDKs), or defaults to @us-east-1@. +-- You can override the 'Env' region by using 'envRegion', or the current operation's +-- region by using 'within'. +-- -- /Since:/ @1.3.6@ - The default logic for retrying 'HttpException's now uses -- 'retryConnectionFailure' to retry specific connection failure conditions up to 3 times. -- Previously only service specific errors were automatically retried. @@ -180,33 +187,41 @@ -- -- /See:/ 'newEnvWith'. newEnv :: (Applicative m, MonadIO m, MonadCatch m) - => Region -- ^ Initial region to operate in. - -> Credentials -- ^ Credential discovery mechanism. + => Credentials -- ^ Credential discovery mechanism. -> m Env -newEnv r c = liftIO (newManager conduitManagerSettings) - >>= newEnvWith r c Nothing +newEnv c = + liftIO (newManager conduitManagerSettings) + >>= newEnvWith c Nothing -- | /See:/ 'newEnv' -- +-- The 'Maybe' 'Bool' parameter is used by the EC2 instance check. By passing a +-- value of 'Nothing', the check will be performed. 'Just' 'True' would cause +-- the check to be skipped and the host treated as an EC2 instance. +-- -- Throws 'AuthError' when environment variables or IAM profiles cannot be read. newEnvWith :: (Applicative m, MonadIO m, MonadCatch m) - => Region -- ^ Initial region to operate in. - -> Credentials -- ^ Credential discovery mechanism. - -> Maybe Bool -- ^ Dictate if the instance is running on EC2. (Preload memoisation.) + => Credentials -- ^ Credential discovery mechanism. + -> Maybe Bool -- ^ Preload the EC2 instance check. -> Manager -> m Env -newEnvWith r c p m = +newEnvWith c p m = do + (a, fromMaybe NorthVirginia -> r) <- getAuth m c Env r (\_ _ -> pure ()) (retryConnectionFailure 3) mempty m <$> liftIO (newIORef p) - <*> getAuth m c + <*> pure a -- | Retry the subset of transport specific errors encompassing connection -- failure up to the specific number of times. retryConnectionFailure :: Int -> Int -> HttpException -> Bool -retryConnectionFailure limit n = \case - _ | n >= limit -> False - NoResponseDataReceived -> True - FailedConnectionException {} -> True - FailedConnectionException2 {} -> True - TlsException {} -> True - _ -> False +retryConnectionFailure _ _ InvalidUrlException {} = False +retryConnectionFailure limit n (HttpExceptionRequest _ ex) + | n >= limit = False + | otherwise = + case ex of + NoResponseDataReceived -> True + ConnectionTimeout -> True + ConnectionClosed -> True + ConnectionFailure {} -> True + InternalException {} -> True + _ -> False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/amazonka-1.4.3/src/Network/AWS.hs new/amazonka-1.4.5/src/Network/AWS.hs --- old/amazonka-1.4.3/src/Network/AWS.hs 2016-06-09 21:31:26.000000000 +0200 +++ new/amazonka-1.4.5/src/Network/AWS.hs 2016-12-04 16:29:21.000000000 +0100 @@ -299,17 +299,20 @@ * 'await' -To utilise these, you will need to specify what 'Region' you wish to operate in -and your Amazon credentials for AuthN/AuthZ purposes. +These functions have constraints that types from the @amazonka-*@ libraries +satisfy. To utilise these, you will need to specify what 'Region' you wish to +operate in and your Amazon credentials for AuthN/AuthZ purposes. 'Credentials' can be supplied in a number of ways. Either via explicit keys, -via session profiles, or have Amazonka determine the credentials from an +via session profiles, or have Amazonka retrieve the credentials from an underlying IAM Role/Profile. As a basic example, you might wish to store an object in an S3 bucket using <http://hackage.haskell.org/package/amazonka-s3 amazonka-s3>: @ +{-# LANGUAGE OverloadedStrings #-} + import Control.Lens import Network.AWS import Network.AWS.S3 @@ -317,20 +320,26 @@ example :: IO PutObjectResponse example = do - -- To specify configuration preferences, 'newEnv' is used to create a new 'Env'. The 'Region' denotes the AWS region requests will be performed against, - -- and 'Credentials' is used to specify the desired mechanism for supplying or retrieving AuthN/AuthZ information. - -- In this case, 'Discover' will cause the library to try a number of options such as default environment variables, or an instance's IAM Profile: - e <- newEnv Frankfurt Discover - - -- A new 'Logger' to replace the default noop logger is created, with the logger set to print debug information and errors to stdout: - l <- newLogger Debug stdout - - -- The payload (and hash) for the S3 object is retrieved from a FilePath: - b <- sourceFileIO "local\/path\/to\/object-payload" - - -- We now run the AWS computation with the overriden logger, performing the PutObject request: - runResourceT . runAWS (e & envLogger .~ l) $ - send (putObject "bucket-name" "object-key" b) + -- A new 'Logger' to replace the default noop logger is created, with the logger + -- set to print debug information and errors to stdout: + lgr <- newLogger Debug stdout + + -- To specify configuration preferences, 'newEnv' is used to create a new + -- configuration environment. The 'Credentials' parameter is used to specify + -- mechanism for supplying or retrieving AuthN/AuthZ information. + -- In this case 'Discover' will cause the library to try a number of options such + -- as default environment variables, or an instance's IAM Profile and identity document: + env <- newEnv Discover + + -- The payload (and hash) for the S3 object is retrieved from a 'FilePath': + body <- sourceFileIO "local\/path\/to\/object-payload" + + -- We now run the 'AWS' computation with the overriden logger, performing the + -- 'PutObject' request. 'envRegion' or 'within' can be used to set the + -- remote AWS 'Region': + runResourceT $ runAWS (env & envLogger .~ lgr) $ + within Frankfurt $ + send (putObject "bucket-name" "object-key" body) @ -}
