This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| platform :ios, '11.0' | |
| target 'AuthLWA' do | |
| # Comment the next line if you're not using Swift and don't want to use dynamic frameworks | |
| use_frameworks! | |
| # Pods for Auth | |
| pod 'AWSMobileClient', '~> 2.9.0' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // AuthLWA with AWSMobileClient using Federated Identities | |
| // | |
| // Created by Hills, Dennis on 4/26/19. | |
| // Copyright © 2019 Hills, Dennis. All rights reserved. | |
| // | |
| // Requires LoginWithAmazonProxy via Gist here: https://gist.github.com/mobilequickie/56916503a41ebb2374fea241ede26eab | |
| // This gist: https://gist.github.com/mobilequickie/47a238e073043a271425f7ffe9d56d5e | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // AuthLWA | |
| // | |
| // Created by Hills, Dennis on 4/26/19. | |
| // Copyright © 2018 Hills, Dennis. All rights reserved. | |
| // | |
| // Gist: https://gist.github.com/mobilequickie/77c60e2204e759ed0a72bde0478c0885 | |
| // | |
| import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aws rds create-db-cluster --db-cluster-identifier my-serverless-cluster --master-username mymasteruser \ | |
| --master-user-password mymasterpassword --engine aurora --engine-mode serverless \ | |
| --region us-east-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Select * query from Aurora Serverless (w/ Data API enabled) using the "execute-sql" API | |
| aws rds-data execute-sql --db-cluster-or-instance-arn "arn:aws:rds:us-east-1:xxxxxxxxxxxx:cluster:my-serverless-cluster" --schema "" \ | |
| --database "MarketPlace" --aws-secret-store-arn "arn:aws:secretsmanager:us-east-1:xxxxxxxxxxxx:secret:RDSAuroraServerlessMasterSecret-3haLhV" \ | |
| --sql-statements "select * from Customers" --region us-east-1 \ | |
| --endpoint-url https://rds-data.us-east-1.amazonaws.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mutation CreateCustomer { | |
| createCustomers(createCustomersInput: { | |
| id: 2, | |
| name: "Customer Two", | |
| phone: "206-555-xxxx", | |
| email: "[email protected]" | |
| }) { | |
| id | |
| name | |
| phone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // As of April 25, 2019 --> Make sure to call $ 'npm install aws-sdk' to package this function before deploying to Lambda as the RDSDataService API is currently in BETA and | |
| // therefore not available in the default aws-sdk included in the Node 8 engine built into Lambda. | |
| // This code uses RDSDataService API for connecting to a Data API enabled Aurora Serverless database: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/RDSDataService.html | |
| // Call this function with: { "sqlStatement": "SELECT * FROM <YOUR-TABLE-NAME"} | |
| // Deploy this Lambda function via CloudFormation here: https://github.com/mobilequickie/rds-aurora-mysql-serverless | |
| const AWS = require('aws-sdk') | |
| const RDS = new AWS.RDSDataService() | |
| exports.handler = async (event, context) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import AWSAppSync // #1 | |
| class AWSServicesTableViewController: UITableViewController { | |
| // Reference AppSync client | |
| var appSyncClient: AWSAppSyncClient? // #2 | |
| // Sample data | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // GraphQL Mutation - Add a new AWS Service to the MyAWSService database table | |
| func createServiceMutation(){ | |
| // A quick sample insert | |
| let createServiceInput = CreateAWSServiceInput(id: 6, shortName: "Device Farm", longName: "AWS Device Farm", serviceRegionName: "aws-device-farm-us-west-2", imageUrl: "device-farm") | |
| appSyncClient?.perform(mutation: CreateAwsServiceMutation(createAWSServiceInput: createServiceInput)) { | |
| (result, error) in | |
| if let error = error as? AWSAppSyncClientError { | |
| print("Error occurred: \(error.localizedDescription )") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // GraphQL Query - List all AWS Services from MyAWSServices Table | |
| // Returned cached list and then fetch | |
| func getServicesQuery(){ | |
| appSyncClient?.fetch(query: ListAwsServicesQuery(), cachePolicy: .returnCacheDataAndFetch) { (result, error) in | |
| if error != nil { | |
| print(error?.localizedDescription ?? "") | |
| return | |
| } | |
| guard let services = result?.data?.listAwsServices else { return } |