hexsha
stringlengths
40
40
size
int64
3
1.03M
content
stringlengths
3
1.03M
avg_line_length
float64
1.33
100
max_line_length
int64
2
1k
alphanum_fraction
float64
0.25
0.99
9b560f6639383a06c0cca80282a333d759ebe92b
1,645
import UIKit extension NewsCollectionViewCell { public func configure(with story: WMFFeedNewsStory, dataStore: MWKDataStore, showArticles: Bool = true, theme: Theme, layoutOnly: Bool) { let previews = story.articlePreviews ?? [] descriptionHTML = story.storyHTML if showArticles { articles = previews.map { (articlePreview) -> CellArticle in return CellArticle(articleURL:articlePreview.articleURL, title: articlePreview.displayTitle, titleHTML: articlePreview.displayTitleHTML, description: articlePreview.descriptionOrSnippet, imageURL: articlePreview.thumbnailURL) } } let firstArticleURL = story.articlePreviews?.first?.articleURL descriptionLabel.accessibilityLanguage = firstArticleURL?.wmf_languageCode semanticContentAttributeOverride = MWKLanguageLinkController.semanticContentAttribute(forContentLanguageCode: firstArticleURL?.wmf_contentLanguageCode) let imageWidthToRequest = traitCollection.wmf_potdImageWidth if let articleURL = story.featuredArticlePreview?.articleURL ?? previews.first?.articleURL, let article = dataStore.fetchArticle(with: articleURL), let imageURL = article.imageURL(forWidth: imageWidthToRequest) { isImageViewHidden = false if !layoutOnly { imageView.wmf_setImage(with: imageURL, detectFaces: true, onGPU: true, failure: {(error) in }, success: { }) } } else { isImageViewHidden = true } apply(theme: theme) resetContentOffset() setNeedsLayout() } }
49.848485
241
0.696049
39b0d9f1f38f7dbc43379f3ae455c0f6b2e2571f
10,488
// // PersonDetailView.swift // TMDB // // Created by Tuyen Le on 12/26/20. // Copyright © 2020 Tuyen Le. All rights reserved. // import UIKit import RxSwift import RxDataSources import RealmSwift class PersonDetailView: UIViewController { var viewModel: PersonDetailViewModelProtocol var id: Int? var delegate: AppCoordinator? // MARK: - datasource let creditDataSource: RxCollectionViewSectionedReloadDataSource<SectionModel<String, Object>> = RxCollectionViewSectionedReloadDataSource(configureCell: { dataSource, collectionView, indexPath, item in let cell: TMDBCellConfig? = collectionView.dequeueReusableCell(withReuseIdentifier: Constant.Identifier.previewItem, for: indexPath) as? TMDBCellConfig cell?.configure(item: item) return cell as! UICollectionViewCell }) // MARK: - constraints @IBOutlet weak var deathdateTop: NSLayoutConstraint! @IBOutlet weak var creditCollectionViewHeight: NSLayoutConstraint! @IBOutlet weak var homepageTop: NSLayoutConstraint! @IBOutlet weak var posterImageViewTop: NSLayoutConstraint! // MARK: - views @IBOutlet weak var personNameLabel: UILabel! @IBOutlet weak var imdbLabel: UILabel! @IBOutlet weak var birthdateLabel: UILabel! @IBOutlet weak var deathdateLabel: UILabel! @IBOutlet weak var genderLabel: UILabel! @IBOutlet weak var occupationLabel: UILabel! @IBOutlet weak var homepageLabel: UILabel! @IBOutlet weak var aliasLabel: UILabel! @IBOutlet weak var ratingLabel: TMDBCircleUserRating! @IBOutlet weak var creditCollectionView: UICollectionView! { didSet { creditCollectionView.collectionViewLayout = CollectionViewLayout.customLayout(widthDimension: 0.3, heightDimension: 1) creditCollectionView.register(UINib(nibName: "TMDBPreviewItemCell", bundle: nil), forCellWithReuseIdentifier: Constant.Identifier.previewItem) creditCollectionView.register(TMDBPersonCreditHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: Constant.Identifier.previewHeader) creditDataSource.configureSupplementaryView = { dataSource, collectionView, kind, indexPath in return collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: Constant.Identifier.previewHeader, for: indexPath) } } } @IBOutlet weak var profileImageView: UIImageView! { didSet { profileImageView.roundImage() profileImageView.layer.borderWidth = 1 } } @IBOutlet weak var scrollView: UIScrollView! { didSet { scrollView.parallaxHeader.view = profileCollectionView } } @IBOutlet weak var profileCollectionView: UICollectionView! { didSet { profileCollectionView.collectionViewLayout = CollectionViewLayout.imageLayout() profileCollectionView.register(TMDBBackdropImageCell.self, forCellWithReuseIdentifier: Constant.Identifier.cell) } } // MARK: - init init(viewModel: PersonDetailViewModelProtocol) { self.viewModel = viewModel super.init(nibName: String(describing: PersonDetailView.self), bundle: nil) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } // MARK: - override override func viewDidLoad() { super.viewDidLoad() navigationItem.setBackArrowIcon() setupBinding() if let personId = id { profileImageView.showAnimatedGradientSkeleton() birthdateLabel.showAnimatedGradientSkeleton() deathdateLabel.showAnimatedGradientSkeleton() genderLabel.showAnimatedGradientSkeleton() occupationLabel.showAnimatedGradientSkeleton() imdbLabel.showAnimatedGradientSkeleton() homepageLabel.showAnimatedGradientSkeleton() aliasLabel.showAnimatedGradientSkeleton() personNameLabel.showAnimatedGradientSkeleton() scrollView.parallaxHeader.contentView.showAnimatedGradientSkeleton() viewModel.getPersonDetail(id: personId) } } override func viewWillAppear(_ animated: Bool) { navigationController?.resetNavBar() } } extension PersonDetailView { func setupBinding() { // left bar button item navigationItem .leftBarButtonItem? .rx .tap .subscribe { _ in self.delegate?.navigateBack() } .disposed(by: rx.disposeBag) // scrollview binding scrollView.animateNavBar(safeAreaInsetTop: view.safeAreaInsets.top, navigationController: navigationController) // bind person detail result viewModel .personDetail .subscribe { event in guard let person = event.element else { return } if let path = person.profilePath, let url = self.viewModel.userSetting.getImageURL(from: path) { self.profileImageView.sd_setImage(with: url) } if person.deathday?.isEmpty ?? true { self.deathdateTop.constant = 0 } if person.homepage?.isEmpty ?? true { self.homepageTop.constant = 0 } self.ratingLabel.rating = person.popularity self.title = person.name self.profileImageView.hideSkeleton() self.birthdateLabel.hideSkeleton() self.deathdateLabel.hideSkeleton() self.genderLabel.hideSkeleton() self.occupationLabel.hideSkeleton() self.imdbLabel.hideSkeleton() self.homepageLabel.hideSkeleton() self.aliasLabel.hideSkeleton() self.personNameLabel.hideSkeleton() self.scrollView.parallaxHeader.contentView.hideSkeleton() } .disposed(by: rx.disposeBag) // bind profile collection view viewModel .profileCollectionImages .bind(to: profileCollectionView.rx.items(cellIdentifier: Constant.Identifier.cell)) { _, image, cell in (cell as? TMDBBackdropImageCell)?.configure(item: image) } .disposed(by: rx.disposeBag) viewModel .profileCollectionImages .subscribe { event in self.scrollView.parallaxHeader.dots = event.element?.count ?? 0 } .disposed(by: rx.disposeBag) profileCollectionView .rx .didEndDisplayingCell .subscribe { cell, indexPath in guard let index = self.profileCollectionView.indexPathsForVisibleItems.first?.row else { return } self.scrollView.parallaxHeader.selectDot(at: index) } .disposed(by: rx.disposeBag) // credit binding viewModel .credits .bind(to: creditCollectionView.rx.items(dataSource: creditDataSource)) .disposed(by: rx.disposeBag) creditCollectionView .rx .willDisplaySupplementaryView .take(1) .asDriver(onErrorDriveWith: .empty()) .drive(onNext: { supplementary, _, _ in let header = supplementary as? TMDBPersonCreditHeaderView header?.shouldRemoveSegment(self.viewModel.noTVShowCredit, at: 1) header?.shouldRemoveSegment(self.viewModel.noMovieCredit, at: 0) self.creditCollectionViewHeight.constant = self.viewModel.creditCollectionViewHeight header? .segmentControl .rx .value .changed .asDriver() .drive(onNext: { index in self.creditCollectionView.scrollToItem(at: IndexPath(row: 0, section: 0), at: .centeredHorizontally, animated: true) self.viewModel.handleCreditSelection(at: index, personId: self.id!) }) .disposed(by: self.rx.disposeBag) }) .disposed(by: rx.disposeBag) creditCollectionView .rx .itemSelected .asDriver() .drive(onNext: { indexPath in self.delegate?.navigateWith(obj: self.creditDataSource.sectionModels.first?.items[indexPath.row]) }) .disposed(by: rx.disposeBag) // bind label viewModel .personName .bind(to: personNameLabel.rx.attributedText) .disposed(by: rx.disposeBag) viewModel .personBirthDay .bind(to: birthdateLabel.rx.attributedText) .disposed(by: rx.disposeBag) viewModel .gender .bind(to: genderLabel.rx.attributedText) .disposed(by: rx.disposeBag) viewModel .personDeathDay .bind(to: deathdateLabel.rx.attributedText) .disposed(by: rx.disposeBag) viewModel .occupation .bind(to: occupationLabel.rx.attributedText) .disposed(by: rx.disposeBag) viewModel .imdb .bind(to: imdbLabel.rx.attributedText) .disposed(by: rx.disposeBag) viewModel .alias .bind(to: aliasLabel.rx.attributedText) .disposed(by: rx.disposeBag) viewModel .homepage .bind(to: homepageLabel.rx.attributedText) .disposed(by: rx.disposeBag) } }
37.457143
205
0.585812
e248311faf258c5a0bf81d3e853f88893cc5f0fc
7,345
// // LCMoneyManageMentController.swift // JXLiCai // // Created by dengtao on 2017/9/19. // Copyright © 2017年 JingXian. All rights reserved. // import UIKit let maxMoney = "2000" class LCMoneyManageMentController: XTViewController { var isCharge:Bool = true; var tableView = UITableView() var textField = UITextField() var passWordView = LCEnterPassWordView() override func viewDidLoad() { super.viewDidLoad() if isCharge { self.title = "账户充值"; }else{ self.title = "账户提现"; } self.automaticallyAdjustsScrollViewInsets = false; tableView = UITableView.init(frame: CGRect(x:0,y:64,width:width,height:height - 64), style:UITableViewStyle.grouped); tableView.rowHeight = 60; tableView.delegate = self; tableView.dataSource = self; self.view.addSubview(tableView); tableView.reloadData(); } func bottomButtonAction(_ button:UIButton) { passWordView = LCEnterPassWordView.init(frame: CGRect(x:0,y:0,width:width,height:height)); UIApplication.shared.keyWindow?.rootViewController?.view.addSubview(passWordView); passWordView .showEnterPassWordView(); passWordView.sureButton .addTarget(self, action: #selector(surePassWordAction), for: UIControlEvents.touchUpInside); passWordView.sureButton.backgroundColor = UIColor.kMainYellowColor(); } func surePassWordAction() { passWordView .cancelShowEnterPassWordView(); var status = "成功"; if arc4random() % 2 == 1 { status = "失败"; } var message = "提现\(status)"; if isCharge { message = "充值\(status)"; } let alertVC = UIAlertController.init(title: "提示", message: message, preferredStyle: UIAlertControllerStyle.alert); let sureButton = UIAlertAction.init(title: "确定", style: UIAlertActionStyle.default) { (sureButton) in }; alertVC.addAction(sureButton); self .present(alertVC, animated: true, completion: nil); } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } } //MARK: UITableViewDelegate extension LCMoneyManageMentController: UITableViewDelegate, UITableViewDataSource,UITextFieldDelegate { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1; } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 10; } func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { return 270; } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let headerView = UIImageView.init(frame: CGRect(x:0,y:0,width:width,height:10)) headerView.backgroundColor = UIColor.groupTableViewBackground; return headerView; } func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { let footerView = UIView.init(frame: CGRect(x:0,y:0,width:width,height:220)) footerView.backgroundColor = UIColor.groupTableViewBackground; let whiteView = UIView.init(frame: CGRect(x:0,y:0,width:width,height:120)); whiteView.backgroundColor = UIColor.white; footerView .addSubview(whiteView); let moneyLabel = UILabel.init(frame: CGRect(x:20,y:20,width:width - 40,height:20)); moneyLabel.font = UIFont.kNormalFont(); if isCharge { moneyLabel.text = "充值金额" }else{ moneyLabel.text = "提现金额" } whiteView.addSubview(moneyLabel); let lineView = UIView.init(frame: CGRect(x:20,y:moneyLabel.frame.maxY + 20,width:width - 40,height:40)); lineView.layer.cornerRadius = 4; lineView.layer.borderColor = UIColor.lightGray.cgColor; lineView.layer.borderWidth = 0.4; lineView.layer.masksToBounds = true; whiteView.addSubview(lineView); textField = UITextField.init(frame: CGRect(x:30,y:moneyLabel.frame.maxY + 20,width:width - 60,height:40)) textField.font = UIFont.kNormalFont(); textField.placeholder = "请输入\(moneyLabel.text!)"; textField.delegate = self; textField.keyboardType = UIKeyboardType.decimalPad; whiteView.addSubview(textField); let tipsLabel = UILabel.init(frame: CGRect(x:15,y:whiteView.frame.maxY + 20,width:width - 30,height:20)); tipsLabel.font = UIFont.kSmallFont(); if isCharge { tipsLabel.text = "单笔充值不超过\(maxMoney)元" }else{ tipsLabel.text = "单笔提现不超过\(maxMoney)元" } tipsLabel.textColor = UIColor.kMainYellowColor(); footerView.addSubview(tipsLabel); let button = UIButton.init(frame: CGRect(x:30,y:tipsLabel.frame.maxY + 30,width:width - 60,height:40)); button.layer.cornerRadius = 4; button.layer.masksToBounds = true; var buttonTitle = "立即提现"; if isCharge { buttonTitle = "立即充值"; } button .setTitle(buttonTitle, for: UIControlState.normal); button.titleLabel?.font = UIFont.kTitleFont(); button.setTitleColor(UIColor.white, for: UIControlState.normal); button.backgroundColor = UIColor.orange; button .addTarget(self, action: #selector(bottomButtonAction(_:)), for: UIControlEvents.touchUpInside); footerView .addSubview(button); return footerView } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cellId: String = "cellId" var cell: UITableViewCell? = tableView.dequeueReusableCell(withIdentifier: cellId) if cell == nil { cell = UITableViewCell (style: UITableViewCellStyle.value1, reuseIdentifier: cellId) } cell?.accessoryType = UITableViewCellAccessoryType.disclosureIndicator cell?.textLabel?.text = "选择银行卡" cell?.textLabel?.font = UIFont.kNormalFont(); cell?.detailTextLabel?.text = "招商银行" cell?.detailTextLabel?.font = UIFont.kSmallFont(); let count = CGFloat((cell?.detailTextLabel?.text?.characters.count)!); let logoImageView = UIImageView.init(frame: CGRect(x:width - 15 - 30 - 12 * count - 20,y:20,width:20,height:20)); logoImageView.image = UIImage.init(named: "icon_bank_02") cell?.contentView.addSubview(logoImageView); return cell! } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView .deselectRow(at: indexPath, animated: true); } func textFieldDidEndEditing(_ textField: UITextField) { // if textField.text != nil && Float(textField.text!) > Float(maxMoney){ // // // } } }
34.483568
125
0.614704
de606db091ec7b7ec1bea98e5bc44d10893bb245
3,034
// // Networking.swift // VideoUpload // // Created by Tim Abraham on 02.03.20. // Copyright © 2020 Tim Abraham. All rights reserved. // import Foundation import Alamofire import CryptoKit class Networking: ObservableObject { @Published var progressValue = 0.0 let url: URL var walletAddress: String = "0x5F21318b12639fEAe73D5f4bfb426B748C93D03A" init(url: URL, walletAdress: String) { self.url = url self.walletAddress = walletAdress } init(url: URL) { self.url = url } func uploadEncryptedData(encryptedData: URL){ Alamofire.upload(encryptedData, to: url.absoluteString + Endpoints.upload.path) .uploadProgress { progress in print("Upload Progress: \(progress.fractionCompleted)") self.progressValue = progress.fractionCompleted } .responseJSON { response in debugPrint(response) } /// for more files simultaneous use multipartFormData // Alamofire.upload(multipartFormData: { multipartFormData in // multipartFormData.append(Data("one".utf8), withName: "one") // multipartFormData.append(Data("two".utf8), withName: "two") // }, to: "http://localhost:3000/upload") // .responseJSON { response in // debugPrint(response) // } } func downloadDecryptData(key: SymmetricKey) { Alamofire.request(url.absoluteString + "download") .downloadProgress { progress in print("Download Progress: \(progress.fractionCompleted)") }.responseData { response in if let data = response.value { let sealedBox = try! ChaChaPoly.SealedBox(combined: data) let test = try! ChaChaPoly.open(sealedBox, using: key) let fileManager = FileManager.default let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]; let filePath="\(documentsPath)/tempFileDecrypted.mp4" fileManager.createFile(atPath: filePath, contents: test) let filePath2="\(documentsPath)/tempFileEncrypted.txt" fileManager.createFile(atPath: filePath2, contents: data) } } } func sendVideoConfigurationData(key: SymmetricKey){ let serializedSymmetricKey = key.serialize() let parameters: [String: String] = [ "symmetricKey": serializedSymmetricKey, "walletAddress": walletAddress ] Alamofire.request(url.absoluteString + Endpoints.symmetricKey.path, method: .post, parameters: parameters).responseJSON { response in if let data = response.value { // for testing print(data) } } } }
37.925
141
0.58174
0a75600fa634bf0cfe2e08c44ea1f7a09046735a
7,586
// // OverlaySKScene.swift // FMEAR // // Created by Angus Lau on 2019-10-18. // Copyright © 2019 Safe Software Inc. All rights reserved. // import Foundation import UIKit import SpriteKit protocol OverlaySKSceneDelegate: class { func overlaySKSceneDelegate(_: OverlaySKScene, didTapNode node: SKNode) } class OverlaySKScene: SKScene { weak var overlaySKSceneDelegate: OverlaySKSceneDelegate? override init(size: CGSize) { super.init(size: size) self.scaleMode = .resizeFill self.isUserInteractionEnabled = false } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } func labelNode(labelName: String) -> PointLabelNode { if let node = childNode(withName: labelName) as? PointLabelNode { return node } else { let newLabelNode = PointLabelNode() newLabelNode.name = labelName newLabelNode.isUserInteractionEnabled = true addChild(newLabelNode) return newLabelNode } } func labelNodeOrNil(labelName: String) -> PointLabelNode? { return childNode(withName: labelName) as? PointLabelNode; } } class ButtonNode: SKNode { var labelNode: SKLabelNode? var shapeNode: SKShapeNode? var text: String = "" { didSet { if let oldLabelNode = labelNode { self.removeChildren(in: [oldLabelNode]) } self.labelNode = SKLabelNode(text: text) self.labelNode!.fontName = "Arial-BoldMT" self.labelNode!.fontColor = .white self.labelNode!.fontSize = CGFloat(UserDefaults.standard.float(for: .labelFontSize)) self.labelNode!.horizontalAlignmentMode = .left self.labelNode!.verticalAlignmentMode = .bottom // self.addChild(self.labelNode!) if let oldShapeNode = shapeNode { self.removeChildren(in: [oldShapeNode]) } let padding: CGFloat = 2.0 let buttonOrigin = CGPoint(x: -padding, y: -padding) let buttonSize = CGSize(width: self.labelNode!.frame.size.width + (padding * 2), height: self.labelNode!.frame.size.height + (padding * 2)) let rect = CGRect(origin: buttonOrigin, size: buttonSize) self.shapeNode = SKShapeNode(rect: rect) self.shapeNode!.fillColor = UIColor(white: 1.0, alpha: 0.2) self.shapeNode!.strokeColor = .white self.shapeNode!.addChild(self.labelNode!) self.addChild(self.shapeNode!) } } override init() { super.init() } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } class PointLabelNode: SKNode { var labelNode: SKLabelNode! var lineNode: SKShapeNode! var pointNode: SKShapeNode! var buttonNode: ButtonNode? var point = CGPoint(x: 0, y: 0) { didSet { updatePointNodePosition() updateLabelNodePosition() updateLineNode() } } var text: String = "" { didSet { self.labelNode.text = text updateLabelNodePosition() updateLineNode() } } var buttonText: String = "" { didSet { if buttonText.isEmpty { if let buttonNode = buttonNode { self.removeChildren(in: [buttonNode]) } } else { if self.buttonNode == nil { self.buttonNode = ButtonNode() self.addChild(self.buttonNode!) } self.buttonNode!.text = buttonText } } } override init() { super.init() self.labelNode = SKLabelNode(text: "") self.labelNode!.fontName = "Arial-BoldMT" self.labelNode.fontSize = CGFloat(UserDefaults.standard.float(for: .labelFontSize)) self.labelNode.horizontalAlignmentMode = .left self.labelNode.verticalAlignmentMode = .bottom self.lineNode = SKShapeNode() self.lineNode.strokeColor = .white self.pointNode = SKShapeNode(circleOfRadius: 1) self.pointNode.fillColor = .white self.addChild(self.labelNode) self.addChild(self.lineNode) self.addChild(self.pointNode) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } func updateLabelNodePosition() { guard let scene = self.scene else { return } let leftMargin: CGFloat = 20.0 let rightMargin: CGFloat = 80.0 let topMargin: CGFloat = 100.0 let bottomMargin: CGFloat = 100.0 let horizontalSpacing: CGFloat = 40.0 let verticalSpacing: CGFloat = 40.0 // Assume we want to display the label right to and above the target point var x: CGFloat = min(max(leftMargin, (point.x + horizontalSpacing)), scene.size.width - labelNode.frame.width - rightMargin) var y: CGFloat = min(max(bottomMargin, (point.y + verticalSpacing)), scene.size.height - labelNode.frame.height - topMargin) if x < (point.x - horizontalSpacing) { x = min(max(leftMargin, point.x - horizontalSpacing - labelNode.frame.width), scene.size.width - labelNode.frame.width - rightMargin) } self.labelNode.position = CGPoint(x: x, y: y) if let buttonNode = self.buttonNode { let buttonSize = buttonNode.calculateAccumulatedFrame().size buttonNode.position = CGPoint(x: x + self.labelNode.frame.width - buttonSize.width, y: y - buttonSize.height) } } func updateLineNode() { let path = CGMutablePath() // Draw the pointer line let labelCenter = self.labelNode.position.x + (labelNode.frame.width / 2) if labelCenter < point.x { path.move(to: self.labelNode.position + (CGPoint(x: labelNode.frame.width, y: 0))) } else { path.move(to: self.labelNode.position) } path.addLine(to: point) // Draw an horizontal line below the text path.move(to: self.labelNode.position) path.addLine(to: labelNode.position + CGPoint(x: labelNode.frame.width, y: 0)) lineNode.path = path } func updatePointNodePosition() { pointNode.position = point } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { for touch: AnyObject in touches { let location = touch.location(in: self) if contains(location) { print("Point Label Touch Began") } } } override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { for touch: AnyObject in touches { let location = touch.location(in: self) if contains(location) { print("Point Label Touch Ended") } if let overlaySKScene = scene as? OverlaySKScene { if let delegate = overlaySKScene.overlaySKSceneDelegate { delegate.overlaySKSceneDelegate(overlaySKScene, didTapNode: self) } } } } }
31.740586
145
0.578038
fe354e1024e767737bd6fc4ebfab7888cf2f9902
4,142
// // TopicDetailViewController.swift // PS_Swift_cnodejs // // Created by 思 彭 on 2018/1/18. // Copyright © 2018年 思 彭. All rights reserved. // import UIKit import ObjectMapper class TopicDetailViewController: BaseViewController { public var topicId: String? = "" { didSet { self.loadDetailData() } } /// MARK: - UI private lazy var tableView: UITableView = { let view = UITableView() view.delegate = self view.dataSource = self view.rowHeight = UITableViewAutomaticDimension view.estimatedRowHeight = 80 view.estimatedSectionHeaderHeight = 0 view.estimatedSectionFooterHeight = 0 view.backgroundColor = .clear // view.keyboardDismissMode = .onDrag view.register(UINib(nibName: "TopicDetailReplyCell", bundle: nil), forCellReuseIdentifier: "TopicDetailReplyCell") var inset = view.contentInset inset.top = navigationController?.navigationBar.height ?? 64 view.contentInset = inset inset.bottom = 0 view.scrollIndicatorInsets = inset return view }() private lazy var headerView: TopicDetailHeaderView = { let view = TopicDetailHeaderView() view.isHidden = true return view }() // 数据源 private var dataModel: TopicListModel? { didSet { // 赋值headerView tableView.tableHeaderView = headerView headerView.topicDetailModel = dataModel } } override func viewDidLoad() { super.viewDidLoad() title = "话题" self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "nodeCollect"), style: .plain, action: { log.info("收藏") }) setupUI() } private func setupUI() { self.view.addSubview(tableView) tableView.snp.makeConstraints { $0.edges.equalToSuperview() } // headerView的webView加载完成 // 注意要在这里刷新tabeleView,否则tableView不显示 headerView.webLoadComplete = { [ weak self ] in self?.headerView.isHidden = false self?.tableView.reloadData() } } } // MARK: - 数据请求 extension TopicDetailViewController { private func loadDetailData() { let url = "https://cnodejs.org/api/v1/topic/" + topicId! HTTPTool.shareInstance.requestData(.GET, URLString: url, parameters: nil, success: { (response) in self.dataModel = Mapper<TopicListModel>().map(JSON: response["data"] as! [String : Any]) }) { (error) in log.error(error) } } } // MARK: - UITableViewDelegate && UITableViewDataSource extension TopicDetailViewController: UITableViewDelegate, UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 20 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "TopicDetailReplyCell", for: indexPath) cell.selectionStyle = .none // 取消选中效果 return cell } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 0.0001 } func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { return 0.0001 } func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { let footer = UIView(frame: CGRect(x: 0, y: 0, width: screenWidth, height: 10)) footer.backgroundColor = #colorLiteral(red: 0.8480219245, green: 0.8480219245, blue: 0.8480219245, alpha: 1) return footer } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { return nil } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 96 } }
31.861538
140
0.634718
5b0851e2b074318b6a6706e2fc12f5015aed9a81
519
// // HomeCoordinator.swift // Paperback // // Created by Tino Emer on 29.09.2021.. // import Foundation import SwiftUI import Stinsen final class HomeCoordinator: NavigationCoordinatable { let stack = NavigationStack(initial: \HomeCoordinator.dashboard) @Root var dashboard = makeLoginView //@Route(.push) var login = makeLoginView @ViewBuilder func makeDashboardView() -> some View { ContentView() } @ViewBuilder func makeLoginView() -> some View { LoginView() } }
19.961538
68
0.684008
f7427e0e4e38be750eebfc6d72c39ef2689aeeb2
317
// // Constants.swift // pokedex // // Created by Vihang Godbole on 20/02/16. // Copyright © 2016 vihanggodbole. All rights reserved. // import Foundation let URL_BASE = "http://pokeapi.co/api/v2/" let URL_POKEMON = "pokemon/" let URL_POKEMON_SPECIES = "pokemon-species/" typealias DownloadCompleted = () -> ()
21.133333
56
0.700315
f8bdded2ac11411e39e7aace4cf6b113679ce00c
2,138
// // AppDelegate.swift // CyclopsExample // // Created by ka2n on 2015/12/02. // Copyright © 2015年 ka2n. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
45.489362
285
0.753976
d992c0a45f00cbd9eed0841e77bb3b4adf495344
6,724
// // MatchStatsticCell.swift // AllAboutBlues // // Created by Soohan Lee on 2020/03/10. // Copyright © 2020 Soohan Lee. All rights reserved. // import UIKit class MatchStatsticsTableViewCell: UITableViewCell { // MARK: - Properties private let homeStatsticsLabel: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false label.textAlignment = .left return label }() private let homeStatsticsView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false view.backgroundColor = .green return view }() private lazy var homeStatsticsViewWidth = homeStatsticsView.widthAnchor.constraint(equalTo: homeUnderLineView.widthAnchor, multiplier: 0) private let homeUnderLineView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false view.backgroundColor = .green return view }() private let statsticsTypeLabel: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false label.textAlignment = .center return label }() private let awayStatsticsLabel: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false label.textAlignment = .right return label }() private lazy var awayStatsticsView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false view.backgroundColor = .cyan return view }() private lazy var awayStatsticsViewWidth = awayStatsticsView.widthAnchor.constraint(equalTo: awayUnderLineView.widthAnchor, multiplier: 0) private let awayUnderLineView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false view.backgroundColor = .cyan return view }() // MARK: - Initializtion override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) configureCell() addAllView() setupCellAutoLayout() setupHomeStatsticLabelAutoLayout() setupHomeStatsticViewAutoLayout() setupHomeUnderLineViewAutoLayout() setupStatsticTypeLabelAutoLayout() setupAwayStatsticLabelAutoLayout() setupAwayStatsticViewAutoLayout() setupAwayUnderLineViewAutoLayout() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } // MARK: - Configuration private func configureCell() { } // MARK: - Setup UI private func addAllView() { self.addSubview(homeStatsticsLabel) self.addSubview(homeStatsticsView) self.addSubview(homeUnderLineView) self.addSubview(statsticsTypeLabel) self.addSubview(awayStatsticsLabel) self.addSubview(awayStatsticsView) self.addSubview(awayUnderLineView) } private func setupCellAutoLayout() { NSLayoutConstraint.activate([ self.heightAnchor.constraint(equalToConstant: 44) ]) } private func setupHomeStatsticLabelAutoLayout() { NSLayoutConstraint.activate([ homeStatsticsLabel.topAnchor .constraint(equalTo: contentView .topAnchor), homeStatsticsLabel.leadingAnchor .constraint(equalTo: contentView .leadingAnchor, constant: 8), homeStatsticsLabel.trailingAnchor.constraint(equalTo: statsticsTypeLabel.leadingAnchor), homeStatsticsLabel.bottomAnchor .constraint(equalTo: homeStatsticsView .topAnchor), ]) } private func setupHomeStatsticViewAutoLayout() { NSLayoutConstraint.activate([ homeStatsticsView.trailingAnchor .constraint(equalTo: homeUnderLineView.trailingAnchor), homeStatsticsView.bottomAnchor .constraint(equalTo: homeUnderLineView.topAnchor), homeStatsticsViewWidth, homeStatsticsView.heightAnchor .constraint(equalToConstant: 3) ]) } private func setupHomeUnderLineViewAutoLayout() { NSLayoutConstraint.activate([ homeUnderLineView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), homeUnderLineView.bottomAnchor .constraint(equalTo: contentView.bottomAnchor), homeUnderLineView.widthAnchor .constraint(equalTo: contentView.widthAnchor, multiplier: 0.5), homeUnderLineView.heightAnchor .constraint(equalToConstant: 1), ]) } private func setupStatsticTypeLabelAutoLayout() { NSLayoutConstraint.activate([ statsticsTypeLabel.centerXAnchor.constraint(equalTo: contentView.centerXAnchor), statsticsTypeLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), ]) } private func setupAwayStatsticLabelAutoLayout() { NSLayoutConstraint.activate([ awayStatsticsLabel.topAnchor .constraint(equalTo: contentView .topAnchor), awayStatsticsLabel.leadingAnchor .constraint(equalTo: statsticsTypeLabel.trailingAnchor), awayStatsticsLabel.trailingAnchor.constraint(equalTo: contentView .trailingAnchor, constant: -8), awayStatsticsLabel.bottomAnchor .constraint(equalTo: awayStatsticsView .topAnchor), ]) } private func setupAwayStatsticViewAutoLayout() { NSLayoutConstraint.activate([ awayStatsticsView.leadingAnchor .constraint(equalTo: awayUnderLineView.leadingAnchor), awayStatsticsView.bottomAnchor .constraint(equalTo: awayUnderLineView.topAnchor), awayStatsticsViewWidth, awayStatsticsView.heightAnchor .constraint(equalToConstant: 3) ]) } private func setupAwayUnderLineViewAutoLayout() { NSLayoutConstraint.activate([ awayUnderLineView.trailingAnchor.constraint(equalTo: contentView .trailingAnchor), awayUnderLineView.bottomAnchor .constraint(equalTo: homeUnderLineView.bottomAnchor), awayUnderLineView.heightAnchor .constraint(equalTo: homeUnderLineView.heightAnchor), awayUnderLineView.widthAnchor .constraint(equalTo: homeUnderLineView.widthAnchor), ]) } // MARK: - Element Control func configure(statsticsType: String, homeValueText: String, awayValueText: String, homeViewWidth: CGFloat, awayViewWidth: CGFloat) { statsticsTypeLabel.text = statsticsType homeStatsticsLabel.text = homeValueText awayStatsticsLabel.text = awayValueText homeStatsticsViewWidth = homeStatsticsView.widthAnchor.constraint(equalTo: homeUnderLineView.widthAnchor, multiplier: homeViewWidth) awayStatsticsViewWidth = awayStatsticsView.widthAnchor.constraint(equalTo: awayUnderLineView.widthAnchor, multiplier: awayViewWidth) homeStatsticsViewWidth.isActive = true awayStatsticsViewWidth.isActive = true } }
32.326923
139
0.73959
67078fbdc27536d4d06962cbbf69a84371fc2db2
524
// // UITabbar+MAThemeUpdatable.swift // HowToThemeApp // // Created by Alok Choudhary on 1/23/20. // Copyright © 2020 Mt Aden LLC. All rights reserved. // import UIKit extension UITabBar { // MARK: - MAThemeUpdatable func updateColors(for theme: MATheme) { let barStyle: UIBarStyle = { switch theme { case .light: return .default case .dark: return .black } }() self.barStyle = barStyle } }
19.407407
54
0.538168
bf49947ecc0200a98c812596170dfb5b4e2e2531
1,581
// // DropDownCellTableViewCell.swift // DropDown // // Created by Kevin Hirsch on 28/07/15. // Copyright (c) 2015 Kevin Hirsch. All rights reserved. // #if os(iOS) import UIKit open class DropDownCell: UITableViewCell { //UI @IBOutlet open weak var optionLabel: UILabel! var selectedBackgroundColor: UIColor? var highlightTextColor: UIColor? var normalTextColor: UIColor? } //MARK: - UI extension DropDownCell { override open func awakeFromNib() { super.awakeFromNib() backgroundColor = .clear } override open var isSelected: Bool { willSet { setSelected(newValue, animated: false) } } override open var isHighlighted: Bool { willSet { setSelected(newValue, animated: false) } } override open func setHighlighted(_ highlighted: Bool, animated: Bool) { setSelected(highlighted, animated: animated) } override open func setSelected(_ selected: Bool, animated: Bool) { let executeSelection: () -> Void = { [weak self] in guard let `self` = self else { return } if let selectedBackgroundColor = self.selectedBackgroundColor { if selected { self.backgroundColor = selectedBackgroundColor self.optionLabel.textColor = self.highlightTextColor } else { self.backgroundColor = .clear self.optionLabel.textColor = self.normalTextColor } } } if animated { UIView.animate(withDuration: 0.3, animations: { executeSelection() }) } else { executeSelection() } accessibilityTraits = selected ? .selected : .none } } #endif
20.012658
73
0.680582
09fae076fbd28e1b67ae3545beda20f41e43934e
4,680
// DownloadTests.swift // // Copyright (c) 2014–2015 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation import Alamofire import XCTest class AlamofireDownloadResponseTestCase: XCTestCase { let searchPathDirectory: NSSearchPathDirectory = .DocumentDirectory let searchPathDomain: NSSearchPathDomainMask = .UserDomainMask // MARK: - func testDownloadRequest() { let numberOfLines = 100 let URL = "http://httpbin.org/stream/\(numberOfLines)" let expectation = expectationWithDescription(URL) let destination = Alamofire.Request.suggestedDownloadDestination(directory: searchPathDirectory, domain: searchPathDomain) Alamofire.download(.GET, URL, destination) .response { request, response, _, error in XCTAssertNotNil(request, "request should not be nil") XCTAssertNotNil(response, "response should not be nil") XCTAssertNil(error, "error should be nil") let fileManager = NSFileManager.defaultManager() let directory = fileManager.URLsForDirectory(self.searchPathDirectory, inDomains: self.searchPathDomain)[0] as! NSURL var fileManagerError: NSError? let contents = fileManager.contentsOfDirectoryAtURL(directory, includingPropertiesForKeys: nil, options: NSDirectoryEnumerationOptions.SkipsHiddenFiles, error: &fileManagerError)! XCTAssertNil(fileManagerError, "fileManagerError should be nil") #if os(iOS) let suggestedFilename = "\(numberOfLines)" #elseif os(OSX) let suggestedFilename = "\(numberOfLines).json" #endif let predicate = NSPredicate(format: "lastPathComponent = '\(suggestedFilename)'") let filteredContents = (contents as NSArray).filteredArrayUsingPredicate(predicate) XCTAssertEqual(filteredContents.count, 1, "should have one file in Documents") let file = filteredContents.first as! NSURL XCTAssertEqual(file.lastPathComponent!, "\(suggestedFilename)", "filename should be \(suggestedFilename)") if let data = NSData(contentsOfURL: file) { XCTAssertGreaterThan(data.length, 0, "data length should be non-zero") } else { XCTFail("data should exist for contents of URL") } fileManager.removeItemAtURL(file, error: nil) expectation.fulfill() } waitForExpectationsWithTimeout(10) { error in XCTAssertNil(error, "\(error)") } } func testDownloadRequestWithProgress() { let numberOfLines = 100 let URL = "http://httpbin.org/stream/\(numberOfLines)" let expectation = expectationWithDescription(URL) let destination = Alamofire.Request.suggestedDownloadDestination(directory: searchPathDirectory, domain: searchPathDomain) let download = Alamofire.download(.GET, URL, destination) download.progress { bytesRead, totalBytesRead, totalBytesExpectedToRead in XCTAssert(bytesRead > 0, "bytesRead should be > 0") XCTAssert(totalBytesRead > 0, "totalBytesRead should be > 0") XCTAssert(totalBytesExpectedToRead == -1, "totalBytesExpectedToRead should be -1") download.cancel() expectation.fulfill() } waitForExpectationsWithTimeout(10) { error in XCTAssertNil(error, "\(error)") } } }
43.333333
195
0.676923
1d0b9e32254031bb5641f6ae4d424297b294e094
275
// // Character.swift // Rick and Morty // // Created by Rodrigo Lourenço on 15/12/21. // import Foundation struct Character: Codable { var id: Int var name: String var species: String var gender: String var type: String var image: String }
14.473684
44
0.636364
eb4ae6c6f21bd99b72795c4b3df69bef02e6d55b
1,308
// // PointTopTableViewCell.swift // Brandingdong // // Created by 이진욱 on 2020/10/01. // Copyright © 2020 jwlee. All rights reserved. // import UIKit class PointTopTableViewCell: UITableViewCell { // MARK: - Property static let identifier = "PointTopTableViewCell" private let titleLabel: PointTopLabel = { let lb = PointTopLabel(title: "포인트") return lb }() var priceLabel: PointTopLabel = { let lb = PointTopLabel(title: "0 원") return lb }() // MARK: - Cell Init override func awakeFromNib() { super.awakeFromNib() } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) setUI() setConstraints() } // MARK: - Set LayOut private func setUI() { [titleLabel, priceLabel].forEach { contentView.addSubview($0) } } private func setConstraints() { let padding: CGFloat = 16 [titleLabel, priceLabel].forEach { $0.snp.makeConstraints { $0.centerY.equalTo(contentView.snp.centerY) } } titleLabel.snp.makeConstraints { $0.leading.equalToSuperview().offset(padding) } priceLabel.snp.makeConstraints { $0.trailing.equalToSuperview().offset(-padding) } } }
19.235294
63
0.626911
0ad624045e66b9fd010fa53ec5c5d14c60528e11
3,051
/** * (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **/ import Foundation import IBMSwiftSDKCore /** Global settings for the workspace. */ public struct WorkspaceSystemSettings: Codable, Equatable { /** Workspace settings related to the Watson Assistant user interface. */ public var tooling: WorkspaceSystemSettingsTooling? /** Workspace settings related to the disambiguation feature. **Note:** This feature is available only to Plus and Premium users. */ public var disambiguation: WorkspaceSystemSettingsDisambiguation? /** For internal use only. */ public var humanAgentAssist: [String: JSON]? /** Workspace settings related to the behavior of system entities. */ public var systemEntities: WorkspaceSystemSettingsSystemEntities? /** Workspace settings related to detection of irrelevant input. */ public var offTopic: WorkspaceSystemSettingsOffTopic? // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { case tooling = "tooling" case disambiguation = "disambiguation" case humanAgentAssist = "human_agent_assist" case systemEntities = "system_entities" case offTopic = "off_topic" } /** Initialize a `WorkspaceSystemSettings` with member variables. - parameter tooling: Workspace settings related to the Watson Assistant user interface. - parameter disambiguation: Workspace settings related to the disambiguation feature. **Note:** This feature is available only to Plus and Premium users. - parameter humanAgentAssist: For internal use only. - parameter systemEntities: Workspace settings related to the behavior of system entities. - parameter offTopic: Workspace settings related to detection of irrelevant input. - returns: An initialized `WorkspaceSystemSettings`. */ public init( tooling: WorkspaceSystemSettingsTooling? = nil, disambiguation: WorkspaceSystemSettingsDisambiguation? = nil, humanAgentAssist: [String: JSON]? = nil, systemEntities: WorkspaceSystemSettingsSystemEntities? = nil, offTopic: WorkspaceSystemSettingsOffTopic? = nil ) { self.tooling = tooling self.disambiguation = disambiguation self.humanAgentAssist = humanAgentAssist self.systemEntities = systemEntities self.offTopic = offTopic } }
34.670455
95
0.712881
2055e353bb1062bf70deba2b82cd1591400df19a
12,614
// // vertex_centered_scalar_grid3_tests.swift // vox.ForceTests // // Created by Feng Yang on 2020/8/6. // Copyright © 2020 Feng Yang. All rights reserved. // import XCTest @testable import vox_Force class vertex_centered_scalar_grid3_tests: XCTestCase { override func setUpWithError() throws { _ = Renderer() } override func tearDownWithError() throws { } func testConstructors() throws { // Default constructors let grid1 = VertexCenteredScalarGrid3() XCTAssertEqual(0, grid1.resolution().x) XCTAssertEqual(0, grid1.resolution().y) XCTAssertEqual(0, grid1.resolution().z) XCTAssertEqual(1.0, grid1.gridSpacing().x) XCTAssertEqual(1.0, grid1.gridSpacing().y) XCTAssertEqual(1.0, grid1.gridSpacing().z) XCTAssertEqual(0.0, grid1.origin().x) XCTAssertEqual(0.0, grid1.origin().y) XCTAssertEqual(0.0, grid1.origin().z) XCTAssertEqual(0, grid1.dataSize().x) XCTAssertEqual(0, grid1.dataSize().y) XCTAssertEqual(0, grid1.dataSize().z) XCTAssertEqual(0.0, grid1.dataOrigin().x) XCTAssertEqual(0.0, grid1.dataOrigin().y) XCTAssertEqual(0.0, grid1.dataOrigin().z) // Constructor with params let grid2 = VertexCenteredScalarGrid3(resolutionX: 5, resolutionY: 4, resolutionZ: 3, gridSpacingX: 1.0, gridSpacingY: 2.0, gridSpacingZ: 3.0, originX: 4.0, originY: 5.0, originZ: 6.0, initialValue: 7.0) XCTAssertEqual(5, grid2.resolution().x) XCTAssertEqual(4, grid2.resolution().y) XCTAssertEqual(3, grid2.resolution().z) XCTAssertEqual(1.0, grid2.gridSpacing().x) XCTAssertEqual(2.0, grid2.gridSpacing().y) XCTAssertEqual(3.0, grid2.gridSpacing().z) XCTAssertEqual(4.0, grid2.origin().x) XCTAssertEqual(5.0, grid2.origin().y) XCTAssertEqual(6.0, grid2.origin().z) XCTAssertEqual(6, grid2.dataSize().x) XCTAssertEqual(5, grid2.dataSize().y) XCTAssertEqual(4, grid2.dataSize().z) XCTAssertEqual(4.0, grid2.dataOrigin().x) XCTAssertEqual(5.0, grid2.dataOrigin().y) XCTAssertEqual(6.0, grid2.dataOrigin().z) grid2.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(7.0, grid2[i, j, k]) } // Copy constructor let grid3 = VertexCenteredScalarGrid3(other: grid2) XCTAssertEqual(5, grid3.resolution().x) XCTAssertEqual(4, grid3.resolution().y) XCTAssertEqual(3, grid3.resolution().z) XCTAssertEqual(1.0, grid3.gridSpacing().x) XCTAssertEqual(2.0, grid3.gridSpacing().y) XCTAssertEqual(3.0, grid3.gridSpacing().z) XCTAssertEqual(4.0, grid3.origin().x) XCTAssertEqual(5.0, grid3.origin().y) XCTAssertEqual(6.0, grid3.origin().z) XCTAssertEqual(6, grid3.dataSize().x) XCTAssertEqual(5, grid3.dataSize().y) XCTAssertEqual(4, grid3.dataSize().z) XCTAssertEqual(4.0, grid3.dataOrigin().x) XCTAssertEqual(5.0, grid3.dataOrigin().y) XCTAssertEqual(6.0, grid3.dataOrigin().z) grid3.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(7.0, grid3[i, j, k]) } } func testSwap() { let grid1 = VertexCenteredScalarGrid3(resolutionX: 5, resolutionY: 4, resolutionZ: 3, gridSpacingX: 1.0, gridSpacingY: 2.0, gridSpacingZ: 3.0, originX: 4.0, originY: 5.0, originZ: 6.0, initialValue: 7.0) let grid2 = VertexCenteredScalarGrid3(resolutionX: 3, resolutionY: 8, resolutionZ: 5, gridSpacingX: 2.0, gridSpacingY: 3.0, gridSpacingZ: 1.0, originX: 5.0, originY: 4.0, originZ: 7.0, initialValue: 8.0) var father_grid:Grid3 = grid2 as Grid3 grid1.swap(other: &father_grid) XCTAssertEqual(3, grid1.resolution().x) XCTAssertEqual(8, grid1.resolution().y) XCTAssertEqual(5, grid1.resolution().z) XCTAssertEqual(2.0, grid1.gridSpacing().x) XCTAssertEqual(3.0, grid1.gridSpacing().y) XCTAssertEqual(1.0, grid1.gridSpacing().z) XCTAssertEqual(5.0, grid1.origin().x) XCTAssertEqual(4.0, grid1.origin().y) XCTAssertEqual(7.0, grid1.origin().z) XCTAssertEqual(4, grid1.dataSize().x) XCTAssertEqual(9, grid1.dataSize().y) XCTAssertEqual(6, grid1.dataSize().z) XCTAssertEqual(5.0, grid1.dataOrigin().x) XCTAssertEqual(4.0, grid1.dataOrigin().y) XCTAssertEqual(7.0, grid1.dataOrigin().z) grid1.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(8.0, grid1[i, j, k]) } XCTAssertEqual(5, grid2.resolution().x) XCTAssertEqual(4, grid2.resolution().y) XCTAssertEqual(3, grid2.resolution().z) XCTAssertEqual(1.0, grid2.gridSpacing().x) XCTAssertEqual(2.0, grid2.gridSpacing().y) XCTAssertEqual(3.0, grid2.gridSpacing().z) XCTAssertEqual(4.0, grid2.origin().x) XCTAssertEqual(5.0, grid2.origin().y) XCTAssertEqual(6.0, grid2.origin().z) XCTAssertEqual(6, grid2.dataSize().x) XCTAssertEqual(5, grid2.dataSize().y) XCTAssertEqual(4, grid2.dataSize().z) XCTAssertEqual(4.0, grid2.dataOrigin().x) XCTAssertEqual(5.0, grid2.dataOrigin().y) XCTAssertEqual(6.0, grid2.dataOrigin().z) grid2.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(7.0, grid2[i, j, k]) } } func testSet() { let grid1 = VertexCenteredScalarGrid3(resolutionX: 5, resolutionY: 4, resolutionZ: 3, gridSpacingX: 1.0, gridSpacingY: 2.0, gridSpacingZ: 3.0, originX: 4.0, originY: 5.0, originZ: 6.0, initialValue: 7.0) let grid2 = VertexCenteredScalarGrid3(resolutionX: 3, resolutionY: 8, resolutionZ: 5, gridSpacingX: 2.0, gridSpacingY: 3.0, gridSpacingZ: 1.0, originX: 5.0, originY: 4.0, originZ: 7.0, initialValue: 8.0) grid1.set(other: grid2) XCTAssertEqual(3, grid1.resolution().x) XCTAssertEqual(8, grid1.resolution().y) XCTAssertEqual(5, grid1.resolution().z) XCTAssertEqual(2.0, grid1.gridSpacing().x) XCTAssertEqual(3.0, grid1.gridSpacing().y) XCTAssertEqual(1.0, grid1.gridSpacing().z) XCTAssertEqual(5.0, grid1.origin().x) XCTAssertEqual(4.0, grid1.origin().y) XCTAssertEqual(7.0, grid1.origin().z) XCTAssertEqual(4, grid1.dataSize().x) XCTAssertEqual(9, grid1.dataSize().y) XCTAssertEqual(6, grid1.dataSize().z) XCTAssertEqual(5.0, grid1.dataOrigin().x) XCTAssertEqual(4.0, grid1.dataOrigin().y) XCTAssertEqual(7.0, grid1.dataOrigin().z) grid1.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(8.0, grid1[i, j, k]) } } func testAssignmentOperator() { var grid1 = VertexCenteredScalarGrid3(resolutionX: 5, resolutionY: 4, resolutionZ: 3, gridSpacingX: 1.0, gridSpacingY: 2.0, gridSpacingZ: 3.0, originX: 4.0, originY: 5.0, originZ: 6.0, initialValue: 7.0) let grid2 = VertexCenteredScalarGrid3(resolutionX: 3, resolutionY: 8, resolutionZ: 5, gridSpacingX: 2.0, gridSpacingY: 3.0, gridSpacingZ: 1.0, originX: 5.0, originY: 4.0, originZ: 7.0, initialValue: 8.0) grid1 = grid2 XCTAssertEqual(3, grid1.resolution().x) XCTAssertEqual(8, grid1.resolution().y) XCTAssertEqual(5, grid1.resolution().z) XCTAssertEqual(2.0, grid1.gridSpacing().x) XCTAssertEqual(3.0, grid1.gridSpacing().y) XCTAssertEqual(1.0, grid1.gridSpacing().z) XCTAssertEqual(5.0, grid1.origin().x) XCTAssertEqual(4.0, grid1.origin().y) XCTAssertEqual(7.0, grid1.origin().z) XCTAssertEqual(4, grid1.dataSize().x) XCTAssertEqual(9, grid1.dataSize().y) XCTAssertEqual(6, grid1.dataSize().z) XCTAssertEqual(5.0, grid1.dataOrigin().x) XCTAssertEqual(4.0, grid1.dataOrigin().y) XCTAssertEqual(7.0, grid1.dataOrigin().z) grid1.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(8.0, grid1[i, j, k]) } } func testBuilder() { var grid1 = VertexCenteredScalarGrid3.builder().build( resolution: Size3(3, 8, 5), gridSpacing: Vector3F(2.0, 3.0, 1.0), gridOrigin: Vector3F(5.0, 4.0, 7.0), initialVal: 8.0) let grid2 = grid1 as? VertexCenteredScalarGrid3 XCTAssertTrue(grid2 != nil) XCTAssertEqual(3, grid1.resolution().x) XCTAssertEqual(8, grid1.resolution().y) XCTAssertEqual(5, grid1.resolution().z) XCTAssertEqual(2.0, grid1.gridSpacing().x) XCTAssertEqual(3.0, grid1.gridSpacing().y) XCTAssertEqual(1.0, grid1.gridSpacing().z) XCTAssertEqual(5.0, grid1.origin().x) XCTAssertEqual(4.0, grid1.origin().y) XCTAssertEqual(7.0, grid1.origin().z) XCTAssertEqual(4, grid1.dataSize().x) XCTAssertEqual(9, grid1.dataSize().y) XCTAssertEqual(6, grid1.dataSize().z) XCTAssertEqual(5.0, grid1.dataOrigin().x) XCTAssertEqual(4.0, grid1.dataOrigin().y) XCTAssertEqual(7.0, grid1.dataOrigin().z) grid1.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(8.0, grid1[i, j, k]) } grid1 = VertexCenteredScalarGrid3.builder() .withResolution(resolutionX: 3, resolutionY: 8, resolutionZ: 5) .withGridSpacing(gridSpacingX: 2, gridSpacingY: 3, gridSpacingZ: 1) .withOrigin(gridOriginX: 5, gridOriginY: 4, gridOriginZ: 7) .withInitialValue(initialVal: 8.0) .build() XCTAssertEqual(3, grid1.resolution().x) XCTAssertEqual(8, grid1.resolution().y) XCTAssertEqual(5, grid1.resolution().z) XCTAssertEqual(2.0, grid1.gridSpacing().x) XCTAssertEqual(3.0, grid1.gridSpacing().y) XCTAssertEqual(1.0, grid1.gridSpacing().z) XCTAssertEqual(5.0, grid1.origin().x) XCTAssertEqual(4.0, grid1.origin().y) XCTAssertEqual(7.0, grid1.origin().z) XCTAssertEqual(4, grid1.dataSize().x) XCTAssertEqual(9, grid1.dataSize().y) XCTAssertEqual(6, grid1.dataSize().z) XCTAssertEqual(5.0, grid1.dataOrigin().x) XCTAssertEqual(4.0, grid1.dataOrigin().y) XCTAssertEqual(7.0, grid1.dataOrigin().z) grid1.forEachDataPointIndex(){(i:size_t, j:size_t, k:size_t) in XCTAssertEqual(8.0, grid1[i, j, k]) } } func testFill() { let grid = VertexCenteredScalarGrid3(resolutionX: 5, resolutionY: 4, resolutionZ: 6, gridSpacingX: 1.0, gridSpacingY: 1.0, gridSpacingZ: 1.0, originX: 0.0, originY: 0.0, originZ: 0.0, initialValue: 0.0) grid.fill(value: 42.0) for k in 0..<grid.dataSize().z { for j in 0..<grid.dataSize().y { for i in 0..<grid.dataSize().x { XCTAssertEqual(42.0, grid[i, j, k]) } } } let function = {(x:Vector3F)->Float in if (x.x < 3.0) { return 2.0 } else { return 5.0 } } grid.fill(function: function) for k in 0..<grid.dataSize().z { for j in 0..<grid.dataSize().y { for i in 0..<grid.dataSize().x { if (i < 3) { XCTAssertEqual(2.0, grid[i, j, k]) } else { XCTAssertEqual(5.0, grid[i, j, k]) } } } } } }
44.104895
106
0.572221
ab33673e765ad9d3ffccdd3eb621258b6adc0168
432
// // PentagoGameHandler.swift // Pentago // // Created by Fredrik on 7/9/18. // Copyright © 2018 Fredrik. All rights reserved. // import Foundation protocol PentagoGameHandler { var selectableFields: Observable<Bool> { get } var selectableQuadrants: Observable<Bool> { get } func whatToPlace(at fieldPos: FieldPos, previousPiece: PieceColor?) -> PieceColor? func afterPlace(at fieldPos: FieldPos) }
22.736842
86
0.703704
5d46855a2df322f756dfa6250fd90f76ca37aa58
519,228
// Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). // You may not use this file except in compliance with the License. // A copy of the License is located at // // http://www.apache.org/licenses/LICENSE-2.0 // // or in the "license" file accompanying this file. This file is distributed // on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language governing // permissions and limitations under the License. // // swiftlint:disable superfluous_disable_command // swiftlint:disable file_length line_length identifier_name type_name vertical_parameter_alignment type_body_length // -- Generated Code; do not edit -- // // AWSRDSClient.swift // RDSClient // import Foundation import RDSModel import SmokeAWSCore import SmokeHTTPClient import SmokeAWSHttp import NIO import NIOHTTP1 import AsyncHTTPClient import Logging public enum RDSClientError: Swift.Error { case invalidEndpoint(String) case unsupportedPayload case unknownError(String?) } extension RDSError: ConvertableError { public static func asUnrecognizedError(error: Swift.Error) -> RDSError { return error.asUnrecognizedRDSError() } } /** AWS Client for the RDS service. */ public struct AWSRDSClient<InvocationReportingType: HTTPClientCoreInvocationReporting>: RDSClientProtocol { let httpClient: HTTPOperationsClient let ownsHttpClients: Bool let awsRegion: AWSRegion let service: String let apiVersion: String let target: String? let retryConfiguration: HTTPClientRetryConfiguration let retryOnErrorProvider: (SmokeHTTPClient.HTTPClientError) -> Bool let credentialsProvider: CredentialsProvider public let reporting: InvocationReportingType let operationsReporting: RDSOperationsReporting let invocationsReporting: RDSInvocationsReporting<InvocationReportingType> public init(credentialsProvider: CredentialsProvider, awsRegion: AWSRegion, reporting: InvocationReportingType, endpointHostName: String, endpointPort: Int = 443, requiresTLS: Bool? = nil, service: String = "rds", contentType: String = "application/octet-stream", apiVersion: String = "2014-10-31", connectionTimeoutSeconds: Int64 = 10, retryConfiguration: HTTPClientRetryConfiguration = .default, eventLoopProvider: HTTPClient.EventLoopGroupProvider = .createNew, reportingConfiguration: SmokeAWSClientReportingConfiguration<RDSModelOperations> = SmokeAWSClientReportingConfiguration<RDSModelOperations>() ) { let useTLS = requiresTLS ?? AWSHTTPClientDelegate.requiresTLS(forEndpointPort: endpointPort) let clientDelegate = XMLAWSHttpClientDelegate<RDSError>(requiresTLS: useTLS) self.httpClient = HTTPOperationsClient( endpointHostName: endpointHostName, endpointPort: endpointPort, contentType: contentType, clientDelegate: clientDelegate, connectionTimeoutSeconds: connectionTimeoutSeconds, eventLoopProvider: eventLoopProvider) self.ownsHttpClients = true self.awsRegion = awsRegion self.service = service self.target = nil self.credentialsProvider = credentialsProvider self.retryConfiguration = retryConfiguration self.reporting = reporting self.retryOnErrorProvider = { error in error.isRetriable() } self.apiVersion = apiVersion self.operationsReporting = RDSOperationsReporting(clientName: "AWSRDSClient", reportingConfiguration: reportingConfiguration) self.invocationsReporting = RDSInvocationsReporting(reporting: reporting, operationsReporting: self.operationsReporting) } internal init(credentialsProvider: CredentialsProvider, awsRegion: AWSRegion, reporting: InvocationReportingType, httpClient: HTTPOperationsClient, service: String, apiVersion: String, retryOnErrorProvider: @escaping (SmokeHTTPClient.HTTPClientError) -> Bool, retryConfiguration: HTTPClientRetryConfiguration, operationsReporting: RDSOperationsReporting) { self.httpClient = httpClient self.ownsHttpClients = false self.awsRegion = awsRegion self.service = service self.target = nil self.credentialsProvider = credentialsProvider self.retryConfiguration = retryConfiguration self.reporting = reporting self.retryOnErrorProvider = retryOnErrorProvider self.apiVersion = apiVersion self.operationsReporting = operationsReporting self.invocationsReporting = RDSInvocationsReporting(reporting: reporting, operationsReporting: self.operationsReporting) } /** Gracefully shuts down this client. This function is idempotent and will handle being called multiple times. */ public func close() throws { if self.ownsHttpClients { try httpClient.close() } } /** Invokes the AddRoleToDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated AddRoleToDBClusterMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBClusterNotFound, dBClusterRoleAlreadyExists, dBClusterRoleQuotaExceeded, invalidDBClusterState. */ public func addRoleToDBClusterAsync( input: RDSModel.AddRoleToDBClusterMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addRoleToDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = AddRoleToDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addRoleToDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the AddRoleToDBCluster operation waiting for the response before returning. - Parameters: - input: The validated AddRoleToDBClusterMessage object being passed to this operation. - Throws: dBClusterNotFound, dBClusterRoleAlreadyExists, dBClusterRoleQuotaExceeded, invalidDBClusterState. */ public func addRoleToDBClusterSync( input: RDSModel.AddRoleToDBClusterMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addRoleToDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = AddRoleToDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addRoleToDBCluster.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the AddRoleToDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated AddRoleToDBInstanceMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBInstanceNotFound, dBInstanceRoleAlreadyExists, dBInstanceRoleQuotaExceeded, invalidDBInstanceState. */ public func addRoleToDBInstanceAsync( input: RDSModel.AddRoleToDBInstanceMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addRoleToDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = AddRoleToDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addRoleToDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the AddRoleToDBInstance operation waiting for the response before returning. - Parameters: - input: The validated AddRoleToDBInstanceMessage object being passed to this operation. - Throws: dBInstanceNotFound, dBInstanceRoleAlreadyExists, dBInstanceRoleQuotaExceeded, invalidDBInstanceState. */ public func addRoleToDBInstanceSync( input: RDSModel.AddRoleToDBInstanceMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addRoleToDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = AddRoleToDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addRoleToDBInstance.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the AddSourceIdentifierToSubscription operation returning immediately and passing the response to a callback. - Parameters: - input: The validated AddSourceIdentifierToSubscriptionMessage object being passed to this operation. - completion: The AddSourceIdentifierToSubscriptionResultForAddSourceIdentifierToSubscription object or an error will be passed to this callback when the operation is complete. The AddSourceIdentifierToSubscriptionResultForAddSourceIdentifierToSubscription object will be validated before being returned to caller. The possible errors are: sourceNotFound, subscriptionNotFound. */ public func addSourceIdentifierToSubscriptionAsync( input: RDSModel.AddSourceIdentifierToSubscriptionMessage, completion: @escaping (Result<RDSModel.AddSourceIdentifierToSubscriptionResultForAddSourceIdentifierToSubscription, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addSourceIdentifierToSubscription, handlerDelegate: handlerDelegate) let wrappedInput = AddSourceIdentifierToSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addSourceIdentifierToSubscription.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the AddSourceIdentifierToSubscription operation waiting for the response before returning. - Parameters: - input: The validated AddSourceIdentifierToSubscriptionMessage object being passed to this operation. - Returns: The AddSourceIdentifierToSubscriptionResultForAddSourceIdentifierToSubscription object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: sourceNotFound, subscriptionNotFound. */ public func addSourceIdentifierToSubscriptionSync( input: RDSModel.AddSourceIdentifierToSubscriptionMessage) throws -> RDSModel.AddSourceIdentifierToSubscriptionResultForAddSourceIdentifierToSubscription { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addSourceIdentifierToSubscription, handlerDelegate: handlerDelegate) let wrappedInput = AddSourceIdentifierToSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addSourceIdentifierToSubscription.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the AddTagsToResource operation returning immediately and passing the response to a callback. - Parameters: - input: The validated AddTagsToResourceMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetGroupNotFound, dBSnapshotNotFound. */ public func addTagsToResourceAsync( input: RDSModel.AddTagsToResourceMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addTagsToResource, handlerDelegate: handlerDelegate) let wrappedInput = AddTagsToResourceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addTagsToResource.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the AddTagsToResource operation waiting for the response before returning. - Parameters: - input: The validated AddTagsToResourceMessage object being passed to this operation. - Throws: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetGroupNotFound, dBSnapshotNotFound. */ public func addTagsToResourceSync( input: RDSModel.AddTagsToResourceMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.addTagsToResource, handlerDelegate: handlerDelegate) let wrappedInput = AddTagsToResourceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.addTagsToResource.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ApplyPendingMaintenanceAction operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ApplyPendingMaintenanceActionMessage object being passed to this operation. - completion: The ApplyPendingMaintenanceActionResultForApplyPendingMaintenanceAction object or an error will be passed to this callback when the operation is complete. The ApplyPendingMaintenanceActionResultForApplyPendingMaintenanceAction object will be validated before being returned to caller. The possible errors are: invalidDBClusterState, invalidDBInstanceState, resourceNotFound. */ public func applyPendingMaintenanceActionAsync( input: RDSModel.ApplyPendingMaintenanceActionMessage, completion: @escaping (Result<RDSModel.ApplyPendingMaintenanceActionResultForApplyPendingMaintenanceAction, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.applyPendingMaintenanceAction, handlerDelegate: handlerDelegate) let wrappedInput = ApplyPendingMaintenanceActionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.applyPendingMaintenanceAction.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ApplyPendingMaintenanceAction operation waiting for the response before returning. - Parameters: - input: The validated ApplyPendingMaintenanceActionMessage object being passed to this operation. - Returns: The ApplyPendingMaintenanceActionResultForApplyPendingMaintenanceAction object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: invalidDBClusterState, invalidDBInstanceState, resourceNotFound. */ public func applyPendingMaintenanceActionSync( input: RDSModel.ApplyPendingMaintenanceActionMessage) throws -> RDSModel.ApplyPendingMaintenanceActionResultForApplyPendingMaintenanceAction { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.applyPendingMaintenanceAction, handlerDelegate: handlerDelegate) let wrappedInput = ApplyPendingMaintenanceActionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.applyPendingMaintenanceAction.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the AuthorizeDBSecurityGroupIngress operation returning immediately and passing the response to a callback. - Parameters: - input: The validated AuthorizeDBSecurityGroupIngressMessage object being passed to this operation. - completion: The AuthorizeDBSecurityGroupIngressResultForAuthorizeDBSecurityGroupIngress object or an error will be passed to this callback when the operation is complete. The AuthorizeDBSecurityGroupIngressResultForAuthorizeDBSecurityGroupIngress object will be validated before being returned to caller. The possible errors are: authorizationAlreadyExists, authorizationQuotaExceeded, dBSecurityGroupNotFound, invalidDBSecurityGroupState. */ public func authorizeDBSecurityGroupIngressAsync( input: RDSModel.AuthorizeDBSecurityGroupIngressMessage, completion: @escaping (Result<RDSModel.AuthorizeDBSecurityGroupIngressResultForAuthorizeDBSecurityGroupIngress, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.authorizeDBSecurityGroupIngress, handlerDelegate: handlerDelegate) let wrappedInput = AuthorizeDBSecurityGroupIngressOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.authorizeDBSecurityGroupIngress.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the AuthorizeDBSecurityGroupIngress operation waiting for the response before returning. - Parameters: - input: The validated AuthorizeDBSecurityGroupIngressMessage object being passed to this operation. - Returns: The AuthorizeDBSecurityGroupIngressResultForAuthorizeDBSecurityGroupIngress object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationAlreadyExists, authorizationQuotaExceeded, dBSecurityGroupNotFound, invalidDBSecurityGroupState. */ public func authorizeDBSecurityGroupIngressSync( input: RDSModel.AuthorizeDBSecurityGroupIngressMessage) throws -> RDSModel.AuthorizeDBSecurityGroupIngressResultForAuthorizeDBSecurityGroupIngress { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.authorizeDBSecurityGroupIngress, handlerDelegate: handlerDelegate) let wrappedInput = AuthorizeDBSecurityGroupIngressOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.authorizeDBSecurityGroupIngress.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the BacktrackDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated BacktrackDBClusterMessage object being passed to this operation. - completion: The DBClusterBacktrackForBacktrackDBCluster object or an error will be passed to this callback when the operation is complete. The DBClusterBacktrackForBacktrackDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, invalidDBClusterState. */ public func backtrackDBClusterAsync( input: RDSModel.BacktrackDBClusterMessage, completion: @escaping (Result<RDSModel.DBClusterBacktrackForBacktrackDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.backtrackDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = BacktrackDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.backtrackDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the BacktrackDBCluster operation waiting for the response before returning. - Parameters: - input: The validated BacktrackDBClusterMessage object being passed to this operation. - Returns: The DBClusterBacktrackForBacktrackDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, invalidDBClusterState. */ public func backtrackDBClusterSync( input: RDSModel.BacktrackDBClusterMessage) throws -> RDSModel.DBClusterBacktrackForBacktrackDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.backtrackDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = BacktrackDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.backtrackDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CancelExportTask operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CancelExportTaskMessage object being passed to this operation. - completion: The ExportTaskForCancelExportTask object or an error will be passed to this callback when the operation is complete. The ExportTaskForCancelExportTask object will be validated before being returned to caller. The possible errors are: exportTaskNotFound, invalidExportTaskState. */ public func cancelExportTaskAsync( input: RDSModel.CancelExportTaskMessage, completion: @escaping (Result<RDSModel.ExportTaskForCancelExportTask, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.cancelExportTask, handlerDelegate: handlerDelegate) let wrappedInput = CancelExportTaskOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.cancelExportTask.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CancelExportTask operation waiting for the response before returning. - Parameters: - input: The validated CancelExportTaskMessage object being passed to this operation. - Returns: The ExportTaskForCancelExportTask object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: exportTaskNotFound, invalidExportTaskState. */ public func cancelExportTaskSync( input: RDSModel.CancelExportTaskMessage) throws -> RDSModel.ExportTaskForCancelExportTask { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.cancelExportTask, handlerDelegate: handlerDelegate) let wrappedInput = CancelExportTaskOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.cancelExportTask.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CopyDBClusterParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CopyDBClusterParameterGroupMessage object being passed to this operation. - completion: The CopyDBClusterParameterGroupResultForCopyDBClusterParameterGroup object or an error will be passed to this callback when the operation is complete. The CopyDBClusterParameterGroupResultForCopyDBClusterParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupAlreadyExists, dBParameterGroupNotFound, dBParameterGroupQuotaExceeded. */ public func copyDBClusterParameterGroupAsync( input: RDSModel.CopyDBClusterParameterGroupMessage, completion: @escaping (Result<RDSModel.CopyDBClusterParameterGroupResultForCopyDBClusterParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBClusterParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CopyDBClusterParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated CopyDBClusterParameterGroupMessage object being passed to this operation. - Returns: The CopyDBClusterParameterGroupResultForCopyDBClusterParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupAlreadyExists, dBParameterGroupNotFound, dBParameterGroupQuotaExceeded. */ public func copyDBClusterParameterGroupSync( input: RDSModel.CopyDBClusterParameterGroupMessage) throws -> RDSModel.CopyDBClusterParameterGroupResultForCopyDBClusterParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBClusterParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CopyDBClusterSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CopyDBClusterSnapshotMessage object being passed to this operation. - completion: The CopyDBClusterSnapshotResultForCopyDBClusterSnapshot object or an error will be passed to this callback when the operation is complete. The CopyDBClusterSnapshotResultForCopyDBClusterSnapshot object will be validated before being returned to caller. The possible errors are: dBClusterSnapshotAlreadyExists, dBClusterSnapshotNotFound, invalidDBClusterSnapshotState, invalidDBClusterState, kMSKeyNotAccessible, snapshotQuotaExceeded. */ public func copyDBClusterSnapshotAsync( input: RDSModel.CopyDBClusterSnapshotMessage, completion: @escaping (Result<RDSModel.CopyDBClusterSnapshotResultForCopyDBClusterSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBClusterSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBClusterSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBClusterSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CopyDBClusterSnapshot operation waiting for the response before returning. - Parameters: - input: The validated CopyDBClusterSnapshotMessage object being passed to this operation. - Returns: The CopyDBClusterSnapshotResultForCopyDBClusterSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterSnapshotAlreadyExists, dBClusterSnapshotNotFound, invalidDBClusterSnapshotState, invalidDBClusterState, kMSKeyNotAccessible, snapshotQuotaExceeded. */ public func copyDBClusterSnapshotSync( input: RDSModel.CopyDBClusterSnapshotMessage) throws -> RDSModel.CopyDBClusterSnapshotResultForCopyDBClusterSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBClusterSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBClusterSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBClusterSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CopyDBParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CopyDBParameterGroupMessage object being passed to this operation. - completion: The CopyDBParameterGroupResultForCopyDBParameterGroup object or an error will be passed to this callback when the operation is complete. The CopyDBParameterGroupResultForCopyDBParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupAlreadyExists, dBParameterGroupNotFound, dBParameterGroupQuotaExceeded. */ public func copyDBParameterGroupAsync( input: RDSModel.CopyDBParameterGroupMessage, completion: @escaping (Result<RDSModel.CopyDBParameterGroupResultForCopyDBParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CopyDBParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated CopyDBParameterGroupMessage object being passed to this operation. - Returns: The CopyDBParameterGroupResultForCopyDBParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupAlreadyExists, dBParameterGroupNotFound, dBParameterGroupQuotaExceeded. */ public func copyDBParameterGroupSync( input: RDSModel.CopyDBParameterGroupMessage) throws -> RDSModel.CopyDBParameterGroupResultForCopyDBParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CopyDBSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CopyDBSnapshotMessage object being passed to this operation. - completion: The CopyDBSnapshotResultForCopyDBSnapshot object or an error will be passed to this callback when the operation is complete. The CopyDBSnapshotResultForCopyDBSnapshot object will be validated before being returned to caller. The possible errors are: customAvailabilityZoneNotFound, dBSnapshotAlreadyExists, dBSnapshotNotFound, invalidDBSnapshotState, kMSKeyNotAccessible, snapshotQuotaExceeded. */ public func copyDBSnapshotAsync( input: RDSModel.CopyDBSnapshotMessage, completion: @escaping (Result<RDSModel.CopyDBSnapshotResultForCopyDBSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CopyDBSnapshot operation waiting for the response before returning. - Parameters: - input: The validated CopyDBSnapshotMessage object being passed to this operation. - Returns: The CopyDBSnapshotResultForCopyDBSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: customAvailabilityZoneNotFound, dBSnapshotAlreadyExists, dBSnapshotNotFound, invalidDBSnapshotState, kMSKeyNotAccessible, snapshotQuotaExceeded. */ public func copyDBSnapshotSync( input: RDSModel.CopyDBSnapshotMessage) throws -> RDSModel.CopyDBSnapshotResultForCopyDBSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CopyDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyDBSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CopyOptionGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CopyOptionGroupMessage object being passed to this operation. - completion: The CopyOptionGroupResultForCopyOptionGroup object or an error will be passed to this callback when the operation is complete. The CopyOptionGroupResultForCopyOptionGroup object will be validated before being returned to caller. The possible errors are: optionGroupAlreadyExists, optionGroupNotFound, optionGroupQuotaExceeded. */ public func copyOptionGroupAsync( input: RDSModel.CopyOptionGroupMessage, completion: @escaping (Result<RDSModel.CopyOptionGroupResultForCopyOptionGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = CopyOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyOptionGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CopyOptionGroup operation waiting for the response before returning. - Parameters: - input: The validated CopyOptionGroupMessage object being passed to this operation. - Returns: The CopyOptionGroupResultForCopyOptionGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: optionGroupAlreadyExists, optionGroupNotFound, optionGroupQuotaExceeded. */ public func copyOptionGroupSync( input: RDSModel.CopyOptionGroupMessage) throws -> RDSModel.CopyOptionGroupResultForCopyOptionGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.copyOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = CopyOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.copyOptionGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateCustomAvailabilityZone operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateCustomAvailabilityZoneMessage object being passed to this operation. - completion: The CreateCustomAvailabilityZoneResultForCreateCustomAvailabilityZone object or an error will be passed to this callback when the operation is complete. The CreateCustomAvailabilityZoneResultForCreateCustomAvailabilityZone object will be validated before being returned to caller. The possible errors are: customAvailabilityZoneAlreadyExists, customAvailabilityZoneQuotaExceeded, kMSKeyNotAccessible. */ public func createCustomAvailabilityZoneAsync( input: RDSModel.CreateCustomAvailabilityZoneMessage, completion: @escaping (Result<RDSModel.CreateCustomAvailabilityZoneResultForCreateCustomAvailabilityZone, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createCustomAvailabilityZone, handlerDelegate: handlerDelegate) let wrappedInput = CreateCustomAvailabilityZoneOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createCustomAvailabilityZone.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateCustomAvailabilityZone operation waiting for the response before returning. - Parameters: - input: The validated CreateCustomAvailabilityZoneMessage object being passed to this operation. - Returns: The CreateCustomAvailabilityZoneResultForCreateCustomAvailabilityZone object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: customAvailabilityZoneAlreadyExists, customAvailabilityZoneQuotaExceeded, kMSKeyNotAccessible. */ public func createCustomAvailabilityZoneSync( input: RDSModel.CreateCustomAvailabilityZoneMessage) throws -> RDSModel.CreateCustomAvailabilityZoneResultForCreateCustomAvailabilityZone { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createCustomAvailabilityZone, handlerDelegate: handlerDelegate) let wrappedInput = CreateCustomAvailabilityZoneOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createCustomAvailabilityZone.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBClusterMessage object being passed to this operation. - completion: The CreateDBClusterResultForCreateDBCluster object or an error will be passed to this callback when the operation is complete. The CreateDBClusterResultForCreateDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBInstanceNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, globalClusterNotFound, insufficientStorageClusterCapacity, invalidDBClusterState, invalidDBInstanceState, invalidDBSubnetGroupState, invalidGlobalClusterState, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, storageQuotaExceeded. */ public func createDBClusterAsync( input: RDSModel.CreateDBClusterMessage, completion: @escaping (Result<RDSModel.CreateDBClusterResultForCreateDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBCluster operation waiting for the response before returning. - Parameters: - input: The validated CreateDBClusterMessage object being passed to this operation. - Returns: The CreateDBClusterResultForCreateDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBInstanceNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, globalClusterNotFound, insufficientStorageClusterCapacity, invalidDBClusterState, invalidDBInstanceState, invalidDBSubnetGroupState, invalidGlobalClusterState, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, storageQuotaExceeded. */ public func createDBClusterSync( input: RDSModel.CreateDBClusterMessage) throws -> RDSModel.CreateDBClusterResultForCreateDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBClusterEndpoint operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBClusterEndpointMessage object being passed to this operation. - completion: The DBClusterEndpointForCreateDBClusterEndpoint object or an error will be passed to this callback when the operation is complete. The DBClusterEndpointForCreateDBClusterEndpoint object will be validated before being returned to caller. The possible errors are: dBClusterEndpointAlreadyExists, dBClusterEndpointQuotaExceeded, dBClusterNotFound, dBInstanceNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func createDBClusterEndpointAsync( input: RDSModel.CreateDBClusterEndpointMessage, completion: @escaping (Result<RDSModel.DBClusterEndpointForCreateDBClusterEndpoint, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBClusterEndpoint, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterEndpointOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBClusterEndpoint.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBClusterEndpoint operation waiting for the response before returning. - Parameters: - input: The validated CreateDBClusterEndpointMessage object being passed to this operation. - Returns: The DBClusterEndpointForCreateDBClusterEndpoint object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterEndpointAlreadyExists, dBClusterEndpointQuotaExceeded, dBClusterNotFound, dBInstanceNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func createDBClusterEndpointSync( input: RDSModel.CreateDBClusterEndpointMessage) throws -> RDSModel.DBClusterEndpointForCreateDBClusterEndpoint { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBClusterEndpoint, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterEndpointOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBClusterEndpoint.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBClusterParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBClusterParameterGroupMessage object being passed to this operation. - completion: The CreateDBClusterParameterGroupResultForCreateDBClusterParameterGroup object or an error will be passed to this callback when the operation is complete. The CreateDBClusterParameterGroupResultForCreateDBClusterParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupAlreadyExists, dBParameterGroupQuotaExceeded. */ public func createDBClusterParameterGroupAsync( input: RDSModel.CreateDBClusterParameterGroupMessage, completion: @escaping (Result<RDSModel.CreateDBClusterParameterGroupResultForCreateDBClusterParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBClusterParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBClusterParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated CreateDBClusterParameterGroupMessage object being passed to this operation. - Returns: The CreateDBClusterParameterGroupResultForCreateDBClusterParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupAlreadyExists, dBParameterGroupQuotaExceeded. */ public func createDBClusterParameterGroupSync( input: RDSModel.CreateDBClusterParameterGroupMessage) throws -> RDSModel.CreateDBClusterParameterGroupResultForCreateDBClusterParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBClusterParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBClusterSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBClusterSnapshotMessage object being passed to this operation. - completion: The CreateDBClusterSnapshotResultForCreateDBClusterSnapshot object or an error will be passed to this callback when the operation is complete. The CreateDBClusterSnapshotResultForCreateDBClusterSnapshot object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, dBClusterSnapshotAlreadyExists, invalidDBClusterSnapshotState, invalidDBClusterState, snapshotQuotaExceeded. */ public func createDBClusterSnapshotAsync( input: RDSModel.CreateDBClusterSnapshotMessage, completion: @escaping (Result<RDSModel.CreateDBClusterSnapshotResultForCreateDBClusterSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBClusterSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBClusterSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBClusterSnapshot operation waiting for the response before returning. - Parameters: - input: The validated CreateDBClusterSnapshotMessage object being passed to this operation. - Returns: The CreateDBClusterSnapshotResultForCreateDBClusterSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, dBClusterSnapshotAlreadyExists, invalidDBClusterSnapshotState, invalidDBClusterState, snapshotQuotaExceeded. */ public func createDBClusterSnapshotSync( input: RDSModel.CreateDBClusterSnapshotMessage) throws -> RDSModel.CreateDBClusterSnapshotResultForCreateDBClusterSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBClusterSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBClusterSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBClusterSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBInstanceMessage object being passed to this operation. - completion: The CreateDBInstanceResultForCreateDBInstance object or an error will be passed to this callback when the operation is complete. The CreateDBInstanceResultForCreateDBInstance object will be validated before being returned to caller. The possible errors are: authorizationNotFound, backupPolicyNotFound, dBClusterNotFound, dBInstanceAlreadyExists, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBClusterState, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func createDBInstanceAsync( input: RDSModel.CreateDBInstanceMessage, completion: @escaping (Result<RDSModel.CreateDBInstanceResultForCreateDBInstance, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBInstance operation waiting for the response before returning. - Parameters: - input: The validated CreateDBInstanceMessage object being passed to this operation. - Returns: The CreateDBInstanceResultForCreateDBInstance object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationNotFound, backupPolicyNotFound, dBClusterNotFound, dBInstanceAlreadyExists, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBClusterState, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func createDBInstanceSync( input: RDSModel.CreateDBInstanceMessage) throws -> RDSModel.CreateDBInstanceResultForCreateDBInstance { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBInstance.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBInstanceReadReplica operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBInstanceReadReplicaMessage object being passed to this operation. - completion: The CreateDBInstanceReadReplicaResultForCreateDBInstanceReadReplica object or an error will be passed to this callback when the operation is complete. The CreateDBInstanceReadReplicaResultForCreateDBInstanceReadReplica object will be validated before being returned to caller. The possible errors are: dBInstanceAlreadyExists, dBInstanceNotFound, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotAllowed, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBInstanceState, invalidDBSubnetGroup, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func createDBInstanceReadReplicaAsync( input: RDSModel.CreateDBInstanceReadReplicaMessage, completion: @escaping (Result<RDSModel.CreateDBInstanceReadReplicaResultForCreateDBInstanceReadReplica, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBInstanceReadReplica, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBInstanceReadReplicaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBInstanceReadReplica.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBInstanceReadReplica operation waiting for the response before returning. - Parameters: - input: The validated CreateDBInstanceReadReplicaMessage object being passed to this operation. - Returns: The CreateDBInstanceReadReplicaResultForCreateDBInstanceReadReplica object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceAlreadyExists, dBInstanceNotFound, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotAllowed, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBInstanceState, invalidDBSubnetGroup, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func createDBInstanceReadReplicaSync( input: RDSModel.CreateDBInstanceReadReplicaMessage) throws -> RDSModel.CreateDBInstanceReadReplicaResultForCreateDBInstanceReadReplica { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBInstanceReadReplica, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBInstanceReadReplicaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBInstanceReadReplica.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBParameterGroupMessage object being passed to this operation. - completion: The CreateDBParameterGroupResultForCreateDBParameterGroup object or an error will be passed to this callback when the operation is complete. The CreateDBParameterGroupResultForCreateDBParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupAlreadyExists, dBParameterGroupQuotaExceeded. */ public func createDBParameterGroupAsync( input: RDSModel.CreateDBParameterGroupMessage, completion: @escaping (Result<RDSModel.CreateDBParameterGroupResultForCreateDBParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated CreateDBParameterGroupMessage object being passed to this operation. - Returns: The CreateDBParameterGroupResultForCreateDBParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupAlreadyExists, dBParameterGroupQuotaExceeded. */ public func createDBParameterGroupSync( input: RDSModel.CreateDBParameterGroupMessage) throws -> RDSModel.CreateDBParameterGroupResultForCreateDBParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBProxy operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBProxyRequest object being passed to this operation. - completion: The CreateDBProxyResponseForCreateDBProxy object or an error will be passed to this callback when the operation is complete. The CreateDBProxyResponseForCreateDBProxy object will be validated before being returned to caller. The possible errors are: dBProxyAlreadyExists, dBProxyQuotaExceeded, invalidSubnet. */ public func createDBProxyAsync( input: RDSModel.CreateDBProxyRequest, completion: @escaping (Result<RDSModel.CreateDBProxyResponseForCreateDBProxy, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBProxy, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBProxyOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBProxy.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBProxy operation waiting for the response before returning. - Parameters: - input: The validated CreateDBProxyRequest object being passed to this operation. - Returns: The CreateDBProxyResponseForCreateDBProxy object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyAlreadyExists, dBProxyQuotaExceeded, invalidSubnet. */ public func createDBProxySync( input: RDSModel.CreateDBProxyRequest) throws -> RDSModel.CreateDBProxyResponseForCreateDBProxy { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBProxy, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBProxyOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBProxy.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBSecurityGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBSecurityGroupMessage object being passed to this operation. - completion: The CreateDBSecurityGroupResultForCreateDBSecurityGroup object or an error will be passed to this callback when the operation is complete. The CreateDBSecurityGroupResultForCreateDBSecurityGroup object will be validated before being returned to caller. The possible errors are: dBSecurityGroupAlreadyExists, dBSecurityGroupNotSupported, dBSecurityGroupQuotaExceeded. */ public func createDBSecurityGroupAsync( input: RDSModel.CreateDBSecurityGroupMessage, completion: @escaping (Result<RDSModel.CreateDBSecurityGroupResultForCreateDBSecurityGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBSecurityGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBSecurityGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBSecurityGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBSecurityGroup operation waiting for the response before returning. - Parameters: - input: The validated CreateDBSecurityGroupMessage object being passed to this operation. - Returns: The CreateDBSecurityGroupResultForCreateDBSecurityGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSecurityGroupAlreadyExists, dBSecurityGroupNotSupported, dBSecurityGroupQuotaExceeded. */ public func createDBSecurityGroupSync( input: RDSModel.CreateDBSecurityGroupMessage) throws -> RDSModel.CreateDBSecurityGroupResultForCreateDBSecurityGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBSecurityGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBSecurityGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBSecurityGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBSnapshotMessage object being passed to this operation. - completion: The CreateDBSnapshotResultForCreateDBSnapshot object or an error will be passed to this callback when the operation is complete. The CreateDBSnapshotResultForCreateDBSnapshot object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound, dBSnapshotAlreadyExists, invalidDBInstanceState, snapshotQuotaExceeded. */ public func createDBSnapshotAsync( input: RDSModel.CreateDBSnapshotMessage, completion: @escaping (Result<RDSModel.CreateDBSnapshotResultForCreateDBSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBSnapshot operation waiting for the response before returning. - Parameters: - input: The validated CreateDBSnapshotMessage object being passed to this operation. - Returns: The CreateDBSnapshotResultForCreateDBSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound, dBSnapshotAlreadyExists, invalidDBInstanceState, snapshotQuotaExceeded. */ public func createDBSnapshotSync( input: RDSModel.CreateDBSnapshotMessage) throws -> RDSModel.CreateDBSnapshotResultForCreateDBSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateDBSubnetGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateDBSubnetGroupMessage object being passed to this operation. - completion: The CreateDBSubnetGroupResultForCreateDBSubnetGroup object or an error will be passed to this callback when the operation is complete. The CreateDBSubnetGroupResultForCreateDBSubnetGroup object will be validated before being returned to caller. The possible errors are: dBSubnetGroupAlreadyExists, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupQuotaExceeded, dBSubnetQuotaExceeded, invalidSubnet. */ public func createDBSubnetGroupAsync( input: RDSModel.CreateDBSubnetGroupMessage, completion: @escaping (Result<RDSModel.CreateDBSubnetGroupResultForCreateDBSubnetGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBSubnetGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBSubnetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBSubnetGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateDBSubnetGroup operation waiting for the response before returning. - Parameters: - input: The validated CreateDBSubnetGroupMessage object being passed to this operation. - Returns: The CreateDBSubnetGroupResultForCreateDBSubnetGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSubnetGroupAlreadyExists, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupQuotaExceeded, dBSubnetQuotaExceeded, invalidSubnet. */ public func createDBSubnetGroupSync( input: RDSModel.CreateDBSubnetGroupMessage) throws -> RDSModel.CreateDBSubnetGroupResultForCreateDBSubnetGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createDBSubnetGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateDBSubnetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createDBSubnetGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateEventSubscription operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateEventSubscriptionMessage object being passed to this operation. - completion: The CreateEventSubscriptionResultForCreateEventSubscription object or an error will be passed to this callback when the operation is complete. The CreateEventSubscriptionResultForCreateEventSubscription object will be validated before being returned to caller. The possible errors are: eventSubscriptionQuotaExceeded, sNSInvalidTopic, sNSNoAuthorization, sNSTopicArnNotFound, sourceNotFound, subscriptionAlreadyExist, subscriptionCategoryNotFound. */ public func createEventSubscriptionAsync( input: RDSModel.CreateEventSubscriptionMessage, completion: @escaping (Result<RDSModel.CreateEventSubscriptionResultForCreateEventSubscription, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createEventSubscription, handlerDelegate: handlerDelegate) let wrappedInput = CreateEventSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createEventSubscription.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateEventSubscription operation waiting for the response before returning. - Parameters: - input: The validated CreateEventSubscriptionMessage object being passed to this operation. - Returns: The CreateEventSubscriptionResultForCreateEventSubscription object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: eventSubscriptionQuotaExceeded, sNSInvalidTopic, sNSNoAuthorization, sNSTopicArnNotFound, sourceNotFound, subscriptionAlreadyExist, subscriptionCategoryNotFound. */ public func createEventSubscriptionSync( input: RDSModel.CreateEventSubscriptionMessage) throws -> RDSModel.CreateEventSubscriptionResultForCreateEventSubscription { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createEventSubscription, handlerDelegate: handlerDelegate) let wrappedInput = CreateEventSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createEventSubscription.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateGlobalCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateGlobalClusterMessage object being passed to this operation. - completion: The CreateGlobalClusterResultForCreateGlobalCluster object or an error will be passed to this callback when the operation is complete. The CreateGlobalClusterResultForCreateGlobalCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, globalClusterAlreadyExists, globalClusterQuotaExceeded, invalidDBClusterState. */ public func createGlobalClusterAsync( input: RDSModel.CreateGlobalClusterMessage, completion: @escaping (Result<RDSModel.CreateGlobalClusterResultForCreateGlobalCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = CreateGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createGlobalCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateGlobalCluster operation waiting for the response before returning. - Parameters: - input: The validated CreateGlobalClusterMessage object being passed to this operation. - Returns: The CreateGlobalClusterResultForCreateGlobalCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, globalClusterAlreadyExists, globalClusterQuotaExceeded, invalidDBClusterState. */ public func createGlobalClusterSync( input: RDSModel.CreateGlobalClusterMessage) throws -> RDSModel.CreateGlobalClusterResultForCreateGlobalCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = CreateGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createGlobalCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the CreateOptionGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated CreateOptionGroupMessage object being passed to this operation. - completion: The CreateOptionGroupResultForCreateOptionGroup object or an error will be passed to this callback when the operation is complete. The CreateOptionGroupResultForCreateOptionGroup object will be validated before being returned to caller. The possible errors are: optionGroupAlreadyExists, optionGroupQuotaExceeded. */ public func createOptionGroupAsync( input: RDSModel.CreateOptionGroupMessage, completion: @escaping (Result<RDSModel.CreateOptionGroupResultForCreateOptionGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createOptionGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the CreateOptionGroup operation waiting for the response before returning. - Parameters: - input: The validated CreateOptionGroupMessage object being passed to this operation. - Returns: The CreateOptionGroupResultForCreateOptionGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: optionGroupAlreadyExists, optionGroupQuotaExceeded. */ public func createOptionGroupSync( input: RDSModel.CreateOptionGroupMessage) throws -> RDSModel.CreateOptionGroupResultForCreateOptionGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.createOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = CreateOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.createOptionGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteCustomAvailabilityZone operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteCustomAvailabilityZoneMessage object being passed to this operation. - completion: The DeleteCustomAvailabilityZoneResultForDeleteCustomAvailabilityZone object or an error will be passed to this callback when the operation is complete. The DeleteCustomAvailabilityZoneResultForDeleteCustomAvailabilityZone object will be validated before being returned to caller. The possible errors are: customAvailabilityZoneNotFound, kMSKeyNotAccessible. */ public func deleteCustomAvailabilityZoneAsync( input: RDSModel.DeleteCustomAvailabilityZoneMessage, completion: @escaping (Result<RDSModel.DeleteCustomAvailabilityZoneResultForDeleteCustomAvailabilityZone, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteCustomAvailabilityZone, handlerDelegate: handlerDelegate) let wrappedInput = DeleteCustomAvailabilityZoneOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteCustomAvailabilityZone.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteCustomAvailabilityZone operation waiting for the response before returning. - Parameters: - input: The validated DeleteCustomAvailabilityZoneMessage object being passed to this operation. - Returns: The DeleteCustomAvailabilityZoneResultForDeleteCustomAvailabilityZone object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: customAvailabilityZoneNotFound, kMSKeyNotAccessible. */ public func deleteCustomAvailabilityZoneSync( input: RDSModel.DeleteCustomAvailabilityZoneMessage) throws -> RDSModel.DeleteCustomAvailabilityZoneResultForDeleteCustomAvailabilityZone { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteCustomAvailabilityZone, handlerDelegate: handlerDelegate) let wrappedInput = DeleteCustomAvailabilityZoneOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteCustomAvailabilityZone.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBClusterMessage object being passed to this operation. - completion: The DeleteDBClusterResultForDeleteDBCluster object or an error will be passed to this callback when the operation is complete. The DeleteDBClusterResultForDeleteDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, dBClusterSnapshotAlreadyExists, invalidDBClusterSnapshotState, invalidDBClusterState, snapshotQuotaExceeded. */ public func deleteDBClusterAsync( input: RDSModel.DeleteDBClusterMessage, completion: @escaping (Result<RDSModel.DeleteDBClusterResultForDeleteDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBCluster operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBClusterMessage object being passed to this operation. - Returns: The DeleteDBClusterResultForDeleteDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, dBClusterSnapshotAlreadyExists, invalidDBClusterSnapshotState, invalidDBClusterState, snapshotQuotaExceeded. */ public func deleteDBClusterSync( input: RDSModel.DeleteDBClusterMessage) throws -> RDSModel.DeleteDBClusterResultForDeleteDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBClusterEndpoint operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBClusterEndpointMessage object being passed to this operation. - completion: The DBClusterEndpointForDeleteDBClusterEndpoint object or an error will be passed to this callback when the operation is complete. The DBClusterEndpointForDeleteDBClusterEndpoint object will be validated before being returned to caller. The possible errors are: dBClusterEndpointNotFound, invalidDBClusterEndpointState, invalidDBClusterState. */ public func deleteDBClusterEndpointAsync( input: RDSModel.DeleteDBClusterEndpointMessage, completion: @escaping (Result<RDSModel.DBClusterEndpointForDeleteDBClusterEndpoint, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBClusterEndpoint, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterEndpointOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBClusterEndpoint.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBClusterEndpoint operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBClusterEndpointMessage object being passed to this operation. - Returns: The DBClusterEndpointForDeleteDBClusterEndpoint object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterEndpointNotFound, invalidDBClusterEndpointState, invalidDBClusterState. */ public func deleteDBClusterEndpointSync( input: RDSModel.DeleteDBClusterEndpointMessage) throws -> RDSModel.DBClusterEndpointForDeleteDBClusterEndpoint { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBClusterEndpoint, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterEndpointOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBClusterEndpoint.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBClusterParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBClusterParameterGroupMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func deleteDBClusterParameterGroupAsync( input: RDSModel.DeleteDBClusterParameterGroupMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBClusterParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBClusterParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBClusterParameterGroupMessage object being passed to this operation. - Throws: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func deleteDBClusterParameterGroupSync( input: RDSModel.DeleteDBClusterParameterGroupMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBClusterParameterGroup.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBClusterSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBClusterSnapshotMessage object being passed to this operation. - completion: The DeleteDBClusterSnapshotResultForDeleteDBClusterSnapshot object or an error will be passed to this callback when the operation is complete. The DeleteDBClusterSnapshotResultForDeleteDBClusterSnapshot object will be validated before being returned to caller. The possible errors are: dBClusterSnapshotNotFound, invalidDBClusterSnapshotState. */ public func deleteDBClusterSnapshotAsync( input: RDSModel.DeleteDBClusterSnapshotMessage, completion: @escaping (Result<RDSModel.DeleteDBClusterSnapshotResultForDeleteDBClusterSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBClusterSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBClusterSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBClusterSnapshot operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBClusterSnapshotMessage object being passed to this operation. - Returns: The DeleteDBClusterSnapshotResultForDeleteDBClusterSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterSnapshotNotFound, invalidDBClusterSnapshotState. */ public func deleteDBClusterSnapshotSync( input: RDSModel.DeleteDBClusterSnapshotMessage) throws -> RDSModel.DeleteDBClusterSnapshotResultForDeleteDBClusterSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBClusterSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBClusterSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBClusterSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBInstanceMessage object being passed to this operation. - completion: The DeleteDBInstanceResultForDeleteDBInstance object or an error will be passed to this callback when the operation is complete. The DeleteDBInstanceResultForDeleteDBInstance object will be validated before being returned to caller. The possible errors are: dBInstanceAutomatedBackupQuotaExceeded, dBInstanceNotFound, dBSnapshotAlreadyExists, invalidDBClusterState, invalidDBInstanceState, snapshotQuotaExceeded. */ public func deleteDBInstanceAsync( input: RDSModel.DeleteDBInstanceMessage, completion: @escaping (Result<RDSModel.DeleteDBInstanceResultForDeleteDBInstance, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBInstance operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBInstanceMessage object being passed to this operation. - Returns: The DeleteDBInstanceResultForDeleteDBInstance object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceAutomatedBackupQuotaExceeded, dBInstanceNotFound, dBSnapshotAlreadyExists, invalidDBClusterState, invalidDBInstanceState, snapshotQuotaExceeded. */ public func deleteDBInstanceSync( input: RDSModel.DeleteDBInstanceMessage) throws -> RDSModel.DeleteDBInstanceResultForDeleteDBInstance { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBInstance.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBInstanceAutomatedBackup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBInstanceAutomatedBackupMessage object being passed to this operation. - completion: The DeleteDBInstanceAutomatedBackupResultForDeleteDBInstanceAutomatedBackup object or an error will be passed to this callback when the operation is complete. The DeleteDBInstanceAutomatedBackupResultForDeleteDBInstanceAutomatedBackup object will be validated before being returned to caller. The possible errors are: dBInstanceAutomatedBackupNotFound, invalidDBInstanceAutomatedBackupState. */ public func deleteDBInstanceAutomatedBackupAsync( input: RDSModel.DeleteDBInstanceAutomatedBackupMessage, completion: @escaping (Result<RDSModel.DeleteDBInstanceAutomatedBackupResultForDeleteDBInstanceAutomatedBackup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBInstanceAutomatedBackup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBInstanceAutomatedBackupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBInstanceAutomatedBackup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBInstanceAutomatedBackup operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBInstanceAutomatedBackupMessage object being passed to this operation. - Returns: The DeleteDBInstanceAutomatedBackupResultForDeleteDBInstanceAutomatedBackup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceAutomatedBackupNotFound, invalidDBInstanceAutomatedBackupState. */ public func deleteDBInstanceAutomatedBackupSync( input: RDSModel.DeleteDBInstanceAutomatedBackupMessage) throws -> RDSModel.DeleteDBInstanceAutomatedBackupResultForDeleteDBInstanceAutomatedBackup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBInstanceAutomatedBackup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBInstanceAutomatedBackupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBInstanceAutomatedBackup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBParameterGroupMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func deleteDBParameterGroupAsync( input: RDSModel.DeleteDBParameterGroupMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBParameterGroupMessage object being passed to this operation. - Throws: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func deleteDBParameterGroupSync( input: RDSModel.DeleteDBParameterGroupMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBParameterGroup.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBProxy operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBProxyRequest object being passed to this operation. - completion: The DeleteDBProxyResponseForDeleteDBProxy object or an error will be passed to this callback when the operation is complete. The DeleteDBProxyResponseForDeleteDBProxy object will be validated before being returned to caller. The possible errors are: dBProxyNotFound, invalidDBProxyState. */ public func deleteDBProxyAsync( input: RDSModel.DeleteDBProxyRequest, completion: @escaping (Result<RDSModel.DeleteDBProxyResponseForDeleteDBProxy, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBProxy, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBProxyOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBProxy.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBProxy operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBProxyRequest object being passed to this operation. - Returns: The DeleteDBProxyResponseForDeleteDBProxy object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyNotFound, invalidDBProxyState. */ public func deleteDBProxySync( input: RDSModel.DeleteDBProxyRequest) throws -> RDSModel.DeleteDBProxyResponseForDeleteDBProxy { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBProxy, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBProxyOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBProxy.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBSecurityGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBSecurityGroupMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBSecurityGroupNotFound, invalidDBSecurityGroupState. */ public func deleteDBSecurityGroupAsync( input: RDSModel.DeleteDBSecurityGroupMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBSecurityGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBSecurityGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBSecurityGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBSecurityGroup operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBSecurityGroupMessage object being passed to this operation. - Throws: dBSecurityGroupNotFound, invalidDBSecurityGroupState. */ public func deleteDBSecurityGroupSync( input: RDSModel.DeleteDBSecurityGroupMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBSecurityGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBSecurityGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBSecurityGroup.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBSnapshotMessage object being passed to this operation. - completion: The DeleteDBSnapshotResultForDeleteDBSnapshot object or an error will be passed to this callback when the operation is complete. The DeleteDBSnapshotResultForDeleteDBSnapshot object will be validated before being returned to caller. The possible errors are: dBSnapshotNotFound, invalidDBSnapshotState. */ public func deleteDBSnapshotAsync( input: RDSModel.DeleteDBSnapshotMessage, completion: @escaping (Result<RDSModel.DeleteDBSnapshotResultForDeleteDBSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBSnapshot operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBSnapshotMessage object being passed to this operation. - Returns: The DeleteDBSnapshotResultForDeleteDBSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSnapshotNotFound, invalidDBSnapshotState. */ public func deleteDBSnapshotSync( input: RDSModel.DeleteDBSnapshotMessage) throws -> RDSModel.DeleteDBSnapshotResultForDeleteDBSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteDBSubnetGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteDBSubnetGroupMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBSubnetGroupNotFound, invalidDBSubnetGroupState, invalidDBSubnetState. */ public func deleteDBSubnetGroupAsync( input: RDSModel.DeleteDBSubnetGroupMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBSubnetGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBSubnetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBSubnetGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteDBSubnetGroup operation waiting for the response before returning. - Parameters: - input: The validated DeleteDBSubnetGroupMessage object being passed to this operation. - Throws: dBSubnetGroupNotFound, invalidDBSubnetGroupState, invalidDBSubnetState. */ public func deleteDBSubnetGroupSync( input: RDSModel.DeleteDBSubnetGroupMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteDBSubnetGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteDBSubnetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteDBSubnetGroup.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteEventSubscription operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteEventSubscriptionMessage object being passed to this operation. - completion: The DeleteEventSubscriptionResultForDeleteEventSubscription object or an error will be passed to this callback when the operation is complete. The DeleteEventSubscriptionResultForDeleteEventSubscription object will be validated before being returned to caller. The possible errors are: invalidEventSubscriptionState, subscriptionNotFound. */ public func deleteEventSubscriptionAsync( input: RDSModel.DeleteEventSubscriptionMessage, completion: @escaping (Result<RDSModel.DeleteEventSubscriptionResultForDeleteEventSubscription, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteEventSubscription, handlerDelegate: handlerDelegate) let wrappedInput = DeleteEventSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteEventSubscription.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteEventSubscription operation waiting for the response before returning. - Parameters: - input: The validated DeleteEventSubscriptionMessage object being passed to this operation. - Returns: The DeleteEventSubscriptionResultForDeleteEventSubscription object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: invalidEventSubscriptionState, subscriptionNotFound. */ public func deleteEventSubscriptionSync( input: RDSModel.DeleteEventSubscriptionMessage) throws -> RDSModel.DeleteEventSubscriptionResultForDeleteEventSubscription { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteEventSubscription, handlerDelegate: handlerDelegate) let wrappedInput = DeleteEventSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteEventSubscription.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteGlobalCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteGlobalClusterMessage object being passed to this operation. - completion: The DeleteGlobalClusterResultForDeleteGlobalCluster object or an error will be passed to this callback when the operation is complete. The DeleteGlobalClusterResultForDeleteGlobalCluster object will be validated before being returned to caller. The possible errors are: globalClusterNotFound, invalidGlobalClusterState. */ public func deleteGlobalClusterAsync( input: RDSModel.DeleteGlobalClusterMessage, completion: @escaping (Result<RDSModel.DeleteGlobalClusterResultForDeleteGlobalCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = DeleteGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteGlobalCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteGlobalCluster operation waiting for the response before returning. - Parameters: - input: The validated DeleteGlobalClusterMessage object being passed to this operation. - Returns: The DeleteGlobalClusterResultForDeleteGlobalCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: globalClusterNotFound, invalidGlobalClusterState. */ public func deleteGlobalClusterSync( input: RDSModel.DeleteGlobalClusterMessage) throws -> RDSModel.DeleteGlobalClusterResultForDeleteGlobalCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = DeleteGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteGlobalCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteInstallationMedia operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteInstallationMediaMessage object being passed to this operation. - completion: The InstallationMediaForDeleteInstallationMedia object or an error will be passed to this callback when the operation is complete. The InstallationMediaForDeleteInstallationMedia object will be validated before being returned to caller. The possible errors are: installationMediaNotFound. */ public func deleteInstallationMediaAsync( input: RDSModel.DeleteInstallationMediaMessage, completion: @escaping (Result<RDSModel.InstallationMediaForDeleteInstallationMedia, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteInstallationMedia, handlerDelegate: handlerDelegate) let wrappedInput = DeleteInstallationMediaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteInstallationMedia.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteInstallationMedia operation waiting for the response before returning. - Parameters: - input: The validated DeleteInstallationMediaMessage object being passed to this operation. - Returns: The InstallationMediaForDeleteInstallationMedia object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: installationMediaNotFound. */ public func deleteInstallationMediaSync( input: RDSModel.DeleteInstallationMediaMessage) throws -> RDSModel.InstallationMediaForDeleteInstallationMedia { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteInstallationMedia, handlerDelegate: handlerDelegate) let wrappedInput = DeleteInstallationMediaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteInstallationMedia.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeleteOptionGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeleteOptionGroupMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: invalidOptionGroupState, optionGroupNotFound. */ public func deleteOptionGroupAsync( input: RDSModel.DeleteOptionGroupMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteOptionGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeleteOptionGroup operation waiting for the response before returning. - Parameters: - input: The validated DeleteOptionGroupMessage object being passed to this operation. - Throws: invalidOptionGroupState, optionGroupNotFound. */ public func deleteOptionGroupSync( input: RDSModel.DeleteOptionGroupMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deleteOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = DeleteOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deleteOptionGroup.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DeregisterDBProxyTargets operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DeregisterDBProxyTargetsRequest object being passed to this operation. - completion: The DeregisterDBProxyTargetsResponseForDeregisterDBProxyTargets object or an error will be passed to this callback when the operation is complete. The DeregisterDBProxyTargetsResponseForDeregisterDBProxyTargets object will be validated before being returned to caller. The possible errors are: dBProxyNotFound, dBProxyTargetGroupNotFound, dBProxyTargetNotFound, invalidDBProxyState. */ public func deregisterDBProxyTargetsAsync( input: RDSModel.DeregisterDBProxyTargetsRequest, completion: @escaping (Result<RDSModel.DeregisterDBProxyTargetsResponseForDeregisterDBProxyTargets, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deregisterDBProxyTargets, handlerDelegate: handlerDelegate) let wrappedInput = DeregisterDBProxyTargetsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deregisterDBProxyTargets.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DeregisterDBProxyTargets operation waiting for the response before returning. - Parameters: - input: The validated DeregisterDBProxyTargetsRequest object being passed to this operation. - Returns: The DeregisterDBProxyTargetsResponseForDeregisterDBProxyTargets object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyNotFound, dBProxyTargetGroupNotFound, dBProxyTargetNotFound, invalidDBProxyState. */ public func deregisterDBProxyTargetsSync( input: RDSModel.DeregisterDBProxyTargetsRequest) throws -> RDSModel.DeregisterDBProxyTargetsResponseForDeregisterDBProxyTargets { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.deregisterDBProxyTargets, handlerDelegate: handlerDelegate) let wrappedInput = DeregisterDBProxyTargetsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.deregisterDBProxyTargets.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeAccountAttributes operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeAccountAttributesMessage object being passed to this operation. - completion: The AccountAttributesMessageForDescribeAccountAttributes object or an error will be passed to this callback when the operation is complete. The AccountAttributesMessageForDescribeAccountAttributes object will be validated before being returned to caller. */ public func describeAccountAttributesAsync( input: RDSModel.DescribeAccountAttributesMessage, completion: @escaping (Result<RDSModel.AccountAttributesMessageForDescribeAccountAttributes, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeAccountAttributes, handlerDelegate: handlerDelegate) let wrappedInput = DescribeAccountAttributesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeAccountAttributes.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeAccountAttributes operation waiting for the response before returning. - Parameters: - input: The validated DescribeAccountAttributesMessage object being passed to this operation. - Returns: The AccountAttributesMessageForDescribeAccountAttributes object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeAccountAttributesSync( input: RDSModel.DescribeAccountAttributesMessage) throws -> RDSModel.AccountAttributesMessageForDescribeAccountAttributes { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeAccountAttributes, handlerDelegate: handlerDelegate) let wrappedInput = DescribeAccountAttributesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeAccountAttributes.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeCertificates operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeCertificatesMessage object being passed to this operation. - completion: The CertificateMessageForDescribeCertificates object or an error will be passed to this callback when the operation is complete. The CertificateMessageForDescribeCertificates object will be validated before being returned to caller. The possible errors are: certificateNotFound. */ public func describeCertificatesAsync( input: RDSModel.DescribeCertificatesMessage, completion: @escaping (Result<RDSModel.CertificateMessageForDescribeCertificates, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeCertificates, handlerDelegate: handlerDelegate) let wrappedInput = DescribeCertificatesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeCertificates.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeCertificates operation waiting for the response before returning. - Parameters: - input: The validated DescribeCertificatesMessage object being passed to this operation. - Returns: The CertificateMessageForDescribeCertificates object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: certificateNotFound. */ public func describeCertificatesSync( input: RDSModel.DescribeCertificatesMessage) throws -> RDSModel.CertificateMessageForDescribeCertificates { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeCertificates, handlerDelegate: handlerDelegate) let wrappedInput = DescribeCertificatesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeCertificates.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeCustomAvailabilityZones operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeCustomAvailabilityZonesMessage object being passed to this operation. - completion: The CustomAvailabilityZoneMessageForDescribeCustomAvailabilityZones object or an error will be passed to this callback when the operation is complete. The CustomAvailabilityZoneMessageForDescribeCustomAvailabilityZones object will be validated before being returned to caller. The possible errors are: customAvailabilityZoneNotFound. */ public func describeCustomAvailabilityZonesAsync( input: RDSModel.DescribeCustomAvailabilityZonesMessage, completion: @escaping (Result<RDSModel.CustomAvailabilityZoneMessageForDescribeCustomAvailabilityZones, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeCustomAvailabilityZones, handlerDelegate: handlerDelegate) let wrappedInput = DescribeCustomAvailabilityZonesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeCustomAvailabilityZones.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeCustomAvailabilityZones operation waiting for the response before returning. - Parameters: - input: The validated DescribeCustomAvailabilityZonesMessage object being passed to this operation. - Returns: The CustomAvailabilityZoneMessageForDescribeCustomAvailabilityZones object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: customAvailabilityZoneNotFound. */ public func describeCustomAvailabilityZonesSync( input: RDSModel.DescribeCustomAvailabilityZonesMessage) throws -> RDSModel.CustomAvailabilityZoneMessageForDescribeCustomAvailabilityZones { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeCustomAvailabilityZones, handlerDelegate: handlerDelegate) let wrappedInput = DescribeCustomAvailabilityZonesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeCustomAvailabilityZones.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBClusterBacktracks operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBClusterBacktracksMessage object being passed to this operation. - completion: The DBClusterBacktrackMessageForDescribeDBClusterBacktracks object or an error will be passed to this callback when the operation is complete. The DBClusterBacktrackMessageForDescribeDBClusterBacktracks object will be validated before being returned to caller. The possible errors are: dBClusterBacktrackNotFound, dBClusterNotFound. */ public func describeDBClusterBacktracksAsync( input: RDSModel.DescribeDBClusterBacktracksMessage, completion: @escaping (Result<RDSModel.DBClusterBacktrackMessageForDescribeDBClusterBacktracks, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterBacktracks, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterBacktracksOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterBacktracks.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBClusterBacktracks operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBClusterBacktracksMessage object being passed to this operation. - Returns: The DBClusterBacktrackMessageForDescribeDBClusterBacktracks object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterBacktrackNotFound, dBClusterNotFound. */ public func describeDBClusterBacktracksSync( input: RDSModel.DescribeDBClusterBacktracksMessage) throws -> RDSModel.DBClusterBacktrackMessageForDescribeDBClusterBacktracks { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterBacktracks, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterBacktracksOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterBacktracks.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBClusterEndpoints operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBClusterEndpointsMessage object being passed to this operation. - completion: The DBClusterEndpointMessageForDescribeDBClusterEndpoints object or an error will be passed to this callback when the operation is complete. The DBClusterEndpointMessageForDescribeDBClusterEndpoints object will be validated before being returned to caller. The possible errors are: dBClusterNotFound. */ public func describeDBClusterEndpointsAsync( input: RDSModel.DescribeDBClusterEndpointsMessage, completion: @escaping (Result<RDSModel.DBClusterEndpointMessageForDescribeDBClusterEndpoints, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterEndpoints, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterEndpointsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterEndpoints.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBClusterEndpoints operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBClusterEndpointsMessage object being passed to this operation. - Returns: The DBClusterEndpointMessageForDescribeDBClusterEndpoints object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound. */ public func describeDBClusterEndpointsSync( input: RDSModel.DescribeDBClusterEndpointsMessage) throws -> RDSModel.DBClusterEndpointMessageForDescribeDBClusterEndpoints { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterEndpoints, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterEndpointsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterEndpoints.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBClusterParameterGroups operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBClusterParameterGroupsMessage object being passed to this operation. - completion: The DBClusterParameterGroupsMessageForDescribeDBClusterParameterGroups object or an error will be passed to this callback when the operation is complete. The DBClusterParameterGroupsMessageForDescribeDBClusterParameterGroups object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound. */ public func describeDBClusterParameterGroupsAsync( input: RDSModel.DescribeDBClusterParameterGroupsMessage, completion: @escaping (Result<RDSModel.DBClusterParameterGroupsMessageForDescribeDBClusterParameterGroups, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterParameterGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterParameterGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterParameterGroups.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBClusterParameterGroups operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBClusterParameterGroupsMessage object being passed to this operation. - Returns: The DBClusterParameterGroupsMessageForDescribeDBClusterParameterGroups object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound. */ public func describeDBClusterParameterGroupsSync( input: RDSModel.DescribeDBClusterParameterGroupsMessage) throws -> RDSModel.DBClusterParameterGroupsMessageForDescribeDBClusterParameterGroups { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterParameterGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterParameterGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterParameterGroups.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBClusterParameters operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBClusterParametersMessage object being passed to this operation. - completion: The DBClusterParameterGroupDetailsForDescribeDBClusterParameters object or an error will be passed to this callback when the operation is complete. The DBClusterParameterGroupDetailsForDescribeDBClusterParameters object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound. */ public func describeDBClusterParametersAsync( input: RDSModel.DescribeDBClusterParametersMessage, completion: @escaping (Result<RDSModel.DBClusterParameterGroupDetailsForDescribeDBClusterParameters, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterParameters.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBClusterParameters operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBClusterParametersMessage object being passed to this operation. - Returns: The DBClusterParameterGroupDetailsForDescribeDBClusterParameters object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound. */ public func describeDBClusterParametersSync( input: RDSModel.DescribeDBClusterParametersMessage) throws -> RDSModel.DBClusterParameterGroupDetailsForDescribeDBClusterParameters { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterParameters.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBClusterSnapshotAttributes operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBClusterSnapshotAttributesMessage object being passed to this operation. - completion: The DescribeDBClusterSnapshotAttributesResultForDescribeDBClusterSnapshotAttributes object or an error will be passed to this callback when the operation is complete. The DescribeDBClusterSnapshotAttributesResultForDescribeDBClusterSnapshotAttributes object will be validated before being returned to caller. The possible errors are: dBClusterSnapshotNotFound. */ public func describeDBClusterSnapshotAttributesAsync( input: RDSModel.DescribeDBClusterSnapshotAttributesMessage, completion: @escaping (Result<RDSModel.DescribeDBClusterSnapshotAttributesResultForDescribeDBClusterSnapshotAttributes, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterSnapshotAttributes, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterSnapshotAttributesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterSnapshotAttributes.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBClusterSnapshotAttributes operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBClusterSnapshotAttributesMessage object being passed to this operation. - Returns: The DescribeDBClusterSnapshotAttributesResultForDescribeDBClusterSnapshotAttributes object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterSnapshotNotFound. */ public func describeDBClusterSnapshotAttributesSync( input: RDSModel.DescribeDBClusterSnapshotAttributesMessage) throws -> RDSModel.DescribeDBClusterSnapshotAttributesResultForDescribeDBClusterSnapshotAttributes { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterSnapshotAttributes, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterSnapshotAttributesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterSnapshotAttributes.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBClusterSnapshots operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBClusterSnapshotsMessage object being passed to this operation. - completion: The DBClusterSnapshotMessageForDescribeDBClusterSnapshots object or an error will be passed to this callback when the operation is complete. The DBClusterSnapshotMessageForDescribeDBClusterSnapshots object will be validated before being returned to caller. The possible errors are: dBClusterSnapshotNotFound. */ public func describeDBClusterSnapshotsAsync( input: RDSModel.DescribeDBClusterSnapshotsMessage, completion: @escaping (Result<RDSModel.DBClusterSnapshotMessageForDescribeDBClusterSnapshots, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterSnapshots, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterSnapshotsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterSnapshots.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBClusterSnapshots operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBClusterSnapshotsMessage object being passed to this operation. - Returns: The DBClusterSnapshotMessageForDescribeDBClusterSnapshots object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterSnapshotNotFound. */ public func describeDBClusterSnapshotsSync( input: RDSModel.DescribeDBClusterSnapshotsMessage) throws -> RDSModel.DBClusterSnapshotMessageForDescribeDBClusterSnapshots { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusterSnapshots, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClusterSnapshotsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusterSnapshots.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBClusters operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBClustersMessage object being passed to this operation. - completion: The DBClusterMessageForDescribeDBClusters object or an error will be passed to this callback when the operation is complete. The DBClusterMessageForDescribeDBClusters object will be validated before being returned to caller. The possible errors are: dBClusterNotFound. */ public func describeDBClustersAsync( input: RDSModel.DescribeDBClustersMessage, completion: @escaping (Result<RDSModel.DBClusterMessageForDescribeDBClusters, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClustersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusters.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBClusters operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBClustersMessage object being passed to this operation. - Returns: The DBClusterMessageForDescribeDBClusters object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound. */ public func describeDBClustersSync( input: RDSModel.DescribeDBClustersMessage) throws -> RDSModel.DBClusterMessageForDescribeDBClusters { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBClusters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBClustersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBClusters.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBEngineVersions operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBEngineVersionsMessage object being passed to this operation. - completion: The DBEngineVersionMessageForDescribeDBEngineVersions object or an error will be passed to this callback when the operation is complete. The DBEngineVersionMessageForDescribeDBEngineVersions object will be validated before being returned to caller. */ public func describeDBEngineVersionsAsync( input: RDSModel.DescribeDBEngineVersionsMessage, completion: @escaping (Result<RDSModel.DBEngineVersionMessageForDescribeDBEngineVersions, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBEngineVersions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBEngineVersionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBEngineVersions.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBEngineVersions operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBEngineVersionsMessage object being passed to this operation. - Returns: The DBEngineVersionMessageForDescribeDBEngineVersions object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeDBEngineVersionsSync( input: RDSModel.DescribeDBEngineVersionsMessage) throws -> RDSModel.DBEngineVersionMessageForDescribeDBEngineVersions { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBEngineVersions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBEngineVersionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBEngineVersions.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBInstanceAutomatedBackups operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBInstanceAutomatedBackupsMessage object being passed to this operation. - completion: The DBInstanceAutomatedBackupMessageForDescribeDBInstanceAutomatedBackups object or an error will be passed to this callback when the operation is complete. The DBInstanceAutomatedBackupMessageForDescribeDBInstanceAutomatedBackups object will be validated before being returned to caller. The possible errors are: dBInstanceAutomatedBackupNotFound. */ public func describeDBInstanceAutomatedBackupsAsync( input: RDSModel.DescribeDBInstanceAutomatedBackupsMessage, completion: @escaping (Result<RDSModel.DBInstanceAutomatedBackupMessageForDescribeDBInstanceAutomatedBackups, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBInstanceAutomatedBackups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBInstanceAutomatedBackupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBInstanceAutomatedBackups.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBInstanceAutomatedBackups operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBInstanceAutomatedBackupsMessage object being passed to this operation. - Returns: The DBInstanceAutomatedBackupMessageForDescribeDBInstanceAutomatedBackups object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceAutomatedBackupNotFound. */ public func describeDBInstanceAutomatedBackupsSync( input: RDSModel.DescribeDBInstanceAutomatedBackupsMessage) throws -> RDSModel.DBInstanceAutomatedBackupMessageForDescribeDBInstanceAutomatedBackups { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBInstanceAutomatedBackups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBInstanceAutomatedBackupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBInstanceAutomatedBackups.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBInstances operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBInstancesMessage object being passed to this operation. - completion: The DBInstanceMessageForDescribeDBInstances object or an error will be passed to this callback when the operation is complete. The DBInstanceMessageForDescribeDBInstances object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound. */ public func describeDBInstancesAsync( input: RDSModel.DescribeDBInstancesMessage, completion: @escaping (Result<RDSModel.DBInstanceMessageForDescribeDBInstances, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBInstances, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBInstancesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBInstances.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBInstances operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBInstancesMessage object being passed to this operation. - Returns: The DBInstanceMessageForDescribeDBInstances object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound. */ public func describeDBInstancesSync( input: RDSModel.DescribeDBInstancesMessage) throws -> RDSModel.DBInstanceMessageForDescribeDBInstances { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBInstances, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBInstancesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBInstances.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBLogFiles operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBLogFilesMessage object being passed to this operation. - completion: The DescribeDBLogFilesResponseForDescribeDBLogFiles object or an error will be passed to this callback when the operation is complete. The DescribeDBLogFilesResponseForDescribeDBLogFiles object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound. */ public func describeDBLogFilesAsync( input: RDSModel.DescribeDBLogFilesMessage, completion: @escaping (Result<RDSModel.DescribeDBLogFilesResponseForDescribeDBLogFiles, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBLogFiles, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBLogFilesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBLogFiles.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBLogFiles operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBLogFilesMessage object being passed to this operation. - Returns: The DescribeDBLogFilesResponseForDescribeDBLogFiles object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound. */ public func describeDBLogFilesSync( input: RDSModel.DescribeDBLogFilesMessage) throws -> RDSModel.DescribeDBLogFilesResponseForDescribeDBLogFiles { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBLogFiles, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBLogFilesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBLogFiles.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBParameterGroups operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBParameterGroupsMessage object being passed to this operation. - completion: The DBParameterGroupsMessageForDescribeDBParameterGroups object or an error will be passed to this callback when the operation is complete. The DBParameterGroupsMessageForDescribeDBParameterGroups object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound. */ public func describeDBParameterGroupsAsync( input: RDSModel.DescribeDBParameterGroupsMessage, completion: @escaping (Result<RDSModel.DBParameterGroupsMessageForDescribeDBParameterGroups, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBParameterGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBParameterGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBParameterGroups.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBParameterGroups operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBParameterGroupsMessage object being passed to this operation. - Returns: The DBParameterGroupsMessageForDescribeDBParameterGroups object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound. */ public func describeDBParameterGroupsSync( input: RDSModel.DescribeDBParameterGroupsMessage) throws -> RDSModel.DBParameterGroupsMessageForDescribeDBParameterGroups { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBParameterGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBParameterGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBParameterGroups.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBParameters operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBParametersMessage object being passed to this operation. - completion: The DBParameterGroupDetailsForDescribeDBParameters object or an error will be passed to this callback when the operation is complete. The DBParameterGroupDetailsForDescribeDBParameters object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound. */ public func describeDBParametersAsync( input: RDSModel.DescribeDBParametersMessage, completion: @escaping (Result<RDSModel.DBParameterGroupDetailsForDescribeDBParameters, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBParameters.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBParameters operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBParametersMessage object being passed to this operation. - Returns: The DBParameterGroupDetailsForDescribeDBParameters object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound. */ public func describeDBParametersSync( input: RDSModel.DescribeDBParametersMessage) throws -> RDSModel.DBParameterGroupDetailsForDescribeDBParameters { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBParameters.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBProxies operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBProxiesRequest object being passed to this operation. - completion: The DescribeDBProxiesResponseForDescribeDBProxies object or an error will be passed to this callback when the operation is complete. The DescribeDBProxiesResponseForDescribeDBProxies object will be validated before being returned to caller. The possible errors are: dBProxyNotFound. */ public func describeDBProxiesAsync( input: RDSModel.DescribeDBProxiesRequest, completion: @escaping (Result<RDSModel.DescribeDBProxiesResponseForDescribeDBProxies, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBProxies, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBProxiesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBProxies.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBProxies operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBProxiesRequest object being passed to this operation. - Returns: The DescribeDBProxiesResponseForDescribeDBProxies object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyNotFound. */ public func describeDBProxiesSync( input: RDSModel.DescribeDBProxiesRequest) throws -> RDSModel.DescribeDBProxiesResponseForDescribeDBProxies { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBProxies, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBProxiesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBProxies.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBProxyTargetGroups operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBProxyTargetGroupsRequest object being passed to this operation. - completion: The DescribeDBProxyTargetGroupsResponseForDescribeDBProxyTargetGroups object or an error will be passed to this callback when the operation is complete. The DescribeDBProxyTargetGroupsResponseForDescribeDBProxyTargetGroups object will be validated before being returned to caller. The possible errors are: dBProxyNotFound, dBProxyTargetGroupNotFound, invalidDBProxyState. */ public func describeDBProxyTargetGroupsAsync( input: RDSModel.DescribeDBProxyTargetGroupsRequest, completion: @escaping (Result<RDSModel.DescribeDBProxyTargetGroupsResponseForDescribeDBProxyTargetGroups, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBProxyTargetGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBProxyTargetGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBProxyTargetGroups.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBProxyTargetGroups operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBProxyTargetGroupsRequest object being passed to this operation. - Returns: The DescribeDBProxyTargetGroupsResponseForDescribeDBProxyTargetGroups object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyNotFound, dBProxyTargetGroupNotFound, invalidDBProxyState. */ public func describeDBProxyTargetGroupsSync( input: RDSModel.DescribeDBProxyTargetGroupsRequest) throws -> RDSModel.DescribeDBProxyTargetGroupsResponseForDescribeDBProxyTargetGroups { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBProxyTargetGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBProxyTargetGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBProxyTargetGroups.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBProxyTargets operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBProxyTargetsRequest object being passed to this operation. - completion: The DescribeDBProxyTargetsResponseForDescribeDBProxyTargets object or an error will be passed to this callback when the operation is complete. The DescribeDBProxyTargetsResponseForDescribeDBProxyTargets object will be validated before being returned to caller. The possible errors are: dBProxyNotFound, dBProxyTargetGroupNotFound, dBProxyTargetNotFound, invalidDBProxyState. */ public func describeDBProxyTargetsAsync( input: RDSModel.DescribeDBProxyTargetsRequest, completion: @escaping (Result<RDSModel.DescribeDBProxyTargetsResponseForDescribeDBProxyTargets, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBProxyTargets, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBProxyTargetsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBProxyTargets.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBProxyTargets operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBProxyTargetsRequest object being passed to this operation. - Returns: The DescribeDBProxyTargetsResponseForDescribeDBProxyTargets object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyNotFound, dBProxyTargetGroupNotFound, dBProxyTargetNotFound, invalidDBProxyState. */ public func describeDBProxyTargetsSync( input: RDSModel.DescribeDBProxyTargetsRequest) throws -> RDSModel.DescribeDBProxyTargetsResponseForDescribeDBProxyTargets { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBProxyTargets, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBProxyTargetsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBProxyTargets.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBSecurityGroups operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBSecurityGroupsMessage object being passed to this operation. - completion: The DBSecurityGroupMessageForDescribeDBSecurityGroups object or an error will be passed to this callback when the operation is complete. The DBSecurityGroupMessageForDescribeDBSecurityGroups object will be validated before being returned to caller. The possible errors are: dBSecurityGroupNotFound. */ public func describeDBSecurityGroupsAsync( input: RDSModel.DescribeDBSecurityGroupsMessage, completion: @escaping (Result<RDSModel.DBSecurityGroupMessageForDescribeDBSecurityGroups, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSecurityGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSecurityGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSecurityGroups.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBSecurityGroups operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBSecurityGroupsMessage object being passed to this operation. - Returns: The DBSecurityGroupMessageForDescribeDBSecurityGroups object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSecurityGroupNotFound. */ public func describeDBSecurityGroupsSync( input: RDSModel.DescribeDBSecurityGroupsMessage) throws -> RDSModel.DBSecurityGroupMessageForDescribeDBSecurityGroups { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSecurityGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSecurityGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSecurityGroups.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBSnapshotAttributes operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBSnapshotAttributesMessage object being passed to this operation. - completion: The DescribeDBSnapshotAttributesResultForDescribeDBSnapshotAttributes object or an error will be passed to this callback when the operation is complete. The DescribeDBSnapshotAttributesResultForDescribeDBSnapshotAttributes object will be validated before being returned to caller. The possible errors are: dBSnapshotNotFound. */ public func describeDBSnapshotAttributesAsync( input: RDSModel.DescribeDBSnapshotAttributesMessage, completion: @escaping (Result<RDSModel.DescribeDBSnapshotAttributesResultForDescribeDBSnapshotAttributes, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSnapshotAttributes, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSnapshotAttributesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSnapshotAttributes.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBSnapshotAttributes operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBSnapshotAttributesMessage object being passed to this operation. - Returns: The DescribeDBSnapshotAttributesResultForDescribeDBSnapshotAttributes object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSnapshotNotFound. */ public func describeDBSnapshotAttributesSync( input: RDSModel.DescribeDBSnapshotAttributesMessage) throws -> RDSModel.DescribeDBSnapshotAttributesResultForDescribeDBSnapshotAttributes { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSnapshotAttributes, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSnapshotAttributesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSnapshotAttributes.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBSnapshots operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBSnapshotsMessage object being passed to this operation. - completion: The DBSnapshotMessageForDescribeDBSnapshots object or an error will be passed to this callback when the operation is complete. The DBSnapshotMessageForDescribeDBSnapshots object will be validated before being returned to caller. The possible errors are: dBSnapshotNotFound. */ public func describeDBSnapshotsAsync( input: RDSModel.DescribeDBSnapshotsMessage, completion: @escaping (Result<RDSModel.DBSnapshotMessageForDescribeDBSnapshots, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSnapshots, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSnapshotsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSnapshots.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBSnapshots operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBSnapshotsMessage object being passed to this operation. - Returns: The DBSnapshotMessageForDescribeDBSnapshots object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSnapshotNotFound. */ public func describeDBSnapshotsSync( input: RDSModel.DescribeDBSnapshotsMessage) throws -> RDSModel.DBSnapshotMessageForDescribeDBSnapshots { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSnapshots, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSnapshotsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSnapshots.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeDBSubnetGroups operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeDBSubnetGroupsMessage object being passed to this operation. - completion: The DBSubnetGroupMessageForDescribeDBSubnetGroups object or an error will be passed to this callback when the operation is complete. The DBSubnetGroupMessageForDescribeDBSubnetGroups object will be validated before being returned to caller. The possible errors are: dBSubnetGroupNotFound. */ public func describeDBSubnetGroupsAsync( input: RDSModel.DescribeDBSubnetGroupsMessage, completion: @escaping (Result<RDSModel.DBSubnetGroupMessageForDescribeDBSubnetGroups, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSubnetGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSubnetGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSubnetGroups.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeDBSubnetGroups operation waiting for the response before returning. - Parameters: - input: The validated DescribeDBSubnetGroupsMessage object being passed to this operation. - Returns: The DBSubnetGroupMessageForDescribeDBSubnetGroups object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSubnetGroupNotFound. */ public func describeDBSubnetGroupsSync( input: RDSModel.DescribeDBSubnetGroupsMessage) throws -> RDSModel.DBSubnetGroupMessageForDescribeDBSubnetGroups { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeDBSubnetGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeDBSubnetGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeDBSubnetGroups.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeEngineDefaultClusterParameters operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeEngineDefaultClusterParametersMessage object being passed to this operation. - completion: The DescribeEngineDefaultClusterParametersResultForDescribeEngineDefaultClusterParameters object or an error will be passed to this callback when the operation is complete. The DescribeEngineDefaultClusterParametersResultForDescribeEngineDefaultClusterParameters object will be validated before being returned to caller. */ public func describeEngineDefaultClusterParametersAsync( input: RDSModel.DescribeEngineDefaultClusterParametersMessage, completion: @escaping (Result<RDSModel.DescribeEngineDefaultClusterParametersResultForDescribeEngineDefaultClusterParameters, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEngineDefaultClusterParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEngineDefaultClusterParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEngineDefaultClusterParameters.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeEngineDefaultClusterParameters operation waiting for the response before returning. - Parameters: - input: The validated DescribeEngineDefaultClusterParametersMessage object being passed to this operation. - Returns: The DescribeEngineDefaultClusterParametersResultForDescribeEngineDefaultClusterParameters object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeEngineDefaultClusterParametersSync( input: RDSModel.DescribeEngineDefaultClusterParametersMessage) throws -> RDSModel.DescribeEngineDefaultClusterParametersResultForDescribeEngineDefaultClusterParameters { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEngineDefaultClusterParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEngineDefaultClusterParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEngineDefaultClusterParameters.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeEngineDefaultParameters operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeEngineDefaultParametersMessage object being passed to this operation. - completion: The DescribeEngineDefaultParametersResultForDescribeEngineDefaultParameters object or an error will be passed to this callback when the operation is complete. The DescribeEngineDefaultParametersResultForDescribeEngineDefaultParameters object will be validated before being returned to caller. */ public func describeEngineDefaultParametersAsync( input: RDSModel.DescribeEngineDefaultParametersMessage, completion: @escaping (Result<RDSModel.DescribeEngineDefaultParametersResultForDescribeEngineDefaultParameters, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEngineDefaultParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEngineDefaultParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEngineDefaultParameters.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeEngineDefaultParameters operation waiting for the response before returning. - Parameters: - input: The validated DescribeEngineDefaultParametersMessage object being passed to this operation. - Returns: The DescribeEngineDefaultParametersResultForDescribeEngineDefaultParameters object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeEngineDefaultParametersSync( input: RDSModel.DescribeEngineDefaultParametersMessage) throws -> RDSModel.DescribeEngineDefaultParametersResultForDescribeEngineDefaultParameters { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEngineDefaultParameters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEngineDefaultParametersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEngineDefaultParameters.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeEventCategories operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeEventCategoriesMessage object being passed to this operation. - completion: The EventCategoriesMessageForDescribeEventCategories object or an error will be passed to this callback when the operation is complete. The EventCategoriesMessageForDescribeEventCategories object will be validated before being returned to caller. */ public func describeEventCategoriesAsync( input: RDSModel.DescribeEventCategoriesMessage, completion: @escaping (Result<RDSModel.EventCategoriesMessageForDescribeEventCategories, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEventCategories, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEventCategoriesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEventCategories.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeEventCategories operation waiting for the response before returning. - Parameters: - input: The validated DescribeEventCategoriesMessage object being passed to this operation. - Returns: The EventCategoriesMessageForDescribeEventCategories object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeEventCategoriesSync( input: RDSModel.DescribeEventCategoriesMessage) throws -> RDSModel.EventCategoriesMessageForDescribeEventCategories { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEventCategories, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEventCategoriesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEventCategories.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeEventSubscriptions operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeEventSubscriptionsMessage object being passed to this operation. - completion: The EventSubscriptionsMessageForDescribeEventSubscriptions object or an error will be passed to this callback when the operation is complete. The EventSubscriptionsMessageForDescribeEventSubscriptions object will be validated before being returned to caller. The possible errors are: subscriptionNotFound. */ public func describeEventSubscriptionsAsync( input: RDSModel.DescribeEventSubscriptionsMessage, completion: @escaping (Result<RDSModel.EventSubscriptionsMessageForDescribeEventSubscriptions, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEventSubscriptions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEventSubscriptionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEventSubscriptions.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeEventSubscriptions operation waiting for the response before returning. - Parameters: - input: The validated DescribeEventSubscriptionsMessage object being passed to this operation. - Returns: The EventSubscriptionsMessageForDescribeEventSubscriptions object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: subscriptionNotFound. */ public func describeEventSubscriptionsSync( input: RDSModel.DescribeEventSubscriptionsMessage) throws -> RDSModel.EventSubscriptionsMessageForDescribeEventSubscriptions { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEventSubscriptions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEventSubscriptionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEventSubscriptions.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeEvents operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeEventsMessage object being passed to this operation. - completion: The EventsMessageForDescribeEvents object or an error will be passed to this callback when the operation is complete. The EventsMessageForDescribeEvents object will be validated before being returned to caller. */ public func describeEventsAsync( input: RDSModel.DescribeEventsMessage, completion: @escaping (Result<RDSModel.EventsMessageForDescribeEvents, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEvents, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEventsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEvents.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeEvents operation waiting for the response before returning. - Parameters: - input: The validated DescribeEventsMessage object being passed to this operation. - Returns: The EventsMessageForDescribeEvents object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeEventsSync( input: RDSModel.DescribeEventsMessage) throws -> RDSModel.EventsMessageForDescribeEvents { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeEvents, handlerDelegate: handlerDelegate) let wrappedInput = DescribeEventsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeEvents.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeExportTasks operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeExportTasksMessage object being passed to this operation. - completion: The ExportTasksMessageForDescribeExportTasks object or an error will be passed to this callback when the operation is complete. The ExportTasksMessageForDescribeExportTasks object will be validated before being returned to caller. The possible errors are: exportTaskNotFound. */ public func describeExportTasksAsync( input: RDSModel.DescribeExportTasksMessage, completion: @escaping (Result<RDSModel.ExportTasksMessageForDescribeExportTasks, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeExportTasks, handlerDelegate: handlerDelegate) let wrappedInput = DescribeExportTasksOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeExportTasks.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeExportTasks operation waiting for the response before returning. - Parameters: - input: The validated DescribeExportTasksMessage object being passed to this operation. - Returns: The ExportTasksMessageForDescribeExportTasks object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: exportTaskNotFound. */ public func describeExportTasksSync( input: RDSModel.DescribeExportTasksMessage) throws -> RDSModel.ExportTasksMessageForDescribeExportTasks { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeExportTasks, handlerDelegate: handlerDelegate) let wrappedInput = DescribeExportTasksOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeExportTasks.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeGlobalClusters operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeGlobalClustersMessage object being passed to this operation. - completion: The GlobalClustersMessageForDescribeGlobalClusters object or an error will be passed to this callback when the operation is complete. The GlobalClustersMessageForDescribeGlobalClusters object will be validated before being returned to caller. The possible errors are: globalClusterNotFound. */ public func describeGlobalClustersAsync( input: RDSModel.DescribeGlobalClustersMessage, completion: @escaping (Result<RDSModel.GlobalClustersMessageForDescribeGlobalClusters, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeGlobalClusters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeGlobalClustersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeGlobalClusters.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeGlobalClusters operation waiting for the response before returning. - Parameters: - input: The validated DescribeGlobalClustersMessage object being passed to this operation. - Returns: The GlobalClustersMessageForDescribeGlobalClusters object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: globalClusterNotFound. */ public func describeGlobalClustersSync( input: RDSModel.DescribeGlobalClustersMessage) throws -> RDSModel.GlobalClustersMessageForDescribeGlobalClusters { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeGlobalClusters, handlerDelegate: handlerDelegate) let wrappedInput = DescribeGlobalClustersOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeGlobalClusters.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeInstallationMedia operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeInstallationMediaMessage object being passed to this operation. - completion: The InstallationMediaMessageForDescribeInstallationMedia object or an error will be passed to this callback when the operation is complete. The InstallationMediaMessageForDescribeInstallationMedia object will be validated before being returned to caller. The possible errors are: installationMediaNotFound. */ public func describeInstallationMediaAsync( input: RDSModel.DescribeInstallationMediaMessage, completion: @escaping (Result<RDSModel.InstallationMediaMessageForDescribeInstallationMedia, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeInstallationMedia, handlerDelegate: handlerDelegate) let wrappedInput = DescribeInstallationMediaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeInstallationMedia.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeInstallationMedia operation waiting for the response before returning. - Parameters: - input: The validated DescribeInstallationMediaMessage object being passed to this operation. - Returns: The InstallationMediaMessageForDescribeInstallationMedia object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: installationMediaNotFound. */ public func describeInstallationMediaSync( input: RDSModel.DescribeInstallationMediaMessage) throws -> RDSModel.InstallationMediaMessageForDescribeInstallationMedia { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeInstallationMedia, handlerDelegate: handlerDelegate) let wrappedInput = DescribeInstallationMediaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeInstallationMedia.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeOptionGroupOptions operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeOptionGroupOptionsMessage object being passed to this operation. - completion: The OptionGroupOptionsMessageForDescribeOptionGroupOptions object or an error will be passed to this callback when the operation is complete. The OptionGroupOptionsMessageForDescribeOptionGroupOptions object will be validated before being returned to caller. */ public func describeOptionGroupOptionsAsync( input: RDSModel.DescribeOptionGroupOptionsMessage, completion: @escaping (Result<RDSModel.OptionGroupOptionsMessageForDescribeOptionGroupOptions, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeOptionGroupOptions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeOptionGroupOptionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeOptionGroupOptions.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeOptionGroupOptions operation waiting for the response before returning. - Parameters: - input: The validated DescribeOptionGroupOptionsMessage object being passed to this operation. - Returns: The OptionGroupOptionsMessageForDescribeOptionGroupOptions object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeOptionGroupOptionsSync( input: RDSModel.DescribeOptionGroupOptionsMessage) throws -> RDSModel.OptionGroupOptionsMessageForDescribeOptionGroupOptions { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeOptionGroupOptions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeOptionGroupOptionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeOptionGroupOptions.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeOptionGroups operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeOptionGroupsMessage object being passed to this operation. - completion: The OptionGroupsForDescribeOptionGroups object or an error will be passed to this callback when the operation is complete. The OptionGroupsForDescribeOptionGroups object will be validated before being returned to caller. The possible errors are: optionGroupNotFound. */ public func describeOptionGroupsAsync( input: RDSModel.DescribeOptionGroupsMessage, completion: @escaping (Result<RDSModel.OptionGroupsForDescribeOptionGroups, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeOptionGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeOptionGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeOptionGroups.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeOptionGroups operation waiting for the response before returning. - Parameters: - input: The validated DescribeOptionGroupsMessage object being passed to this operation. - Returns: The OptionGroupsForDescribeOptionGroups object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: optionGroupNotFound. */ public func describeOptionGroupsSync( input: RDSModel.DescribeOptionGroupsMessage) throws -> RDSModel.OptionGroupsForDescribeOptionGroups { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeOptionGroups, handlerDelegate: handlerDelegate) let wrappedInput = DescribeOptionGroupsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeOptionGroups.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeOrderableDBInstanceOptions operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeOrderableDBInstanceOptionsMessage object being passed to this operation. - completion: The OrderableDBInstanceOptionsMessageForDescribeOrderableDBInstanceOptions object or an error will be passed to this callback when the operation is complete. The OrderableDBInstanceOptionsMessageForDescribeOrderableDBInstanceOptions object will be validated before being returned to caller. */ public func describeOrderableDBInstanceOptionsAsync( input: RDSModel.DescribeOrderableDBInstanceOptionsMessage, completion: @escaping (Result<RDSModel.OrderableDBInstanceOptionsMessageForDescribeOrderableDBInstanceOptions, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeOrderableDBInstanceOptions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeOrderableDBInstanceOptionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeOrderableDBInstanceOptions.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeOrderableDBInstanceOptions operation waiting for the response before returning. - Parameters: - input: The validated DescribeOrderableDBInstanceOptionsMessage object being passed to this operation. - Returns: The OrderableDBInstanceOptionsMessageForDescribeOrderableDBInstanceOptions object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeOrderableDBInstanceOptionsSync( input: RDSModel.DescribeOrderableDBInstanceOptionsMessage) throws -> RDSModel.OrderableDBInstanceOptionsMessageForDescribeOrderableDBInstanceOptions { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeOrderableDBInstanceOptions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeOrderableDBInstanceOptionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeOrderableDBInstanceOptions.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribePendingMaintenanceActions operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribePendingMaintenanceActionsMessage object being passed to this operation. - completion: The PendingMaintenanceActionsMessageForDescribePendingMaintenanceActions object or an error will be passed to this callback when the operation is complete. The PendingMaintenanceActionsMessageForDescribePendingMaintenanceActions object will be validated before being returned to caller. The possible errors are: resourceNotFound. */ public func describePendingMaintenanceActionsAsync( input: RDSModel.DescribePendingMaintenanceActionsMessage, completion: @escaping (Result<RDSModel.PendingMaintenanceActionsMessageForDescribePendingMaintenanceActions, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describePendingMaintenanceActions, handlerDelegate: handlerDelegate) let wrappedInput = DescribePendingMaintenanceActionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describePendingMaintenanceActions.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribePendingMaintenanceActions operation waiting for the response before returning. - Parameters: - input: The validated DescribePendingMaintenanceActionsMessage object being passed to this operation. - Returns: The PendingMaintenanceActionsMessageForDescribePendingMaintenanceActions object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: resourceNotFound. */ public func describePendingMaintenanceActionsSync( input: RDSModel.DescribePendingMaintenanceActionsMessage) throws -> RDSModel.PendingMaintenanceActionsMessageForDescribePendingMaintenanceActions { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describePendingMaintenanceActions, handlerDelegate: handlerDelegate) let wrappedInput = DescribePendingMaintenanceActionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describePendingMaintenanceActions.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeReservedDBInstances operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeReservedDBInstancesMessage object being passed to this operation. - completion: The ReservedDBInstanceMessageForDescribeReservedDBInstances object or an error will be passed to this callback when the operation is complete. The ReservedDBInstanceMessageForDescribeReservedDBInstances object will be validated before being returned to caller. The possible errors are: reservedDBInstanceNotFound. */ public func describeReservedDBInstancesAsync( input: RDSModel.DescribeReservedDBInstancesMessage, completion: @escaping (Result<RDSModel.ReservedDBInstanceMessageForDescribeReservedDBInstances, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeReservedDBInstances, handlerDelegate: handlerDelegate) let wrappedInput = DescribeReservedDBInstancesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeReservedDBInstances.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeReservedDBInstances operation waiting for the response before returning. - Parameters: - input: The validated DescribeReservedDBInstancesMessage object being passed to this operation. - Returns: The ReservedDBInstanceMessageForDescribeReservedDBInstances object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: reservedDBInstanceNotFound. */ public func describeReservedDBInstancesSync( input: RDSModel.DescribeReservedDBInstancesMessage) throws -> RDSModel.ReservedDBInstanceMessageForDescribeReservedDBInstances { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeReservedDBInstances, handlerDelegate: handlerDelegate) let wrappedInput = DescribeReservedDBInstancesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeReservedDBInstances.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeReservedDBInstancesOfferings operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeReservedDBInstancesOfferingsMessage object being passed to this operation. - completion: The ReservedDBInstancesOfferingMessageForDescribeReservedDBInstancesOfferings object or an error will be passed to this callback when the operation is complete. The ReservedDBInstancesOfferingMessageForDescribeReservedDBInstancesOfferings object will be validated before being returned to caller. The possible errors are: reservedDBInstancesOfferingNotFound. */ public func describeReservedDBInstancesOfferingsAsync( input: RDSModel.DescribeReservedDBInstancesOfferingsMessage, completion: @escaping (Result<RDSModel.ReservedDBInstancesOfferingMessageForDescribeReservedDBInstancesOfferings, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeReservedDBInstancesOfferings, handlerDelegate: handlerDelegate) let wrappedInput = DescribeReservedDBInstancesOfferingsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeReservedDBInstancesOfferings.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeReservedDBInstancesOfferings operation waiting for the response before returning. - Parameters: - input: The validated DescribeReservedDBInstancesOfferingsMessage object being passed to this operation. - Returns: The ReservedDBInstancesOfferingMessageForDescribeReservedDBInstancesOfferings object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: reservedDBInstancesOfferingNotFound. */ public func describeReservedDBInstancesOfferingsSync( input: RDSModel.DescribeReservedDBInstancesOfferingsMessage) throws -> RDSModel.ReservedDBInstancesOfferingMessageForDescribeReservedDBInstancesOfferings { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeReservedDBInstancesOfferings, handlerDelegate: handlerDelegate) let wrappedInput = DescribeReservedDBInstancesOfferingsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeReservedDBInstancesOfferings.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeSourceRegions operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeSourceRegionsMessage object being passed to this operation. - completion: The SourceRegionMessageForDescribeSourceRegions object or an error will be passed to this callback when the operation is complete. The SourceRegionMessageForDescribeSourceRegions object will be validated before being returned to caller. */ public func describeSourceRegionsAsync( input: RDSModel.DescribeSourceRegionsMessage, completion: @escaping (Result<RDSModel.SourceRegionMessageForDescribeSourceRegions, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeSourceRegions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeSourceRegionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeSourceRegions.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeSourceRegions operation waiting for the response before returning. - Parameters: - input: The validated DescribeSourceRegionsMessage object being passed to this operation. - Returns: The SourceRegionMessageForDescribeSourceRegions object to be passed back from the caller of this operation. Will be validated before being returned to caller. */ public func describeSourceRegionsSync( input: RDSModel.DescribeSourceRegionsMessage) throws -> RDSModel.SourceRegionMessageForDescribeSourceRegions { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeSourceRegions, handlerDelegate: handlerDelegate) let wrappedInput = DescribeSourceRegionsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeSourceRegions.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DescribeValidDBInstanceModifications operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DescribeValidDBInstanceModificationsMessage object being passed to this operation. - completion: The DescribeValidDBInstanceModificationsResultForDescribeValidDBInstanceModifications object or an error will be passed to this callback when the operation is complete. The DescribeValidDBInstanceModificationsResultForDescribeValidDBInstanceModifications object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound, invalidDBInstanceState. */ public func describeValidDBInstanceModificationsAsync( input: RDSModel.DescribeValidDBInstanceModificationsMessage, completion: @escaping (Result<RDSModel.DescribeValidDBInstanceModificationsResultForDescribeValidDBInstanceModifications, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeValidDBInstanceModifications, handlerDelegate: handlerDelegate) let wrappedInput = DescribeValidDBInstanceModificationsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeValidDBInstanceModifications.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DescribeValidDBInstanceModifications operation waiting for the response before returning. - Parameters: - input: The validated DescribeValidDBInstanceModificationsMessage object being passed to this operation. - Returns: The DescribeValidDBInstanceModificationsResultForDescribeValidDBInstanceModifications object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound, invalidDBInstanceState. */ public func describeValidDBInstanceModificationsSync( input: RDSModel.DescribeValidDBInstanceModificationsMessage) throws -> RDSModel.DescribeValidDBInstanceModificationsResultForDescribeValidDBInstanceModifications { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.describeValidDBInstanceModifications, handlerDelegate: handlerDelegate) let wrappedInput = DescribeValidDBInstanceModificationsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.describeValidDBInstanceModifications.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the DownloadDBLogFilePortion operation returning immediately and passing the response to a callback. - Parameters: - input: The validated DownloadDBLogFilePortionMessage object being passed to this operation. - completion: The DownloadDBLogFilePortionDetailsForDownloadDBLogFilePortion object or an error will be passed to this callback when the operation is complete. The DownloadDBLogFilePortionDetailsForDownloadDBLogFilePortion object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound, dBLogFileNotFound. */ public func downloadDBLogFilePortionAsync( input: RDSModel.DownloadDBLogFilePortionMessage, completion: @escaping (Result<RDSModel.DownloadDBLogFilePortionDetailsForDownloadDBLogFilePortion, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.downloadDBLogFilePortion, handlerDelegate: handlerDelegate) let wrappedInput = DownloadDBLogFilePortionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.downloadDBLogFilePortion.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the DownloadDBLogFilePortion operation waiting for the response before returning. - Parameters: - input: The validated DownloadDBLogFilePortionMessage object being passed to this operation. - Returns: The DownloadDBLogFilePortionDetailsForDownloadDBLogFilePortion object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound, dBLogFileNotFound. */ public func downloadDBLogFilePortionSync( input: RDSModel.DownloadDBLogFilePortionMessage) throws -> RDSModel.DownloadDBLogFilePortionDetailsForDownloadDBLogFilePortion { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.downloadDBLogFilePortion, handlerDelegate: handlerDelegate) let wrappedInput = DownloadDBLogFilePortionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.downloadDBLogFilePortion.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the FailoverDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated FailoverDBClusterMessage object being passed to this operation. - completion: The FailoverDBClusterResultForFailoverDBCluster object or an error will be passed to this callback when the operation is complete. The FailoverDBClusterResultForFailoverDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func failoverDBClusterAsync( input: RDSModel.FailoverDBClusterMessage, completion: @escaping (Result<RDSModel.FailoverDBClusterResultForFailoverDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.failoverDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = FailoverDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.failoverDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the FailoverDBCluster operation waiting for the response before returning. - Parameters: - input: The validated FailoverDBClusterMessage object being passed to this operation. - Returns: The FailoverDBClusterResultForFailoverDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func failoverDBClusterSync( input: RDSModel.FailoverDBClusterMessage) throws -> RDSModel.FailoverDBClusterResultForFailoverDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.failoverDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = FailoverDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.failoverDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ImportInstallationMedia operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ImportInstallationMediaMessage object being passed to this operation. - completion: The InstallationMediaForImportInstallationMedia object or an error will be passed to this callback when the operation is complete. The InstallationMediaForImportInstallationMedia object will be validated before being returned to caller. The possible errors are: customAvailabilityZoneNotFound, installationMediaAlreadyExists. */ public func importInstallationMediaAsync( input: RDSModel.ImportInstallationMediaMessage, completion: @escaping (Result<RDSModel.InstallationMediaForImportInstallationMedia, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.importInstallationMedia, handlerDelegate: handlerDelegate) let wrappedInput = ImportInstallationMediaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.importInstallationMedia.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ImportInstallationMedia operation waiting for the response before returning. - Parameters: - input: The validated ImportInstallationMediaMessage object being passed to this operation. - Returns: The InstallationMediaForImportInstallationMedia object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: customAvailabilityZoneNotFound, installationMediaAlreadyExists. */ public func importInstallationMediaSync( input: RDSModel.ImportInstallationMediaMessage) throws -> RDSModel.InstallationMediaForImportInstallationMedia { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.importInstallationMedia, handlerDelegate: handlerDelegate) let wrappedInput = ImportInstallationMediaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.importInstallationMedia.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ListTagsForResource operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ListTagsForResourceMessage object being passed to this operation. - completion: The TagListMessageForListTagsForResource object or an error will be passed to this callback when the operation is complete. The TagListMessageForListTagsForResource object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetGroupNotFound, dBSnapshotNotFound. */ public func listTagsForResourceAsync( input: RDSModel.ListTagsForResourceMessage, completion: @escaping (Result<RDSModel.TagListMessageForListTagsForResource, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.listTagsForResource, handlerDelegate: handlerDelegate) let wrappedInput = ListTagsForResourceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.listTagsForResource.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ListTagsForResource operation waiting for the response before returning. - Parameters: - input: The validated ListTagsForResourceMessage object being passed to this operation. - Returns: The TagListMessageForListTagsForResource object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetGroupNotFound, dBSnapshotNotFound. */ public func listTagsForResourceSync( input: RDSModel.ListTagsForResourceMessage) throws -> RDSModel.TagListMessageForListTagsForResource { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.listTagsForResource, handlerDelegate: handlerDelegate) let wrappedInput = ListTagsForResourceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.listTagsForResource.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyCertificates operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyCertificatesMessage object being passed to this operation. - completion: The ModifyCertificatesResultForModifyCertificates object or an error will be passed to this callback when the operation is complete. The ModifyCertificatesResultForModifyCertificates object will be validated before being returned to caller. The possible errors are: certificateNotFound. */ public func modifyCertificatesAsync( input: RDSModel.ModifyCertificatesMessage, completion: @escaping (Result<RDSModel.ModifyCertificatesResultForModifyCertificates, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyCertificates, handlerDelegate: handlerDelegate) let wrappedInput = ModifyCertificatesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyCertificates.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyCertificates operation waiting for the response before returning. - Parameters: - input: The validated ModifyCertificatesMessage object being passed to this operation. - Returns: The ModifyCertificatesResultForModifyCertificates object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: certificateNotFound. */ public func modifyCertificatesSync( input: RDSModel.ModifyCertificatesMessage) throws -> RDSModel.ModifyCertificatesResultForModifyCertificates { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyCertificates, handlerDelegate: handlerDelegate) let wrappedInput = ModifyCertificatesOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyCertificates.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyCurrentDBClusterCapacity operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyCurrentDBClusterCapacityMessage object being passed to this operation. - completion: The DBClusterCapacityInfoForModifyCurrentDBClusterCapacity object or an error will be passed to this callback when the operation is complete. The DBClusterCapacityInfoForModifyCurrentDBClusterCapacity object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, invalidDBClusterCapacity, invalidDBClusterState. */ public func modifyCurrentDBClusterCapacityAsync( input: RDSModel.ModifyCurrentDBClusterCapacityMessage, completion: @escaping (Result<RDSModel.DBClusterCapacityInfoForModifyCurrentDBClusterCapacity, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyCurrentDBClusterCapacity, handlerDelegate: handlerDelegate) let wrappedInput = ModifyCurrentDBClusterCapacityOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyCurrentDBClusterCapacity.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyCurrentDBClusterCapacity operation waiting for the response before returning. - Parameters: - input: The validated ModifyCurrentDBClusterCapacityMessage object being passed to this operation. - Returns: The DBClusterCapacityInfoForModifyCurrentDBClusterCapacity object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, invalidDBClusterCapacity, invalidDBClusterState. */ public func modifyCurrentDBClusterCapacitySync( input: RDSModel.ModifyCurrentDBClusterCapacityMessage) throws -> RDSModel.DBClusterCapacityInfoForModifyCurrentDBClusterCapacity { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyCurrentDBClusterCapacity, handlerDelegate: handlerDelegate) let wrappedInput = ModifyCurrentDBClusterCapacityOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyCurrentDBClusterCapacity.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBClusterMessage object being passed to this operation. - completion: The ModifyDBClusterResultForModifyDBCluster object or an error will be passed to this callback when the operation is complete. The ModifyDBClusterResultForModifyDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBSubnetGroupNotFound, domainNotFound, invalidDBClusterState, invalidDBInstanceState, invalidDBSecurityGroupState, invalidDBSubnetGroupState, invalidSubnet, invalidVPCNetworkState, storageQuotaExceeded. */ public func modifyDBClusterAsync( input: RDSModel.ModifyDBClusterMessage, completion: @escaping (Result<RDSModel.ModifyDBClusterResultForModifyDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBCluster operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBClusterMessage object being passed to this operation. - Returns: The ModifyDBClusterResultForModifyDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBSubnetGroupNotFound, domainNotFound, invalidDBClusterState, invalidDBInstanceState, invalidDBSecurityGroupState, invalidDBSubnetGroupState, invalidSubnet, invalidVPCNetworkState, storageQuotaExceeded. */ public func modifyDBClusterSync( input: RDSModel.ModifyDBClusterMessage) throws -> RDSModel.ModifyDBClusterResultForModifyDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBClusterEndpoint operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBClusterEndpointMessage object being passed to this operation. - completion: The DBClusterEndpointForModifyDBClusterEndpoint object or an error will be passed to this callback when the operation is complete. The DBClusterEndpointForModifyDBClusterEndpoint object will be validated before being returned to caller. The possible errors are: dBClusterEndpointNotFound, dBInstanceNotFound, invalidDBClusterEndpointState, invalidDBClusterState, invalidDBInstanceState. */ public func modifyDBClusterEndpointAsync( input: RDSModel.ModifyDBClusterEndpointMessage, completion: @escaping (Result<RDSModel.DBClusterEndpointForModifyDBClusterEndpoint, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBClusterEndpoint, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterEndpointOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBClusterEndpoint.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBClusterEndpoint operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBClusterEndpointMessage object being passed to this operation. - Returns: The DBClusterEndpointForModifyDBClusterEndpoint object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterEndpointNotFound, dBInstanceNotFound, invalidDBClusterEndpointState, invalidDBClusterState, invalidDBInstanceState. */ public func modifyDBClusterEndpointSync( input: RDSModel.ModifyDBClusterEndpointMessage) throws -> RDSModel.DBClusterEndpointForModifyDBClusterEndpoint { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBClusterEndpoint, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterEndpointOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBClusterEndpoint.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBClusterParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBClusterParameterGroupMessage object being passed to this operation. - completion: The DBClusterParameterGroupNameMessageForModifyDBClusterParameterGroup object or an error will be passed to this callback when the operation is complete. The DBClusterParameterGroupNameMessageForModifyDBClusterParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func modifyDBClusterParameterGroupAsync( input: RDSModel.ModifyDBClusterParameterGroupMessage, completion: @escaping (Result<RDSModel.DBClusterParameterGroupNameMessageForModifyDBClusterParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBClusterParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBClusterParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBClusterParameterGroupMessage object being passed to this operation. - Returns: The DBClusterParameterGroupNameMessageForModifyDBClusterParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func modifyDBClusterParameterGroupSync( input: RDSModel.ModifyDBClusterParameterGroupMessage) throws -> RDSModel.DBClusterParameterGroupNameMessageForModifyDBClusterParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBClusterParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBClusterSnapshotAttribute operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBClusterSnapshotAttributeMessage object being passed to this operation. - completion: The ModifyDBClusterSnapshotAttributeResultForModifyDBClusterSnapshotAttribute object or an error will be passed to this callback when the operation is complete. The ModifyDBClusterSnapshotAttributeResultForModifyDBClusterSnapshotAttribute object will be validated before being returned to caller. The possible errors are: dBClusterSnapshotNotFound, invalidDBClusterSnapshotState, sharedSnapshotQuotaExceeded. */ public func modifyDBClusterSnapshotAttributeAsync( input: RDSModel.ModifyDBClusterSnapshotAttributeMessage, completion: @escaping (Result<RDSModel.ModifyDBClusterSnapshotAttributeResultForModifyDBClusterSnapshotAttribute, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBClusterSnapshotAttribute, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterSnapshotAttributeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBClusterSnapshotAttribute.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBClusterSnapshotAttribute operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBClusterSnapshotAttributeMessage object being passed to this operation. - Returns: The ModifyDBClusterSnapshotAttributeResultForModifyDBClusterSnapshotAttribute object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterSnapshotNotFound, invalidDBClusterSnapshotState, sharedSnapshotQuotaExceeded. */ public func modifyDBClusterSnapshotAttributeSync( input: RDSModel.ModifyDBClusterSnapshotAttributeMessage) throws -> RDSModel.ModifyDBClusterSnapshotAttributeResultForModifyDBClusterSnapshotAttribute { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBClusterSnapshotAttribute, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBClusterSnapshotAttributeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBClusterSnapshotAttribute.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBInstanceMessage object being passed to this operation. - completion: The ModifyDBInstanceResultForModifyDBInstance object or an error will be passed to this callback when the operation is complete. The ModifyDBInstanceResultForModifyDBInstance object will be validated before being returned to caller. The possible errors are: authorizationNotFound, backupPolicyNotFound, certificateNotFound, dBInstanceAlreadyExists, dBInstanceNotFound, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBUpgradeDependencyFailure, domainNotFound, insufficientDBInstanceCapacity, invalidDBClusterState, invalidDBInstanceState, invalidDBSecurityGroupState, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func modifyDBInstanceAsync( input: RDSModel.ModifyDBInstanceMessage, completion: @escaping (Result<RDSModel.ModifyDBInstanceResultForModifyDBInstance, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBInstance operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBInstanceMessage object being passed to this operation. - Returns: The ModifyDBInstanceResultForModifyDBInstance object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationNotFound, backupPolicyNotFound, certificateNotFound, dBInstanceAlreadyExists, dBInstanceNotFound, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBUpgradeDependencyFailure, domainNotFound, insufficientDBInstanceCapacity, invalidDBClusterState, invalidDBInstanceState, invalidDBSecurityGroupState, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func modifyDBInstanceSync( input: RDSModel.ModifyDBInstanceMessage) throws -> RDSModel.ModifyDBInstanceResultForModifyDBInstance { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBInstance.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBParameterGroupMessage object being passed to this operation. - completion: The DBParameterGroupNameMessageForModifyDBParameterGroup object or an error will be passed to this callback when the operation is complete. The DBParameterGroupNameMessageForModifyDBParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func modifyDBParameterGroupAsync( input: RDSModel.ModifyDBParameterGroupMessage, completion: @escaping (Result<RDSModel.DBParameterGroupNameMessageForModifyDBParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBParameterGroupMessage object being passed to this operation. - Returns: The DBParameterGroupNameMessageForModifyDBParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func modifyDBParameterGroupSync( input: RDSModel.ModifyDBParameterGroupMessage) throws -> RDSModel.DBParameterGroupNameMessageForModifyDBParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBProxy operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBProxyRequest object being passed to this operation. - completion: The ModifyDBProxyResponseForModifyDBProxy object or an error will be passed to this callback when the operation is complete. The ModifyDBProxyResponseForModifyDBProxy object will be validated before being returned to caller. The possible errors are: dBProxyAlreadyExists, dBProxyNotFound, invalidDBProxyState. */ public func modifyDBProxyAsync( input: RDSModel.ModifyDBProxyRequest, completion: @escaping (Result<RDSModel.ModifyDBProxyResponseForModifyDBProxy, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBProxy, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBProxyOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBProxy.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBProxy operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBProxyRequest object being passed to this operation. - Returns: The ModifyDBProxyResponseForModifyDBProxy object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyAlreadyExists, dBProxyNotFound, invalidDBProxyState. */ public func modifyDBProxySync( input: RDSModel.ModifyDBProxyRequest) throws -> RDSModel.ModifyDBProxyResponseForModifyDBProxy { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBProxy, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBProxyOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBProxy.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBProxyTargetGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBProxyTargetGroupRequest object being passed to this operation. - completion: The ModifyDBProxyTargetGroupResponseForModifyDBProxyTargetGroup object or an error will be passed to this callback when the operation is complete. The ModifyDBProxyTargetGroupResponseForModifyDBProxyTargetGroup object will be validated before being returned to caller. The possible errors are: dBProxyNotFound, dBProxyTargetGroupNotFound, invalidDBProxyState. */ public func modifyDBProxyTargetGroupAsync( input: RDSModel.ModifyDBProxyTargetGroupRequest, completion: @escaping (Result<RDSModel.ModifyDBProxyTargetGroupResponseForModifyDBProxyTargetGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBProxyTargetGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBProxyTargetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBProxyTargetGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBProxyTargetGroup operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBProxyTargetGroupRequest object being passed to this operation. - Returns: The ModifyDBProxyTargetGroupResponseForModifyDBProxyTargetGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBProxyNotFound, dBProxyTargetGroupNotFound, invalidDBProxyState. */ public func modifyDBProxyTargetGroupSync( input: RDSModel.ModifyDBProxyTargetGroupRequest) throws -> RDSModel.ModifyDBProxyTargetGroupResponseForModifyDBProxyTargetGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBProxyTargetGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBProxyTargetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBProxyTargetGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBSnapshotMessage object being passed to this operation. - completion: The ModifyDBSnapshotResultForModifyDBSnapshot object or an error will be passed to this callback when the operation is complete. The ModifyDBSnapshotResultForModifyDBSnapshot object will be validated before being returned to caller. The possible errors are: dBSnapshotNotFound. */ public func modifyDBSnapshotAsync( input: RDSModel.ModifyDBSnapshotMessage, completion: @escaping (Result<RDSModel.ModifyDBSnapshotResultForModifyDBSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBSnapshot operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBSnapshotMessage object being passed to this operation. - Returns: The ModifyDBSnapshotResultForModifyDBSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSnapshotNotFound. */ public func modifyDBSnapshotSync( input: RDSModel.ModifyDBSnapshotMessage) throws -> RDSModel.ModifyDBSnapshotResultForModifyDBSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBSnapshotAttribute operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBSnapshotAttributeMessage object being passed to this operation. - completion: The ModifyDBSnapshotAttributeResultForModifyDBSnapshotAttribute object or an error will be passed to this callback when the operation is complete. The ModifyDBSnapshotAttributeResultForModifyDBSnapshotAttribute object will be validated before being returned to caller. The possible errors are: dBSnapshotNotFound, invalidDBSnapshotState, sharedSnapshotQuotaExceeded. */ public func modifyDBSnapshotAttributeAsync( input: RDSModel.ModifyDBSnapshotAttributeMessage, completion: @escaping (Result<RDSModel.ModifyDBSnapshotAttributeResultForModifyDBSnapshotAttribute, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBSnapshotAttribute, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBSnapshotAttributeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBSnapshotAttribute.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBSnapshotAttribute operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBSnapshotAttributeMessage object being passed to this operation. - Returns: The ModifyDBSnapshotAttributeResultForModifyDBSnapshotAttribute object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSnapshotNotFound, invalidDBSnapshotState, sharedSnapshotQuotaExceeded. */ public func modifyDBSnapshotAttributeSync( input: RDSModel.ModifyDBSnapshotAttributeMessage) throws -> RDSModel.ModifyDBSnapshotAttributeResultForModifyDBSnapshotAttribute { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBSnapshotAttribute, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBSnapshotAttributeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBSnapshotAttribute.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyDBSubnetGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyDBSubnetGroupMessage object being passed to this operation. - completion: The ModifyDBSubnetGroupResultForModifyDBSubnetGroup object or an error will be passed to this callback when the operation is complete. The ModifyDBSubnetGroupResultForModifyDBSubnetGroup object will be validated before being returned to caller. The possible errors are: dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, dBSubnetQuotaExceeded, invalidSubnet, subnetAlreadyInUse. */ public func modifyDBSubnetGroupAsync( input: RDSModel.ModifyDBSubnetGroupMessage, completion: @escaping (Result<RDSModel.ModifyDBSubnetGroupResultForModifyDBSubnetGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBSubnetGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBSubnetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBSubnetGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyDBSubnetGroup operation waiting for the response before returning. - Parameters: - input: The validated ModifyDBSubnetGroupMessage object being passed to this operation. - Returns: The ModifyDBSubnetGroupResultForModifyDBSubnetGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, dBSubnetQuotaExceeded, invalidSubnet, subnetAlreadyInUse. */ public func modifyDBSubnetGroupSync( input: RDSModel.ModifyDBSubnetGroupMessage) throws -> RDSModel.ModifyDBSubnetGroupResultForModifyDBSubnetGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyDBSubnetGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyDBSubnetGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyDBSubnetGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyEventSubscription operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyEventSubscriptionMessage object being passed to this operation. - completion: The ModifyEventSubscriptionResultForModifyEventSubscription object or an error will be passed to this callback when the operation is complete. The ModifyEventSubscriptionResultForModifyEventSubscription object will be validated before being returned to caller. The possible errors are: eventSubscriptionQuotaExceeded, sNSInvalidTopic, sNSNoAuthorization, sNSTopicArnNotFound, subscriptionCategoryNotFound, subscriptionNotFound. */ public func modifyEventSubscriptionAsync( input: RDSModel.ModifyEventSubscriptionMessage, completion: @escaping (Result<RDSModel.ModifyEventSubscriptionResultForModifyEventSubscription, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyEventSubscription, handlerDelegate: handlerDelegate) let wrappedInput = ModifyEventSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyEventSubscription.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyEventSubscription operation waiting for the response before returning. - Parameters: - input: The validated ModifyEventSubscriptionMessage object being passed to this operation. - Returns: The ModifyEventSubscriptionResultForModifyEventSubscription object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: eventSubscriptionQuotaExceeded, sNSInvalidTopic, sNSNoAuthorization, sNSTopicArnNotFound, subscriptionCategoryNotFound, subscriptionNotFound. */ public func modifyEventSubscriptionSync( input: RDSModel.ModifyEventSubscriptionMessage) throws -> RDSModel.ModifyEventSubscriptionResultForModifyEventSubscription { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyEventSubscription, handlerDelegate: handlerDelegate) let wrappedInput = ModifyEventSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyEventSubscription.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyGlobalCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyGlobalClusterMessage object being passed to this operation. - completion: The ModifyGlobalClusterResultForModifyGlobalCluster object or an error will be passed to this callback when the operation is complete. The ModifyGlobalClusterResultForModifyGlobalCluster object will be validated before being returned to caller. The possible errors are: globalClusterNotFound, invalidGlobalClusterState. */ public func modifyGlobalClusterAsync( input: RDSModel.ModifyGlobalClusterMessage, completion: @escaping (Result<RDSModel.ModifyGlobalClusterResultForModifyGlobalCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = ModifyGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyGlobalCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyGlobalCluster operation waiting for the response before returning. - Parameters: - input: The validated ModifyGlobalClusterMessage object being passed to this operation. - Returns: The ModifyGlobalClusterResultForModifyGlobalCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: globalClusterNotFound, invalidGlobalClusterState. */ public func modifyGlobalClusterSync( input: RDSModel.ModifyGlobalClusterMessage) throws -> RDSModel.ModifyGlobalClusterResultForModifyGlobalCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = ModifyGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyGlobalCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ModifyOptionGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ModifyOptionGroupMessage object being passed to this operation. - completion: The ModifyOptionGroupResultForModifyOptionGroup object or an error will be passed to this callback when the operation is complete. The ModifyOptionGroupResultForModifyOptionGroup object will be validated before being returned to caller. The possible errors are: invalidOptionGroupState, optionGroupNotFound. */ public func modifyOptionGroupAsync( input: RDSModel.ModifyOptionGroupMessage, completion: @escaping (Result<RDSModel.ModifyOptionGroupResultForModifyOptionGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyOptionGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ModifyOptionGroup operation waiting for the response before returning. - Parameters: - input: The validated ModifyOptionGroupMessage object being passed to this operation. - Returns: The ModifyOptionGroupResultForModifyOptionGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: invalidOptionGroupState, optionGroupNotFound. */ public func modifyOptionGroupSync( input: RDSModel.ModifyOptionGroupMessage) throws -> RDSModel.ModifyOptionGroupResultForModifyOptionGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.modifyOptionGroup, handlerDelegate: handlerDelegate) let wrappedInput = ModifyOptionGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.modifyOptionGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the PromoteReadReplica operation returning immediately and passing the response to a callback. - Parameters: - input: The validated PromoteReadReplicaMessage object being passed to this operation. - completion: The PromoteReadReplicaResultForPromoteReadReplica object or an error will be passed to this callback when the operation is complete. The PromoteReadReplicaResultForPromoteReadReplica object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound, invalidDBInstanceState. */ public func promoteReadReplicaAsync( input: RDSModel.PromoteReadReplicaMessage, completion: @escaping (Result<RDSModel.PromoteReadReplicaResultForPromoteReadReplica, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.promoteReadReplica, handlerDelegate: handlerDelegate) let wrappedInput = PromoteReadReplicaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.promoteReadReplica.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the PromoteReadReplica operation waiting for the response before returning. - Parameters: - input: The validated PromoteReadReplicaMessage object being passed to this operation. - Returns: The PromoteReadReplicaResultForPromoteReadReplica object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound, invalidDBInstanceState. */ public func promoteReadReplicaSync( input: RDSModel.PromoteReadReplicaMessage) throws -> RDSModel.PromoteReadReplicaResultForPromoteReadReplica { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.promoteReadReplica, handlerDelegate: handlerDelegate) let wrappedInput = PromoteReadReplicaOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.promoteReadReplica.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the PromoteReadReplicaDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated PromoteReadReplicaDBClusterMessage object being passed to this operation. - completion: The PromoteReadReplicaDBClusterResultForPromoteReadReplicaDBCluster object or an error will be passed to this callback when the operation is complete. The PromoteReadReplicaDBClusterResultForPromoteReadReplicaDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, invalidDBClusterState. */ public func promoteReadReplicaDBClusterAsync( input: RDSModel.PromoteReadReplicaDBClusterMessage, completion: @escaping (Result<RDSModel.PromoteReadReplicaDBClusterResultForPromoteReadReplicaDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.promoteReadReplicaDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = PromoteReadReplicaDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.promoteReadReplicaDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the PromoteReadReplicaDBCluster operation waiting for the response before returning. - Parameters: - input: The validated PromoteReadReplicaDBClusterMessage object being passed to this operation. - Returns: The PromoteReadReplicaDBClusterResultForPromoteReadReplicaDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, invalidDBClusterState. */ public func promoteReadReplicaDBClusterSync( input: RDSModel.PromoteReadReplicaDBClusterMessage) throws -> RDSModel.PromoteReadReplicaDBClusterResultForPromoteReadReplicaDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.promoteReadReplicaDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = PromoteReadReplicaDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.promoteReadReplicaDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the PurchaseReservedDBInstancesOffering operation returning immediately and passing the response to a callback. - Parameters: - input: The validated PurchaseReservedDBInstancesOfferingMessage object being passed to this operation. - completion: The PurchaseReservedDBInstancesOfferingResultForPurchaseReservedDBInstancesOffering object or an error will be passed to this callback when the operation is complete. The PurchaseReservedDBInstancesOfferingResultForPurchaseReservedDBInstancesOffering object will be validated before being returned to caller. The possible errors are: reservedDBInstanceAlreadyExists, reservedDBInstanceQuotaExceeded, reservedDBInstancesOfferingNotFound. */ public func purchaseReservedDBInstancesOfferingAsync( input: RDSModel.PurchaseReservedDBInstancesOfferingMessage, completion: @escaping (Result<RDSModel.PurchaseReservedDBInstancesOfferingResultForPurchaseReservedDBInstancesOffering, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.purchaseReservedDBInstancesOffering, handlerDelegate: handlerDelegate) let wrappedInput = PurchaseReservedDBInstancesOfferingOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.purchaseReservedDBInstancesOffering.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the PurchaseReservedDBInstancesOffering operation waiting for the response before returning. - Parameters: - input: The validated PurchaseReservedDBInstancesOfferingMessage object being passed to this operation. - Returns: The PurchaseReservedDBInstancesOfferingResultForPurchaseReservedDBInstancesOffering object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: reservedDBInstanceAlreadyExists, reservedDBInstanceQuotaExceeded, reservedDBInstancesOfferingNotFound. */ public func purchaseReservedDBInstancesOfferingSync( input: RDSModel.PurchaseReservedDBInstancesOfferingMessage) throws -> RDSModel.PurchaseReservedDBInstancesOfferingResultForPurchaseReservedDBInstancesOffering { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.purchaseReservedDBInstancesOffering, handlerDelegate: handlerDelegate) let wrappedInput = PurchaseReservedDBInstancesOfferingOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.purchaseReservedDBInstancesOffering.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RebootDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RebootDBInstanceMessage object being passed to this operation. - completion: The RebootDBInstanceResultForRebootDBInstance object or an error will be passed to this callback when the operation is complete. The RebootDBInstanceResultForRebootDBInstance object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound, invalidDBInstanceState. */ public func rebootDBInstanceAsync( input: RDSModel.RebootDBInstanceMessage, completion: @escaping (Result<RDSModel.RebootDBInstanceResultForRebootDBInstance, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.rebootDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = RebootDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.rebootDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RebootDBInstance operation waiting for the response before returning. - Parameters: - input: The validated RebootDBInstanceMessage object being passed to this operation. - Returns: The RebootDBInstanceResultForRebootDBInstance object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound, invalidDBInstanceState. */ public func rebootDBInstanceSync( input: RDSModel.RebootDBInstanceMessage) throws -> RDSModel.RebootDBInstanceResultForRebootDBInstance { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.rebootDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = RebootDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.rebootDBInstance.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RegisterDBProxyTargets operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RegisterDBProxyTargetsRequest object being passed to this operation. - completion: The RegisterDBProxyTargetsResponseForRegisterDBProxyTargets object or an error will be passed to this callback when the operation is complete. The RegisterDBProxyTargetsResponseForRegisterDBProxyTargets object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetAlreadyRegistered, dBProxyTargetGroupNotFound, insufficientAvailableIPsInSubnet, invalidDBClusterState, invalidDBInstanceState, invalidDBProxyState. */ public func registerDBProxyTargetsAsync( input: RDSModel.RegisterDBProxyTargetsRequest, completion: @escaping (Result<RDSModel.RegisterDBProxyTargetsResponseForRegisterDBProxyTargets, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.registerDBProxyTargets, handlerDelegate: handlerDelegate) let wrappedInput = RegisterDBProxyTargetsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.registerDBProxyTargets.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RegisterDBProxyTargets operation waiting for the response before returning. - Parameters: - input: The validated RegisterDBProxyTargetsRequest object being passed to this operation. - Returns: The RegisterDBProxyTargetsResponseForRegisterDBProxyTargets object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetAlreadyRegistered, dBProxyTargetGroupNotFound, insufficientAvailableIPsInSubnet, invalidDBClusterState, invalidDBInstanceState, invalidDBProxyState. */ public func registerDBProxyTargetsSync( input: RDSModel.RegisterDBProxyTargetsRequest) throws -> RDSModel.RegisterDBProxyTargetsResponseForRegisterDBProxyTargets { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.registerDBProxyTargets, handlerDelegate: handlerDelegate) let wrappedInput = RegisterDBProxyTargetsOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.registerDBProxyTargets.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RemoveFromGlobalCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RemoveFromGlobalClusterMessage object being passed to this operation. - completion: The RemoveFromGlobalClusterResultForRemoveFromGlobalCluster object or an error will be passed to this callback when the operation is complete. The RemoveFromGlobalClusterResultForRemoveFromGlobalCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, globalClusterNotFound, invalidGlobalClusterState. */ public func removeFromGlobalClusterAsync( input: RDSModel.RemoveFromGlobalClusterMessage, completion: @escaping (Result<RDSModel.RemoveFromGlobalClusterResultForRemoveFromGlobalCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeFromGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = RemoveFromGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeFromGlobalCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RemoveFromGlobalCluster operation waiting for the response before returning. - Parameters: - input: The validated RemoveFromGlobalClusterMessage object being passed to this operation. - Returns: The RemoveFromGlobalClusterResultForRemoveFromGlobalCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, globalClusterNotFound, invalidGlobalClusterState. */ public func removeFromGlobalClusterSync( input: RDSModel.RemoveFromGlobalClusterMessage) throws -> RDSModel.RemoveFromGlobalClusterResultForRemoveFromGlobalCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeFromGlobalCluster, handlerDelegate: handlerDelegate) let wrappedInput = RemoveFromGlobalClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeFromGlobalCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RemoveRoleFromDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RemoveRoleFromDBClusterMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBClusterNotFound, dBClusterRoleNotFound, invalidDBClusterState. */ public func removeRoleFromDBClusterAsync( input: RDSModel.RemoveRoleFromDBClusterMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeRoleFromDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = RemoveRoleFromDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeRoleFromDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RemoveRoleFromDBCluster operation waiting for the response before returning. - Parameters: - input: The validated RemoveRoleFromDBClusterMessage object being passed to this operation. - Throws: dBClusterNotFound, dBClusterRoleNotFound, invalidDBClusterState. */ public func removeRoleFromDBClusterSync( input: RDSModel.RemoveRoleFromDBClusterMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeRoleFromDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = RemoveRoleFromDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeRoleFromDBCluster.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RemoveRoleFromDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RemoveRoleFromDBInstanceMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBInstanceNotFound, dBInstanceRoleNotFound, invalidDBInstanceState. */ public func removeRoleFromDBInstanceAsync( input: RDSModel.RemoveRoleFromDBInstanceMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeRoleFromDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = RemoveRoleFromDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeRoleFromDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RemoveRoleFromDBInstance operation waiting for the response before returning. - Parameters: - input: The validated RemoveRoleFromDBInstanceMessage object being passed to this operation. - Throws: dBInstanceNotFound, dBInstanceRoleNotFound, invalidDBInstanceState. */ public func removeRoleFromDBInstanceSync( input: RDSModel.RemoveRoleFromDBInstanceMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeRoleFromDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = RemoveRoleFromDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeRoleFromDBInstance.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RemoveSourceIdentifierFromSubscription operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RemoveSourceIdentifierFromSubscriptionMessage object being passed to this operation. - completion: The RemoveSourceIdentifierFromSubscriptionResultForRemoveSourceIdentifierFromSubscription object or an error will be passed to this callback when the operation is complete. The RemoveSourceIdentifierFromSubscriptionResultForRemoveSourceIdentifierFromSubscription object will be validated before being returned to caller. The possible errors are: sourceNotFound, subscriptionNotFound. */ public func removeSourceIdentifierFromSubscriptionAsync( input: RDSModel.RemoveSourceIdentifierFromSubscriptionMessage, completion: @escaping (Result<RDSModel.RemoveSourceIdentifierFromSubscriptionResultForRemoveSourceIdentifierFromSubscription, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeSourceIdentifierFromSubscription, handlerDelegate: handlerDelegate) let wrappedInput = RemoveSourceIdentifierFromSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeSourceIdentifierFromSubscription.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RemoveSourceIdentifierFromSubscription operation waiting for the response before returning. - Parameters: - input: The validated RemoveSourceIdentifierFromSubscriptionMessage object being passed to this operation. - Returns: The RemoveSourceIdentifierFromSubscriptionResultForRemoveSourceIdentifierFromSubscription object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: sourceNotFound, subscriptionNotFound. */ public func removeSourceIdentifierFromSubscriptionSync( input: RDSModel.RemoveSourceIdentifierFromSubscriptionMessage) throws -> RDSModel.RemoveSourceIdentifierFromSubscriptionResultForRemoveSourceIdentifierFromSubscription { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeSourceIdentifierFromSubscription, handlerDelegate: handlerDelegate) let wrappedInput = RemoveSourceIdentifierFromSubscriptionOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeSourceIdentifierFromSubscription.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RemoveTagsFromResource operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RemoveTagsFromResourceMessage object being passed to this operation. - completion: Nil or an error will be passed to this callback when the operation is complete. The possible errors are: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetGroupNotFound, dBSnapshotNotFound. */ public func removeTagsFromResourceAsync( input: RDSModel.RemoveTagsFromResourceMessage, completion: @escaping (RDSError?) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeTagsFromResource, handlerDelegate: handlerDelegate) let wrappedInput = RemoveTagsFromResourceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeTagsFromResource.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RemoveTagsFromResource operation waiting for the response before returning. - Parameters: - input: The validated RemoveTagsFromResourceMessage object being passed to this operation. - Throws: dBClusterNotFound, dBInstanceNotFound, dBProxyNotFound, dBProxyTargetGroupNotFound, dBSnapshotNotFound. */ public func removeTagsFromResourceSync( input: RDSModel.RemoveTagsFromResourceMessage) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.removeTagsFromResource, handlerDelegate: handlerDelegate) let wrappedInput = RemoveTagsFromResourceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.removeTagsFromResource.rawValue, version: apiVersion) do { try httpClient.executeSyncRetriableWithoutOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ResetDBClusterParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ResetDBClusterParameterGroupMessage object being passed to this operation. - completion: The DBClusterParameterGroupNameMessageForResetDBClusterParameterGroup object or an error will be passed to this callback when the operation is complete. The DBClusterParameterGroupNameMessageForResetDBClusterParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func resetDBClusterParameterGroupAsync( input: RDSModel.ResetDBClusterParameterGroupMessage, completion: @escaping (Result<RDSModel.DBClusterParameterGroupNameMessageForResetDBClusterParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.resetDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ResetDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.resetDBClusterParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ResetDBClusterParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated ResetDBClusterParameterGroupMessage object being passed to this operation. - Returns: The DBClusterParameterGroupNameMessageForResetDBClusterParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func resetDBClusterParameterGroupSync( input: RDSModel.ResetDBClusterParameterGroupMessage) throws -> RDSModel.DBClusterParameterGroupNameMessageForResetDBClusterParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.resetDBClusterParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ResetDBClusterParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.resetDBClusterParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the ResetDBParameterGroup operation returning immediately and passing the response to a callback. - Parameters: - input: The validated ResetDBParameterGroupMessage object being passed to this operation. - completion: The DBParameterGroupNameMessageForResetDBParameterGroup object or an error will be passed to this callback when the operation is complete. The DBParameterGroupNameMessageForResetDBParameterGroup object will be validated before being returned to caller. The possible errors are: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func resetDBParameterGroupAsync( input: RDSModel.ResetDBParameterGroupMessage, completion: @escaping (Result<RDSModel.DBParameterGroupNameMessageForResetDBParameterGroup, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.resetDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ResetDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.resetDBParameterGroup.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the ResetDBParameterGroup operation waiting for the response before returning. - Parameters: - input: The validated ResetDBParameterGroupMessage object being passed to this operation. - Returns: The DBParameterGroupNameMessageForResetDBParameterGroup object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBParameterGroupNotFound, invalidDBParameterGroupState. */ public func resetDBParameterGroupSync( input: RDSModel.ResetDBParameterGroupMessage) throws -> RDSModel.DBParameterGroupNameMessageForResetDBParameterGroup { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.resetDBParameterGroup, handlerDelegate: handlerDelegate) let wrappedInput = ResetDBParameterGroupOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.resetDBParameterGroup.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RestoreDBClusterFromS3 operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RestoreDBClusterFromS3Message object being passed to this operation. - completion: The RestoreDBClusterFromS3ResultForRestoreDBClusterFromS3 object or an error will be passed to this callback when the operation is complete. The RestoreDBClusterFromS3ResultForRestoreDBClusterFromS3 object will be validated before being returned to caller. The possible errors are: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBSubnetGroupNotFound, domainNotFound, insufficientStorageClusterCapacity, invalidDBClusterState, invalidDBSubnetGroupState, invalidS3Bucket, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, storageQuotaExceeded. */ public func restoreDBClusterFromS3Async( input: RDSModel.RestoreDBClusterFromS3Message, completion: @escaping (Result<RDSModel.RestoreDBClusterFromS3ResultForRestoreDBClusterFromS3, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBClusterFromS3, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBClusterFromS3OperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBClusterFromS3.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RestoreDBClusterFromS3 operation waiting for the response before returning. - Parameters: - input: The validated RestoreDBClusterFromS3Message object being passed to this operation. - Returns: The RestoreDBClusterFromS3ResultForRestoreDBClusterFromS3 object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBSubnetGroupNotFound, domainNotFound, insufficientStorageClusterCapacity, invalidDBClusterState, invalidDBSubnetGroupState, invalidS3Bucket, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, storageQuotaExceeded. */ public func restoreDBClusterFromS3Sync( input: RDSModel.RestoreDBClusterFromS3Message) throws -> RDSModel.RestoreDBClusterFromS3ResultForRestoreDBClusterFromS3 { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBClusterFromS3, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBClusterFromS3OperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBClusterFromS3.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RestoreDBClusterFromSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RestoreDBClusterFromSnapshotMessage object being passed to this operation. - completion: The RestoreDBClusterFromSnapshotResultForRestoreDBClusterFromSnapshot object or an error will be passed to this callback when the operation is complete. The RestoreDBClusterFromSnapshotResultForRestoreDBClusterFromSnapshot object will be validated before being returned to caller. The possible errors are: dBClusterAlreadyExists, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBClusterSnapshotNotFound, dBSnapshotNotFound, dBSubnetGroupNotFound, dBSubnetGroupNotFound, domainNotFound, insufficientDBClusterCapacity, insufficientStorageClusterCapacity, invalidDBClusterSnapshotState, invalidDBSnapshotState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, storageQuotaExceeded, storageQuotaExceeded. */ public func restoreDBClusterFromSnapshotAsync( input: RDSModel.RestoreDBClusterFromSnapshotMessage, completion: @escaping (Result<RDSModel.RestoreDBClusterFromSnapshotResultForRestoreDBClusterFromSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBClusterFromSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBClusterFromSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBClusterFromSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RestoreDBClusterFromSnapshot operation waiting for the response before returning. - Parameters: - input: The validated RestoreDBClusterFromSnapshotMessage object being passed to this operation. - Returns: The RestoreDBClusterFromSnapshotResultForRestoreDBClusterFromSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterAlreadyExists, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBClusterSnapshotNotFound, dBSnapshotNotFound, dBSubnetGroupNotFound, dBSubnetGroupNotFound, domainNotFound, insufficientDBClusterCapacity, insufficientStorageClusterCapacity, invalidDBClusterSnapshotState, invalidDBSnapshotState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, storageQuotaExceeded, storageQuotaExceeded. */ public func restoreDBClusterFromSnapshotSync( input: RDSModel.RestoreDBClusterFromSnapshotMessage) throws -> RDSModel.RestoreDBClusterFromSnapshotResultForRestoreDBClusterFromSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBClusterFromSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBClusterFromSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBClusterFromSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RestoreDBClusterToPointInTime operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RestoreDBClusterToPointInTimeMessage object being passed to this operation. - completion: The RestoreDBClusterToPointInTimeResultForRestoreDBClusterToPointInTime object or an error will be passed to this callback when the operation is complete. The RestoreDBClusterToPointInTimeResultForRestoreDBClusterToPointInTime object will be validated before being returned to caller. The possible errors are: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBClusterSnapshotNotFound, dBSubnetGroupNotFound, domainNotFound, insufficientDBClusterCapacity, insufficientStorageClusterCapacity, invalidDBClusterSnapshotState, invalidDBClusterState, invalidDBSnapshotState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, storageQuotaExceeded. */ public func restoreDBClusterToPointInTimeAsync( input: RDSModel.RestoreDBClusterToPointInTimeMessage, completion: @escaping (Result<RDSModel.RestoreDBClusterToPointInTimeResultForRestoreDBClusterToPointInTime, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBClusterToPointInTime, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBClusterToPointInTimeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBClusterToPointInTime.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RestoreDBClusterToPointInTime operation waiting for the response before returning. - Parameters: - input: The validated RestoreDBClusterToPointInTimeMessage object being passed to this operation. - Returns: The RestoreDBClusterToPointInTimeResultForRestoreDBClusterToPointInTime object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterAlreadyExists, dBClusterNotFound, dBClusterParameterGroupNotFound, dBClusterQuotaExceeded, dBClusterSnapshotNotFound, dBSubnetGroupNotFound, domainNotFound, insufficientDBClusterCapacity, insufficientStorageClusterCapacity, invalidDBClusterSnapshotState, invalidDBClusterState, invalidDBSnapshotState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, storageQuotaExceeded. */ public func restoreDBClusterToPointInTimeSync( input: RDSModel.RestoreDBClusterToPointInTimeMessage) throws -> RDSModel.RestoreDBClusterToPointInTimeResultForRestoreDBClusterToPointInTime { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBClusterToPointInTime, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBClusterToPointInTimeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBClusterToPointInTime.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RestoreDBInstanceFromDBSnapshot operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RestoreDBInstanceFromDBSnapshotMessage object being passed to this operation. - completion: The RestoreDBInstanceFromDBSnapshotResultForRestoreDBInstanceFromDBSnapshot object or an error will be passed to this callback when the operation is complete. The RestoreDBInstanceFromDBSnapshotResultForRestoreDBInstanceFromDBSnapshot object will be validated before being returned to caller. The possible errors are: authorizationNotFound, backupPolicyNotFound, dBInstanceAlreadyExists, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSnapshotNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBSnapshotState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func restoreDBInstanceFromDBSnapshotAsync( input: RDSModel.RestoreDBInstanceFromDBSnapshotMessage, completion: @escaping (Result<RDSModel.RestoreDBInstanceFromDBSnapshotResultForRestoreDBInstanceFromDBSnapshot, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBInstanceFromDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBInstanceFromDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBInstanceFromDBSnapshot.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RestoreDBInstanceFromDBSnapshot operation waiting for the response before returning. - Parameters: - input: The validated RestoreDBInstanceFromDBSnapshotMessage object being passed to this operation. - Returns: The RestoreDBInstanceFromDBSnapshotResultForRestoreDBInstanceFromDBSnapshot object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationNotFound, backupPolicyNotFound, dBInstanceAlreadyExists, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSnapshotNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBSnapshotState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func restoreDBInstanceFromDBSnapshotSync( input: RDSModel.RestoreDBInstanceFromDBSnapshotMessage) throws -> RDSModel.RestoreDBInstanceFromDBSnapshotResultForRestoreDBInstanceFromDBSnapshot { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBInstanceFromDBSnapshot, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBInstanceFromDBSnapshotOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBInstanceFromDBSnapshot.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RestoreDBInstanceFromS3 operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RestoreDBInstanceFromS3Message object being passed to this operation. - completion: The RestoreDBInstanceFromS3ResultForRestoreDBInstanceFromS3 object or an error will be passed to this callback when the operation is complete. The RestoreDBInstanceFromS3ResultForRestoreDBInstanceFromS3 object will be validated before being returned to caller. The possible errors are: authorizationNotFound, backupPolicyNotFound, dBInstanceAlreadyExists, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidS3Bucket, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func restoreDBInstanceFromS3Async( input: RDSModel.RestoreDBInstanceFromS3Message, completion: @escaping (Result<RDSModel.RestoreDBInstanceFromS3ResultForRestoreDBInstanceFromS3, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBInstanceFromS3, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBInstanceFromS3OperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBInstanceFromS3.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RestoreDBInstanceFromS3 operation waiting for the response before returning. - Parameters: - input: The validated RestoreDBInstanceFromS3Message object being passed to this operation. - Returns: The RestoreDBInstanceFromS3ResultForRestoreDBInstanceFromS3 object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationNotFound, backupPolicyNotFound, dBInstanceAlreadyExists, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidS3Bucket, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func restoreDBInstanceFromS3Sync( input: RDSModel.RestoreDBInstanceFromS3Message) throws -> RDSModel.RestoreDBInstanceFromS3ResultForRestoreDBInstanceFromS3 { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBInstanceFromS3, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBInstanceFromS3OperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBInstanceFromS3.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RestoreDBInstanceToPointInTime operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RestoreDBInstanceToPointInTimeMessage object being passed to this operation. - completion: The RestoreDBInstanceToPointInTimeResultForRestoreDBInstanceToPointInTime object or an error will be passed to this callback when the operation is complete. The RestoreDBInstanceToPointInTimeResultForRestoreDBInstanceToPointInTime object will be validated before being returned to caller. The possible errors are: authorizationNotFound, backupPolicyNotFound, dBInstanceAlreadyExists, dBInstanceAutomatedBackupNotFound, dBInstanceNotFound, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBInstanceState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, pointInTimeRestoreNotEnabled, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func restoreDBInstanceToPointInTimeAsync( input: RDSModel.RestoreDBInstanceToPointInTimeMessage, completion: @escaping (Result<RDSModel.RestoreDBInstanceToPointInTimeResultForRestoreDBInstanceToPointInTime, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBInstanceToPointInTime, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBInstanceToPointInTimeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBInstanceToPointInTime.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RestoreDBInstanceToPointInTime operation waiting for the response before returning. - Parameters: - input: The validated RestoreDBInstanceToPointInTimeMessage object being passed to this operation. - Returns: The RestoreDBInstanceToPointInTimeResultForRestoreDBInstanceToPointInTime object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationNotFound, backupPolicyNotFound, dBInstanceAlreadyExists, dBInstanceAutomatedBackupNotFound, dBInstanceNotFound, dBParameterGroupNotFound, dBSecurityGroupNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, domainNotFound, instanceQuotaExceeded, insufficientDBInstanceCapacity, invalidDBInstanceState, invalidRestore, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible, optionGroupNotFound, pointInTimeRestoreNotEnabled, provisionedIopsNotAvailableInAZ, storageQuotaExceeded, storageTypeNotSupported. */ public func restoreDBInstanceToPointInTimeSync( input: RDSModel.RestoreDBInstanceToPointInTimeMessage) throws -> RDSModel.RestoreDBInstanceToPointInTimeResultForRestoreDBInstanceToPointInTime { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.restoreDBInstanceToPointInTime, handlerDelegate: handlerDelegate) let wrappedInput = RestoreDBInstanceToPointInTimeOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.restoreDBInstanceToPointInTime.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the RevokeDBSecurityGroupIngress operation returning immediately and passing the response to a callback. - Parameters: - input: The validated RevokeDBSecurityGroupIngressMessage object being passed to this operation. - completion: The RevokeDBSecurityGroupIngressResultForRevokeDBSecurityGroupIngress object or an error will be passed to this callback when the operation is complete. The RevokeDBSecurityGroupIngressResultForRevokeDBSecurityGroupIngress object will be validated before being returned to caller. The possible errors are: authorizationNotFound, dBSecurityGroupNotFound, invalidDBSecurityGroupState. */ public func revokeDBSecurityGroupIngressAsync( input: RDSModel.RevokeDBSecurityGroupIngressMessage, completion: @escaping (Result<RDSModel.RevokeDBSecurityGroupIngressResultForRevokeDBSecurityGroupIngress, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.revokeDBSecurityGroupIngress, handlerDelegate: handlerDelegate) let wrappedInput = RevokeDBSecurityGroupIngressOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.revokeDBSecurityGroupIngress.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the RevokeDBSecurityGroupIngress operation waiting for the response before returning. - Parameters: - input: The validated RevokeDBSecurityGroupIngressMessage object being passed to this operation. - Returns: The RevokeDBSecurityGroupIngressResultForRevokeDBSecurityGroupIngress object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationNotFound, dBSecurityGroupNotFound, invalidDBSecurityGroupState. */ public func revokeDBSecurityGroupIngressSync( input: RDSModel.RevokeDBSecurityGroupIngressMessage) throws -> RDSModel.RevokeDBSecurityGroupIngressResultForRevokeDBSecurityGroupIngress { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.revokeDBSecurityGroupIngress, handlerDelegate: handlerDelegate) let wrappedInput = RevokeDBSecurityGroupIngressOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.revokeDBSecurityGroupIngress.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the StartActivityStream operation returning immediately and passing the response to a callback. - Parameters: - input: The validated StartActivityStreamRequest object being passed to this operation. - completion: The StartActivityStreamResponseForStartActivityStream object or an error will be passed to this callback when the operation is complete. The StartActivityStreamResponseForStartActivityStream object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, dBInstanceNotFound, invalidDBClusterState, invalidDBInstanceState, kMSKeyNotAccessible, resourceNotFound. */ public func startActivityStreamAsync( input: RDSModel.StartActivityStreamRequest, completion: @escaping (Result<RDSModel.StartActivityStreamResponseForStartActivityStream, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startActivityStream, handlerDelegate: handlerDelegate) let wrappedInput = StartActivityStreamOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startActivityStream.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the StartActivityStream operation waiting for the response before returning. - Parameters: - input: The validated StartActivityStreamRequest object being passed to this operation. - Returns: The StartActivityStreamResponseForStartActivityStream object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, dBInstanceNotFound, invalidDBClusterState, invalidDBInstanceState, kMSKeyNotAccessible, resourceNotFound. */ public func startActivityStreamSync( input: RDSModel.StartActivityStreamRequest) throws -> RDSModel.StartActivityStreamResponseForStartActivityStream { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startActivityStream, handlerDelegate: handlerDelegate) let wrappedInput = StartActivityStreamOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startActivityStream.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the StartDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated StartDBClusterMessage object being passed to this operation. - completion: The StartDBClusterResultForStartDBCluster object or an error will be passed to this callback when the operation is complete. The StartDBClusterResultForStartDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func startDBClusterAsync( input: RDSModel.StartDBClusterMessage, completion: @escaping (Result<RDSModel.StartDBClusterResultForStartDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = StartDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the StartDBCluster operation waiting for the response before returning. - Parameters: - input: The validated StartDBClusterMessage object being passed to this operation. - Returns: The StartDBClusterResultForStartDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func startDBClusterSync( input: RDSModel.StartDBClusterMessage) throws -> RDSModel.StartDBClusterResultForStartDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = StartDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the StartDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated StartDBInstanceMessage object being passed to this operation. - completion: The StartDBInstanceResultForStartDBInstance object or an error will be passed to this callback when the operation is complete. The StartDBInstanceResultForStartDBInstance object will be validated before being returned to caller. The possible errors are: authorizationNotFound, dBClusterNotFound, dBInstanceNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, insufficientDBInstanceCapacity, invalidDBClusterState, invalidDBInstanceState, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible. */ public func startDBInstanceAsync( input: RDSModel.StartDBInstanceMessage, completion: @escaping (Result<RDSModel.StartDBInstanceResultForStartDBInstance, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = StartDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the StartDBInstance operation waiting for the response before returning. - Parameters: - input: The validated StartDBInstanceMessage object being passed to this operation. - Returns: The StartDBInstanceResultForStartDBInstance object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: authorizationNotFound, dBClusterNotFound, dBInstanceNotFound, dBSubnetGroupDoesNotCoverEnoughAZs, dBSubnetGroupNotFound, insufficientDBInstanceCapacity, invalidDBClusterState, invalidDBInstanceState, invalidSubnet, invalidVPCNetworkState, kMSKeyNotAccessible. */ public func startDBInstanceSync( input: RDSModel.StartDBInstanceMessage) throws -> RDSModel.StartDBInstanceResultForStartDBInstance { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = StartDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startDBInstance.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the StartExportTask operation returning immediately and passing the response to a callback. - Parameters: - input: The validated StartExportTaskMessage object being passed to this operation. - completion: The ExportTaskForStartExportTask object or an error will be passed to this callback when the operation is complete. The ExportTaskForStartExportTask object will be validated before being returned to caller. The possible errors are: dBClusterSnapshotNotFound, dBSnapshotNotFound, exportTaskAlreadyExists, iamRoleMissingPermissions, iamRoleNotFound, invalidExportOnly, invalidExportSourceState, invalidS3Bucket, kMSKeyNotAccessible. */ public func startExportTaskAsync( input: RDSModel.StartExportTaskMessage, completion: @escaping (Result<RDSModel.ExportTaskForStartExportTask, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startExportTask, handlerDelegate: handlerDelegate) let wrappedInput = StartExportTaskOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startExportTask.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the StartExportTask operation waiting for the response before returning. - Parameters: - input: The validated StartExportTaskMessage object being passed to this operation. - Returns: The ExportTaskForStartExportTask object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterSnapshotNotFound, dBSnapshotNotFound, exportTaskAlreadyExists, iamRoleMissingPermissions, iamRoleNotFound, invalidExportOnly, invalidExportSourceState, invalidS3Bucket, kMSKeyNotAccessible. */ public func startExportTaskSync( input: RDSModel.StartExportTaskMessage) throws -> RDSModel.ExportTaskForStartExportTask { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.startExportTask, handlerDelegate: handlerDelegate) let wrappedInput = StartExportTaskOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.startExportTask.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the StopActivityStream operation returning immediately and passing the response to a callback. - Parameters: - input: The validated StopActivityStreamRequest object being passed to this operation. - completion: The StopActivityStreamResponseForStopActivityStream object or an error will be passed to this callback when the operation is complete. The StopActivityStreamResponseForStopActivityStream object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, dBInstanceNotFound, invalidDBClusterState, invalidDBInstanceState, resourceNotFound. */ public func stopActivityStreamAsync( input: RDSModel.StopActivityStreamRequest, completion: @escaping (Result<RDSModel.StopActivityStreamResponseForStopActivityStream, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.stopActivityStream, handlerDelegate: handlerDelegate) let wrappedInput = StopActivityStreamOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.stopActivityStream.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the StopActivityStream operation waiting for the response before returning. - Parameters: - input: The validated StopActivityStreamRequest object being passed to this operation. - Returns: The StopActivityStreamResponseForStopActivityStream object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, dBInstanceNotFound, invalidDBClusterState, invalidDBInstanceState, resourceNotFound. */ public func stopActivityStreamSync( input: RDSModel.StopActivityStreamRequest) throws -> RDSModel.StopActivityStreamResponseForStopActivityStream { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.stopActivityStream, handlerDelegate: handlerDelegate) let wrappedInput = StopActivityStreamOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.stopActivityStream.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the StopDBCluster operation returning immediately and passing the response to a callback. - Parameters: - input: The validated StopDBClusterMessage object being passed to this operation. - completion: The StopDBClusterResultForStopDBCluster object or an error will be passed to this callback when the operation is complete. The StopDBClusterResultForStopDBCluster object will be validated before being returned to caller. The possible errors are: dBClusterNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func stopDBClusterAsync( input: RDSModel.StopDBClusterMessage, completion: @escaping (Result<RDSModel.StopDBClusterResultForStopDBCluster, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.stopDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = StopDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.stopDBCluster.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the StopDBCluster operation waiting for the response before returning. - Parameters: - input: The validated StopDBClusterMessage object being passed to this operation. - Returns: The StopDBClusterResultForStopDBCluster object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBClusterNotFound, invalidDBClusterState, invalidDBInstanceState. */ public func stopDBClusterSync( input: RDSModel.StopDBClusterMessage) throws -> RDSModel.StopDBClusterResultForStopDBCluster { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.stopDBCluster, handlerDelegate: handlerDelegate) let wrappedInput = StopDBClusterOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.stopDBCluster.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } /** Invokes the StopDBInstance operation returning immediately and passing the response to a callback. - Parameters: - input: The validated StopDBInstanceMessage object being passed to this operation. - completion: The StopDBInstanceResultForStopDBInstance object or an error will be passed to this callback when the operation is complete. The StopDBInstanceResultForStopDBInstance object will be validated before being returned to caller. The possible errors are: dBInstanceNotFound, dBSnapshotAlreadyExists, invalidDBClusterState, invalidDBInstanceState, snapshotQuotaExceeded. */ public func stopDBInstanceAsync( input: RDSModel.StopDBInstanceMessage, completion: @escaping (Result<RDSModel.StopDBInstanceResultForStopDBInstance, RDSError>) -> ()) throws { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.stopDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = StopDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.stopDBInstance.rawValue, version: apiVersion) _ = try httpClient.executeOperationAsyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, completion: completion, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } /** Invokes the StopDBInstance operation waiting for the response before returning. - Parameters: - input: The validated StopDBInstanceMessage object being passed to this operation. - Returns: The StopDBInstanceResultForStopDBInstance object to be passed back from the caller of this operation. Will be validated before being returned to caller. - Throws: dBInstanceNotFound, dBSnapshotAlreadyExists, invalidDBClusterState, invalidDBInstanceState, snapshotQuotaExceeded. */ public func stopDBInstanceSync( input: RDSModel.StopDBInstanceMessage) throws -> RDSModel.StopDBInstanceResultForStopDBInstance { let handlerDelegate = AWSClientInvocationDelegate( credentialsProvider: credentialsProvider, awsRegion: awsRegion, service: service, target: target) let invocationContext = HTTPClientInvocationContext(reporting: self.invocationsReporting.stopDBInstance, handlerDelegate: handlerDelegate) let wrappedInput = StopDBInstanceOperationHTTPRequestInput(encodable: input) let requestInput = QueryWrapperHTTPRequestInput( wrappedInput: wrappedInput, action: RDSModelOperations.stopDBInstance.rawValue, version: apiVersion) do { return try httpClient.executeSyncRetriableWithOutput( endpointPath: "/", httpMethod: .POST, input: requestInput, invocationContext: invocationContext, retryConfiguration: retryConfiguration, retryOnError: retryOnErrorProvider) } catch { let typedError: RDSError = error.asTypedError() throw typedError } } }
50.805088
572
0.669729
d57c13d63ed381b44001b785428ffcb37f6fe268
6,101
// // BaseXCTestCase+Let.swift // Pods-ZPTesting_Example // // Created by Zsolt Pete on 2019. 10. 14.. // import Foundation import XCTest extension BaseXCTestCase { /** ZPTesting: Find the element with the given id. - parameter id: Element id. - parameter type: The element type which will be searched. - returns: The element which on the screen */ open func letElement(_ id: String, type: ElementType) -> XCUIElement { switch type { case .label: return self.letLabel(id) case .button: return self.letButton(id) case .image: return self.letImage(id) case .inputField: return self.letInputField(id) case .secureInputField: return self.letSecureInputField(id) case .searchField: return self.letSearchField(id) case .inputView: return self.letInputView(id) case .scrollView: return self.letScrollView(id) case .tables: return self.letTableView(id) case .collectionView: return self.letCollectionView(id) case .cells: return self.letCell(id) case .view: return self.letView(id) default: return self.letView(id) } } /** ZPTesting: Find a label with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letLabel(_ id: String) -> XCUIElement { let element = app.staticTexts[id] return self.isExists(element) } /** ZPTesting: Find a button with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letButton(_ id: String) -> XCUIElement { let element = app.buttons[id] return self.isExists(element) } /** ZPTesting: Find a image with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letImage(_ id: String) -> XCUIElement { let element = app.images[id] return self.isExists(element) } /** ZPTesting: Find a input field with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letInputField(_ id: String) -> XCUIElement { let element = app.textFields[id] return self.isExists(element) } /** ZPTesting: Find a secure input field with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letSecureInputField(_ id: String) -> XCUIElement { let element = app.secureTextFields[id] return self.isExists(element) } /** ZPTesting: Find a search field with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letSearchField(_ id: String) -> XCUIElement { let element = app.searchFields[id] return self.isExists(element) } /** ZPTesting: Find a input view with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letInputView(_ id: String) -> XCUIElement { let element = app.textViews[id] return self.isExists(element) } /** ZPTesting: Find a scroll view with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letScrollView(_ id: String) -> XCUIElement { let element = app.scrollViews[id] return self.isExists(element) } /** ZPTesting: Find a table view with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letTableView(_ id: String) -> XCUIElement { let element = app.tables[id] return self.isExists(element) } /** ZPTesting: Find a collection view with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letCollectionView(_ id: String) -> XCUIElement { let element = app.collectionViews[id] return self.isExists(element) } /** ZPTesting: Find a cell with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letCell(_ id: String) -> XCUIElement { let element = app.cells[id] return self.isExists(element) } /** ZPTesting: Find a alert with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letAlert(_ id: String) -> XCUIElement { let element = app.alerts[id] return self.isExists(element) } /** ZPTesting: Find a view with the given id - parameter id: The elemnt id - returns: The element which on the screen */ open func letView(_ id: String) -> XCUIElement { let element = app.otherElements[id] return self.isExists(element) } /** Let cell at index - parameter bound: Index of cell - parameter table: Table of the cell - returns: Cell of the table */ open func letCell(at bound: Int, table: XCUIElement? = nil) -> XCUIElement { if let table = table { return table.cells.element(boundBy: bound) } else { return app.cells.element(boundBy: bound) } } /** Let cell at index - parameter bound: Index of cell - parameter tableId: Table id which contains the cell - returns: Cell of the table */ open func letCell(at bound: Int, tableId: String? = nil) -> XCUIElement { if let tableId = tableId { let table = self.letTableView(tableId) return table.cells.element(boundBy: bound) } else { return app.cells.element(boundBy: bound) } } }
29.052381
80
0.595148
fee748cfbfaab8c232a77c4c071aab52ea201185
1,417
// // AppDelegate.swift // I Am Rich // // Created by Thyme Nawaphanarat on 26/11/19. // Copyright © 2019 Thyme. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }
37.289474
179
0.746648
dbb3329bacd1f7ce6fac39d242c8bcd6f804443f
9,584
// // StepIndicatorView.swift // StepIndicator // // Created by Yun Chen on 2017/7/14. // Copyright © 2017 Yun CHEN. All rights reserved. // import UIKit public enum StepIndicatorViewDirection:UInt { case leftToRight = 0, rightToLeft, topToBottom, bottomToTop } @IBDesignable public class StepIndicatorView: UIView { // Variables static let defaultColor = UIColor(red: 179.0/255.0, green: 189.0/255.0, blue: 194.0/255.0, alpha: 1.0) static let defaultTintColor = UIColor(red: 0.0/255.0, green: 180.0/255.0, blue: 124.0/255.0, alpha: 1.0) private var annularLayers = [AnnularLayer]() private var horizontalLineLayers = [LineLayer]() private let containerLayer = CALayer() // MARK: - Overrided properties and methods override public var frame: CGRect { didSet{ self.updateSubLayers() } } override public func layoutSubviews() { super.layoutSubviews() self.updateSubLayers() } // MARK: - Custom properties @IBInspectable public var numberOfSteps: Int = 5 { didSet { self.createSteps() } } @IBInspectable public var currentStep: Int = -1 { didSet{ if self.annularLayers.count <= 0 { return } if oldValue != self.currentStep { self.setCurrentStep(step: self.currentStep) } } } @IBInspectable public var displayNumbers: Bool = false { didSet { self.updateSubLayers() } } @IBInspectable public var circleRadius:CGFloat = 10.0 { didSet{ self.updateSubLayers() } } @IBInspectable public var circleColor:UIColor = defaultColor { didSet { self.updateSubLayers() } } @IBInspectable public var circleTintColor:UIColor = defaultTintColor { didSet { self.updateSubLayers() } } @IBInspectable public var circleStrokeWidth:CGFloat = 3.0 { didSet{ self.updateSubLayers() } } @IBInspectable public var lineColor:UIColor = defaultColor { didSet { self.updateSubLayers() } } @IBInspectable public var lineTintColor:UIColor = defaultTintColor { didSet { self.updateSubLayers() } } @IBInspectable public var lineMargin:CGFloat = 4.0 { didSet{ self.updateSubLayers() } } @IBInspectable public var lineStrokeWidth:CGFloat = 2.0 { didSet{ self.updateSubLayers() } } public var direction:StepIndicatorViewDirection = .leftToRight { didSet{ self.updateSubLayers() } } @IBInspectable var directionRaw: UInt { get{ return self.direction.rawValue } set{ let value = newValue > 3 ? 0 : newValue self.direction = StepIndicatorViewDirection(rawValue: value)! } } @IBInspectable var showFlag: Bool = true { didSet { self.updateSubLayers() } } // MARK: - Functions private func createSteps() { if let layers = self.layer.sublayers { for layer in layers { layer.removeFromSuperlayer() } } self.annularLayers.removeAll() self.horizontalLineLayers.removeAll() if self.numberOfSteps <= 0 { return } for i in 0..<self.numberOfSteps { let annularLayer = AnnularLayer() self.containerLayer.addSublayer(annularLayer) self.annularLayers.append(annularLayer) if (i < self.numberOfSteps - 1) { let lineLayer = LineLayer() self.containerLayer.addSublayer(lineLayer) self.horizontalLineLayers.append(lineLayer) } } self.layer.addSublayer(self.containerLayer) self.updateSubLayers() self.setCurrentStep(step: self.currentStep) } private func updateSubLayers() { self.containerLayer.frame = self.layer.bounds if self.direction == .leftToRight || self.direction == .rightToLeft { self.layoutHorizontal() } else{ self.layoutVertical() } self.applyDirection() } private func layoutHorizontal() { let diameter = self.circleRadius * 2 let stepWidth = self.numberOfSteps == 1 ? 0 : (self.containerLayer.frame.width - self.lineMargin * 2 - diameter) / CGFloat(self.numberOfSteps - 1) let y = self.containerLayer.frame.height / 2.0 for i in 0..<self.annularLayers.count { let annularLayer = self.annularLayers[i] let x = self.numberOfSteps == 1 ? self.containerLayer.frame.width / 2.0 - self.circleRadius : self.lineMargin + CGFloat(i) * stepWidth annularLayer.frame = CGRect(x: x, y: y - self.circleRadius, width: diameter, height: diameter) self.applyAnnularStyle(annularLayer: annularLayer) annularLayer.step = i + 1 annularLayer.updateStatus() if (i < self.numberOfSteps - 1) { let lineLayer = self.horizontalLineLayers[i] lineLayer.frame = CGRect(x: CGFloat(i) * stepWidth + diameter + self.lineMargin * 2, y: y - 1, width: stepWidth - diameter - self.lineMargin * 2, height: 3) self.applyLineStyle(lineLayer: lineLayer) lineLayer.updateStatus() } } } private func layoutVertical() { let diameter = self.circleRadius * 2 let stepWidth = self.numberOfSteps == 1 ? 0 : (self.containerLayer.frame.height - self.lineMargin * 2 - diameter) / CGFloat(self.numberOfSteps - 1) let x = self.containerLayer.frame.width / 2.0 for i in 0..<self.annularLayers.count { let annularLayer = self.annularLayers[i] let y = self.numberOfSteps == 1 ? self.containerLayer.frame.height / 2.0 - self.circleRadius : self.lineMargin + CGFloat(i) * stepWidth annularLayer.frame = CGRect(x: x - self.circleRadius, y: y, width: diameter, height: diameter) self.applyAnnularStyle(annularLayer: annularLayer) annularLayer.step = i + 1 annularLayer.updateStatus() if (i < self.numberOfSteps - 1) { let lineLayer = self.horizontalLineLayers[i] lineLayer.frame = CGRect(x: x - 1.5, y: CGFloat(i) * stepWidth + diameter + self.lineMargin * 2, width: 3 , height: stepWidth - diameter - self.lineMargin * 2) lineLayer.isHorizontal = false self.applyLineStyle(lineLayer: lineLayer) lineLayer.updateStatus() } } } private func applyAnnularStyle(annularLayer:AnnularLayer) { annularLayer.annularDefaultColor = self.circleColor annularLayer.tintColor = self.circleTintColor annularLayer.lineWidth = self.circleStrokeWidth annularLayer.displayNumber = self.displayNumbers annularLayer.showFlag = self.showFlag } private func applyLineStyle(lineLayer:LineLayer) { lineLayer.strokeColor = self.lineColor.cgColor lineLayer.tintColor = self.lineTintColor lineLayer.lineWidth = self.lineStrokeWidth } private func applyDirection() { switch self.direction { case .rightToLeft: let rotation180 = CATransform3DMakeRotation(CGFloat.pi, 0.0, 1.0, 0.0) self.containerLayer.transform = rotation180 for annularLayer in self.annularLayers { annularLayer.transform = rotation180 } case .bottomToTop: let rotation180 = CATransform3DMakeRotation(CGFloat.pi, 1.0, 0.0, 0.0) self.containerLayer.transform = rotation180 for annularLayer in self.annularLayers { annularLayer.transform = rotation180 } default: self.containerLayer.transform = CATransform3DIdentity for annularLayer in self.annularLayers { annularLayer.transform = CATransform3DIdentity } } } private func setCurrentStep(step:Int) { for i in 0..<self.numberOfSteps { if i < step { if !self.annularLayers[i].isFinished { self.annularLayers[i].isFinished = true } self.setLineFinished(isFinished: true, index: i - 1) } else if i == step { self.annularLayers[i].isFinished = false self.annularLayers[i].isCurrent = true self.setLineFinished(isFinished: true, index: i - 1) } else{ self.annularLayers[i].isFinished = false self.annularLayers[i].isCurrent = false self.setLineFinished(isFinished: false, index: i - 1) } } } private func setLineFinished(isFinished:Bool,index:Int) { if index >= 0 { if self.horizontalLineLayers[index].isFinished != isFinished { self.horizontalLineLayers[index].isFinished = isFinished } } } }
32.709898
175
0.574395
33fdfd35d5ba31d2901878d3835d02501e4c6a71
4,794
import Combine import SwiftUI struct PickerWrapper<Cell: View, Center: View, Value: Hashable>: UIViewRepresentable where Value: Comparable { let values: [Value] @Binding var selected: Value let centerSize: Int let cell: (Value) -> Cell let center: (Value) -> Center typealias UIViewType = CollectionPickerView<UIHostingCell<Cell>, UIHostingView<Center>, Value> init(_ values: [Value], selected: Binding<Value>, centerSize: Int = 1, cell: @escaping (Value) -> Cell, center: @escaping (Value) -> Center) { self.values = values self._selected = selected self.cell = cell self.center = center self.centerSize = centerSize } func updateUIView(_ picker: UIViewType, context: Context) { picker.configureCell = { $0.set(value: self.cell($1)) } picker.configureCenter = { $0.set(value: self.center($1)) } picker.values = self.values picker.select(value: self.selected) picker.centerSize = self.centerSize } func makeUIView(context: Context) -> UIViewType { let picker = UIViewType(values: self.values, selected: self.selected, configureCell: { $0.set(value: self.cell($1)) }, configureCenter: { $0.set(value: self.center($1)) }) picker.centerSize = self.centerSize context.coordinator.listing(to: picker.publisher) return picker } func makeCoordinator() -> PickerModel<Value> { PickerModel(selected: $selected) } } class PickerModel<Value: Hashable> { @Binding var selected: Value private var cancallable: AnyCancellable? init(selected: Binding<Value>) { self._selected = selected } func listing<P: Publisher>(to publisher: P) where P.Output == Value, P.Failure == Never { DispatchQueue.main.async { self.cancallable?.cancel() self.cancallable = publisher .assign(to: \.selected, on: self) } } } final class UIHostingView<Content: View>: UIView { private var hosting: UIHostingController<Content>? func set(value content: Content) { if let hosting = self.hosting { hosting.rootView = content } else { let hosting = UIHostingController(rootView: content) backgroundColor = .clear hosting.view.translatesAutoresizingMaskIntoConstraints = false hosting.view.backgroundColor = .clear self.addSubview(hosting.view) NSLayoutConstraint.activate([ hosting.view.topAnchor.constraint(equalTo: self.topAnchor, constant: 0), hosting.view.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 0), hosting.view.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: 0), hosting.view.rightAnchor.constraint(equalTo: self.rightAnchor, constant: 0) ]) self.hosting = hosting } } } final class UIHostingCell<Content: View>: UICollectionViewCell { private var hosting: UIHostingController<Content>? func set(value content: Content) { if let hosting = self.hosting { hosting.rootView = content } else { let hosting = UIHostingController(rootView: content) backgroundColor = .clear hosting.view.translatesAutoresizingMaskIntoConstraints = false hosting.view.backgroundColor = .clear // hosting.view.layer.borderColor = UIColor.green.withAlphaComponent(0.5).cgColor // hosting.view.layer.borderWidth = 2 self.contentView.addSubview(hosting.view) NSLayoutConstraint.activate([ hosting.view.topAnchor .constraint(equalTo: self.contentView.topAnchor, constant: 0), hosting.view.leftAnchor .constraint(equalTo: self.contentView.leftAnchor, constant: 0), hosting.view.bottomAnchor .constraint(equalTo: self.contentView.bottomAnchor, constant: 0), hosting.view.rightAnchor .constraint(equalTo: self.contentView.rightAnchor, constant: 0) ]) self.hosting = hosting } } override func layoutSubviews() { super.layoutSubviews() self.hosting?.view.setNeedsUpdateConstraints() } override func prepareForReuse() { super.prepareForReuse() self.hosting?.view.removeFromSuperview() self.hosting = nil } }
35.25
110
0.596788
8ae60d3bb99f09c21b6377668215e5ceea644a52
20,955
// -------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // The MIT License (MIT) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the ""Software""), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. // // -------------------------------------------------------------------------- import AzureCore import Foundation /// Class used to upload an individual data chunk. internal class ChunkUploader { // MARK: Properties internal let blockId: UUID internal let client: StorageBlobClient internal let options: UploadBlobOptions internal let uploadSource: URL internal let uploadDestination: URL internal var streamStart: UInt64? internal var startRange: Int internal var endRange: Int internal var isEncrypted: Bool { return options.encryptionOptions?.key != nil || options.encryptionOptions?.keyResolver != nil } // MARK: Initializers /// Creates a `ChunkUploader` object. /// - Parameters: /// - blockId: A unique block identifer. /// - client: The `StorageBlobClient` that initiated the request. /// - source: The location on the device of the file being uploaded. /// - destination: The location in Blob Storage to upload the file to. /// - startRange: The start point, in bytes, of the upload request. /// - endRange: The end point, in bytes, of the upload request. /// - options: An `UploadBlobOptions` object with which to control the upload. public init( blockId: UUID, client: StorageBlobClient, source: URL, destination: URL, startRange: Int, endRange: Int, options: UploadBlobOptions ) { self.blockId = blockId self.client = client self.options = options self.uploadSource = source self.uploadDestination = destination self.startRange = startRange self.endRange = endRange } // MARK: Public Methods /// Begin the upload process. /// - Parameters: /// - requestId: Unique request ID (GUID) for the operation. /// - completionHandler: A completion handler that forwards the downloaded data. public func upload( requestId: String? = nil, transactionalContentMd5: Data? = nil, transactionalContentCrc64: Data? = nil, completionHandler: @escaping HTTPResultHandler<Data> ) { let chunkSize = endRange - startRange var buffer = Data(capacity: chunkSize) do { let fileHandle = try FileHandle(forReadingFrom: uploadSource) if #available(iOS 13.0, *) { try? fileHandle.seek(toOffset: UInt64(startRange)) } else { // Fallback on earlier versions fileHandle.seek(toFileOffset: UInt64(startRange)) } let tempData = fileHandle.readData(ofLength: chunkSize) buffer.append(tempData) } catch { let request = try? HTTPRequest(method: .put, url: uploadDestination, headers: HTTPHeaders()) completionHandler( .failure(AzureError.client("File error.", error)), HTTPResponse(request: request, statusCode: nil) ) return } // Construct parameters let leaseAccessConditions = options.leaseAccessConditions let cpk = options.customerProvidedEncryptionKey let params = RequestParameters( (.query, "comp", "block", .encode), (.query, "blockid", blockId.uuidString.base64EncodedString(), .encode), (.query, "timeout", options.timeoutInSeconds, .encode), (.header, HTTPHeader.contentType, "application/octet-stream", .encode), (.header, HTTPHeader.contentLength, chunkSize, .encode), (.header, HTTPHeader.apiVersion, client.options.apiVersion, .encode), (.header, HTTPHeader.contentMD5, transactionalContentMd5, .encode), (.header, StorageHTTPHeader.contentCRC64, transactionalContentCrc64, .encode), (.header, HTTPHeader.clientRequestId, requestId, .encode), (.header, StorageHTTPHeader.leaseId, leaseAccessConditions?.leaseId, .encode), (.header, StorageHTTPHeader.encryptionKey, cpk?.keyData, .encode), (.header, StorageHTTPHeader.encryptionScope, options.customerProvidedEncryptionScope, .encode), (.header, StorageHTTPHeader.encryptionKeySHA256, cpk?.hash, .encode), (.header, StorageHTTPHeader.encryptionAlgorithm, cpk?.algorithm, .encode) ) // Construct and send request guard let requestUrl = uploadDestination.appendingQueryParameters(params) else { return } guard let request = try? HTTPRequest(method: .put, url: requestUrl, headers: params.headers, data: buffer) else { return } let context = options.context ?? PipelineContext.of(keyValues: [ ContextKey.allowedStatusCodes.rawValue: [201] as AnyObject ]) context.merge(with: options.context) client.request(request, context: context) { result, httpResponse in switch result { case let .failure(error): completionHandler(.failure(error), httpResponse) case let .success(data): let data = data ?? Data() completionHandler(.success(data), httpResponse) } } } // MARK: Private Methods private func decrypt(_ data: Data) -> Data { guard isEncrypted else { return data } // TODO: Implement client-side decryption. fatalError("Client-side encryption is not currently supported!") } } /// A delegate to receive notifications about state changes from `BlobUploader` objects. public protocol BlobUploadDelegate: AnyObject { /// An upload's progress has updated. func uploader(_: BlobUploader, didUpdateWithProgress: TransferProgress) /// An upload has failed. func uploader(_: BlobUploader, didFailWithError: Error) /// An upload has completed. func uploaderDidComplete(_: BlobUploader) } /// An object that contains details about an upload operation. public protocol BlobUploader { /// The `BlobUploadDelegate` to inform about upload events. var delegate: BlobUploadDelegate? { get set } /// Location on the device of the file being uploaded. var uploadSource: URL { get } /// Location in Blob Storage to upload the file to. var uploadDestination: URL { get } /// Properties applied to the destination blob. var blobProperties: BlobProperties? { get } /// Size, in bytes, of the file being uploaded. var fileSize: Int { get } /// The total bytes uploaded. var progress: Int { get } /// Indicates if the upload is complete. var isComplete: Bool { get } /// Indicates if the upload is encrypted. var isEncrypted: Bool { get } } /// Class used to upload block blobs. internal class BlobStreamUploader: BlobUploader { // MARK: Properties public weak var delegate: BlobUploadDelegate? /// Location on the device of the file being uploaded. public let uploadSource: URL /// Location in Blob Storage to upload the file to. public let uploadDestination: URL /// Properties applied to the destination blob. public var blobProperties: BlobProperties? /// Size, in bytes, of the file being uploaded. public let fileSize: Int /// The total bytes uploaded. public var progress = 0 /// The list of blocks for the blob upload. internal var blockList = [(range: Range<Int>, blockId: UUID)]() /// Internal list that maps the order of block IDs. internal var blockIdMap = [UUID: Int]() /// Logs completed block IDs and the order they *should* be in. internal var completedBlockMap = [UUID: Int]() /// Indicates if the upload is complete. public var isComplete: Bool { return progress == fileSize } /// Indicates if the upload is encrypted. public var isEncrypted: Bool { return options.encryptionOptions?.key != nil || options.encryptionOptions?.keyResolver != nil } internal let client: StorageBlobClient internal let options: UploadBlobOptions // MARK: Initializers /// Create a `BlobStreamUploader` object. /// - Parameters: /// - client: A`StorageBlobClient` reference. /// - delegate: A `BlobUploadDelegate` to notify about the progress of the upload. /// - source: The location on the device of the file being uploaded. /// - destination: The location in Blob Storage to upload the file to. /// - properties: Properties to set on the resulting blob. /// - options: An `UploadBlobOptions` object to control the upload process. public init( client: StorageBlobClient, delegate: BlobUploadDelegate? = nil, source: LocalURL, destination: URL, properties: BlobProperties? = nil, options: UploadBlobOptions ) throws { guard let uploadSource = source.resolvedUrl else { throw AzureError.client("Unable to determine upload source: \(source)") } let attributes = try FileManager.default.attributesOfItem(atPath: uploadSource.path) guard let fileSize = attributes[FileAttributeKey.size] as? Int else { throw AzureError.client("Unable to determine file size: \(uploadSource.path)") } self.uploadSource = uploadSource self.fileSize = fileSize self.client = client self.delegate = delegate self.options = options self.uploadDestination = destination self.blobProperties = properties self.blockList = computeBlockList() } // MARK: Public Methods /// Read and return the content of the downloaded file. public func contents() throws -> Data { let handle = try FileHandle(forReadingFrom: uploadSource) defer { handle.closeFile() } return handle.readDataToEndOfFile() } /// Uploads the entire blob in a parallel fashion. /// - Parameters: /// - group: An optional `DispatchGroup` to wait for the download to complete. /// - completionHandler: A completion handler called when the download completes. public func complete(inGroup group: DispatchGroup? = nil, completionHandler: @escaping () -> Void) throws { guard !isComplete else { if let delegate = self.delegate { delegate.uploaderDidComplete(self) } else { completionHandler() } return } let defaultGroup = DispatchGroup() let dispatchGroup = group ?? defaultGroup for _ in blockList { dispatchGroup.enter() next(inGroup: dispatchGroup) { _, _ in if let delegate = self.delegate { let progress = TransferProgress(bytes: self.progress, totalBytes: self.fileSize) delegate.uploader(self, didUpdateWithProgress: progress) } } } dispatchGroup.notify(queue: DispatchQueue.main) { // Once all blocks are done, commit block list self.commit { result, _ in switch result { case .success: if let delegate = self.delegate { delegate.uploaderDidComplete(self) } else { completionHandler() } case let .failure(error): if let delegate = self.delegate { delegate.uploader(self, didFailWithError: error) } } } } } public func commit( requestId: String? = nil, transactionalContentMd5: Data? = nil, transactionalContentCrc64: Data? = nil, inGroup _: DispatchGroup? = nil, completionHandler: @escaping HTTPResultHandler<BlobProperties> ) { // Construct parameters & headers let params = RequestParameters( (.query, "comp", "blocklist", .encode), (.query, "timeout", options.timeoutInSeconds, .encode) ) let headers = commitHeadersForRequest( withId: requestId, withContentMD5: transactionalContentMd5, withContentCRC64: transactionalContentCrc64 ) // Construct and send request let lookupList = buildLookupList() let encoding = String.Encoding.utf8 guard let xmlString = try? lookupList.asXmlString(encoding: encoding) else { fatalError("Unable to serialize block list as XML string.") } let xmlData = xmlString.data(using: encoding) guard let requestUrl = uploadDestination.appendingQueryParameters(params) else { return } guard let request = try? HTTPRequest(method: .put, url: requestUrl, headers: headers, data: xmlData) else { return } let context = options.context ?? PipelineContext.of(keyValues: [ ContextKey.allowedStatusCodes.rawValue: [201] as AnyObject ]) context.add(cancellationToken: options.cancellationToken, applying: client.options) context.merge(with: options.context) client.request(request, context: context) { result, httpResponse in switch result { case let .failure(error): completionHandler(.failure(error), httpResponse) case .success: guard let responseHeaders = httpResponse?.headers else { let error = AzureError.client("No response received.") completionHandler(.failure(error), httpResponse) return } let blobProperties = BlobProperties(from: responseHeaders) completionHandler(.success(blobProperties), httpResponse) } } } /// Download the contents of this file to a stream. /// - Parameters: /// - group: An optional `DispatchGroup` to wait for the download to complete. /// - completionHandler: A completion handler with which to process the downloaded chunk. public func next(inGroup group: DispatchGroup? = nil, completionHandler: @escaping HTTPResultHandler<Data>) { guard !isComplete else { return } let metadata = blockList.removeFirst() let range = metadata.range let blockId = metadata.blockId let uploader = ChunkUploader( blockId: blockId, client: client, source: uploadSource, destination: uploadDestination, startRange: range.startIndex, endRange: range.endIndex, options: options ) uploader.upload { result, httpResponse in switch result { case .success: // Add block ID to the completed list and lookup where its final // placement should be self.progress += uploader.endRange - uploader.startRange let blockId = uploader.blockId self.completedBlockMap[blockId] = self.blockIdMap[blockId] case let .failure(error): self.client.options.logger.debug(String(describing: error)) } completionHandler(result, httpResponse) group?.leave() } } // MARK: Private Methods // swiftlint:disable:next cyclomatic_complexity private func commitHeadersForRequest( withId requestId: String?, withContentMD5 md5: Data?, withContentCRC64 crc64: Data? ) -> HTTPHeaders { let leaseAccessConditions = options.leaseAccessConditions let modifiedAccessConditions = options.modifiedAccessConditions let cpk = options.customerProvidedEncryptionKey // Construct headers let headers = RequestParameters( (.header, HTTPHeader.contentType, "application/xml; charset=utf-8", .encode), (.header, HTTPHeader.apiVersion, client.options.apiVersion, .encode), (.header, HTTPHeader.contentMD5, String(data: md5, encoding: .utf8), .encode), (.header, StorageHTTPHeader.contentCRC64, String(data: crc64, encoding: .utf8), .encode), (.header, HTTPHeader.clientRequestId, requestId, .encode), (.header, StorageHTTPHeader.leaseId, leaseAccessConditions?.leaseId, .encode), (.header, StorageHTTPHeader.encryptionKey, cpk?.keyData, .encode), (.header, StorageHTTPHeader.encryptionScope, options.customerProvidedEncryptionScope, .encode), (.header, StorageHTTPHeader.encryptionKeySHA256, cpk?.hash, .encode), (.header, StorageHTTPHeader.encryptionAlgorithm, cpk?.algorithm, .encode), (.header, HTTPHeader.ifModifiedSince, modifiedAccessConditions?.ifModifiedSince, .encode), (.header, HTTPHeader.ifUnmodifiedSince, modifiedAccessConditions?.ifUnmodifiedSince, .encode), (.header, HTTPHeader.ifMatch, modifiedAccessConditions?.ifMatch, .encode), (.header, HTTPHeader.ifNoneMatch, modifiedAccessConditions?.ifNoneMatch, .encode), (.header, StorageHTTPHeader.accessTier, blobProperties?.accessTier, .encode), (.header, StorageHTTPHeader.blobCacheControl, blobProperties?.cacheControl, .encode), (.header, StorageHTTPHeader.blobContentType, blobProperties?.contentType, .encode), (.header, StorageHTTPHeader.blobContentEncoding, blobProperties?.contentEncoding, .encode), (.header, StorageHTTPHeader.blobContentLanguage, blobProperties?.contentLanguage, .encode), (.header, StorageHTTPHeader.blobContentMD5, blobProperties?.contentMD5, .encode), (.header, StorageHTTPHeader.blobContentDisposition, blobProperties?.contentDisposition, .encode) ) return headers.headers } private func buildLookupList() -> BlobLookupList { let sortedIds = completedBlockMap.sorted(by: { $0.value < $1.value }) let lookupList = BlobLookupList(latest: sortedIds.compactMap { $0.key.uuidString.base64EncodedString() }) return lookupList } private func computeBlockList(withOffset offset: Int = 0) -> [(Range<Int>, UUID)] { var blockList = [(Range<Int>, UUID)]() let alignForCrypto = isEncrypted let chunkLength = client.options.maxChunkSizeInBytes if alignForCrypto { fatalError("Client-side encryption is not yet supported!") } else { for index in stride(from: offset, to: fileSize, by: chunkLength) { var blockEnd = index + chunkLength if fileSize < 0 { blockEnd = chunkLength } if blockEnd > fileSize { blockEnd = fileSize } let range = index ..< blockEnd let blockId = UUID() blockList.append((range: range, blockId: blockId)) blockIdMap[blockId] = blockList.count - 1 } } return blockList } /// Parses the blob length from the content range header: bytes 1-3/65537 private func parseLength(fromContentRange contentRange: String?) throws -> Int { let error = AzureError.client("Unable to parse content range: \(contentRange ?? "nil")") guard let contentRange = contentRange else { throw error } // split on slash and take the second half: "65537" guard let lengthString = contentRange.split(separator: "/", maxSplits: 1).last else { throw error } // Finally, convert to an Int: 65537 guard let intVal = Int(String(lengthString)) else { throw error } return intVal } }
41.993988
114
0.634455
bb2db1af46358fce5455d52401d77715a913cd36
9,971
import Foundation import CoreBluetooth @testable import RxBluetoothKit /// Bluetooth error which can be emitted by RxBluetoothKit created observables. enum _BluetoothError: Error { /// Emitted when the object that is the source of Observable was destroyed and event was emitted nevertheless. /// To mitigate it dispose all of your subscriptions before deinitializing /// object that created Observables that subscriptions are made to. case destroyed // Emitted when `_CentralManager.scanForPeripherals` called and there is already ongoing scan case scanInProgress // Emitted when `_PeripheralManager.startAdvertising` called and there is already ongoing advertisement case advertisingInProgress case advertisingStartFailed(Error) // States case bluetoothUnsupported case bluetoothUnauthorized case bluetoothPoweredOff case bluetoothInUnknownState case bluetoothResetting // _Peripheral case peripheralIsAlreadyObservingConnection(_Peripheral) @available(*, deprecated: 5.0.2, renamed: "_BluetoothError.peripheralIsAlreadyObservingConnection") case peripheralIsConnectingOrAlreadyConnected(_Peripheral) case peripheralConnectionFailed(_Peripheral, Error?) case peripheralDisconnected(_Peripheral, Error?) case peripheralRSSIReadFailed(_Peripheral, Error?) // Services case servicesDiscoveryFailed(_Peripheral, Error?) case includedServicesDiscoveryFailed(_Peripheral, Error?) case addingServiceFailed(CBServiceMock, Error?) // Characteristics case characteristicsDiscoveryFailed(_Service, Error?) case characteristicWriteFailed(_Characteristic, Error?) case characteristicReadFailed(_Characteristic, Error?) case characteristicNotifyChangeFailed(_Characteristic, Error?) case characteristicSetNotifyValueFailed(_Characteristic, Error?) // Descriptors case descriptorsDiscoveryFailed(_Characteristic, Error?) case descriptorWriteFailed(_Descriptor, Error?) case descriptorReadFailed(_Descriptor, Error?) // L2CAP case openingL2CAPChannelFailed(_Peripheral, Error?) case publishingL2CAPChannelFailed(CBL2CAPPSM, Error?) } extension _BluetoothError: CustomStringConvertible { /// Human readable description of bluetooth error var description: String { switch self { case .destroyed: return """ The object that is the source of this Observable was destroyed. It's programmer's error, please check documentation of error for more details """ case .scanInProgress: return """ Tried to scan for peripheral when there is already ongoing scan. You can have only 1 ongoing scanning, please check documentation of _CentralManager for more details """ case .advertisingInProgress: return """ Tried to advertise when there is already advertising ongoing. You can have only 1 ongoing advertising, please check documentation of _PeripheralManager for more details """ case let .advertisingStartFailed(err): return "Start advertising error occured: \(err.localizedDescription)" case .bluetoothUnsupported: return "Bluetooth is unsupported" case .bluetoothUnauthorized: return "Bluetooth is unauthorized" case .bluetoothPoweredOff: return "Bluetooth is powered off" case .bluetoothInUnknownState: return "Bluetooth is in unknown state" case .bluetoothResetting: return "Bluetooth is resetting" // _Peripheral case .peripheralIsAlreadyObservingConnection, .peripheralIsConnectingOrAlreadyConnected: return """ _Peripheral connection is already being observed. You cannot try to establishConnection to peripheral when you have ongoing connection (previously establishConnection subscription was not disposed). """ case let .peripheralConnectionFailed(_, err): return "Connection error has occured: \(err?.localizedDescription ?? "-")" case let .peripheralDisconnected(_, err): return "Connection error has occured: \(err?.localizedDescription ?? "-")" case let .peripheralRSSIReadFailed(_, err): return "RSSI read failed : \(err?.localizedDescription ?? "-")" // Services case let .servicesDiscoveryFailed(_, err): return "Services discovery error has occured: \(err?.localizedDescription ?? "-")" case let .includedServicesDiscoveryFailed(_, err): return "Included services discovery error has occured: \(err?.localizedDescription ?? "-")" case let .addingServiceFailed(_, err): return "Adding _PeripheralManager service error has occured: \(err?.localizedDescription ?? "-")" // Characteristics case let .characteristicsDiscoveryFailed(_, err): return "Characteristics discovery error has occured: \(err?.localizedDescription ?? "-")" case let .characteristicWriteFailed(_, err): return "_Characteristic write error has occured: \(err?.localizedDescription ?? "-")" case let .characteristicReadFailed(_, err): return "_Characteristic read error has occured: \(err?.localizedDescription ?? "-")" case let .characteristicNotifyChangeFailed(_, err): return "_Characteristic notify change error has occured: \(err?.localizedDescription ?? "-")" case let .characteristicSetNotifyValueFailed(_, err): return "_Characteristic isNotyfing value change error has occured: \(err?.localizedDescription ?? "-")" // Descriptors case let .descriptorsDiscoveryFailed(_, err): return "_Descriptor discovery error has occured: \(err?.localizedDescription ?? "-")" case let .descriptorWriteFailed(_, err): return "_Descriptor write error has occured: \(err?.localizedDescription ?? "-")" case let .descriptorReadFailed(_, err): return "_Descriptor read error has occured: \(err?.localizedDescription ?? "-")" case let .openingL2CAPChannelFailed(_, err): return "Opening L2CAP channel error has occured: \(err?.localizedDescription ?? "-")" case let .publishingL2CAPChannelFailed(_, err): return "Publishing L2CAP channel error has occured: \(err?.localizedDescription ?? "-")" } } } extension _BluetoothError { init?(state: BluetoothState) { switch state { case .unsupported: self = .bluetoothUnsupported case .unauthorized: self = .bluetoothUnauthorized case .poweredOff: self = .bluetoothPoweredOff case .unknown: self = .bluetoothInUnknownState case .resetting: self = .bluetoothResetting default: return nil } } } extension _BluetoothError: Equatable {} // swiftlint:disable cyclomatic_complexity func == (lhs: _BluetoothError, rhs: _BluetoothError) -> Bool { switch (lhs, rhs) { case (.scanInProgress, .scanInProgress): return true case (.advertisingInProgress, .advertisingInProgress): return true case (.advertisingStartFailed, .advertisingStartFailed): return true // States case (.bluetoothUnsupported, .bluetoothUnsupported): return true case (.bluetoothUnauthorized, .bluetoothUnauthorized): return true case (.bluetoothPoweredOff, .bluetoothPoweredOff): return true case (.bluetoothInUnknownState, .bluetoothInUnknownState): return true case (.bluetoothResetting, .bluetoothResetting): return true // Services case let (.servicesDiscoveryFailed(l, _), .servicesDiscoveryFailed(r, _)): return l == r case let (.includedServicesDiscoveryFailed(l, _), .includedServicesDiscoveryFailed(r, _)): return l == r case let (.addingServiceFailed(l, _), .addingServiceFailed(r, _)): return l == r // Peripherals case let (.peripheralIsAlreadyObservingConnection(l), .peripheralIsAlreadyObservingConnection(r)): return l == r case let (.peripheralIsConnectingOrAlreadyConnected(l), .peripheralIsConnectingOrAlreadyConnected(r)): return l == r case let (.peripheralIsAlreadyObservingConnection(l), .peripheralIsConnectingOrAlreadyConnected(r)): return l == r case let (.peripheralIsConnectingOrAlreadyConnected(l), .peripheralIsAlreadyObservingConnection(r)): return l == r case let (.peripheralConnectionFailed(l, _), .peripheralConnectionFailed(r, _)): return l == r case let (.peripheralDisconnected(l, _), .peripheralDisconnected(r, _)): return l == r case let (.peripheralRSSIReadFailed(l, _), .peripheralRSSIReadFailed(r, _)): return l == r // Characteristics case let (.characteristicsDiscoveryFailed(l, _), .characteristicsDiscoveryFailed(r, _)): return l == r case let (.characteristicWriteFailed(l, _), .characteristicWriteFailed(r, _)): return l == r case let (.characteristicReadFailed(l, _), .characteristicReadFailed(r, _)): return l == r case let (.characteristicNotifyChangeFailed(l, _), .characteristicNotifyChangeFailed(r, _)): return l == r case let (.characteristicSetNotifyValueFailed(l, _), .characteristicSetNotifyValueFailed(r, _)): return l == r // Descriptors case let (.descriptorsDiscoveryFailed(l, _), .descriptorsDiscoveryFailed(r, _)): return l == r case let (.descriptorWriteFailed(l, _), .descriptorWriteFailed(r, _)): return l == r case let (.descriptorReadFailed(l, _), .descriptorReadFailed(r, _)): return l == r // L2CAP case let (.openingL2CAPChannelFailed(l, _), .openingL2CAPChannelFailed(r, _)): return l == r case let (.publishingL2CAPChannelFailed(l, _), .publishingL2CAPChannelFailed(r, _)): return l == r default: return false } } // swiftlint:enable cyclomatic_complexity
52.478947
120
0.701936
d626e475db3288f3fef49ca76e92f2ca6f5bfc9d
1,379
import Foundation import XCTest @testable import BinarySearch class BinarySearchTest: XCTestCase { var searchList = [Int]() override func setUp() { super.setUp() for number in 1...500 { searchList.append(number) } } func testEmptyArray() { let array = [Int]() let index = binarySearch(array, key: 123) XCTAssertNil(index) } func testBinarySearch() { for i in 1...100 { var array = [Int]() for number in 1...i { array.append(number) } let randomIndex = Int(arc4random_uniform(UInt32(i))) let testValue = array[randomIndex] let index = binarySearch(array, key: testValue) XCTAssertNotNil(index) XCTAssertEqual(index!, randomIndex) XCTAssertEqual(array[index!], testValue) } } func testLowerBound() { let index = binarySearch(searchList, key: 1) XCTAssertNotNil(index) XCTAssertEqual(index!, 0) XCTAssertEqual(searchList[index!], 1) } func testUpperBound() { let index = binarySearch(searchList, key: 500) XCTAssertNotNil(index) XCTAssertEqual(index!, 499) XCTAssertEqual(searchList[index!], 500) } func testOutOfLowerBound() { let index = binarySearch(searchList, key: 0) XCTAssertNil(index) } func testOutOfUpperBound() { let index = binarySearch(searchList, key: 501) XCTAssertNil(index) } }
22.606557
58
0.654822
eb3d3bf3bd1e3afcbc01c44032d11fb0f752cc85
1,490
// // github.com/screensailor 2022 // import SwiftUI import Lexicon struct Editor: View { @EnvironmentObject var my: Object @Environment(\.events) var events @Environment(\.animated) var animated @Environment(\.undoManager) var undoManager @Environment(\.focusedDocumentID) var focusedDocumentID @Environment(\.documentID) var documentID let document: Document @Binding var isExporting: Bool var body: some View { VStack(alignment: .leading, spacing: 8) { CLIView(text: my.ui.text) ColumnsView(columns: my.ui.columns) PropertiesView(ui: my.ui.properties) } .cliEvents(for: my.doc.browser.cli) .searchable(my.doc.editor.search, in: Binding(get: { my.cli.lemma.lexicon }, set: { _ in })) .animation(animated ? .default : nil, value: my.cli) .padding(.horizontal) .padding(.bottom) .fileExporter( isPresented: $isExporting, document: document, contentType: document.export?.generator.utType ?? .data, defaultFilename: document.description ) { _ in } .onChange(of: document) { document in my.document = document } .onChange(of: document.snapshot) { snapshot in my.revert(to: snapshot) } .onChange(of: my.snapshot) { snapshot in document.update(with: snapshot, undo: undoManager) } .onChange(of: focusedDocumentID) { focusedDocumentID in my.focusedDocumentID = focusedDocumentID } } }
24.42623
94
0.655034
29e29273309b8f081531c1d6d6bc7cc71f03e6ad
2,491
/* UIViewController.swift Created by William Falcon on 3/26/15. The MIT License (MIT) Copyright (c) 2015 William Falcon [email protected] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import Foundation import UIKit public extension UIViewController { /// Storyboard containing this VC must be named after this VC. /// Ex: MainViewController -> Main.storyboard class func _newInstance() -> UIViewController { let name = _storyboardName() return _newInstanceFromStoryboardNamed(sbName: name) } /// Returns a newly instantiated VC from the input storyboard class func _newInstanceFromStoryboardNamed(sbName : String) -> UIViewController { let storyboard = UIStoryboard(name: sbName, bundle: Bundle.main) let id = _identifier() let viewController = storyboard.instantiateViewController(withIdentifier: id) return viewController } /// Class name is the identifier for the storyboard class func _identifier() -> String { let name = _className return name.components(separatedBy: ".")[0] } /// Storyboard name is the class of this VC without the words ViewController class func _storyboardName() -> String { _ = NSStringFromClass(self as AnyClass).components(separatedBy:".") var sbName = NSStringFromClass(self as AnyClass).components(separatedBy:".")[1] sbName = sbName._removeString("ViewController")! return sbName } }
37.742424
87
0.733039
ccbb5d8f310d705b6f125e73e41e24333419cea0
705
// // GFError.swift // GHFollowers // // Created by Fabio Tiberio on 24/12/21. // import Foundation enum GFError: String, Error { case invalidUsername = "This username created an invalid request. Please try again." case unableToComplete = "Unable to complete your request. Please check your Internet connection." case invalidResponse = "Invalid response from the server. Please try again." case invalidData = "The data received from the server were invalid. Please try again." case unableToFavorite = "There was an error favoriting this user. Please try again" case alreadyInFavorites = "You've already favorited this user. You must REALLY like them!" }
37.105263
103
0.71773
26a62ffeb8ace89e1574e8297e863e1880c32d64
11,491
/* This source file is part of the Swift.org open source project Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors Licensed under Apache License v2.0 with Runtime Library Exception See http://swift.org/LICENSE.txt for license information See http://swift.org/CONTRIBUTORS.txt for Swift project authors */ import Foundation import TSCBasic /// Specifies a repository address. public struct RepositorySpecifier: Hashable { public let location: Location public init(location: Location) { self.location = location } /// Create a specifier based on a path. public init(path: AbsolutePath) { self.init(location: .path(path)) } /// Create a specifier on a URL. public init(url: URL) { self.init(location: .url(url)) } /// The location of the repository as URL. public var url: URL { switch self.location { case .path(let path): return URL(fileURLWithPath: path.pathString) case .url(let url): return url } } /// Returns the cleaned basename for the specifier. public var basename: String { var basename = self.location.description.components(separatedBy: "/").last(where: { !$0.isEmpty }) ?? "" if basename.hasSuffix(".git") { basename = String(basename.dropLast(4)) } return basename } public enum Location: Hashable, CustomStringConvertible { case path(AbsolutePath) case url(URL) public var description: String { switch self { case .path(let path): return path.pathString case .url(let url): return url.absoluteString } } } } extension RepositorySpecifier: CustomStringConvertible { public var description: String { return self.location.description } } /// A repository provider. /// /// This protocol defines the lower level interface used to to access /// repositories. High-level clients should access repositories via a /// `RepositoryManager`. public protocol RepositoryProvider { /// Fetch the complete repository at the given location to `path`. /// /// - Parameters: /// - repository: The specifier of the repository to fetch. /// - path: The destination path for the fetch. /// - progress: Reports the progress of the current fetch operation. /// - Throws: If there is any error fetching the repository. func fetch(repository: RepositorySpecifier, to path: AbsolutePath, progressHandler: FetchProgress.Handler?) throws /// Returns true if a repository exists at `path` func repositoryExists(at path: AbsolutePath) throws -> Bool /// Open the given repository. /// /// - Parameters: /// - repository: The specifier of the original repository from which the /// local clone repository was created. /// - path: The location of the repository on disk, at which the /// repository has previously been created via `fetch`. /// /// - Throws: If the repository is unable to be opened. func open(repository: RepositorySpecifier, at path: AbsolutePath) throws -> Repository /// Create a working copy from a managed repository. /// /// Once complete, the repository can be opened using `openWorkingCopy`. Note /// that there is no requirement that the files have been materialized into /// the file system at the completion of this call, since it will always be /// followed by checking out the cloned working copy at a particular ref. /// /// - Parameters: /// - repository: The specifier of the original repository from which the /// local clone repository was created. /// - sourcePath: The location of the repository on disk, at which the /// repository has previously been created via `fetch`. /// - destinationPath: The path at which to create the working copy; it is /// expected to be non-existent when called. /// - editable: The checkout is expected to be edited by users. /// /// - Throws: If there is any error cloning the repository. func createWorkingCopy( repository: RepositorySpecifier, sourcePath: AbsolutePath, at destinationPath: AbsolutePath, editable: Bool) throws -> WorkingCheckout /// Returns true if a working repository exists at `path` func workingCopyExists(at path: AbsolutePath) throws -> Bool /// Open a working repository copy. /// /// - Parameters: /// - path: The location of the repository on disk, at which the repository /// has previously been created via `copyToWorkingDirectory`. func openWorkingCopy(at path: AbsolutePath) throws -> WorkingCheckout /// Copies the repository at path `from` to path `to`. /// - Parameters: /// - sourcePath: the source path. /// - destinationPath: the destination path. func copy(from sourcePath: AbsolutePath, to destinationPath: AbsolutePath) throws /// Returns true if the directory is valid git location. func isValidDirectory(_ directory: AbsolutePath) -> Bool /// Returns true if the git reference name is well formed. func isValidRefFormat(_ ref: String) -> Bool } /// Abstract repository operations. /// /// This interface provides access to an abstracted representation of a /// repository which is ultimately owned by a `RepositoryManager`. This interface /// is designed in such a way as to provide the minimal facilities required by /// the package manager to gather basic information about a repository, but it /// does not aim to provide all of the interfaces one might want for working /// with an editable checkout of a repository on disk. /// /// The goal of this design is to allow the `RepositoryManager` a large degree of /// flexibility in the storage and maintenance of its underlying repositories. /// /// This protocol is designed under the assumption that the repository can only /// be mutated via the functions provided here; thus, e.g., `tags` is expected /// to be unchanged through the lifetime of an instance except as otherwise /// documented. The behavior when this assumption is violated is undefined, /// although the expectation is that implementations should throw or crash when /// an inconsistency can be detected. public protocol Repository { /// Get the list of tags in the repository. func getTags() throws -> [String] /// Resolve the revision for a specific tag. /// /// - Precondition: The `tag` should be a member of `tags`. /// - Throws: If a error occurs accessing the named tag. func resolveRevision(tag: String) throws -> Revision /// Resolve the revision for an identifier. /// /// The identifier can be a branch name or a revision identifier. /// /// - Throws: If the identifier can not be resolved. func resolveRevision(identifier: String) throws -> Revision /// Fetch and update the repository from its remote. /// /// - Throws: If an error occurs while performing the fetch operation. func fetch() throws /// Fetch and update the repository from its remote. /// /// - Throws: If an error occurs while performing the fetch operation. func fetch(progress: FetchProgress.Handler?) throws /// Returns true if the given revision exists. func exists(revision: Revision) -> Bool /// Open an immutable file system view for a particular revision. /// /// This view exposes the contents of the repository at the given revision /// as a file system rooted inside the repository. The repository must /// support opening multiple views concurrently, but the expectation is that /// clients should be prepared for this to be inefficient when performing /// interleaved accesses across separate views (i.e., the repository may /// back the view by an actual file system representation of the /// repository). /// /// It is expected behavior that attempts to mutate the given FileSystem /// will fail or crash. /// /// - Throws: If an error occurs accessing the revision. func openFileView(revision: Revision) throws -> FileSystem /// Open an immutable file system view for a particular tag. /// /// This view exposes the contents of the repository at the given revision /// as a file system rooted inside the repository. The repository must /// support opening multiple views concurrently, but the expectation is that /// clients should be prepared for this to be inefficient when performing /// interleaved accesses across separate views (i.e., the repository may /// back the view by an actual file system representation of the /// repository). /// /// It is expected behavior that attempts to mutate the given FileSystem /// will fail or crash. /// /// - Throws: If an error occurs accessing the revision. func openFileView(tag: String) throws -> FileSystem } extension Repository { public func fetch(progress: FetchProgress.Handler?) throws { try fetch() } } /// An editable checkout of a repository (i.e. a working copy) on the local file /// system. public protocol WorkingCheckout { /// Get the list of tags in the repository. func getTags() throws -> [String] /// Get the current revision. func getCurrentRevision() throws -> Revision /// Fetch and update the repository from its remote. /// /// - Throws: If an error occurs while performing the fetch operation. func fetch() throws /// Query whether the checkout has any commits which are not pushed to its remote. func hasUnpushedCommits() throws -> Bool /// This check for any modified state of the repository and returns true /// if there are uncommited changes. func hasUncommittedChanges() -> Bool /// Check out the given tag. func checkout(tag: String) throws /// Check out the given revision. func checkout(revision: Revision) throws /// Returns true if the given revision exists. func exists(revision: Revision) -> Bool /// Create a new branch and checkout HEAD to it. /// /// Note: It is an error to provide a branch name which already exists. func checkout(newBranch: String) throws /// Returns true if there is an alternative store in the checkout and it is valid. func isAlternateObjectStoreValid() -> Bool /// Returns true if the file at `path` is ignored by `git` func areIgnored(_ paths: [AbsolutePath]) throws -> [Bool] } /// A single repository revision. public struct Revision: Hashable { /// A precise identifier for a single repository revision, in a repository-specified manner. /// /// This string is intended to be opaque to the client, but understandable /// by a user. For example, a Git repository might supply the SHA1 of a /// commit, or an SVN repository might supply a string such as 'r123'. public let identifier: String public init(identifier: String) { self.identifier = identifier } } public protocol FetchProgress { typealias Handler = (FetchProgress) -> Void var message: String { get } var step: Int { get } var totalSteps: Int? { get } /// The current download progress including the unit var downloadProgress: String? { get } /// The current download speed including the unit var downloadSpeed: String? { get } }
38.431438
118
0.682621
e4c8b368b19fe881c1cdb152b538545b6194ceb7
3,866
import TSCBasic import TuistSupportTesting import XCTest @testable import TuistDependencies class SwiftPackageManagerModuleMapGeneratorTests: TuistTestCase { private var subject: SwiftPackageManagerModuleMapGenerator! override func setUp() { super.setUp() subject = SwiftPackageManagerModuleMapGenerator() } override func tearDown() { subject = nil super.tearDown() } func test_generate_when_no_headers() throws { try test_generate(for: .none) } func test_generate_when_custom_module_map() throws { try test_generate(for: .custom) } func test_generate_when_umbrella_header() throws { try test_generate(for: .header) } func test_generate_when_nested_umbrella_header() throws { try test_generate(for: .nestedHeader) } private func test_generate(for moduleMapType: ModuleMapType) throws { var writeCalled = false fileHandler.stubContentsOfDirectory = { _ in switch moduleMapType { case .none: return [] case .custom: return ["/Absolute/Public/Headers/Path/module.modulemap"] case .header: return ["/Absolute/Public/Headers/Path/Module.h"] case .nestedHeader: return ["/Absolute/Public/Headers/Path/Module/Module.h"] case .directory: return ["/Absolute/Public/Headers/Path/AnotherHeader.h"] } } fileHandler.stubExists = { path in switch path { case "/Absolute/Public/Headers/Path": return moduleMapType != .none case "/Absolute/Public/Headers/Path/module.modulemap": return moduleMapType == .custom case "/Absolute/Public/Headers/Path/Module.h": return moduleMapType == .header case "/Absolute/Public/Headers/Path/Module/Module.h": return moduleMapType == .nestedHeader default: XCTFail("Unexpected exists call: \(path)") return false } } fileHandler.stubWrite = { content, path, atomically in writeCalled = true let expectedContent: String switch moduleMapType { case .none, .custom, .header: XCTFail("FileHandler.write should not be called") return case .nestedHeader: expectedContent = """ module Module { umbrella header "/Absolute/Public/Headers/Path/Module/Module.h" export * } """ case .directory: expectedContent = """ module Module { umbrella "/Absolute/Public/Headers/Path" export * } """ } XCTAssertEqual(content, expectedContent) XCTAssertEqual(path, "/Absolute/Public/Headers/Path/Module.modulemap") XCTAssertTrue(atomically) } let moduleMap = try subject.generate(moduleName: "Module", publicHeadersPath: "/Absolute/Public/Headers/Path") XCTAssertEqual(moduleMap.type, moduleMapType) switch moduleMapType { case .none, .header, .nestedHeader: XCTAssertNil(moduleMap.path) case .custom: XCTAssertEqual(moduleMap.path, "/Absolute/Public/Headers/Path/module.modulemap") case .directory: XCTAssertEqual(moduleMap.path, "/Absolute/Public/Headers/Path/Module.modulemap") } switch moduleMapType { case .none, .custom, .header, .nestedHeader: XCTAssertFalse(writeCalled) case .directory: XCTAssertTrue(writeCalled) } } }
34.212389
118
0.578634
ef65e2f5ddd6724004436701e9bcb656c3f6f7f6
12,733
/* * Copyright (C) 2019-2021 HERE Europe B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 * License-Filename: LICENSE */ import heresdk import UIKit class SearchExample: TapDelegate, LongPressDelegate { private var viewController: UIViewController private var mapView: MapView private var mapMarkers = [MapMarker]() private var searchEngine: SearchEngine init(viewController: UIViewController, mapView: MapView) { self.viewController = viewController self.mapView = mapView let camera = mapView.camera camera.lookAt(point: GeoCoordinates(latitude: 52.520798, longitude: 13.409408), distanceInMeters: 1000 * 10) do { try searchEngine = SearchEngine() } catch let engineInstantiationError { fatalError("Failed to initialize SearchEngine. Cause: \(engineInstantiationError)") } mapView.gestures.tapDelegate = self mapView.gestures.longPressDelegate = self showDialog(title: "Note", message: "Long press on map to get the address for that position using reverse geocoding.") } func onSearchButtonClicked() { // Search for "Pizza" and show the results on the map. searchExample() // Search for auto suggestions and log the results to the console. autoSuggestExample() } func onGeoCodeButtonClicked() { // Search for the location that belongs to an address and show it on the map. geocodeAnAddress() } private func searchExample() { let searchTerm = "Pizza" searchInViewport(queryString: searchTerm) } private func searchInViewport(queryString: String) { clearMap() let textQuery = TextQuery(queryString, in: getMapViewGeoBox()) let searchOptions = SearchOptions(languageCode: LanguageCode.enUs, maxItems: 30) _ = searchEngine.search(textQuery: textQuery, options: searchOptions, completion: onSearchCompleted) } // Completion handler to receive search results. func onSearchCompleted(error: SearchError?, items: [Place]?) { if let searchError = error { showDialog(title: "Search", message: "Error: \(searchError)") return } // If error is nil, it is guaranteed that the items will not be nil. showDialog(title: "Search in viewport for: 'Pizza'.", message: "Found \(items!.count) results.") // Add a new marker for each search result on map. for searchResult in items! { let metadata = Metadata() metadata.setCustomValue(key: "key_search_result", value: SearchResultMetadata(searchResult)) // Note that geoCoordinates are always set, but can be nil for suggestions only. addPoiMapMarker(geoCoordinates: searchResult.geoCoordinates!, metadata: metadata) } } private class SearchResultMetadata : CustomMetadataValue { var searchResult: Place init(_ searchResult: Place) { self.searchResult = searchResult } func getTag() -> String { return "SearchResult Metadata" } } private func autoSuggestExample() { let centerGeoCoordinates = getMapViewCenter() let autosuggestOptions = SearchOptions(languageCode: LanguageCode.enUs, maxItems: 5) // Simulate a user typing a search term. _ = searchEngine.suggest(textQuery: TextQuery("p", near: centerGeoCoordinates), options: autosuggestOptions, completion: onSearchCompleted) _ = searchEngine.suggest(textQuery: TextQuery("pi", near: centerGeoCoordinates), options: autosuggestOptions, completion: onSearchCompleted) _ = searchEngine.suggest(textQuery: TextQuery("piz", near: centerGeoCoordinates), options: autosuggestOptions, completion: onSearchCompleted) } // Completion handler to receive auto suggestion results. func onSearchCompleted(error: SearchError?, items: [Suggestion]?) { if let searchError = error { print("Autosuggest Error: \(searchError)") return } // If error is nil, it is guaranteed that the items will not be nil. print("Autosuggest: Found \(items!.count) result(s).") for autosuggestResult in items! { var addressText = "Not a place." if let place = autosuggestResult.place { addressText = place.address.addressText } print("Autosuggest result: \(autosuggestResult.title), addressText: \(addressText)") } } public func geocodeAnAddress() { // Set map near to expected location. let geoCoordinates = GeoCoordinates(latitude: 52.537931, longitude: 13.384914) mapView.camera.lookAt(point: geoCoordinates, distanceInMeters: 1000 * 5) let streetName = "Invalidenstraße 116, Berlin" geocodeAddressAtLocation(queryString: streetName, geoCoordinates: geoCoordinates) } private func geocodeAddressAtLocation(queryString: String, geoCoordinates: GeoCoordinates) { clearMap() let query = AddressQuery(queryString, near: geoCoordinates) let geocodingOptions = SearchOptions(languageCode: LanguageCode.deDe, maxItems: 25) _ = searchEngine.search(addressQuery: query, options: geocodingOptions, completion: onGeocodingCompleted) } // Completion handler to receive geocoding results. func onGeocodingCompleted(error: SearchError?, items: [Place]?) { if let searchError = error { showDialog(title: "Geocoding", message: "Error: \(searchError)") return } // If error is nil, it is guaranteed that the items will not be nil. for geocodingResult in items! { // Note that geoCoordinates are always set, but can be nil for suggestions only. let geoCoordinates = geocodingResult.geoCoordinates! let address = geocodingResult.address let locationDetails = address.addressText + ". Coordinates: \(geoCoordinates.latitude)" + ", \(geoCoordinates.longitude)" showDialog(title: "Geocoding - Locations in viewport for 'Invalidenstraße 116, Berlin':", message: "Found: \(items!.count) result(s): \(locationDetails)") self.addPoiMapMarker(geoCoordinates: geoCoordinates) } } // Conforming to TapDelegate protocol. func onTap(origin: Point2D) { mapView.pickMapItems(at: origin, radius: 2, completion: onMapItemsPicked) } // Completion handler to receive picked map items. func onMapItemsPicked(pickedMapItems: PickMapItemsResult?) { guard let topmostMapMarker = pickedMapItems?.markers.first else { return } if let searchResultMetadata = topmostMapMarker.metadata?.getCustomValue(key: "key_search_result") as? SearchResultMetadata { let title = searchResultMetadata.searchResult.title let vicinity = searchResultMetadata.searchResult.address.addressText showDialog(title: "Picked Search Result", message: "Title: \(title), Vicinity: \(vicinity)") return } showDialog(title: "Map Marker picked at: ", message: "\(topmostMapMarker.coordinates.latitude), \(topmostMapMarker.coordinates.longitude)") } // Conforming to LongPressDelegate protocol. func onLongPress(state: GestureState, origin: Point2D) { if (state == .begin) { let geoCoordinates = mapView.viewToGeoCoordinates(viewCoordinates: origin) addPoiMapMarker(geoCoordinates: geoCoordinates!) getAddressForCoordinates(geoCoordinates: geoCoordinates!) } } private func getAddressForCoordinates(geoCoordinates: GeoCoordinates) { // By default results are localized in EN_US. let reverseGeocodingOptions = SearchOptions(languageCode: LanguageCode.enGb, maxItems: 1) _ = searchEngine.search(coordinates: geoCoordinates, options: reverseGeocodingOptions, completion: onReverseGeocodingCompleted) } // Completion handler to receive reverse geocoding results. func onReverseGeocodingCompleted(error: SearchError?, items: [Place]?) { if let searchError = error { showDialog(title: "ReverseGeocodingError", message: "Error: \(searchError)") return } // If error is nil, it is guaranteed that the place list will not be empty. let addressText = items!.first!.address.addressText showDialog(title: "Reverse geocoded address:", message: addressText) } private func addPoiMapMarker(geoCoordinates: GeoCoordinates) { let mapMarker = createPoiMapMarker(geoCoordinates: geoCoordinates) mapView.mapScene.addMapMarker(mapMarker) mapMarkers.append(mapMarker) } private func addPoiMapMarker(geoCoordinates: GeoCoordinates, metadata: Metadata) { let mapMarker = createPoiMapMarker(geoCoordinates: geoCoordinates) mapMarker.metadata = metadata mapView.mapScene.addMapMarker(mapMarker) mapMarkers.append(mapMarker) } private func createPoiMapMarker(geoCoordinates: GeoCoordinates) -> MapMarker { guard let image = UIImage(named: "poi"), let imageData = image.pngData() else { fatalError("Error: Image not found.") } let mapMarker = MapMarker(at: geoCoordinates, image: MapImage(pixelData: imageData, imageFormat: ImageFormat.png), anchor: Anchor2D(horizontal: 0.5, vertical: 1)) return mapMarker } private func getMapViewCenter() -> GeoCoordinates { let scaleFactor = UIScreen.main.scale let mapViewWidthInPixels = Double(mapView.bounds.width * scaleFactor) let mapViewHeightInPixels = Double(mapView.bounds.height * scaleFactor) let centerPoint2D = Point2D(x: mapViewWidthInPixels / 2, y: mapViewHeightInPixels / 2) return mapView.viewToGeoCoordinates(viewCoordinates: centerPoint2D)! } private func getMapViewGeoBox() -> GeoBox { let scaleFactor = UIScreen.main.scale let mapViewWidthInPixels = Double(mapView.bounds.width * scaleFactor) let mapViewHeightInPixels = Double(mapView.bounds.height * scaleFactor) let bottomLeftPoint2D = Point2D(x: 0, y: mapViewHeightInPixels) let topRightPoint2D = Point2D(x: mapViewWidthInPixels, y: 0) let southWestCorner = mapView.viewToGeoCoordinates(viewCoordinates: bottomLeftPoint2D)! let northEastCorner = mapView.viewToGeoCoordinates(viewCoordinates: topRightPoint2D)! // Note: This algorithm assumes an unrotated map view. return GeoBox(southWestCorner: southWestCorner, northEastCorner: northEastCorner) } private func showDialog(title: String, message: String) { let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) viewController.present(alertController, animated: true, completion: nil) } private func clearMap() { for mapMarker in mapMarkers { mapView.mapScene.removeMapMarker(mapMarker) } mapMarkers.removeAll() } }
40.810897
125
0.635985
e2527e153bdd569018c34b28629cacf16dc6ade0
4,652
// // ChannelListViewController.swift // Dark Chat // // Created by elusive on 8/27/17. // Copyright © 2017 Knyazik. All rights reserved. // import UIKit import Firebase enum Section: Int { case createNewChannelSection = 0 case currentChannelsSection = 1 } class ChannelListViewController: UITableViewController { var senderDisplayName: String? var newChannelTextField: UITextField? private var channels: [Channel] = [] private lazy var channelRef: DatabaseReference = Database.database() .reference() .child("channels") private var channelRefHandle: DatabaseHandle? // MARK: - Lifecycle override func viewDidLoad() { super.viewDidLoad() title = "Dark Chat" observeChannels() } deinit { if let refHandle = channelRefHandle { channelRef.removeObserver(withHandle: refHandle) } } // MARK: - <UITableViewDataSource> override func numberOfSections(in tableView: UITableView) -> Int { return 2 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if let currentSection = Section(rawValue: section) { switch currentSection { case .createNewChannelSection: return 1 case .currentChannelsSection: return channels.count } } else { return 0 } } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let reuseIdentifier = (indexPath.section == Section.createNewChannelSection.rawValue) ? "NewChannel" : "ExistingChannel" let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) if indexPath.section == Section.createNewChannelSection.rawValue { if let createNewChannelCell = cell as? CreateChannelCell { newChannelTextField = createNewChannelCell.newChannelNameField } } else if indexPath.section == Section.currentChannelsSection.rawValue { cell.textLabel?.text = channels[indexPath.row].name } return cell } // MARK: UITableViewDelegate override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section == Section.currentChannelsSection.rawValue { let channel = channels[indexPath.row] performSegue(withIdentifier: "ShowChannel", sender: channel) } } // MARK: - Firebase Database private func observeChannels() { channelRefHandle = channelRef.observe(.childAdded, with: { [weak self] (snapshot) -> Void in guard let channelData = snapshot.value as? Dictionary<String, AnyObject> else { print("Error! Unknown format of channel data") return } let id = snapshot.key if let name = channelData["name"] as? String, name.characters.count > 0 { self?.channels.append(Channel(id: id, name: name)) self?.tableView.reloadData() } else { print("Error! Could not decode channel data") } }) } // MARK: - Actions @IBAction func createChannel(_ sender: AnyObject) { if let name = newChannelTextField?.text, !name.isEmpty { let newChannelRef = channelRef.childByAutoId() let channelItem = [ "name": name ] newChannelRef.setValue(channelItem) } else { UIUtils.showAlert("Error", message: "Please enter channel name") } } // MARK: - Segue override func prepare(for segue: UIStoryboardSegue, sender: Any?) { super.prepare(for: segue, sender: sender) guard let channel = sender as? Channel, let chatVC = segue.destination as? ChatViewController else { return } chatVC.senderDisplayName = senderDisplayName chatVC.channel = channel chatVC.channelRef = channelRef.child(channel.id) } }
31.221477
100
0.556535
fef2f78189946af54b6ac5bc832e2f791f803e42
7,717
// // UIKitApplicationViewController.swift // XestiMonitorsDemo-iOS // // Created by J. G. Pusey on 2016-11-23. // // © 2016 J. G. Pusey (see LICENSE.md) // import UIKit import XestiMonitors public class UIKitApplicationViewController: UITableViewController { // MARK: Private Instance Properties @IBOutlet private weak var applicationStateLabel: UILabel! @IBOutlet private weak var backgroundRefreshLabel: UILabel! @IBOutlet private weak var memoryButton: UIButton! @IBOutlet private weak var memoryLabel: UILabel! @IBOutlet private weak var protectedDataLabel: UILabel! @IBOutlet private weak var screenshotLabel: UILabel! @IBOutlet private weak var statusBarActionLabel: UILabel! @IBOutlet private weak var statusBarFrameLabel: UILabel! @IBOutlet private weak var statusBarOrientationLabel: UILabel! @IBOutlet private weak var timeLabel: UILabel! private lazy var applicationStateMonitor = ApplicationStateMonitor(options: .all, queue: .main) { [unowned self] in self.displayApplicationState($0) } private lazy var backgroundRefreshMonitor = BackgroundRefreshMonitor(queue: .main) { [unowned self] in self.displayBackgroundRefresh($0) } private lazy var memoryMonitor = MemoryMonitor(queue: .main) { [unowned self] in self.displayMemory($0) } private lazy var protectedDataMonitor = ProtectedDataMonitor(options: .all, queue: .main) { [unowned self] in self.displayProtectedData($0) } private lazy var screenshotMonitor = ScreenshotMonitor(queue: .main) { [unowned self] in self.displayScreenshot($0) } private lazy var statusBarMonitor = StatusBarMonitor(options: .all, queue: .main) { [unowned self] in self.displayStatusBar($0) } private lazy var timeMonitor = TimeMonitor(queue: .main) { [unowned self] in self.displayTime($0) } private lazy var monitors: [Monitor] = [applicationStateMonitor, backgroundRefreshMonitor, memoryMonitor, protectedDataMonitor, screenshotMonitor, statusBarMonitor, timeMonitor] private var memoryCount = 0 private var screenshotCount = 0 private var timeCount = 0 // MARK: Private Instance Methods private func displayApplicationState(_ event: ApplicationStateMonitor.Event?) { if let event = event { switch event { case .didBecomeActive: applicationStateLabel.text = "Did become active" case .didEnterBackground: applicationStateLabel.text = "Did enter background" case .didFinishLaunching: applicationStateLabel.text = "Did finish launching" case .willEnterForeground: applicationStateLabel.text = "Will enter foreground" case .willResignActive: applicationStateLabel.text = "Will resign active" case .willTerminate: applicationStateLabel.text = "Will terminate" } } else { applicationStateLabel.text = " " } } private func displayBackgroundRefresh(_ event: BackgroundRefreshMonitor.Event?) { if let event = event, case let .statusDidChange(status) = event { backgroundRefreshLabel.text = formatBackgroundRefreshStatus(status) } else { backgroundRefreshLabel.text = formatBackgroundRefreshStatus(backgroundRefreshMonitor.status) } } private func displayMemory(_ event: MemoryMonitor.Event?) { if let event = event, case .didReceiveWarning = event { memoryCount += 1 } memoryLabel.text = formatInteger(memoryCount) } private func displayProtectedData(_ event: ProtectedDataMonitor.Event?) { if let event = event { switch event { case .didBecomeAvailable: protectedDataLabel.text = "Did become available" case .willBecomeUnavailable: protectedDataLabel.text = "Will become unavailable" } } else { protectedDataLabel.text = " " } } private func displayScreenshot(_ event: ScreenshotMonitor.Event?) { if let event = event, case .userDidTake = event { screenshotCount += 1 } screenshotLabel.text = formatInteger(screenshotCount) } private func displayStatusBar(_ event: StatusBarMonitor.Event?) { if let event = event { switch event { case let .didChangeFrame(frame): statusBarActionLabel.text = "Did change frame" statusBarFrameLabel.text = formatRect(frame) statusBarOrientationLabel.text = formatInterfaceOrientation(statusBarMonitor.orientation) case let .didChangeOrientation(orientation): statusBarActionLabel.text = "Did change orientation" statusBarFrameLabel.text = formatRect(statusBarMonitor.frame) statusBarOrientationLabel.text = formatInterfaceOrientation(orientation) case let .willChangeFrame(frame): statusBarActionLabel.text = "Will change frame" statusBarFrameLabel.text = formatRect(frame) statusBarOrientationLabel.text = formatInterfaceOrientation(statusBarMonitor.orientation) case let .willChangeOrientation(orientation): statusBarActionLabel.text = "Will change orientation" statusBarFrameLabel.text = formatRect(statusBarMonitor.frame) statusBarOrientationLabel.text = formatInterfaceOrientation(orientation) } } else { statusBarActionLabel.text = " " statusBarFrameLabel.text = formatRect(statusBarMonitor.frame) statusBarOrientationLabel.text = formatInterfaceOrientation(statusBarMonitor.orientation) } } private func displayTime(_ event: TimeMonitor.Event?) { if let event = event, case .significantChange = event { timeCount += 1 } timeLabel.text = formatInteger(timeCount) } @IBAction private func memoryButtonTapped() { UIControl().sendAction(Selector(("_performMemoryWarning")), to: UIApplication.shared, for: nil) } // MARK: Overridden UIViewController Methods override public func viewDidLoad() { super.viewDidLoad() displayApplicationState(nil) displayBackgroundRefresh(nil) displayMemory(nil) displayProtectedData(nil) displayScreenshot(nil) displayStatusBar(nil) displayTime(nil) } override public func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) monitors.forEach { $0.startMonitoring() } } override public func viewWillDisappear(_ animated: Bool) { monitors.forEach { $0.stopMonitoring() } super.viewWillDisappear(animated) } }
34.918552
106
0.599326
8779e02e944a457731af7c957bbc8429bf5418ef
2,146
// // AppDelegate.swift // Reversi // // Created by Lukas Schramm on 31.10.15. // Copyright © 2015 Lukas Schramm. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
45.659574
285
0.753961
14356655d3ac3cf5bc504a0d19047c0c82f7796b
12,555
// // Copyright (c) 2019 Adyen B.V. // // This file is open source and available under the MIT license. See the LICENSE file for more info. // import AdyenInternal import QuartzCore import UIKit class CardFormViewController: FormViewController { // MARK: - FormViewController internal override func pay() { guard let number = numberField.text, let expiryDate = expiryDateField.text, let cvc = cvcField.text, let publicKey = paymentSession?.publicKey, let generationDate = paymentSession?.generationDate else { return } super.pay() let dateComponents = expiryDate.replacingOccurrences(of: " ", with: "").components(separatedBy: "/") let month = dateComponents[0] let year = "20" + dateComponents[1] let card = CardEncryptor.Card(number: number, securityCode: cvc, expiryMonth: month, expiryYear: year) let encryptedCard = CardEncryptor.encryptedCard(for: card, publicKey: publicKey, generationDate: generationDate) let installments = installmentItems?.filter({ $0.name == installmentsField.selectedValue }).first?.identifier let cardData = CardInputData(encryptedCard: encryptedCard, holderName: holderNameField.text, storeDetails: storeDetailsView.isSelected, installments: installments) cardDetailsHandler?(cardData) } // MARK: - UIViewController override func viewDidLoad() { super.viewDidLoad() if cardScanButtonHandler != nil { navigationItem.rightBarButtonItem = cardNumberScanButton } if holderNameConfiguration != .none { formView.addFormElement(holderNameField) } formView.addFormElement(numberField) formView.addFormElement(expiryDateField) if cvcConfiguration != .none { formView.addFormElement(cvcStackView) } if installmentsConfiguration != .none { formView.addFormElement(installmentsField) } if storeDetailsConfiguration != .none { formView.addFormElement(storeDetailsView) } formView.payButton.addTarget(self, action: #selector(pay), for: .touchUpInside) } // MARK: - Public var cardDetailsHandler: ((CardInputData) -> Void)? var cardScanButtonHandler: ((@escaping CardScanCompletion) -> Void)? var paymentSession: PaymentSession? var paymentMethod: PaymentMethod? { didSet { guard let paymentMethod = paymentMethod else { return } // If the payment method represents a group, acceptedCards should include all card types of its members. if paymentMethod.children.isEmpty == false { acceptedCards = paymentMethod.children.compactMap({ CardType(rawValue: $0.type) }) } else if let cardType = CardType(rawValue: paymentMethod.type) { // Otherwise, we would expect only the card type associated with the payment method. acceptedCards = [cardType] } storeDetailsConfiguration = CardFormFieldConfiguration.from(paymentDetail: paymentMethod.details.storeDetails) installmentsConfiguration = CardFormFieldConfiguration.from(paymentDetail: paymentMethod.details.installments) holderNameConfiguration = CardFormFieldConfiguration.from(paymentDetail: paymentMethod.details.cardholderName) if let installmentsDetail = paymentMethod.details.installments, case let .select(installments) = installmentsDetail.inputType { installmentItems = installments } } } // MARK: - Private private var installmentItems: [PaymentDetail.SelectItem]? private var acceptedCards: [CardType] = [] private var storeDetailsConfiguration: CardFormFieldConfiguration = .optional private var installmentsConfiguration: CardFormFieldConfiguration = .optional private var holderNameConfiguration: CardFormFieldConfiguration = .optional private var cvcConfiguration: CardFormFieldConfiguration { if let paymentMethodForDetectedCardType = paymentMethodForDetectedCardType { return CardFormFieldConfiguration.from(paymentDetail: paymentMethodForDetectedCardType.details.encryptedSecurityCode) } if let paymentMethod = paymentMethod { return CardFormFieldConfiguration.from(paymentDetail: paymentMethod.details.encryptedSecurityCode) } return .required } private var detectedCardType: CardType? { didSet { if detectedCardType != oldValue { updateCardLogo() updateCvcVisibility() } } } private var paymentMethodForDetectedCardType: PaymentMethod? { guard let detectedCardType = detectedCardType, let paymentMethod = paymentMethod else { return nil } // Check the payment method and all its children for a match let allPaymentMethods = [paymentMethod] + paymentMethod.children return allPaymentMethods.first(where: { $0.type == detectedCardType.rawValue }) } private lazy var holderNameField: FormTextField = { let nameField = FormTextField() nameField.delegate = self nameField.validator = CardNameValidator() nameField.title = ADYLocalizedString("creditCard.holderNameField.title") nameField.placeholder = ADYLocalizedString("creditCard.holderNameField.placeholder") nameField.accessibilityIdentifier = "holder-name-field" nameField.autocapitalizationType = .words nameField.nextResponderInChain = numberField return nameField }() private lazy var numberField: FormTextField = { let numberField = FormTextField() numberField.delegate = self numberField.keyboardType = .numberPad numberField.validator = CardNumberValidator() numberField.title = ADYLocalizedString("creditCard.numberField.title") numberField.placeholder = ADYLocalizedString("creditCard.numberField.placeholder") numberField.accessibilityIdentifier = "number-field" numberField.accessoryView = cardImageView numberField.nextResponderInChain = expiryDateField return numberField }() private lazy var cvcStackView: UIStackView = { // This is a stack view so that the cvc field can be easily added/removed. let stackView = UIStackView() stackView.spacing = 22.0 stackView.distribution = .fillEqually stackView.addArrangedSubview(cvcField) return stackView }() private lazy var expiryDateField: FormTextField = { let expiryDateField = FormTextField() expiryDateField.delegate = self expiryDateField.keyboardType = .numberPad expiryDateField.validator = CardExpiryValidator() expiryDateField.title = ADYLocalizedString("creditCard.expiryDateField.title") expiryDateField.placeholder = ADYLocalizedString("creditCard.expiryDateField.placeholder") expiryDateField.accessibilityIdentifier = "expiry-date-field" expiryDateField.nextResponderInChain = cvcField return expiryDateField }() private lazy var cvcField: FormTextField = { let cvcField = FormTextField() cvcField.delegate = self cvcField.keyboardType = .numberPad cvcField.validator = CardSecurityCodeValidator() cvcField.title = ADYLocalizedString("creditCard.cvcField.title") cvcField.placeholder = ADYLocalizedString("creditCard.cvcField.placeholder") cvcField.accessibilityIdentifier = "cvc-field" return cvcField }() private lazy var storeDetailsView: FormConsentView = { let view = FormConsentView() view.title = ADYLocalizedString("creditCard.storeDetailsButton") view.isSelected = false view.accessibilityIdentifier = "store-details-button" return view }() private lazy var cardImageView: UIImageView = { let imageView = UIImageView(image: UIImage.bundleImage("credit_card_icon")) imageView.frame = CGRect(x: 0, y: 0, width: 38, height: 24) imageView.contentMode = .scaleAspectFit imageView.layer.cornerRadius = 3 imageView.clipsToBounds = true imageView.layer.borderWidth = 1 / UIScreen.main.nativeScale imageView.layer.borderColor = UIColor.clear.cgColor return imageView }() private lazy var cardNumberScanButton: UIBarButtonItem = { let button = UIBarButtonItem(barButtonSystemItem: .camera, target: self, action: #selector(scanCardClicked)) button.tintColor = appearance.tintColor return button }() private lazy var installmentsField: FormSelectField = { let selectField = FormSelectField(values: installmentItems!.map { $0.name }) selectField.title = ADYLocalizedString("creditCard.installmentsField") return selectField }() private func updateCardType() { guard let cardNumber = numberField.text, let validator = numberField.validator as? CardNumberValidator else { return } let sanitizedCardNumber = validator.sanitize(cardNumber) let cardType = acceptedCards.first { $0.matches(cardNumber: sanitizedCardNumber) } detectedCardType = cardType } private func updateValidity() { var valid = false if holderNameField.validatedValue != nil || holderNameConfiguration != .required, cvcField.validatedValue != nil || cvcConfiguration != .required, numberField.validatedValue != nil, expiryDateField.validatedValue != nil { valid = true } isValid = valid } private func updateCardLogo() { guard let url = paymentMethodForDetectedCardType?.logoURL else { cardImageView.image = UIImage.bundleImage("credit_card_icon") cardImageView.layer.borderColor = UIColor.clear.cgColor return } cardImageView.downloadImage(from: url) cardImageView.layer.borderColor = UIColor.black.withAlphaComponent(0.2).cgColor } private func updateCvcVisibility() { if cvcConfiguration == .none { cvcField.removeFromSuperview() cvcStackView.removeArrangedSubview(cvcField) } else { cvcStackView.addArrangedSubview(cvcField) } } } extension CardFormViewController: FormTextFieldDelegate { func valueChanged(_ formTextField: FormTextField) { if formTextField == numberField { updateCardType() } updateValidity() } } // MARK: - Scan Card extension CardFormViewController { @objc private func scanCardClicked() { guard let cardScanButtonHandler = cardScanButtonHandler else { return } let completion: CardScanCompletion = { [weak self] scannedCard in DispatchQueue.main.async { self?.numberField.text = scannedCard.number self?.expiryDateField.text = scannedCard.expiryDate self?.cvcField.text = scannedCard.securityCode self?.holderNameField.text = scannedCard.holderName let nameIsEmpty = self?.holderNameField.text?.isEmpty ?? true let cardNumberIsEmpty = self?.numberField.text?.isEmpty ?? true let expiryIsEmpty = self?.expiryDateField.text?.isEmpty ?? true if nameIsEmpty, self?.holderNameConfiguration != .none { _ = self?.holderNameField.becomeFirstResponder() } else if cardNumberIsEmpty { _ = self?.numberField.becomeFirstResponder() } else if expiryIsEmpty { _ = self?.expiryDateField.becomeFirstResponder() } else { _ = self?.cvcField.becomeFirstResponder() } self?.updateValidity() } } cardScanButtonHandler(completion) } }
39.234375
171
0.64771
46878e359b8b7b585c13d0f51418e49aa4d349e0
3,141
// AppDelegate.swift // // Copyright (c) 2015 Gurpartap Singh // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
51.491803
285
0.762178
d66b60d950231994704a3d4e89aaf4036819ce17
536
import CTNotificationContent class NotificationViewController: CTNotificationViewController { override func viewDidLoad() { self.contentType = .contentSlider // default is .contentSlider, just here for illustration super.viewDidLoad() } // optional: implement to get user event data override func userDidPerformAction(_ action: String, withProperties properties: [AnyHashable : Any]!) { print("userDidPerformAction \(action) with props \(String(describing: properties))") } }
33.5
107
0.712687
2344f3714d46580e2d565ab390ceb7ea1ef11523
5,624
/// Matrix /// 初期化は(行数, 列数)を渡すのが基本。それ以外は実装を読んで確認。 /// M.dot(L)で(アダマール積ではない)積 /// ElementをIntにした場合はM.modPow(p, mod)が可能。 protocol Field: Numeric { static var multiplicationIdentity: Self {get} static prefix func - (value: Self) -> Self static func / (lhs: Self, rhs: Self) -> Self } extension Int: Field { //違うけど仕方ない。 static var multiplicationIdentity: Int = 1 } extension Double: Field { //厳密には違うけど仕方ない。 static var multiplicationIdentity: Double = 1.0 } struct Matrix<Element: Field>{ var elements: [Element] var shape: (Int, Int) init(_ shape: (Int, Int)){ self.shape = shape elements = Array(repeating: Element.zero, count: shape.0*shape.1) } init(_ row: Int, _ column: Int){ self.init((row, column)) } init(_ x: [[Element]]){ elements = Array(x.joined()) shape = (x.count, x[0].count) } init(_ x: [Element], _ shape: (Int, Int)){ self.shape = shape self.elements = x } //defaultは縦 init(_ x: [Element], _ horizontal: Bool = false){ elements = x shape = horizontal ? (1, x.count) : (x.count, 1) } init(identity size: Int){ elements = Array(repeating: Element.zero, count: size*size) shape = (size, size) for i in 0..<size{ elements[i + size*i] = Element.multiplicationIdentity } } subscript(_ i: Int, _ j: Int) -> Element{ get{ assert(i < shape.0 && j < shape.1, "Index out of range") return elements[shape.1 * i + j] } set{ assert(i < shape.0 && j < shape.1, "Index out of range") elements[shape.1*i + j] = newValue } } subscript(_ index: Int) -> [Element]{ get{ assert(index < shape.0, "Index out of range") return Array(elements[shape.1*(index)..<(index+1)*shape.1]) } } var T: Matrix{ return Matrix(elements, (shape.1, shape.0)) } func dot(_ value: Matrix) -> Matrix{ assert(self.shape.1 == value.shape.0, "Shape error") var res: Matrix = Matrix(self.shape.0, value.shape.1) for i in 0..<self.shape.0{ for j in 0..<value.shape.1{ for k in 0..<self.shape.1{ res[i, j] += self[i, k] * value[k, j] } } } return res } func pow(_ p: Int) -> Matrix{ var p = p var x = self var res = Matrix(self.shape) for i in 0..<min(res.shape.0, res.shape.1){ res[i, i] = Element.multiplicationIdentity } while(p > 0){ if((p&1) == 1){ res = res.dot(x) } x = x.dot(x) p >>= 1 } return res } static prefix func - (_ matrix: Matrix) -> Matrix{ return Matrix(matrix.elements.map{-$0}, matrix.shape) } static func + (_ left: Matrix, _ right: Matrix) -> Matrix{ assert(left.shape == right.shape, "Shapes must be same") var res: [Element] = [] for idx in 0..<left.elements.count{ res.append(left.elements[idx] + right.elements[idx]) } return Matrix(res, left.shape) } static func - (_ left: Matrix, _ right: Matrix) -> Matrix{ return left + (-right) } static func * (_ left: Matrix, _ right: Matrix) -> Matrix{ var res: [Element] = [] for idx in 0..<left.elements.count{ res.append(left.elements[idx] * right.elements[idx]) } return Matrix(res, left.shape) } static func += (_ left: inout Matrix, _ right: Matrix){ left = left + right } static func -= (_ left: inout Matrix, _ right: Matrix){ left = left - right } static func *= (_ left: inout Matrix, _ right: Matrix){ left = left * right } static func * (_ left: Element, _ right: Matrix) -> Matrix{ return Matrix(right.elements.map{left*$0}, right.shape) } static func * (_ left: Matrix, _ right: Element) -> Matrix{ return right*left } static func *= (_ left: inout Matrix, _ right: Element){ left = right * left } static func / (_ left: Matrix, _ right: Element) -> Matrix{ return Matrix(left.elements.map {$0/right}, left.shape) } static func /= (_ left: inout Matrix, _ right: Element){ left = left / right } } extension Matrix: CustomStringConvertible{ var description: String{ var res: String = "[" for i in 0..<(shape.0-1){ res += self[i].description res += "\n " } return res + self[shape.0-1].description + "]" } } extension Matrix where Element == Int{ func modDot(_ value: Matrix<Int>, _ Mod: Int) -> Matrix<Int>{ assert(self.shape.1 == value.shape.0, "Shape error") var res: Matrix<Int> = Matrix<Int>(self.shape.0, value.shape.1) for i in 0..<self.shape.0{ for j in 0..<value.shape.1{ for k in 0..<self.shape.1{ res[i, j] = (res[i, j] + self[i, k] * value[k, j]) % Mod } } } return res } func modPow(_ p: Int,_ mod: Int) -> Matrix<Int>{ var p = p var x = self var res = Matrix<Int>(self.shape) for i in 0..<min(res.shape.0, res.shape.1){ res[i, i] = 1 } while(p > 0){ if((p&1) == 1){ res = modDot(x, mod) } x = modDot(x, mod) p >>= 1 } return res } }
31.244444
76
0.515825
1695955b73aca66c60c8203cfdc14f1675e8eb93
556
// // Email.swift // LiteJSONConvertible // // Created by Andrea Prearo on 4/5/16. // Copyright © 2016 Andrea Prearo // import Foundation import CoreClient struct Email { let label: String? let address: String? init(label: String?, address: String?) { self.label = label self.address = address } } extension Email: JSONDecodable { static func decode(json: JSON) -> Email? { return Email( label: json <| "label", address: json <| "address") } }
16.352941
46
0.56295
efd89091a7729566a0e26b399c93111025eb5fb2
2,305
// // SceneDelegate.swift // XQNavigationBar15BlankDemo // // Created by sinking on 2021/9/26. // import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let _ = (scene as? UIWindowScene) else { return } } func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system. // This occurs shortly after the scene enters the background, or when its session is discarded. // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). } func sceneDidBecomeActive(_ scene: UIScene) { // Called when the scene has moved from an inactive state to an active state. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. } func sceneWillResignActive(_ scene: UIScene) { // Called when the scene will move from an active state to an inactive state. // This may occur due to temporary interruptions (ex. an incoming phone call). } func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. } func sceneDidEnterBackground(_ scene: UIScene) { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. } }
43.490566
147
0.714967
4b106900d91a15ffd0f0a1c6b67dd23714fe56cb
32,286
//===--- Range.swift ------------------------------------------*- swift -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// /// A type that can be used to slice a collection. /// /// A type that conforms to `RangeExpression` can convert itself to a /// `Range<Bound>` of indices within a given collection. public protocol RangeExpression { /// The type for which the expression describes a range. associatedtype Bound: Comparable /// Returns the range of indices described by this range expression within /// the given collection. /// /// You can use the `relative(to:)` method to convert a range expression, /// which could be missing one or both of its endpoints, into a concrete /// range that is bounded on both sides. The following example uses this /// method to convert a partial range up to `4` into a half-open range, /// using an array instance to add the range's lower bound. /// /// let numbers = [10, 20, 30, 40, 50, 60, 70] /// let upToFour = ..<4 /// /// let r1 = upToFour.relative(to: numbers) /// // r1 == 0..<4 /// /// The `r1` range is bounded on the lower end by `0` because that is the /// starting index of the `numbers` array. When the collection passed to /// `relative(to:)` starts with a different index, that index is used as the /// lower bound instead. The next example creates a slice of `numbers` /// starting at index `2`, and then uses the slice with `relative(to:)` to /// convert `upToFour` to a concrete range. /// /// let numbersSuffix = numbers[2...] /// // numbersSuffix == [30, 40, 50, 60, 70] /// /// let r2 = upToFour.relative(to: numbersSuffix) /// // r2 == 2..<4 /// /// Use this method only if you need the concrete range it produces. To /// access a slice of a collection using a range expression, use the /// collection's generic subscript that uses a range expression as its /// parameter. /// /// let numbersPrefix = numbers[upToFour] /// // numbersPrefix == [10, 20, 30, 40] /// /// - Parameter collection: The collection to evaluate this range expression /// in relation to. /// - Returns: A range suitable for slicing `collection`. The returned range /// is *not* guaranteed to be inside the bounds of `collection`. Callers /// should apply the same preconditions to the return value as they would /// to a range provided directly by the user. func relative<C: Collection>( to collection: C ) -> Range<Bound> where C.Index == Bound /// Returns a Boolean value indicating whether the given element is contained /// within the range expression. /// /// - Parameter element: The element to check for containment. /// - Returns: `true` if `element` is contained in the range expression; /// otherwise, `false`. func contains(_ element: Bound) -> Bool } extension RangeExpression { @inlinable public static func ~= (pattern: Self, value: Bound) -> Bool { return pattern.contains(value) } } /// A half-open interval from a lower bound up to, but not including, an upper /// bound. /// /// You create a `Range` instance by using the half-open range operator /// (`..<`). /// /// let underFive = 0.0..<5.0 /// /// You can use a `Range` instance to quickly check if a value is contained in /// a particular range of values. For example: /// /// underFive.contains(3.14) /// // true /// underFive.contains(6.28) /// // false /// underFive.contains(5.0) /// // false /// /// `Range` instances can represent an empty interval, unlike `ClosedRange`. /// /// let empty = 0.0..<0.0 /// empty.contains(0.0) /// // false /// empty.isEmpty /// // true /// /// Using a Range as a Collection of Consecutive Values /// ---------------------------------------------------- /// /// When a range uses integers as its lower and upper bounds, or any other type /// that conforms to the `Strideable` protocol with an integer stride, you can /// use that range in a `for`-`in` loop or with any sequence or collection /// method. The elements of the range are the consecutive values from its /// lower bound up to, but not including, its upper bound. /// /// for n in 3..<5 { /// print(n) /// } /// // Prints "3" /// // Prints "4" /// /// Because floating-point types such as `Float` and `Double` are their own /// `Stride` types, they cannot be used as the bounds of a countable range. If /// you need to iterate over consecutive floating-point values, see the /// `stride(from:to:by:)` function. @_fixed_layout public struct Range<Bound : Comparable> { /// The range's lower bound. /// /// In an empty range, `lowerBound` is equal to `upperBound`. public let lowerBound: Bound /// The range's upper bound. /// /// In an empty range, `upperBound` is equal to `lowerBound`. A `Range` /// instance does not contain its upper bound. public let upperBound: Bound /// Creates an instance with the given bounds. /// /// Because this initializer does not perform any checks, it should be used /// as an optimization only when you are absolutely certain that `lower` is /// less than or equal to `upper`. Using the half-open range operator /// (`..<`) to form `Range` instances is preferred. /// /// - Parameter bounds: A tuple of the lower and upper bounds of the range. @inlinable public init(uncheckedBounds bounds: (lower: Bound, upper: Bound)) { self.lowerBound = bounds.lower self.upperBound = bounds.upper } /// Returns a Boolean value indicating whether the given element is contained /// within the range. /// /// Because `Range` represents a half-open range, a `Range` instance does not /// contain its upper bound. `element` is contained in the range if it is /// greater than or equal to the lower bound and less than the upper bound. /// /// - Parameter element: The element to check for containment. /// - Returns: `true` if `element` is contained in the range; otherwise, /// `false`. @inlinable public func contains(_ element: Bound) -> Bool { return lowerBound <= element && element < upperBound } /// A Boolean value indicating whether the range contains no elements. /// /// An empty `Range` instance has equal lower and upper bounds. /// /// let empty: Range = 10..<10 /// print(empty.isEmpty) /// // Prints "true" @inlinable public var isEmpty: Bool { return lowerBound == upperBound } } extension Range: Sequence where Bound: Strideable, Bound.Stride : SignedInteger { public typealias Element = Bound public typealias Iterator = IndexingIterator<Range<Bound>> } // FIXME: should just be RandomAccessCollection extension Range: Collection, BidirectionalCollection, RandomAccessCollection where Bound : Strideable, Bound.Stride : SignedInteger { /// A type that represents a position in the range. public typealias Index = Bound public typealias Indices = Range<Bound> public typealias SubSequence = Range<Bound> @inlinable public var startIndex: Index { return lowerBound } @inlinable public var endIndex: Index { return upperBound } @inlinable public func index(after i: Index) -> Index { _failEarlyRangeCheck(i, bounds: startIndex..<endIndex) return i.advanced(by: 1) } @inlinable public func index(before i: Index) -> Index { _precondition(i > lowerBound) _precondition(i <= upperBound) return i.advanced(by: -1) } @inlinable public func index(_ i: Index, offsetBy n: Int) -> Index { let r = i.advanced(by: numericCast(n)) _precondition(r >= lowerBound) _precondition(r <= upperBound) return r } @inlinable public func distance(from start: Index, to end: Index) -> Int { return numericCast(start.distance(to: end)) } /// Accesses the subsequence bounded by the given range. /// /// - Parameter bounds: A range of the range's indices. The upper and lower /// bounds of the `bounds` range must be valid indices of the collection. @inlinable public subscript(bounds: Range<Index>) -> Range<Bound> { return bounds } /// The indices that are valid for subscripting the range, in ascending /// order. @inlinable public var indices: Indices { return self } @inlinable public func _customContainsEquatableElement(_ element: Element) -> Bool? { return lowerBound <= element && element < upperBound } @inlinable public func _customIndexOfEquatableElement(_ element: Bound) -> Index?? { return lowerBound <= element && element < upperBound ? element : nil } /// Accesses the element at specified position. /// /// You can subscript a collection with any valid index other than the /// collection's end index. The end index refers to the position one past /// the last element of a collection, so it doesn't correspond with an /// element. /// /// - Parameter position: The position of the element to access. `position` /// must be a valid index of the range, and must not equal the range's end /// index. @inlinable public subscript(position: Index) -> Element { // FIXME: swift-3-indexing-model: tests for the range check. _debugPrecondition(self.contains(position), "Index out of range") return position } } extension Range where Bound: Strideable, Bound.Stride : SignedInteger { /// Now that Range is conditionally a collection when Bound: Strideable, /// CountableRange is no longer needed. This is a deprecated initializer /// for any remaining uses of Range(countableRange). @available(*,deprecated: 4.2, message: "CountableRange is now Range. No need to convert any more.") public init(_ other: Range<Bound>) { self = other } /// Creates an instance equivalent to the given `ClosedRange`. /// /// - Parameter other: A closed range to convert to a `Range` instance. /// /// An equivalent range must be representable as an instance of Range<Bound>. /// For example, passing a closed range with an upper bound of `Int.max` /// triggers a runtime error, because the resulting half-open range would /// require an upper bound of `Int.max + 1`, which is not representable as public init(_ other: ClosedRange<Bound>) { let upperBound = other.upperBound.advanced(by: 1) self.init(uncheckedBounds: (lower: other.lowerBound, upper: upperBound)) } } extension Range: RangeExpression { /// Returns the range of indices described by this range expression within /// the given collection. /// /// - Parameter collection: The collection to evaluate this range expression /// in relation to. /// - Returns: A range suitable for slicing `collection`. The returned range /// is *not* guaranteed to be inside the bounds of `collection`. Callers /// should apply the same preconditions to the return value as they would /// to a range provided directly by the user. @inlinable // FIXME(sil-serialize-all) public func relative<C: Collection>(to collection: C) -> Range<Bound> where C.Index == Bound { return Range(uncheckedBounds: (lower: lowerBound, upper: upperBound)) } } extension Range { /// Returns a copy of this range clamped to the given limiting range. /// /// The bounds of the result are always limited to the bounds of `limits`. /// For example: /// /// let x: Range = 0..<20 /// print(x.clamped(to: 10..<1000)) /// // Prints "10..<20" /// /// If the two ranges do not overlap, the result is an empty range within the /// bounds of `limits`. /// /// let y: Range = 0..<5 /// print(y.clamped(to: 10..<1000)) /// // Prints "10..<10" /// /// - Parameter limits: The range to clamp the bounds of this range. /// - Returns: A new range clamped to the bounds of `limits`. @inlinable // FIXME(sil-serialize-all) @inline(__always) public func clamped(to limits: Range) -> Range { let lower = limits.lowerBound > self.lowerBound ? limits.lowerBound : limits.upperBound < self.lowerBound ? limits.upperBound : self.lowerBound let upper = limits.upperBound < self.upperBound ? limits.upperBound : limits.lowerBound > self.upperBound ? limits.lowerBound : self.upperBound return Range(uncheckedBounds: (lower: lower, upper: upper)) } } extension Range : CustomStringConvertible { /// A textual representation of the range. @inlinable // FIXME(sil-serialize-all) public var description: String { return "\(lowerBound)..<\(upperBound)" } } extension Range : CustomDebugStringConvertible { /// A textual representation of the range, suitable for debugging. @inlinable // FIXME(sil-serialize-all) public var debugDescription: String { return "Range(\(String(reflecting: lowerBound))" + "..<\(String(reflecting: upperBound)))" } } extension Range : CustomReflectable { @inlinable // FIXME(sil-serialize-all) public var customMirror: Mirror { return Mirror( self, children: ["lowerBound": lowerBound, "upperBound": upperBound]) } } extension Range: Equatable { /// Returns a Boolean value indicating whether two ranges are equal. /// /// Two ranges are equal when they have the same lower and upper bounds. /// That requirement holds even for empty ranges. /// /// let x: Range = 5..<15 /// print(x == 5..<15) /// // Prints "true" /// /// let y: Range = 5..<5 /// print(y == 15..<15) /// // Prints "false" /// /// - Parameters: /// - lhs: A range to compare. /// - rhs: Another range to compare. @inlinable public static func == (lhs: Range<Bound>, rhs: Range<Bound>) -> Bool { return lhs.lowerBound == rhs.lowerBound && lhs.upperBound == rhs.upperBound } } extension Range: Hashable where Bound: Hashable { @inlinable // FIXME(sil-serialize-all) public var hashValue: Int { return _hashValue(for: self) } @inlinable // FIXME(sil-serialize-all) public func _hash(into hasher: inout _Hasher) { hasher.combine(lowerBound) hasher.combine(upperBound) } } /// A partial half-open interval up to, but not including, an upper bound. /// /// You create `PartialRangeUpTo` instances by using the prefix half-open range /// operator (prefix `..<`). /// /// let upToFive = ..<5.0 /// /// You can use a `PartialRangeUpTo` instance to quickly check if a value is /// contained in a particular range of values. For example: /// /// upToFive.contains(3.14) // true /// upToFive.contains(6.28) // false /// upToFive.contains(5.0) // false /// /// You can use a `PartialRangeUpTo` instance of a collection's indices to /// represent the range from the start of the collection up to, but not /// including, the partial range's upper bound. /// /// let numbers = [10, 20, 30, 40, 50, 60, 70] /// print(numbers[..<3]) /// // Prints "[10, 20, 30]" @_fixed_layout public struct PartialRangeUpTo<Bound: Comparable> { public let upperBound: Bound @inlinable // FIXME(sil-serialize-all) public init(_ upperBound: Bound) { self.upperBound = upperBound } } extension PartialRangeUpTo: RangeExpression { @inlinable // FIXME(sil-serialize-all) @_transparent public func relative<C: Collection>(to collection: C) -> Range<Bound> where C.Index == Bound { return collection.startIndex..<self.upperBound } @inlinable // FIXME(sil-serialize-all) @_transparent public func contains(_ element: Bound) -> Bool { return element < upperBound } } /// A partial interval up to, and including, an upper bound. /// /// You create `PartialRangeThrough` instances by using the prefix closed range /// operator (prefix `...`). /// /// let throughFive = ...5.0 /// /// You can use a `PartialRangeThrough` instance to quickly check if a value is /// contained in a particular range of values. For example: /// /// throughFive.contains(4.0) // true /// throughFive.contains(5.0) // true /// throughFive.contains(6.0) // false /// /// You can use a `PartialRangeThrough` instance of a collection's indices to /// represent the range from the start of the collection up to, and including, /// the partial range's upper bound. /// /// let numbers = [10, 20, 30, 40, 50, 60, 70] /// print(numbers[...3]) /// // Prints "[10, 20, 30, 40]" @_fixed_layout public struct PartialRangeThrough<Bound: Comparable> { public let upperBound: Bound @inlinable // FIXME(sil-serialize-all) public init(_ upperBound: Bound) { self.upperBound = upperBound } } extension PartialRangeThrough: RangeExpression { @inlinable // FIXME(sil-serialize-all) @_transparent public func relative<C: Collection>(to collection: C) -> Range<Bound> where C.Index == Bound { return collection.startIndex..<collection.index(after: self.upperBound) } @inlinable // FIXME(sil-serialize-all) @_transparent public func contains(_ element: Bound) -> Bool { return element <= upperBound } } /// A partial interval extending upward from a lower bound. /// /// You create `PartialRangeFrom` instances by using the postfix range operator /// (postfix `...`). /// /// let atLeastFive = 5... /// /// You can use a partial range to quickly check if a value is contained in a /// particular range of values. For example: /// /// atLeastFive.contains(4) /// // false /// atLeastFive.contains(5) /// // true /// atLeastFive.contains(6) /// // true /// /// You can use a partial range of a collection's indices to represent the /// range from the partial range's lower bound up to the end of the /// collection. /// /// let numbers = [10, 20, 30, 40, 50, 60, 70] /// print(numbers[3...]) /// // Prints "[40, 50, 60, 70]" /// /// Using a Partial Range as a Sequence /// ----------------------------------- /// /// When a partial range uses integers as its lower and upper bounds, or any /// other type that conforms to the `Strideable` protocol with an integer /// stride, you can use that range in a `for`-`in` loop or with any sequence /// method that doesn't require that the sequence is finite. The elements of /// a partial range are the consecutive values from its lower bound continuing /// upward indefinitely. /// /// func isTheMagicNumber(_ x: Int) -> Bool { /// return x == 3 /// } /// /// for x in 1... { /// if isTheMagicNumber(x) { /// print("\(x) is the magic number!") /// break /// } else { /// print("\(x) wasn't it...") /// } /// } /// // "1 wasn't it..." /// // "2 wasn't it..." /// // "3 is the magic number!" /// /// Because a `PartialRangeFrom` sequence counts upward indefinitely, do not /// use one with methods that read the entire sequence before returning, such /// as `map(_:)`, `filter(_:)`, or `suffix(_:)`. It is safe to use operations /// that put an upper limit on the number of elements they access, such as /// `prefix(_:)` or `dropFirst(_:)`, and operations that you can guarantee /// will terminate, such as passing a closure you know will eventually return /// `true` to `first(where:)`. /// /// In the following example, the `asciiTable` sequence is made by zipping /// together the characters in the `alphabet` string with a partial range /// starting at 65, the ASCII value of the capital letter A. Iterating over /// two zipped sequences continues only as long as the shorter of the two /// sequences, so the iteration stops at the end of `alphabet`. /// /// let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" /// let asciiTable = zip(65..., alphabet) /// for (code, letter) in asciiTable { /// print(code, letter) /// } /// // "65 A" /// // "66 B" /// // "67 C" /// // ... /// // "89 Y" /// // "90 Z" /// /// The behavior of incrementing indefinitely is determined by the type of /// `Bound`. For example, iterating over an instance of /// `PartialRangeFrom<Int>` traps when the sequence's next value would be /// above `Int.max`. @_fixed_layout public struct PartialRangeFrom<Bound: Comparable> { public let lowerBound: Bound @inlinable // FIXME(sil-serialize-all) public init(_ lowerBound: Bound) { self.lowerBound = lowerBound } } extension PartialRangeFrom: RangeExpression { @inlinable // FIXME(sil-serialize-all) @_transparent public func relative<C: Collection>( to collection: C ) -> Range<Bound> where C.Index == Bound { return self.lowerBound..<collection.endIndex } @inlinable // FIXME(sil-serialize-all) public func contains(_ element: Bound) -> Bool { return lowerBound <= element } } extension PartialRangeFrom: Sequence where Bound : Strideable, Bound.Stride : SignedInteger { public typealias Element = Bound /// The iterator for a `PartialRangeFrom` instance. @_fixed_layout public struct Iterator: IteratorProtocol { @usableFromInline internal var _current: Bound @inlinable public init(_current: Bound) { self._current = _current } /// Advances to the next element and returns it, or `nil` if no next /// element exists. /// /// Once `nil` has been returned, all subsequent calls return `nil`. /// /// - Returns: The next element in the underlying sequence, if a next /// element exists; otherwise, `nil`. @inlinable public mutating func next() -> Bound? { defer { _current = _current.advanced(by: 1) } return _current } } /// Returns an iterator for this sequence. @inlinable public func makeIterator() -> Iterator { return Iterator(_current: lowerBound) } } extension Comparable { /// Returns a half-open range that contains its lower bound but not its upper /// bound. /// /// Use the half-open range operator (`..<`) to create a range of any type /// that conforms to the `Comparable` protocol. This example creates a /// `Range<Double>` from zero up to, but not including, 5.0. /// /// let lessThanFive = 0.0..<5.0 /// print(lessThanFive.contains(3.14)) // Prints "true" /// print(lessThanFive.contains(5.0)) // Prints "false" /// /// - Parameters: /// - minimum: The lower bound for the range. /// - maximum: The upper bound for the range. @inlinable // FIXME(sil-serialize-all) @_transparent public static func ..< (minimum: Self, maximum: Self) -> Range<Self> { _precondition(minimum <= maximum, "Can't form Range with upperBound < lowerBound") return Range(uncheckedBounds: (lower: minimum, upper: maximum)) } /// Returns a partial range up to, but not including, its upper bound. /// /// Use the prefix half-open range operator (prefix `..<`) to create a /// partial range of any type that conforms to the `Comparable` protocol. /// This example creates a `PartialRangeUpTo<Double>` instance that includes /// any value less than `5.0`. /// /// let upToFive = ..<5.0 /// /// upToFive.contains(3.14) // true /// upToFive.contains(6.28) // false /// upToFive.contains(5.0) // false /// /// You can use this type of partial range of a collection's indices to /// represent the range from the start of the collection up to, but not /// including, the partial range's upper bound. /// /// let numbers = [10, 20, 30, 40, 50, 60, 70] /// print(numbers[..<3]) /// // Prints "[10, 20, 30]" /// /// - Parameter maximum: The upper bound for the range. @inlinable // FIXME(sil-serialize-all) @_transparent public static prefix func ..< (maximum: Self) -> PartialRangeUpTo<Self> { return PartialRangeUpTo(maximum) } /// Returns a partial range up to, and including, its upper bound. /// /// Use the prefix closed range operator (prefix `...`) to create a partial /// range of any type that conforms to the `Comparable` protocol. This /// example creates a `PartialRangeThrough<Double>` instance that includes /// any value less than or equal to `5.0`. /// /// let throughFive = ...5.0 /// /// throughFive.contains(4.0) // true /// throughFive.contains(5.0) // true /// throughFive.contains(6.0) // false /// /// You can use this type of partial range of a collection's indices to /// represent the range from the start of the collection up to, and /// including, the partial range's upper bound. /// /// let numbers = [10, 20, 30, 40, 50, 60, 70] /// print(numbers[...3]) /// // Prints "[10, 20, 30, 40]" /// /// - Parameter maximum: The upper bound for the range. @inlinable // FIXME(sil-serialize-all) @_transparent public static prefix func ... (maximum: Self) -> PartialRangeThrough<Self> { return PartialRangeThrough(maximum) } /// Returns a partial range extending upward from a lower bound. /// /// Use the postfix range operator (postfix `...`) to create a partial range /// of any type that conforms to the `Comparable` protocol. This example /// creates a `PartialRangeFrom<Double>` instance that includes any value /// greater than or equal to `5.0`. /// /// let atLeastFive = 5.0... /// /// atLeastFive.contains(4.0) // false /// atLeastFive.contains(5.0) // true /// atLeastFive.contains(6.0) // true /// /// You can use this type of partial range of a collection's indices to /// represent the range from the partial range's lower bound up to the end /// of the collection. /// /// let numbers = [10, 20, 30, 40, 50, 60, 70] /// print(numbers[3...]) /// // Prints "[40, 50, 60, 70]" /// /// - Parameter minimum: The lower bound for the range. @inlinable // FIXME(sil-serialize-all) @_transparent public static postfix func ... (minimum: Self) -> PartialRangeFrom<Self> { return PartialRangeFrom(minimum) } } /// A range expression that represents the entire range of a collection. /// /// You can use the unbounded range operator (`...`) to create a slice of a /// collection that contains all of the collection's elements. Slicing with an /// unbounded range is essentially a conversion of a collection instance into /// its slice type. /// /// For example, the following code declares `countLetterChanges(_:_:)`, a /// function that finds the number of changes required to change one /// word or phrase into another. The function uses a recursive approach to /// perform the same comparisons on smaller and smaller pieces of the original /// strings. In order to use recursion without making copies of the strings at /// each step, `countLetterChanges(_:_:)` uses `Substring`, a string's slice /// type, for its parameters. /// /// func countLetterChanges(_ s1: Substring, _ s2: Substring) -> Int { /// if s1.isEmpty { return s2.count } /// if s2.isEmpty { return s1.count } /// /// let cost = s1.first == s2.first ? 0 : 1 /// /// return min( /// countLetterChanges(s1.dropFirst(), s2) + 1, /// countLetterChanges(s1, s2.dropFirst()) + 1, /// countLetterChanges(s1.dropFirst(), s2.dropFirst()) + cost) /// } /// /// To call `countLetterChanges(_:_:)` with two strings, use an unbounded /// range in each string's subscript. /// /// let word1 = "grizzly" /// let word2 = "grisly" /// let changes = countLetterChanges(word1[...], word2[...]) /// // changes == 2 @_frozen // FIXME(sil-serialize-all) public enum UnboundedRange_ { // FIXME: replace this with a computed var named `...` when the language makes // that possible. /// Creates an unbounded range expression. /// /// The unbounded range operator (`...`) is valid only within a collection's /// subscript. @inlinable // FIXME(sil-serialize-all) public static postfix func ... (_: UnboundedRange_) -> () { fatalError("uncallable") } } /// The type of an unbounded range operator. public typealias UnboundedRange = (UnboundedRange_)->() extension Collection { /// Accesses the contiguous subrange of the collection's elements specified /// by a range expression. /// /// The range expression is converted to a concrete subrange relative to this /// collection. For example, using a `PartialRangeFrom` range expression /// with an array accesses the subrange from the start of the range /// expression until the end of the array. /// /// let streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] /// let streetsSlice = streets[2...] /// print(streetsSlice) /// // ["Channing", "Douglas", "Evarts"] /// /// The accessed slice uses the same indices for the same elements as the /// original collection uses. This example searches `streetsSlice` for one /// of the strings in the slice, and then uses that index in the original /// array. /// /// let index = streetsSlice.firstIndex(of: "Evarts") // 4 /// print(streets[index!]) /// // "Evarts" /// /// Always use the slice's `startIndex` property instead of assuming that its /// indices start at a particular value. Attempting to access an element by /// using an index outside the bounds of the slice's indices may result in a /// runtime error, even if that index is valid for the original collection. /// /// print(streetsSlice.startIndex) /// // 2 /// print(streetsSlice[2]) /// // "Channing" /// /// print(streetsSlice[0]) /// // error: Index out of bounds /// /// - Parameter bounds: A range of the collection's indices. The bounds of /// the range must be valid indices of the collection. /// /// - Complexity: O(1) @inlinable public subscript<R: RangeExpression>(r: R) -> SubSequence where R.Bound == Index { return self[r.relative(to: self)] } @inlinable public subscript(x: UnboundedRange) -> SubSequence { return self[startIndex...] } } extension MutableCollection { @inlinable public subscript<R: RangeExpression>(r: R) -> SubSequence where R.Bound == Index { get { return self[r.relative(to: self)] } set { self[r.relative(to: self)] = newValue } } @inlinable // FIXME(sil-serialize-all) public subscript(x: UnboundedRange) -> SubSequence { get { return self[startIndex...] } set { self[startIndex...] = newValue } } } // TODO: enhance RangeExpression to make this generic and available on // any expression. extension Range { /// Returns a Boolean value indicating whether this range and the given range /// contain an element in common. /// /// This example shows two overlapping ranges: /// /// let x: Range = 0..<20 /// print(x.overlaps(10...1000)) /// // Prints "true" /// /// Because a half-open range does not include its upper bound, the ranges /// in the following example do not overlap: /// /// let y = 20..<30 /// print(x.overlaps(y)) /// // Prints "false" /// /// - Parameter other: A range to check for elements in common. /// - Returns: `true` if this range and `other` have at least one element in /// common; otherwise, `false`. @inlinable public func overlaps(_ other: Range<Bound>) -> Bool { return (!other.isEmpty && self.contains(other.lowerBound)) || (!self.isEmpty && other.contains(self.lowerBound)) } @inlinable public func overlaps(_ other: ClosedRange<Bound>) -> Bool { return self.contains(other.lowerBound) || (!self.isEmpty && other.contains(self.lowerBound)) } } @available(*, deprecated, renamed: "Range") public typealias CountableRange<Bound: Strideable> = Range<Bound> where Bound.Stride : SignedInteger @available(*, deprecated: 4.2, renamed: "PartialRangeFrom") public typealias CountablePartialRangeFrom<Bound: Strideable> = PartialRangeFrom<Bound> where Bound.Stride : SignedInteger
35.323851
87
0.650592
ab48bef0cfbc68b2960a484c7d205e44460e2238
146
// // BooksListModuleInput.swift // GoogleBooksApp // // Created by Artur Chernov on 07/04/2018. // protocol BooksListModuleInput: class { }
13.272727
43
0.705479
28cc024d28b1694400e08222d0ea9fe0561812e5
2,638
/*  * SimpleMDMDevice.swift  * officectl  *  * Created by François Lamboley on 2020/4/8.  */ import Foundation struct SimpleMDMDevice : Decodable { struct Attributes : Decodable { var name: String var lastSeenAt: String var status: String /* Technically an enum */ var deviceName: String var osVersion: String? var buildVersion: String? var modelName: String? var model: String? var productName: String? var uniqueIdentifier: String? var serialNumber: String? var imei: String? var meid: String? var deviceCapacity: Float? var availableDeviceCapacity: Float? var batteryLevel: String? var modemFirmwareVersion: String? var iccid: String? var bluetoothMac: String? var ethernetMacs: [String] var wifiMac: String? var currentCarrierNetwork: String? var simCarrierNetwork: String? var subscriberCarrierNetwork: String? var carrierSettingsVersion: String? var phoneNumber: String? var voiceRoamingEnabled: Bool? var dataRoamingEnabled: Bool? var isRoaming: Bool? var subscriberMcc: String? var subscriberMnc: String? var simmnc: String? /* Not sure of actual type */ var currentMcc: String? var currentMnc: String? var hardwareEncryptionCaps: Int? var passcodePresent: Bool? var passcodeCompliant: Bool? var passcodeCompliantWithProfiles: Bool? var isSupervised: Bool? var isDepEnrollment: Bool var isUserApprovedEnrollment: Bool? var isDeviceLocatorServiceEnabled: Bool? var isDoNotDisturbInEffect: Bool? var personalHotspotEnabled: Bool? var itunesStoreAccountIsActive: Bool? var cellularTechnology: Int? var lastCloudBackupDate: String? var isActivationLockEnabled: Bool var isCloudBackupEnabled: Bool var filevaultEnabled: Bool var filevaultRecoveryKey: String? var firmwarePasswordEnabled: Bool var firmwarePassword: String? var locationLatitude: String? var locationLongitude: String? var locationAccuracy: Int? var locationUpdatedAt: String? } struct DeviceGroup : Decodable { var id: Int var type: String /* Technically enum */ init(from decoder: Decoder) throws { struct GroupData : Decodable { var type: String /* Technically enum */ var id: Int } let container = try decoder.container(keyedBy: DeviceGroup.CodingKeys.self) let groupData = try container.decode(GroupData.self, forKey: .data) id = groupData.id type = groupData.type } private enum CodingKeys : String, CodingKey { case data } } struct Relationships : Decodable { var deviceGroup: DeviceGroup } var id: Int var attributes: Attributes var relationships: Relationships }
24.654206
78
0.740713
f552309edb5882ed998b7589c9d0e3795ee19c89
1,588
// // This is free and unencumbered software released into the public domain. // // Anyone is free to copy, modify, publish, use, compile, sell, or // distribute this software, either in source code form or as a compiled // binary, for any purpose, commercial or non-commercial, and by any // means. // // In jurisdictions that recognize copyright laws, the author or authors // of this software dedicate any and all copyright interest in the // software to the public domain. We make this dedication for the benefit // of the public at large and to the detriment of our heirs and // successors. We intend this dedication to be an overt act of // relinquishment in perpetuity of all present and future rights to this // software under copyright law. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // // For more information, please refer to <http://unlicense.org/> // // MARK: - Weak: CustomStringConvertible extension Weak: CustomStringConvertible { } public extension Weak { @inlinable var description: String { if let instance = self.instance { return "weak \(instance) of type \(Instance.self)" } else { return "expired weak \(Instance.self)" } } }
37.809524
74
0.743703
33c1b9fe46f427ade78f32f9db68b401565d3f10
5,263
// // ViewController.swift // Sheep // // Created by mono on 7/24/14. // Copyright (c) 2014 Sheep. All rights reserved. // import UIKit import AVFoundation let sideMenuWidth = CGFloat(200) class MainViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource, iCarouselDelegate, iCarouselDataSource, NSFetchedResultsControllerDelegate { @IBOutlet weak var hayoButton: UIButton! @IBOutlet weak var pickerView: UIPickerView! @IBOutlet weak var carouselContainerView: UIView! private var _needReload = false var carousel: iCarousel! var users: NSFetchedResultsController! let hayoManager = HayoManager() override func viewDidLoad() { super.viewDidLoad() users = User.fetchUserList(self) carousel = iCarousel() carouselContainerView.addSubview(carousel) let padding = UIEdgeInsetsMake(0, 0, 0, 0); carousel.mas_makeConstraints() {make in make.edges.equalTo()(self.carouselContainerView).with().insets()(padding) return () } carousel.delegate = self carousel.dataSource = self carousel.type = .CoverFlow self.configureBackgroundTheme() let account = Account.instance()! let image = account.barButtonImage.imageWithRenderingMode(.AlwaysOriginal) let profileButtonItem = UIBarButtonItem(image: image, style: .Plain, target: self, action: "profileDidTap") self.navigationItem.rightBarButtonItem = profileButtonItem } @IBAction func hayoDidTap(sender: UIButton) { let user = users.fetchedObjects![carousel!.currentItemIndex] as User let message = hayoManager[0].messages[pickerView.selectedRowInComponent(0)] ParseClient.sharedInstance.hayo(user, messageId: message.id, category: "HAYO") { result, error in if nil != error { self.showError() return } let message = NSString(format: localize("SentHayoFormat"), user.username) self.showSuccess(message) } } func profileDidTap() { let vc = MenuViewController.create() self.navigationController!.modalPresentationStyle = .CurrentContext // iOS7用 self.presentViewController(vc, animated: isIOS8OrLater(), completion: {}) } @IBAction func homeButtonDidTap(sender: UIBarButtonItem) { let hayoVC = HayoListViewController.create() self.navigationController!.presentViewController(hayoVC, animated: true, completion: {}) } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) User.updateUsers() } func numberOfItemsInCarousel(carousel: iCarousel!) -> Int { let count = users.fetchedObjects!.count self.hayoButton.enabled = count != 0 return count } func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, reusingView view: UIView!) -> UIView! { var friendView: FriendView! = view as? FriendView if nil == friendView { friendView = FriendView.create() // friendView.frame = CGRectMake(0, 0, 130, 150) } else { println("view resused") } let user = users.fetchedObjects![Int(index)] as User friendView.user = user return friendView } func carouselItemWidth(carousel: iCarousel!) -> CGFloat { return 140 } func carousel(carousel: iCarousel!, didSelectItemAtIndex index: Int) { if carousel.currentItemIndex != index { return } let vc = FriendViewController.create() let user = users.fetchedObjects![index] as User let friendVC = vc.topViewController as FriendViewController friendVC.user = user self.presentViewController(vc, animated: true, completion: {}) } func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int { return 1 } func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return hayoManager[0].messages.count } func pickerView(pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { return NSAttributedString(string: hayoManager[0].messages[row].message, attributes: [NSForegroundColorAttributeName: UIColor.whiteColor()]) } func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { self.dismissProgress() } // MARK: FetchedResultsControllerDelegate func controllerDidChangeContent(controller: NSFetchedResultsController) { if _needReload { carousel.reloadData() } } func controllerWillChangeContent(controller: NSFetchedResultsController) { _needReload = false } func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { if type != .Update { _needReload = true } } }
35.560811
211
0.65875
3a393256b717c61211215b3a9d1798466f35e00a
22,733
// // 🦠 Corona-Warn-App // import Foundation import ExposureNotification import UIKit import OpenCombine // swiftlint:disable:next type_body_length final class RiskProvider: RiskProviding { // MARK: - Init init( configuration: RiskProvidingConfiguration, store: Store, appConfigurationProvider: AppConfigurationProviding, exposureManagerState: ExposureManagerState, targetQueue: DispatchQueue = .main, enfRiskCalculation: ENFRiskCalculationProtocol = ENFRiskCalculation(), checkinRiskCalculation: CheckinRiskCalculationProtocol, keyPackageDownload: KeyPackageDownloadProtocol, traceWarningPackageDownload: TraceWarningPackageDownloading, exposureDetectionExecutor: ExposureDetectionDelegate, coronaTestService: CoronaTestService ) { self.riskProvidingConfiguration = configuration self.store = store self.appConfigurationProvider = appConfigurationProvider self.exposureManagerState = exposureManagerState self.targetQueue = targetQueue self.enfRiskCalculation = enfRiskCalculation self.checkinRiskCalculation = checkinRiskCalculation self.keyPackageDownload = keyPackageDownload self.traceWarningPackageDownload = traceWarningPackageDownload self.exposureDetectionExecutor = exposureDetectionExecutor self.coronaTestService = coronaTestService self.keyPackageDownloadStatus = .idle self.traceWarningDownloadStatus = .idle self.registerForPackagesDownloadStatusUpdates() } // MARK: - Protocol RiskProviding var riskProvidingConfiguration: RiskProvidingConfiguration { didSet { if riskProvidingConfiguration != oldValue { riskProvidingConfigurationChanged(riskProvidingConfiguration) } } } var exposureManagerState: ExposureManagerState private(set) var activityState: RiskProviderActivityState = .idle var riskCalculatonDate: Date? { if let enfRiskCalculationResult = store.enfRiskCalculationResult, let checkinRiskCalculationResult = store.checkinRiskCalculationResult { let risk = Risk(enfRiskCalculationResult: enfRiskCalculationResult, checkinCalculationResult: checkinRiskCalculationResult) return risk.details.calculationDate } else { return nil } } var manualExposureDetectionState: ManualExposureDetectionState? { riskProvidingConfiguration.manualExposureDetectionState( lastExposureDetectionDate: riskCalculatonDate ) } /// Returns the next possible date of a exposureDetection var nextExposureDetectionDate: Date { riskProvidingConfiguration.nextExposureDetectionDate( lastExposureDetectionDate: riskCalculatonDate ) } func observeRisk(_ consumer: RiskConsumer) { consumers.insert(consumer) } func removeRisk(_ consumer: RiskConsumer) { consumers.remove(consumer) } /// Called by consumers to request the risk level. This method triggers the risk level process. func requestRisk(userInitiated: Bool, timeoutInterval: TimeInterval) { #if DEBUG if isUITesting { self._requestRiskLevel_Mock(userInitiated: userInitiated) return } #endif Log.info("RiskProvider: Request risk was called. UserInitiated: \(userInitiated)", log: .riskDetection) guard activityState == .idle else { Log.info("RiskProvider: Risk detection is already running. Don't start new risk detection.", log: .riskDetection) failOnTargetQueue(error: .riskProviderIsRunning, updateState: false) return } guard !coronaTestService.hasAtLeastOneShownPositiveOrSubmittedTest else { Log.info("RiskProvider: At least one registered test has an already shown positive test result or keys submitted. Don't start new risk detection.", log: .riskDetection) // Keep downloading key packages and trace warning packages for plausible deniability downloadKeyPackages { [weak self] _ in guard let self = self else { return } self.appConfigurationProvider.appConfiguration().sink { [weak self] appConfiguration in self?.downloadTraceWarningPackages(with: appConfiguration, completion: { [weak self] result in guard let self = self else { return } switch result { case .success: // this should not actually determine risk but use a previous, still valid risk and return that self.determineRisk(userInitiated: userInitiated, appConfiguration: appConfiguration) { result in switch result { case .success(let risk): self.successOnTargetQueue(risk: risk) case .failure(let error): self.failOnTargetQueue(error: error) } } case .failure(let error): self.failOnTargetQueue(error: error) } }) }.store(in: &self.subscriptions) } return } queue.async { self.updateActivityState(.riskRequested) self._requestRiskLevel(userInitiated: userInitiated, timeoutInterval: timeoutInterval) } } // MARK: - Private private typealias Completion = (RiskProviderResult) -> Void private let store: Store private let appConfigurationProvider: AppConfigurationProviding private let targetQueue: DispatchQueue private let enfRiskCalculation: ENFRiskCalculationProtocol private let checkinRiskCalculation: CheckinRiskCalculationProtocol private let exposureDetectionExecutor: ExposureDetectionDelegate private let coronaTestService: CoronaTestService private let queue = DispatchQueue(label: "com.sap.RiskProvider") private let consumersQueue = DispatchQueue(label: "com.sap.RiskProvider.consumer") private var keyPackageDownload: KeyPackageDownloadProtocol private var traceWarningPackageDownload: TraceWarningPackageDownloading private var exposureDetection: ExposureDetection? private var subscriptions = [AnyCancellable]() private var keyPackageDownloadStatus: KeyPackageDownloadStatus private var traceWarningDownloadStatus: TraceWarningDownloadStatus private var _consumers: Set<RiskConsumer> = Set<RiskConsumer>() private var consumers: Set<RiskConsumer> { get { consumersQueue.sync { _consumers } } set { consumersQueue.sync { _consumers = newValue } } } private var shouldDetectExposureBecauseOfNewPackages: Bool { let lastKeyPackageDownloadDate = store.lastKeyPackageDownloadDate let lastExposureDetectionDate = store.enfRiskCalculationResult?.calculationDate ?? .distantPast let didDownloadNewPackagesSinceLastDetection = lastKeyPackageDownloadDate > lastExposureDetectionDate let hoursSinceLastDetection = -lastExposureDetectionDate.hoursSinceNow let lastDetectionMoreThan24HoursAgo = hoursSinceLastDetection > 24 return didDownloadNewPackagesSinceLastDetection || lastDetectionMoreThan24HoursAgo } private func _requestRiskLevel(userInitiated: Bool, timeoutInterval: TimeInterval) { let group = DispatchGroup() group.enter() appConfigurationProvider.appConfiguration().sink { [weak self] appConfiguration in guard let self = self else { Log.error("RiskProvider: Error at creating self. Cancel download packages and calculate risk.", log: .riskDetection) return } self.updateRiskProvidingConfiguration(with: appConfiguration) // First, download the diagnosis keys self.downloadKeyPackages {result in switch result { case .success: // If key download succeeds, continue with the download of the trace warning packages self.downloadTraceWarningPackages(with: appConfiguration, completion: { result in switch result { case .success: // And only if both downloads succeeds, we can determine a risk. self.determineRisk(userInitiated: userInitiated, appConfiguration: appConfiguration) { result in switch result { case .success(let risk): self.successOnTargetQueue(risk: risk) case .failure(let error): self.failOnTargetQueue(error: error) } group.leave() } case .failure(let error): self.failOnTargetQueue(error: error) group.leave() } }) case .failure(let error): self.failOnTargetQueue(error: error) group.leave() } } }.store(in: &subscriptions) guard group.wait(timeout: DispatchTime.now() + timeoutInterval) == .success else { updateActivityState(.idle) exposureDetection?.cancel() Log.info("RiskProvider: Canceled risk calculation due to timeout", log: .riskDetection) failOnTargetQueue(error: .timeout) return } } private func downloadKeyPackages(completion: ((Result<Void, RiskProviderError>) -> Void)? = nil) { // The result of a hour package download is not handled, because for the risk detection it is irrelevant if it fails or not. self.downloadHourPackages { [weak self] in guard let self = self else { return } self.downloadDayPackages(completion: { result in completion?(result) }) } } private func downloadDayPackages(completion: @escaping (Result<Void, RiskProviderError>) -> Void) { keyPackageDownload.startDayPackagesDownload(completion: { result in switch result { case .success: completion(.success(())) case .failure(let error): completion(.failure(.failedKeyPackageDownload(error))) } }) } private func downloadHourPackages(completion: @escaping () -> Void) { keyPackageDownload.startHourPackagesDownload(completion: { _ in completion() }) } private func downloadTraceWarningPackages( with appConfiguration: SAP_Internal_V2_ApplicationConfigurationIOS, completion: @escaping (Result<Void, RiskProviderError>) -> Void ) { traceWarningPackageDownload.startTraceWarningPackageDownload(with: appConfiguration, completion: { result in switch result { case .success: completion(.success(())) case let .failure(error): completion(.failure(.failedTraceWarningPackageDownload(error))) } }) } private func determineRisk( userInitiated: Bool, appConfiguration: SAP_Internal_V2_ApplicationConfigurationIOS, completion: @escaping Completion ) { // Risk Calculation involves some potentially long running tasks, like exposure detection and // fetching the configuration from the backend. // However in some precondition cases we can return early: // 1. The exposureManagerState is bad (turned off, not authorized, etc.) if !exposureManagerState.isGood { Log.info("RiskProvider: Precondition not met for ExposureManagerState", log: .riskDetection) completion(.failure(.inactive)) return } // 2. There is a previous risk that is still valid and should not be recalculated if let risk = previousRiskIfExistingAndNotExpired(userInitiated: userInitiated) { Log.info("RiskProvider: Using risk from previous detection", log: .riskDetection) // fill in the risk exposure metadata if new risk calculation is not done in the meanwhile if let riskCalculationResult = store.enfRiskCalculationResult { Analytics.collect(.riskExposureMetadata(.updateRiskExposureMetadata(riskCalculationResult))) } completion(.success(risk)) return } executeExposureDetection( appConfiguration: appConfiguration, completion: { [weak self] result in guard let self = self else { return } switch result { case .success(let exposureWindows): self.calculateRiskLevel( exposureWindows: exposureWindows, appConfiguration: appConfiguration, completion: completion ) case .failure(let error): completion(.failure(error)) } } ) } private func previousRiskIfExistingAndNotExpired(userInitiated: Bool) -> Risk? { let enoughTimeHasPassed = riskProvidingConfiguration.shouldPerformExposureDetection( lastExposureDetectionDate: store.enfRiskCalculationResult?.calculationDate ) let shouldDetectExposures = (riskProvidingConfiguration.detectionMode == .manual && userInitiated) || riskProvidingConfiguration.detectionMode == .automatic // If the User is in manual mode and wants to refresh we should let him. Case: Manual Mode and Wifi disabled will lead to no new packages in the last 23 hours and 59 Minutes, but a refresh interval of 4 Hours should allow this. let shouldDetectExposureBecauseOfNewPackagesConsideringDetectionMode = shouldDetectExposureBecauseOfNewPackages || (riskProvidingConfiguration.detectionMode == .manual && userInitiated) Log.info("RiskProvider: Precondition fulfilled for fresh risk detection: enoughTimeHasPassed = \(enoughTimeHasPassed)", log: .riskDetection) Log.info("RiskProvider: Precondition fulfilled for fresh risk detection: shouldDetectExposures = \(shouldDetectExposures)", log: .riskDetection) Log.info("RiskProvider: Precondition fulfilled for fresh risk detection: shouldDetectExposureBecauseOfNewPackagesConsideringDetectionMode = \(shouldDetectExposureBecauseOfNewPackagesConsideringDetectionMode)", log: .riskDetection) if !enoughTimeHasPassed || !shouldDetectExposures || !shouldDetectExposureBecauseOfNewPackagesConsideringDetectionMode, let enfRiskCalculationResult = store.enfRiskCalculationResult, let checkinRiskCalculationResult = store.checkinRiskCalculationResult { Log.info("RiskProvider: Not calculating new risk, using result of most recent risk calculation", log: .riskDetection) return Risk( enfRiskCalculationResult: enfRiskCalculationResult, checkinCalculationResult: checkinRiskCalculationResult ) } return nil } private func executeExposureDetection( appConfiguration: SAP_Internal_V2_ApplicationConfigurationIOS, completion: @escaping (Result<[ExposureWindow], RiskProviderError>) -> Void ) { self.updateActivityState(.detecting) let _exposureDetection = ExposureDetection( delegate: exposureDetectionExecutor, appConfiguration: appConfiguration, deviceTimeCheck: DeviceTimeCheck(store: store) ) _exposureDetection.start { result in switch result { case .success(let detectedExposureWindows): Log.info("RiskProvider: Detect exposure completed", log: .riskDetection) let exposureWindows = detectedExposureWindows.map { ExposureWindow(from: $0) } completion(.success(exposureWindows)) case .failure(let error): Log.error("RiskProvider: Detect exposure failed", log: .riskDetection, error: error) completion(.failure(.failedRiskDetection(error))) } } self.exposureDetection = _exposureDetection } private func calculateRiskLevel(exposureWindows: [ExposureWindow], appConfiguration: SAP_Internal_V2_ApplicationConfigurationIOS, completion: Completion) { Log.info("RiskProvider: Calculate risk level", log: .riskDetection) let configuration = RiskCalculationConfiguration(from: appConfiguration.riskCalculationParameters) let riskCalculationResult = enfRiskCalculation.calculateRisk(exposureWindows: exposureWindows, configuration: configuration) let mappedWindows = exposureWindows.map { RiskCalculationExposureWindow(exposureWindow: $0, configuration: configuration) } Analytics.collect(.exposureWindowsMetadata(.collectExposureWindows(mappedWindows))) let checkinRiskCalculationResult = checkinRiskCalculation.calculateRisk(with: appConfiguration) let risk = Risk( enfRiskCalculationResult: riskCalculationResult, previousENFRiskCalculationResult: store.enfRiskCalculationResult, checkinCalculationResult: checkinRiskCalculationResult, previousCheckinCalculationResult: store.checkinRiskCalculationResult ) store.enfRiskCalculationResult = riskCalculationResult store.checkinRiskCalculationResult = checkinRiskCalculationResult checkIfRiskStatusLoweredAlertShouldBeShown(risk) Analytics.collect(.riskExposureMetadata(.updateRiskExposureMetadata(riskCalculationResult))) completion(.success(risk)) /// We were able to calculate a risk so we have to reset the DeadMan Notification DeadmanNotificationManager(coronaTestService: coronaTestService).resetDeadmanNotification() } private func _provideRiskResult(_ result: RiskProviderResult, to consumer: RiskConsumer?) { #if DEBUG if isUITesting && UserDefaults.standard.string(forKey: "riskLevel") == "inactive" { consumer?.provideRiskCalculationResult(.failure(.inactive)) return } #endif consumer?.provideRiskCalculationResult(result) } private func checkIfRiskStatusLoweredAlertShouldBeShown(_ risk: Risk) { /// Only set shouldShowRiskStatusLoweredAlert if risk level has changed from increase to low or vice versa. Otherwise leave shouldShowRiskStatusLoweredAlert unchanged. /// Scenario: Risk level changed from high to low in the first risk calculation. In a second risk calculation it stays low. If the user does not open the app between these two calculations, the alert should still be shown. if risk.riskLevelHasChanged { switch risk.level { case .low: store.shouldShowRiskStatusLoweredAlert = true case .high: store.shouldShowRiskStatusLoweredAlert = false store.dateOfConversionToHighRisk = Date() } } } private func updateRiskProvidingConfiguration(with appConfig: SAP_Internal_V2_ApplicationConfigurationIOS) { let maxExposureDetectionsPerInterval = Int(appConfig.exposureDetectionParameters.maxExposureDetectionsPerInterval) var exposureDetectionInterval: DateComponents if maxExposureDetectionsPerInterval <= 0 { // Deactivate exposure detection by setting a high, not reachable value. // Int.max does not work. It leads to DateComponents.hour == nil. exposureDetectionInterval = DateComponents(hour: Int.max.advanced(by: -1)) // a.k.a. 1 BER build } else { exposureDetectionInterval = DateComponents(hour: 24 / maxExposureDetectionsPerInterval) } self.riskProvidingConfiguration = RiskProvidingConfiguration( exposureDetectionValidityDuration: DateComponents(day: 2), exposureDetectionInterval: exposureDetectionInterval, detectionMode: riskProvidingConfiguration.detectionMode ) } private func successOnTargetQueue(risk: Risk) { Log.info("RiskProvider: Risk detection and calculation was successful.", log: .riskDetection) updateActivityState(.idle) for consumer in consumers { _provideRiskResult(.success(risk), to: consumer) } } private func failOnTargetQueue(error: RiskProviderError, updateState: Bool = true) { Log.info("RiskProvider: Failed with error: \(error)", log: .riskDetection) if updateState { updateActivityState(.idle) } for consumer in consumers { _provideRiskResult(.failure(error), to: consumer) } } private func updateActivityState(_ state: RiskProviderActivityState) { Log.info("RiskProvider: Update activity state to: \(state)", log: .riskDetection) self.activityState = state targetQueue.async { [weak self] in self?.consumers.forEach { $0.didChangeActivityState?(state) } } } private func riskProvidingConfigurationChanged(_ configuration: RiskProvidingConfiguration) { Log.info("RiskProvider: Inform consumers about risk providing configuration change to: \(configuration)", log: .riskDetection) targetQueue.async { [weak self] in self?.consumers.forEach { $0.didChangeRiskProvidingConfiguration?(configuration) } } } private func registerForPackagesDownloadStatusUpdates() { keyPackageDownload.statusDidChange = { [weak self] downloadStatus in guard let self = self else { Log.error("RiskProvider: Error at creating strong self.", log: .riskDetection) return } self.keyPackageDownloadStatus = downloadStatus self.updateRiskProviderActivityState() } traceWarningPackageDownload.statusDidChange = { [weak self] downloadStatus in guard let self = self else { Log.error("RiskProvider: Error at creating strong self.", log: .riskDetection) return } self.traceWarningDownloadStatus = downloadStatus self.updateRiskProviderActivityState() } } private func updateRiskProviderActivityState() { if keyPackageDownloadStatus == .downloading || traceWarningDownloadStatus == .downloading { self.updateActivityState(.downloading) } else if keyPackageDownloadStatus == .idle && coronaTestService.hasAtLeastOneShownPositiveOrSubmittedTest && traceWarningDownloadStatus == .idle { self.updateActivityState(.idle) } } } private extension RiskConsumer { func provideRiskCalculationResult(_ result: RiskProviderResult) { switch result { case .success(let risk): targetQueue.async { [weak self] in self?.didCalculateRisk(risk) } case .failure(let error): targetQueue.async { [weak self] in self?.didFailCalculateRisk(error) } } } } #if DEBUG extension RiskProvider { private func _requestRiskLevel_Mock(userInitiated: Bool) { let risk = Risk.mocked let dateFormatter = ISO8601DateFormatter.contactDiaryUTCFormatter let todayString = dateFormatter.string(from: Date()) guard let today = dateFormatter.date(from: todayString), let someDaysAgo = Calendar.current.date(byAdding: .day, value: -3, to: today) else { fatalError("Could not create date test data for riskLevelPerDate.") } let calculationDate = Calendar.autoupdatingCurrent.date(bySettingHour: 9, minute: 6, second: 0, of: Date()) ?? Date() switch risk.level { case .high: store.enfRiskCalculationResult = ENFRiskCalculationResult( riskLevel: .high, minimumDistinctEncountersWithLowRisk: 0, minimumDistinctEncountersWithHighRisk: 0, mostRecentDateWithLowRisk: risk.details.mostRecentDateWithRiskLevel, mostRecentDateWithHighRisk: risk.details.mostRecentDateWithRiskLevel, numberOfDaysWithLowRisk: risk.details.numberOfDaysWithRiskLevel, numberOfDaysWithHighRisk: risk.details.numberOfDaysWithRiskLevel, calculationDate: calculationDate, riskLevelPerDate: [ today: .high, someDaysAgo: .low ], minimumDistinctEncountersWithHighRiskPerDate: [ today: 1, someDaysAgo: 1 ] ) store.checkinRiskCalculationResult = CheckinRiskCalculationResult( calculationDate: calculationDate, checkinIdsWithRiskPerDate: [:], riskLevelPerDate: [:] ) default: store.enfRiskCalculationResult = ENFRiskCalculationResult( riskLevel: .low, minimumDistinctEncountersWithLowRisk: 0, minimumDistinctEncountersWithHighRisk: 0, mostRecentDateWithLowRisk: risk.details.mostRecentDateWithRiskLevel, mostRecentDateWithHighRisk: risk.details.mostRecentDateWithRiskLevel, numberOfDaysWithLowRisk: risk.details.numberOfDaysWithRiskLevel, numberOfDaysWithHighRisk: 0, calculationDate: calculationDate, riskLevelPerDate: [ today: .low, someDaysAgo: .low ], minimumDistinctEncountersWithHighRiskPerDate: [ today: 1, someDaysAgo: 1 ] ) store.checkinRiskCalculationResult = CheckinRiskCalculationResult( calculationDate: calculationDate, checkinIdsWithRiskPerDate: [:], riskLevelPerDate: [:] ) } successOnTargetQueue(risk: risk) } } // swiftlint:disable:next file_length #endif
37.084829
232
0.769982
2fbe22a679b8993af5bd620b56784690ee1f78f8
5,101
// // PerfectCRUDLogging.swift // PerfectCRUD // // Created by Kyle Jessup on 2017-11-24. // Copyright (C) 2017 PerfectlySoft, Inc. // //===----------------------------------------------------------------------===// // // This source file is part of the Perfect.org open source project // // Copyright (c) 2015 - 2017 PerfectlySoft Inc. and the Perfect project authors // Licensed under Apache License v2.0 // // See http://perfect.org/licensing.html for license information // //===----------------------------------------------------------------------===// // import Foundation import Dispatch public struct CRUDSQLGenError: Error, CustomStringConvertible { public let description: String public init(_ msg: String) { description = msg CRUDLogging.log(.error, msg) } } public struct CRUDSQLExeError: Error, CustomStringConvertible { public let description: String public init(_ msg: String) { description = msg CRUDLogging.log(.error, msg) } } public enum CRUDLogDestination { case none case console case file(String) case custom((CRUDLogEvent) -> ()) func handleEvent(_ event: CRUDLogEvent) { switch self { case .none: () case .console: print("\(event)") case .file(let name): let fm = FileManager() guard fm.isWritableFile(atPath: name) || fm.createFile(atPath: name, contents: nil, attributes: nil), let fileHandle = FileHandle(forWritingAtPath: name), let data = "\(event)\n".data(using: .utf8) else { print("[ERR] Unable to open file at \"\(name)\" to log event \(event)") return } defer { fileHandle.closeFile() } fileHandle.seekToEndOfFile() fileHandle.write(data) case .custom(let code): code(event) } } } public enum CRUDLogEventType: CustomStringConvertible { case info, warning, error, query public var description: String { switch self { case .info: return "INFO" case .warning: return "WARN" case .error: return "ERR" case .query: return "QUERY" } } } public struct CRUDLogEvent: CustomStringConvertible { public let time: Date public let type: CRUDLogEventType public let msg: String public var description: String { let formatter = DateFormatter() formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss ZZ" return "[\(formatter.string(from: time))] [\(type)] \(msg)" } } public struct CRUDLogging { private static var _queryLogDestinations: [CRUDLogDestination] = [.console] private static var _errorLogDestinations: [CRUDLogDestination] = [.console] private static var pendingEvents: [CRUDLogEvent] = [] private static var loggingQueue: DispatchQueue = { let q = DispatchQueue(label: "CRUDLoggingQueue", qos: .background) scheduleLogCheck(q) return q }() private static func logCheckReschedulingInSerialQueue() { logCheckInSerialQueue() scheduleLogCheck(loggingQueue) } private static func logCheckInSerialQueue() { guard !pendingEvents.isEmpty else { return } let eventsToLog = pendingEvents pendingEvents = [] eventsToLog.forEach { logEventInSerialQueue($0) } } private static func logEventInSerialQueue(_ event: CRUDLogEvent) { if case .query = event.type { _queryLogDestinations.forEach { $0.handleEvent(event) } } else { _errorLogDestinations.forEach { $0.handleEvent(event) } } } private static func scheduleLogCheck(_ queue: DispatchQueue) { queue.asyncAfter(deadline: .now() + 0.5, execute: logCheckReschedulingInSerialQueue) } } public extension CRUDLogging { static func flush() { loggingQueue.sync { logCheckInSerialQueue() } } static var queryLogDestinations: [CRUDLogDestination] { set { loggingQueue.async { _queryLogDestinations = newValue } } get { return loggingQueue.sync { return _queryLogDestinations } } } static var errorLogDestinations: [CRUDLogDestination] { set { loggingQueue.async { _errorLogDestinations = newValue } } get { return loggingQueue.sync { return _errorLogDestinations } } } static func log(_ type: CRUDLogEventType, _ msg: String) { let now = Date() #if DEBUG || Xcode loggingQueue.sync { pendingEvents.append(.init(time: now, type: type, msg: msg)) logCheckInSerialQueue() } #else loggingQueue.async { pendingEvents.append(.init(time: now, type: type, msg: msg)) } #endif } } public extension CRUDLogging{ static func log(_ type : CRUDLogEventType, _ msg : String, _ bindings : Bindings) { let now = Date() var msg = msg do { if bindings.count > 0 { let something = bindings.map { "\($0.0) = \'\($0.1.description)\' "} // print("\(msg) \nParms: \(something)") msg = msg + something.reduce("Parms", {"\($0) - \($1)"}) } #if DEBUG || Xcode loggingQueue.sync { pendingEvents.append(.init(time: now, type: type, msg: msg)) logCheckInSerialQueue() } #else loggingQueue.async { pendingEvents.append(.init(time: now, type: type, msg: msg)) } #endif } } }
26.430052
104
0.6485
4851f4aae91f932022a37bf2f79cc8328aa24ddc
10,616
// // JTACMonthView.swift // // Copyright (c) 2016-2020 JTAppleCalendar (https://github.com/patchthecode/JTAppleCalendar) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // import Foundation import UIKit let maxNumberOfDaysInWeek = 7 // Should not be changed let maxNumberOfRowsPerMonth = 6 // Should not be changed let developerErrorMessage = "There was an error in this code section. Please contact the developer on GitHub" let decorationViewID = "Are you ready for the life after this one?" let errorDelta: CGFloat = 0.0000001 /// An instance of JTAppleCalendarMonthView (or simply, a calendar view) is a /// means for displaying and interacting with a gridstyle layout of date-cells @available(*, unavailable, renamed: "JTACMonthView") open class JTAppleCalendarView: UICollectionView {} open class JTACMonthView: UICollectionView { /// Configures the size of your date cells @IBInspectable open var cellSize: CGFloat = 0 { didSet { if oldValue == cellSize { return } calendarViewLayout.invalidateLayout() } } /// Stores the first and last selected date cel open var selectedCells: ( first: (date: Date, indexPath: IndexPath)?, last: (date: Date, indexPath: IndexPath)? ) /// The scroll direction of the sections in JTAppleCalendar. open var scrollDirection: UICollectionView.ScrollDirection = .horizontal /// The configuration parameters setup by the developer in the confogureCalendar function open var cachedConfiguration: ConfigurationParameters? { return _cachedConfiguration } /// Enables/Disables the stretching of date cells. When enabled cells will stretch to fit the width of a month in case of a <= 5 row month. open var allowsDateCellStretching = true /// Alerts the calendar that range selection will be checked. If you are /// not using rangeSelection and you enable this, /// then whenever you click on a datecell, you may notice a very fast /// refreshing of the date-cells both left and right of the cell you /// just selected. @available(*, unavailable, renamed: "allowsRangedSelection") open var isRangeSelectionUsed: Bool = false open var allowsRangedSelection: Bool = false open var rangeSelectionMode: RangeSelectionMode = .segmented /// The object that acts as the delegate of the calendar view. open weak var calendarDelegate: JTACMonthViewDelegate? { didSet { lastMonthSize = sizesForMonthSection() } } /// The object that acts as the data source of the calendar view. open weak var calendarDataSource: JTACMonthViewDataSource? { didSet { setupMonthInfoAndMap() } // Refetch the data source for a data source change } var triggerScrollToDateDelegate: Bool? = true var isScrollInProgress = false var isReloadDataInProgress = false // Keeps track of scroll target location. If isScrolling, and user taps while scrolling var endScrollTargetLocation: CGFloat = 0 var lastMovedScrollDirection: CGFloat = 0 var generalDelayedExecutionClosure: [() -> Void] = [] var scrollDelayedExecutionClosure: [() -> Void] = [] let dateGenerator = JTAppleDateConfigGenerator.shared /// Implemented by subclasses to initialize a new object (the receiver) immediately after memory for it has been allocated. public init() { super.init(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) setupNewLayout(from: collectionViewLayout as! JTACMonthLayoutProtocol) } /// Initializes and returns a newly allocated collection view object with the specified frame and layout. @available( *, unavailable, message: "Please use JTAppleCalendarMonthView() instead. It manages its own layout." ) override public init(frame: CGRect, collectionViewLayout _: UICollectionViewLayout) { super.init(frame: frame, collectionViewLayout: UICollectionViewFlowLayout()) setupNewLayout(from: collectionViewLayout as! JTACMonthLayoutProtocol) } /// Initializes using decoder object public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setupNewLayout(from: collectionViewLayout as! JTACMonthLayoutProtocol) } // Configuration parameters from the dataSource var _cachedConfiguration: ConfigurationParameters! // Set the start of the month var startOfMonthCache: Date! // Set the end of month var endOfMonthCache: Date! var selectedCellData: [IndexPath: SelectedCellData] = [:] var pathsToReload: Set<IndexPath> = [] // Paths to reload because of prefetched cells var anchorDate: Date? var requestedContentOffset: CGPoint { var retval = CGPoint(x: -contentInset.left, y: -contentInset.top) guard let date = anchorDate else { return retval } // reset the initial scroll date once used. anchorDate = nil // Ensure date is within valid boundary let components = calendar.dateComponents([.year, .month, .day], from: date) let firstDayOfDate = calendar.date(from: components)! if !((firstDayOfDate >= startOfMonthCache!) && (firstDayOfDate <= endOfMonthCache!)) { return retval } // Get valid indexPath of date to scroll to let retrievedPathsFromDates = pathsFromDates([date]) if retrievedPathsFromDates.isEmpty { return retval } let sectionIndexPath = pathsFromDates([date])[0] if calendarViewLayout.thereAreHeaders, scrollDirection == .vertical { let indexPath = IndexPath(item: 0, section: sectionIndexPath.section) guard let attributes = calendarViewLayout.layoutAttributesForSupplementaryView( ofKind: UICollectionView.elementKindSectionHeader, at: indexPath ) else { return retval } let maxYCalendarOffset = max(0, contentSize.height - frame.size.height) retval = CGPoint( x: attributes.frame.origin.x, y: min(maxYCalendarOffset, attributes.frame.origin.y) ) // if self.scrollDirection == .horizontal { topOfHeader.x += extraAddedOffset} else { topOfHeader.y += extraAddedOffset } } else { switch scrollingMode { case .stopAtEach, .stopAtEachSection, .stopAtEachCalendarFrame: if scrollDirection == .horizontal || (scrollDirection == .vertical && !calendarViewLayout.thereAreHeaders) { retval = targetPointForItemAt(indexPath: sectionIndexPath) ?? retval } default: break } } return retval } var _sectionInset: UIEdgeInsets = .zero open var sectionInset: UIEdgeInsets { set { _sectionInset.top = newValue.top < 0 ? 0 : newValue.top _sectionInset.bottom = newValue.bottom < 0 ? 0 : newValue.bottom _sectionInset.left = newValue.left < 0 ? 0 : newValue.left _sectionInset.right = newValue.right < 0 ? 0 : newValue.right } get { return _sectionInset } } var _minimumInteritemSpacing: CGFloat = 0 open var minimumInteritemSpacing: CGFloat { set { _minimumInteritemSpacing = newValue < 0 ? 0 : newValue } get { return _minimumInteritemSpacing } } var _minimumLineSpacing: CGFloat = 0 open var minimumLineSpacing: CGFloat { set { _minimumLineSpacing = newValue < 0 ? 0 : newValue } get { return _minimumLineSpacing } } lazy var theData: CalendarData = { self.setupMonthInfoDataForStartAndEndDate() }() var lastMonthSize: [AnyHashable: CGFloat] = [:] var monthMap: [Int: Int] { get { return theData.sectionToMonthMap } set { theData.sectionToMonthMap = newValue } } var decelerationRateMatchingScrollingMode: CGFloat { switch scrollingMode { case .stopAtEachCalendarFrame: return UIScrollView.DecelerationRate.fast.rawValue case .stopAtEach, .stopAtEachSection: return UIScrollView.DecelerationRate.fast.rawValue case .nonStopToSection, .nonStopToCell, .nonStopTo, .none: return UIScrollView.DecelerationRate.normal.rawValue } } /// Configure the scrolling behavior open var scrollingMode: ScrollingMode = .stopAtEachCalendarFrame { didSet { decelerationRate = UIScrollView .DecelerationRate(rawValue: decelerationRateMatchingScrollingMode) #if os(iOS) switch scrollingMode { case .stopAtEachCalendarFrame: isPagingEnabled = true default: isPagingEnabled = false } #endif } } } extension JTACMonthView { /// A semantic description of the view’s contents, used to determine whether the view should be flipped when switching between left-to-right and right-to-left layouts. override open var semanticContentAttribute: UISemanticContentAttribute { didSet { var superviewIsRTL = false if let validSuperView = superview? .effectiveUserInterfaceLayoutDirection { superviewIsRTL = validSuperView == .rightToLeft && semanticContentAttribute == .unspecified } transform.a = semanticContentAttribute == .forceRightToLeft || superviewIsRTL ? -1 : 1 } } }
41.795276
171
0.680671
d60405fb60f3578b9df6d48886ca017f30a24584
168
import Foundation @testable import IzzyParser @objcMembers class ThrowableResource: Resource { required init(id: String) { super.init(id: id) } }
16.8
48
0.678571
1643d5651e2f39fc1d548ecfd4fc52d2f48a2c9e
133
// // RootInputModelProtocol.swift // // Created by Benedek Varga on 2020. 04. 07.. // public protocol RootInputModelProtocol { }
16.625
46
0.706767
fc6f0417a0c0d7e97946d2396a0a37b3ee488a11
6,164
class Foo { var x: Int = 0 var y: Int = 0 func fooMethod() {} } struct Bar { var a: Int = 0 var b: Int = 0 func barMethod() {} } var globalValImplicit: Foo { Bar(). } var globalValGetSet: Foo { get { Foo(). } set { Bar(). } } enum S { var foo: Foo var bar: Bar var propertyImplicit: Foo { foo. } var propertyGetSet: Foo { get { bar. } set { foo. } } subscript(idx: Foo) -> Foo { idx. } subscript(idx: Bar) -> Foo { get { idx. } set { idx. } } } // Enabled. // RUN: %sourcekitd-test \ // RUN: -req=track-compiles == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=12:9 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=15:15 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:15 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=23:9 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=26:15 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=27:15 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=30:9 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=33:15 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=34:15 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=12:1 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=23:1 %s -- %s == \ // RUN: -req=complete -req-opts=reuseastcontext=1 -pos=16:1 %s -- %s > %t.response // RUN: %FileCheck --check-prefix=RESULT %s < %t.response // RUN: %FileCheck --check-prefix=TRACE %s < %t.response // globalValImplicit // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "barMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "a" // RESULT-DAG: key.name: "b" // RESULT: ] // globalValGetSet(get) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "fooMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "x" // RESULT-DAG: key.name: "y" // RESULT: ] // globalValGetSet(set) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "barMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "a" // RESULT-DAG: key.name: "b" // RESULT: ] // propertyImplicit // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "fooMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "x" // RESULT-DAG: key.name: "y" // RESULT: ] // propertyGetSet(get) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "barMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "a" // RESULT-DAG: key.name: "b" // RESULT: ] // propertyGetSet(set) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "fooMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "x" // RESULT-DAG: key.name: "y" // RESULT: ] // subscript(implicit getter) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "fooMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "x" // RESULT-DAG: key.name: "y" // RESULT: ] // subscript(get) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "barMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "a" // RESULT-DAG: key.name: "b" // RESULT: ] // subscript(set) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.name: "barMethod()" // RESULT-DAG: key.name: "self" // RESULT-DAG: key.name: "a" // RESULT-DAG: key.name: "b" // RESULT: ] // accessor top (global var) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.description: "get" // RESULT-DAG: key.description: "set" // RESULT-DAG: key.description: "willSet" // RESULT-DAG: key.description: "didSet" // RESULT-DAG: key.description: "Foo" // RESULT: ] // accessor top (property) // RESULT-LABEL: key.results: [ // RESULT-DAG: key.description: "get" // RESULT-DAG: key.description: "set" // RESULT-DAG: key.description: "willSet" // RESULT-DAG: key.description: "didSet" // RESULT-DAG: key.description: "Foo" // RESULT: ] // accessor second (global var) // RESULT-LABEL: key.results: [ // RESULT-NOT: key.description: "Foo" // RESULT-DAG: key.description: "get" // RESULT-DAG: key.description: "set" // RESULT-DAG: key.description: "willSet" // RESULT-DAG: key.description: "didSet" // RESULT: ] // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE-NOT: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE: key.description: "completion reusing previous ASTContext (benign diagnostic)" // TRACE-LABEL: key.notification: source.notification.compile-did-finish, // TRACE-NOT: key.description: "completion reusing previous ASTContext (benign diagnostic)"
36.258824
91
0.673589
de7afce1b5a4b22edaca5ddb362a0a634f565f14
1,491
import DateProviderTestHelpers import MetricsExtensions import MetricsTestHelpers import QueueModels import SimulatorPool import SimulatorPoolModels import SimulatorPoolTestHelpers import SynchronousWaiter import Tmp import XCTest final class SimulatorPoolConvenienceTests: XCTestCase { private lazy var dateProvider = DateProviderFixture() private lazy var simulatorOperationTimeouts = SimulatorOperationTimeouts(create: 1, boot: 2, delete: 3, shutdown: 4, automaticSimulatorShutdown: 5, automaticSimulatorDelete: 6) private lazy var version = Version(value: "version") func test__simulator_contoller_frees__upon_release() throws { let pool = SimulatorPoolMock() let allocatedSimulator = try pool.allocateSimulator( dateProvider: dateProvider, logger: .noOp, simulatorOperationTimeouts: simulatorOperationTimeouts, version: version, globalMetricRecorder: GlobalMetricRecorderImpl() ) allocatedSimulator.releaseSimulator() guard let fakeSimulatorController = pool.freedSimulatorContoller as? FakeSimulatorController else { return XCTFail("Unexpected behaviour") } XCTAssertEqual( allocatedSimulator.simulator, fakeSimulatorController.simulator ) XCTAssertEqual( fakeSimulatorController.simulatorOperationTimeouts, simulatorOperationTimeouts ) } }
35.5
180
0.720322
d68b6fba5f3b7ce56268b89793598c03e03bace5
23,038
/* * Copyright 2019 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import UIKit import third_party_objective_c_material_components_ios_components_Dialogs_Dialogs /// The primary view controller for Science Journal which owns the navigation controller and manages /// all other flows and view controllers. class AppFlowViewController: UIViewController { /// The account user manager for the current account. Exposed for testing. If the current /// account's ID matches the existing accountUserManager account ID, this returns the existing /// manager. If not, a new manager is created for the current account and returned. var currentAccountUserManager: AccountUserManager? { guard let account = accountsManager.currentAccount else { return nil } if _currentAccountUserManager == nil || _currentAccountUserManager!.account.ID != account.ID { _currentAccountUserManager = AccountUserManager(account: account, driveConstructor: driveConstructor, networkAvailability: networkAvailability, sensorController: sensorController, analyticsReporter: analyticsReporter) } return _currentAccountUserManager } private var _currentAccountUserManager: AccountUserManager? /// The device preference manager. Exposed for testing. let devicePreferenceManager = DevicePreferenceManager() /// The root user manager. Exposed for testing. let rootUserManager: RootUserManager /// The accounts manager. Exposed so the AppDelegate can ask for reauthentication and related /// tasks, as well as testing. let accountsManager: AccountsManager private let analyticsReporter: AnalyticsReporter private let commonUIComponents: CommonUIComponents private let drawerConfig: DrawerConfig private let driveConstructor: DriveConstructor private var existingDataMigrationManager: ExistingDataMigrationManager? private var existingDataOptionsVC: ExistingDataOptionsViewController? private let feedbackReporter: FeedbackReporter private let networkAvailability: NetworkAvailability private let queue = GSJOperationQueue() private let sensorController: SensorController private var shouldShowPreferenceMigrationMessage = false /// The current user flow view controller, if it exists. private weak var userFlowViewController: UserFlowViewController? #if FEATURE_FIREBASE_RC private var remoteConfigManager: RemoteConfigManager? /// Convenience initializer. /// /// - Parameters: /// - accountsManager: The accounts manager. /// - analyticsReporter: The analytics reporter. /// - commonUIComponents: Common UI components. /// - drawerConfig: The drawer config. /// - driveConstructor: The drive constructor. /// - feedbackReporter: The feedback reporter. /// - networkAvailability: Network availability. /// - remoteConfigManager: The remote config manager. /// - sensorController: The sensor controller. convenience init(accountsManager: AccountsManager, analyticsReporter: AnalyticsReporter, commonUIComponents: CommonUIComponents, drawerConfig: DrawerConfig, driveConstructor: DriveConstructor, feedbackReporter: FeedbackReporter, networkAvailability: NetworkAvailability, remoteConfigManager: RemoteConfigManager, sensorController: SensorController) { self.init(accountsManager: accountsManager, analyticsReporter: analyticsReporter, commonUIComponents: commonUIComponents, drawerConfig: drawerConfig, driveConstructor: driveConstructor, feedbackReporter: feedbackReporter, networkAvailability: networkAvailability, sensorController: sensorController) self.remoteConfigManager = remoteConfigManager } #endif /// Designated initializer. /// /// - Parameters: /// - accountsManager: The accounts manager. /// - analyticsReporter: The analytics reporter. /// - commonUIComponents: Common UI components. /// - drawerConfig: The drawer config. /// - driveConstructor: The drive constructor. /// - feedbackReporter: The feedback reporter. /// - networkAvailability: Network availability. /// - sensorController: The sensor controller. init(accountsManager: AccountsManager, analyticsReporter: AnalyticsReporter, commonUIComponents: CommonUIComponents, drawerConfig: DrawerConfig, driveConstructor: DriveConstructor, feedbackReporter: FeedbackReporter, networkAvailability: NetworkAvailability, sensorController: SensorController) { self.accountsManager = accountsManager self.analyticsReporter = analyticsReporter self.commonUIComponents = commonUIComponents self.drawerConfig = drawerConfig self.driveConstructor = driveConstructor self.feedbackReporter = feedbackReporter self.networkAvailability = networkAvailability self.sensorController = sensorController rootUserManager = RootUserManager(sensorController: sensorController) super.init(nibName: nil, bundle: nil) // Register as the delegate for AccountsManager. self.accountsManager.delegate = self // If a user should be forced to sign in from outside the sign in flow (e.g. their account was // invalid on foreground or they deleted an account), this notification will be fired. NotificationCenter.default.addObserver(self, selector: #selector(forceSignInViaNotification), name: .userWillBeSignedOut, object: nil) #if SCIENCEJOURNAL_DEV_BUILD || SCIENCEJOURNAL_DOGFOOD_BUILD // If we should create root user data to test the claim flow, this notification will be fired. NotificationCenter.default.addObserver(self, selector: #selector(debug_createRootUserData), name: .DEBUG_createRootUserData, object: nil) // If we should create root user data and force auth to test the migration flow, this // notification will be fired. NotificationCenter.default.addObserver(self, selector: #selector(debug_forceAuth), name: .DEBUG_forceAuth, object: nil) #endif // SCIENCEJOURNAL_DEV_BUILD || SCIENCEJOURNAL_DOGFOOD_BUILD } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) is not supported") } deinit { NotificationCenter.default.removeObserver(self) } override func viewDidLoad() { super.viewDidLoad() configureInitialLoadingView() func accountsSupported() { accountsManager.signInAsCurrentAccount() } func accountsNotSupported() { showNonAccountUser(animated: false) } if accountsManager.supportsAccounts { accountsSupported() } else { accountsNotSupported() } } override var preferredStatusBarStyle: UIStatusBarStyle { return children.last?.preferredStatusBarStyle ?? .lightContent } private func showCurrentUserOrSignIn() { guard let accountUserManager = currentAccountUserManager else { print("[AppFlowViewController] No current account user manager, must sign in.") showSignIn() return } let existingDataMigrationManager = ExistingDataMigrationManager(accountUserManager: accountUserManager, rootUserManager: rootUserManager) let accountUserFlow = UserFlowViewController( accountsManager: accountsManager, analyticsReporter: analyticsReporter, commonUIComponents: commonUIComponents, devicePreferenceManager: devicePreferenceManager, drawerConfig: drawerConfig, existingDataMigrationManager: existingDataMigrationManager, feedbackReporter: feedbackReporter, networkAvailability: networkAvailability, sensorController: sensorController, shouldShowPreferenceMigrationMessage: shouldShowPreferenceMigrationMessage, userManager: accountUserManager) accountUserFlow.delegate = self userFlowViewController = accountUserFlow transitionToViewControllerModally(accountUserFlow) // Set to false now so we don't accidently cache true and show it again when we don't want to. shouldShowPreferenceMigrationMessage = false } private func showNonAccountUser(animated: Bool) { let userFlow = UserFlowViewController(accountsManager: accountsManager, analyticsReporter: analyticsReporter, commonUIComponents: commonUIComponents, devicePreferenceManager: devicePreferenceManager, drawerConfig: drawerConfig, existingDataMigrationManager: nil, feedbackReporter: feedbackReporter, networkAvailability: networkAvailability, sensorController: sensorController, shouldShowPreferenceMigrationMessage: false, userManager: rootUserManager) userFlow.delegate = self userFlowViewController = userFlow transitionToViewControllerModally(userFlow, animated: animated) } // Transitions to the sign in flow with an optional completion block to fire when the flow // has been shown. private func showSignIn(completion: (() -> Void)? = nil) { let signInFlow = SignInFlowViewController(accountsManager: accountsManager, analyticsReporter: analyticsReporter, rootUserManager: rootUserManager, sensorController: sensorController) signInFlow.delegate = self transitionToViewControllerModally(signInFlow, completion: completion) } /// Handles a file import URL if possible. /// /// - Parameter url: A file URL. /// - Returns: True if the URL can be handled, otherwise false. func handleImportURL(_ url: URL) -> Bool { guard let userFlowViewController = userFlowViewController else { showSnackbar(withMessage: String.importSignInError) return false } return userFlowViewController.handleImportURL(url) } // MARK: - Private // Wrapper method for use with notifications, where notifications would attempt to push their // notification object into the completion argument of `forceUserSignIn` incorrectly. @objc func forceSignInViaNotification() { tearDownCurrentUser() showSignIn() } private func handlePermissionDenial() { // Remove the current account and force the user to sign in. accountsManager.signOutCurrentAccount() showSignIn { // Show an alert messaging that permission was denied if we can grab the top view controller. // The top view controller is required to present an alert. It should be the sign in flow view // controller. guard let topVC = self.children.last else { return } let alertController = MDCAlertController(title: String.serverPermissionDeniedTitle, message: String.serverPermissionDeniedMessage) alertController.addAction(MDCAlertAction(title: String.serverSwitchAccountsTitle, handler: { (_) in self.presentAccountSelector() })) alertController.addAction(MDCAlertAction(title: String.actionOk)) alertController.accessibilityViewIsModal = true topVC.present(alertController, animated: true) } analyticsReporter.track(.signInPermissionDenied) } /// Migrates preferences and removes bluetooth devices if this account is signing in for the first /// time. /// /// - Parameter accountID: The account ID. /// - Returns: Whether the user should be messaged saying that preferences were migrated. private func migratePreferencesAndRemoveBluetoothDevicesIfNeeded(forAccountID accountID: String) -> Bool { // If an account does not yet have a directory, this is its first time signing in. Each new // account should have preferences migrated from the root user. let shouldMigratePrefs = !AccountUserManager.hasRootDirectoryForAccount(withID: accountID) if shouldMigratePrefs, let accountUserManager = currentAccountUserManager { let existingDataMigrationManager = ExistingDataMigrationManager(accountUserManager: accountUserManager, rootUserManager: rootUserManager) existingDataMigrationManager.migratePreferences() existingDataMigrationManager.removeAllBluetoothDevices() } let wasAppUsedByRootUser = rootUserManager.hasExperimentsDirectory return wasAppUsedByRootUser && shouldMigratePrefs } private func performMigrationIfNeededAndContinueSignIn() { guard let accountID = accountsManager.currentAccount?.ID else { sjlog_error("Accounts manager does not have a current account after sign in flow completion.", category: .general) // This method should never be called if the current user doesn't exist but in case of error, // show sign in again. showSignIn() return } // Unwrapping `currentAccountUserManager` would initialize a new instance of the account manager // if a current account exists. This creates the account's directory. However, the migration // method checks to see if this directory exists or not, so we must not call it until after // migration. shouldShowPreferenceMigrationMessage = migratePreferencesAndRemoveBluetoothDevicesIfNeeded(forAccountID: accountID) // Show the migration options if a choice has never been selected. guard !devicePreferenceManager.hasAUserChosenAnExistingDataMigrationOption else { showCurrentUserOrSignIn() return } guard let accountUserManager = currentAccountUserManager else { // This delegate method should never be called if the current user doesn't exist but in case // of error, show sign in again. showSignIn() return } let existingDataMigrationManager = ExistingDataMigrationManager(accountUserManager: accountUserManager, rootUserManager: rootUserManager) if existingDataMigrationManager.hasExistingExperiments { self.existingDataMigrationManager = existingDataMigrationManager let existingDataOptionsVC = ExistingDataOptionsViewController( analyticsReporter: analyticsReporter, numberOfExistingExperiments: existingDataMigrationManager.numberOfExistingExperiments) self.existingDataOptionsVC = existingDataOptionsVC existingDataOptionsVC.delegate = self transitionToViewControllerModally(existingDataOptionsVC) } else { showCurrentUserOrSignIn() } } /// Prepares an existing user to be removed from memory. This is non-descrtuctive in terms of /// the user's local data. It should be called when a user is logging out, being removed, or /// changing to a new user. private func tearDownCurrentUser() { _currentAccountUserManager?.tearDown() _currentAccountUserManager = nil userFlowViewController = nil } private func configureInitialLoadingView() { // Grab a copy of the launch storyboard view controller and transition to it, which makes it // look like the app is still loading. let launchVC = UIStoryboard(name: "LaunchScreen", bundle: Bundle.currentBundle) .instantiateViewController(withIdentifier: "viewController") as UIViewController transitionToViewController(launchVC, animated: false) } /// Uses a modal UI operation to transition to a view controller. /// /// - Parameters: /// - viewController: The view controller. /// - animated: Whether to animate. /// - minimumDisplaySeconds: The minimum number of seconds to display the view controller for. /// - completion: Called when finished transitioning to the view controller. private func transitionToViewControllerModally(_ viewController: UIViewController, animated: Bool = true, withMinimumDisplaySeconds minimumDisplaySeconds: Double? = nil, completion: (() -> Void)? = nil) { let showViewControllerOp = GSJBlockOperation(mainQueueBlock: { [unowned self] finish in self.transitionToViewController(viewController, animated: animated) { completion?() if let minimumDisplaySeconds = minimumDisplaySeconds { DispatchQueue.main.asyncAfter(deadline: .now() + minimumDisplaySeconds) { finish() } } else { finish() } } }) showViewControllerOp.addCondition(MutuallyExclusive.modalUI) queue.addOperation(showViewControllerOp) } } // MARK: - AccountsManagerDelegate extension AppFlowViewController: AccountsManagerDelegate { func deleteAllUserDataForIdentity(withID identityID: String) { // Remove the persistent store before deleting the DB files to avoid a log error. Use // `_currentAccountUserManager`, because `currentAccountUserManager` will return nil because // `accountsManager.currentAccount` is now nil. Also, remove the current account user manager so // the sensor data manager is recreated if this same user logs back in immediately. _currentAccountUserManager?.sensorDataManager.removeStore() tearDownCurrentUser() do { try AccountDeleter(accountID: identityID).deleteData() } catch { print("Failed to delete user data: \(error.localizedDescription)") } } func accountsManagerWillBeginSignIn(signInType: SignInType) { switch signInType { case .newSignIn: transitionToViewControllerModally(LoadingViewController(), withMinimumDisplaySeconds: 0.5) case .restoreCachedAccount: break } } func accountsManagerSignInComplete(signInResult: SignInResult, signInType: SignInType) { switch signInResult { case .accountChanged: switch signInType { case .newSignIn: // Wait for the permissions check to finish before showing UI. break case .restoreCachedAccount: showCurrentUserOrSignIn() } case .forceSignIn: tearDownCurrentUser() showCurrentUserOrSignIn() case .noAccountChange: break } } func accountsManagerPermissionCheckComplete(permissionState: PermissionState, signInType: SignInType) { switch signInType { case .newSignIn: switch permissionState { case .granted: tearDownCurrentUser() performMigrationIfNeededAndContinueSignIn() case .denied: handlePermissionDenial() } case .restoreCachedAccount: switch permissionState { case .granted: // UI was shown when sign in completed. break case .denied: handlePermissionDenial() } } } } // MARK: - ExistingDataOptionsDelegate extension AppFlowViewController: ExistingDataOptionsDelegate { func existingDataOptionsViewControllerDidSelectSaveAllExperiments() { guard let existingDataOptionsVC = existingDataOptionsVC else { return } devicePreferenceManager.hasAUserChosenAnExistingDataMigrationOption = true let spinnerViewController = SpinnerViewController() spinnerViewController.present(fromViewController: existingDataOptionsVC) { self.existingDataMigrationManager?.migrateAllExperiments(completion: { (errors) in spinnerViewController.dismissSpinner() { self.showCurrentUserOrSignIn() if !errors.isEmpty { showSnackbar(withMessage: String.claimExperimentsErrorMessage) } } }) } } func existingDataOptionsViewControllerDidSelectDeleteAllExperiments() { devicePreferenceManager.hasAUserChosenAnExistingDataMigrationOption = true existingDataMigrationManager?.removeAllExperimentsFromRootUser() showCurrentUserOrSignIn() } func existingDataOptionsViewControllerDidSelectSelectExperimentsToSave() { devicePreferenceManager.hasAUserChosenAnExistingDataMigrationOption = true // If the user wants to manually select experiments to claim, nothing needs to be done now. They // will see the option to claim experiments in the experiments list. showCurrentUserOrSignIn() } } // MARK: - SignInFlowViewControllerDelegate extension AppFlowViewController: SignInFlowViewControllerDelegate { func signInFlowDidCompleteWithoutAccount() { showNonAccountUser(animated: true) } } // MARK: - UserFlowViewControllerDelegate extension AppFlowViewController: UserFlowViewControllerDelegate { func presentAccountSelector() { accountsManager.presentSignIn(fromViewController: self) } } #if SCIENCEJOURNAL_DEV_BUILD || SCIENCEJOURNAL_DOGFOOD_BUILD // MARK: - Debug additions for creating data and testing claim and migration flows in-app. extension AppFlowViewController { @objc private func debug_createRootUserData() { guard let settingsVC = userFlowViewController?.settingsVC else { return } let spinnerVC = SpinnerViewController() spinnerVC.present(fromViewController: settingsVC) { self.rootUserManager.metadataManager.debug_createRootUserData() { DispatchQueue.main.async { self.userFlowViewController?.experimentsListVC?.refreshUnclaimedExperiments() spinnerVC.dismissSpinner() } } } } @objc private func debug_forceAuth() { devicePreferenceManager.hasAUserChosenAnExistingDataMigrationOption = false devicePreferenceManager.hasAUserCompletedPermissionsGuide = false NotificationCenter.default.post(name: .DEBUG_destroyCurrentUser, object: nil, userInfo: nil) showSignIn() } } #endif // SCIENCEJOURNAL_DEV_BUILD || SCIENCEJOURNAL_DOGFOOD_BUILD
41.584838
100
0.703056
091b2665abdb23441bf0395b66fe049d174a90d7
1,066
// // CategoryCollectionViewCell.swift // FamilyPocket // // Created by Sapozhnik Ivan on 13/05/17. // Copyright © 2017 Ivan Sapozhnik. All rights reserved. // import UIKit class CategoryCollectionViewCell: UICollectionViewCell { @IBOutlet weak var titleLabel: UILabel! @IBOutlet weak var iconView: UIImageView! @IBOutlet weak var iconLeftConstraint: NSLayoutConstraint! override func awakeFromNib() { super.awakeFromNib() } func bind(categoryName: String, color: UIColor, icon: UIImage?) { titleLabel.text = categoryName contentView.backgroundColor = color iconView.image = icon } func animate() { self.iconLeftConstraint.constant = -30.0 self.contentView.layoutIfNeeded() UIView.animate(withDuration: 0.3, delay: 0.3, usingSpringWithDamping: 0.6, initialSpringVelocity: 0.0, options: [], animations: { self.iconLeftConstraint.constant = 20.0 self.contentView.layoutIfNeeded() }, completion: nil) } }
28.052632
137
0.661351
89d1828065699954d2b1f3ee4ea84d65360e4fab
1,351
// RUN: %target-swift-remoteast-test %s | %FileCheck %s // REQUIRES: swift-remoteast-test @_silgen_name("printDynamicTypeAndAddressForExistential") func printDynamicTypeAndAddressForExistential<T>(_: T) struct MyStruct<T, U, V> { let x: T let y: U let z: V } // Case one, small opaque (fits into the inline buffer). // CHECK: MyStruct<Int, Int, Int> let smallStruct = MyStruct(x : 1, y: 2, z: 3) printDynamicTypeAndAddressForExistential(smallStruct as Any) // Case two, large opaque (boxed representation). // CHECK-NEXT: MyStruct<(Int, Int, Int), (Int, Int, Int), (Int, Int, Int)> let largeStruct = MyStruct(x: (1,1,1), y: (2,2,2), z: (3,3,3)) printDynamicTypeAndAddressForExistential(largeStruct as Any) class MyClass<T, U> { let x: T let y: (T, U) init(x: T, y: (T, U)) { self.x = x self.y = y } } // Case three, class existential (adheres to AnyObject protocol).a // CHECK-NEXT: MyClass<Int, Int> let mc = MyClass(x : 23, y : (42, 44)) as AnyObject printDynamicTypeAndAddressForExistential(mc) enum MyError : Error { case a case b } // Case four: error existential. // CHECK-NEXT: MyError let q : Error = MyError.a printDynamicTypeAndAddressForExistential(q) // Case five: existential metatypes. // CHECK-NEXT: Any.Type let metatype : Any.Type = Any.self printDynamicTypeAndAddressForExistential(metatype)
25.980769
74
0.700962
480cf9153db623878f4dc186b67edb3cab50d8ff
3,188
// -*- swift -*- //===----------------------------------------------------------------------===// // Automatically Generated From validation-test/stdlib/Slice/Inputs/Template.swift.gyb // Do Not Edit Directly! //===----------------------------------------------------------------------===// // RUN: %target-run-simple-swift // REQUIRES: executable_test // FIXME: the test is too slow when the standard library is not optimized. // REQUIRES: optimized_stdlib import StdlibUnittest import StdlibCollectionUnittest var SliceTests = TestSuite("Collection") let prefix: [Int] = [-9999, -9998, -9997] let suffix: [Int] = [] func makeCollection(elements: [OpaqueValue<Int>]) -> Slice<DefaultedBidirectionalCollection<OpaqueValue<Int>>> { var baseElements = prefix.map(OpaqueValue.init) baseElements.append(contentsOf: elements) baseElements.append(contentsOf: suffix.map(OpaqueValue.init)) let base = DefaultedBidirectionalCollection(elements: baseElements) let startIndex = base.index( base.startIndex, offsetBy: numericCast(prefix.count)) let endIndex = base.index( base.startIndex, offsetBy: numericCast(prefix.count + elements.count)) return Slice(base: base, bounds: startIndex..<endIndex) } func makeCollectionOfEquatable(elements: [MinimalEquatableValue]) -> Slice<DefaultedBidirectionalCollection<MinimalEquatableValue>> { var baseElements = prefix.map(MinimalEquatableValue.init) baseElements.append(contentsOf: elements) baseElements.append(contentsOf: suffix.map(MinimalEquatableValue.init)) let base = DefaultedBidirectionalCollection(elements: baseElements) let startIndex = base.index( base.startIndex, offsetBy: numericCast(prefix.count)) let endIndex = base.index( base.startIndex, offsetBy: numericCast(prefix.count + elements.count)) return Slice(base: base, bounds: startIndex..<endIndex) } func makeCollectionOfComparable(elements: [MinimalComparableValue]) -> Slice<DefaultedBidirectionalCollection<MinimalComparableValue>> { var baseElements = prefix.map(MinimalComparableValue.init) baseElements.append(contentsOf: elements) baseElements.append(contentsOf: suffix.map(MinimalComparableValue.init)) let base = DefaultedBidirectionalCollection(elements: baseElements) let startIndex = base.index( base.startIndex, offsetBy: numericCast(prefix.count)) let endIndex = base.index( base.startIndex, offsetBy: numericCast(prefix.count + elements.count)) return Slice(base: base, bounds: startIndex..<endIndex) } var resiliencyChecks = CollectionMisuseResiliencyChecks.all resiliencyChecks.creatingOutOfBoundsIndicesBehavior = .trap resiliencyChecks.subscriptOnOutOfBoundsIndicesBehavior = .trap resiliencyChecks.subscriptRangeOnOutOfBoundsRangesBehavior = .trap SliceTests.addBidirectionalCollectionTests( "Slice_Of_DefaultedBidirectionalCollection_WithPrefix.swift.", makeCollection: makeCollection, wrapValue: identity, extractValue: identity, makeCollectionOfEquatable: makeCollectionOfEquatable, wrapValueIntoEquatable: identityEq, extractValueFromEquatable: identityEq, resiliencyChecks: resiliencyChecks, outOfBoundsIndexOffset: 6 ) runAllTests()
37.505882
86
0.751568
8f9b0054ec8adbd8ac62924ac111a2b3342b35b7
1,045
import Foundation import SVProgressHUD import Toast_Swift class CommonClass: NSObject { static let shared: CommonClass = { return CommonClass() }() var isProgressViewAdded = false // MARK: - Use this method to show loader func showLoader() { guard !isProgressViewAdded else { return } isProgressViewAdded = true DispatchQueue.main.async { SVProgressHUD.show() } } // MARK: - Use this method to hide loader func hideLoader() { guard isProgressViewAdded else { return } isProgressViewAdded = false DispatchQueue.main.async { SVProgressHUD.dismiss() } } // MARK: - Use this method to show toast message func showToastWithTitle(messageBody: String, onViewController viewController: UIViewController?) { guard let viewController = viewController else { return } viewController.view.makeToast(messageBody) } }
24.880952
102
0.604785
d6327914bdb273c26d78a8503f71286e649a852a
496
// // TupleMapTests.swift // Collections // // Created by James Bean on 2/2/17. // // import XCTest import Collections class TupleMapTests: XCTestCase { func testMapAB() { XCTAssert(map(1,2) { $0 * 2 } == (2,4)) } func testMapABC() { XCTAssert(map(1,2,3) { $0 * 3 } == (3,6,9)) } func testMapTupleAB() { XCTAssert(map((1,2)) { $0 * 2 } == (2,4)) } func testMapTupleABC() { XCTAssert(map((1,2,3)) { $0 * 3 } == (3,6,9)) } }
16.533333
53
0.504032
d5c6f63c8c8d233dfe20c15d5272258aa46ddc10
1,145
// // a_28_ImplementStrStr.swift // LeetCode // // Created by Nail Sharipov on 26.02.2020. // Copyright © 2020 Nail Sharipov. All rights reserved. // import Foundation class ImplementStrStr { func strStr(_ haystack: String, _ needle: String) -> Int { guard !needle.isEmpty else { return 0 } var result = -1 [Character](haystack).withUnsafeBufferPointer() { buffer in var i = 0 let m = needle.count let n = buffer.count &- m next_char: while i <= n { var a = buffer[i] var j = 0 for b in needle { if a == b { j &+= 1 if j < m { a = buffer[i &+ j] } else { break } } else { i &+= 1 continue next_char } } result = i break } } return result } }
24.891304
67
0.371179
26d36f9653cf83f559c3ee1e1714803eb5aea38c
1,925
/** * Copyright © 2019 Aga Khan Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/ import UIKit extension UIImage { convenience init?(color: UIColor, size: CGSize = CGSize(width: 1.0, height: 1.0)) { let rect = CGRect(origin: .zero, size: size) UIGraphicsBeginImageContext(rect.size) color.setFill() UIRectFill(rect) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() guard let cgImage = image?.cgImage else { return nil } self.init(cgImage: cgImage) } }
40.957447
85
0.748571
03430bd43ef8524054a88c4d57ec892975ddcc8a
649
// // UICollectionViewElementKind.swift // ReusableViews // // Created by Hesham Salman on 5/11/17. // // import Foundation /// Convenience enumeration for UICollectionView supplementary view types public enum UICollectionViewElementKind { case sectionHeader, sectionFooter var type: String { switch self { case .sectionFooter: return UICollectionView.elementKindSectionFooter case .sectionHeader: return UICollectionView.elementKindSectionHeader } } static var all: [UICollectionViewElementKind] { return [.sectionHeader, .sectionFooter] } static var count: Int { return all.count } }
19.666667
73
0.724191
f56debd584c99fe8827b698fc2e28c8c0924a897
1,779
// // ResultTableViewController.swift // SoolyWeather // // Created by SoolyChristina on 2017/3/24. // Copyright © 2017年 SoolyChristina. All rights reserved. // import UIKit private let resultCell = "resultCell" class ResultTableViewController: UITableViewController { var resultArray:[String] = [] var isFrameChange = false /// 点击cell回调闭包 var callBack: () -> () = {} override func viewDidLoad() { super.viewDidLoad() // 控制器根据所在界面的status bar,navigationbar,与tabbar的高度,不自动调整scrollview的 inset self.automaticallyAdjustsScrollViewInsets = false tableView.register(UITableViewCell.self, forCellReuseIdentifier: resultCell) } override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return resultArray.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: resultCell, for: indexPath) cell.textLabel?.text = resultArray[indexPath.row] return cell } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let cell = tableView.cellForRow(at: indexPath) // 请求数据 NetworkManager.weatherData(cityName: cell?.textLabel?.text ?? "") callBack() } override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() if isFrameChange == false { view.frame = CGRect(x: 0, y: 64, width: ScreenWidth, height: ScreenHeight - 64) isFrameChange = true } } }
29.65
109
0.663856
d6aa90f1b6b6407c9c4cf549a2ccd4eeb5a7a3bc
2,693
import Foundation import azureSwiftRuntime public protocol GlobalSchedulesGet { var headerParameters: [String: String] { get set } var subscriptionId : String { get set } var resourceGroupName : String { get set } var name : String { get set } var expand : String? { get set } var apiVersion : String { get set } func execute(client: RuntimeClient, completionHandler: @escaping (ScheduleProtocol?, Error?) -> Void) -> Void ; } extension Commands.GlobalSchedules { // Get get schedule. internal class GetCommand : BaseCommand, GlobalSchedulesGet { public var subscriptionId : String public var resourceGroupName : String public var name : String public var expand : String? public var apiVersion = "2016-05-15" public init(subscriptionId: String, resourceGroupName: String, name: String) { self.subscriptionId = subscriptionId self.resourceGroupName = resourceGroupName self.name = name super.init() self.method = "Get" self.isLongRunningOperation = false self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}" self.headerParameters = ["Content-Type":"application/json; charset=utf-8"] } public override func preCall() { self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId) self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName) self.pathParameters["{name}"] = String(describing: self.name) if self.expand != nil { queryParameters["$expand"] = String(describing: self.expand!) } self.queryParameters["api-version"] = String(describing: self.apiVersion) } public override func returnFunc(data: Data) throws -> Decodable? { let contentType = "application/json" if let mimeType = MimeType.getType(forStr: contentType) { let decoder = try CoderFactory.decoder(for: mimeType) let result = try decoder.decode(ScheduleData?.self, from: data) return result; } throw DecodeError.unknownMimeType } public func execute(client: RuntimeClient, completionHandler: @escaping (ScheduleProtocol?, Error?) -> Void) -> Void { client.executeAsync(command: self) { (result: ScheduleData?, error: Error?) in completionHandler(result, error) } } } }
44.147541
141
0.62124
db0600726420961d85ea301756b680470bf01d2f
1,972
// // SoolyToast.swift // SoolyWeather // // Created by SoolyChristina on 2017/3/30. // Copyright © 2017年 SoolyChristina. All rights reserved. // Toast提示 import UIKit class SoolyToast: UIView { var textColor: UIColor var duration: TimeInterval var title: String var superView: UIView? /// 重载构造器 /// /// - Parameters: /// - title: toast - 消息 /// - textColor: 文字颜色 /// - duration: toast持续时间 init(title: String, textColor: UIColor = UIColor.white, duration: Double) { // 1. 给属性赋值 self.title = title self.textColor = textColor self.duration = duration // 2. 调用super.init() 必须调用父类的方法即 init(frame: CGRect) super.init(frame: CGRect(x: 2, y: 2, width: ScreenWidth - 2 * 2, height: 34)) // 3. 初始化完成后 才能继续操作 self.backgroundColor = mainColor self.addSubview(self.label) self.alpha = 0 } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } func show(in view: UIView) { // 若存在Toast 则返回 for view in view.subviews { if view is SoolyToast { return } } superView = view view.addSubview(self) view.bringSubviewToFront(self) UIView.animate(withDuration: 0.5) { self.alpha = 0.9 } UIView.animate(withDuration: 0.25, delay: duration, animations: { self.frame.origin.y -= 38 }) { _ in self.removeFromSuperview() } } /// 标签 private lazy var label: UILabel = { let label = UILabel() label.textAlignment = .center label.textColor = self.textColor label.text = self.title label.font = UIFont.systemFont(ofSize: 14) label.sizeToFit() label.center = self.center return label }() }
25.282051
85
0.549696
61c15630eca38384a0cf2b772f4c3d48718845cd
384
// // LottieSwiftUIViewCoordinator.swift // ReaddleDocs2 // // Created by Igor Fedorov on 02.11.2021. // Copyright © 2021 Readdle. All rights reserved. // import Foundation extension LottieSwiftUIView { public class Coordinator: NSObject { let parent: LottieSwiftUIView init(_ parent: LottieSwiftUIView) { self.parent = parent } } }
19.2
50
0.661458
d97542145327b5b5b397045c33a180fccd12b2e1
1,610
// // Extension+UIButton.swift // Button // // Created by Weslie on 2017/9/21. // Copyright © 2017年 Weslie. All rights reserved. // import UIKit extension UIButton { enum Edge { case right case top // case button case middle } //the label will beyond the button itself when the button's width is too narrow func moveImage(to edge: Edge) { switch edge { case .right: titleEdgeInsets = UIEdgeInsets(top: 0, left: -intrinsicContentSize.width - (imageView?.intrinsicContentSize.width)! + (titleLabel?.intrinsicContentSize.width)!, bottom: 0, right: 0) imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -intrinsicContentSize.width - (titleLabel?.intrinsicContentSize.width)! + (imageView?.intrinsicContentSize.width)!) case .top: //in this case the imageView and titleLabel will beyond the button's click area if it is not enough titleEdgeInsets = UIEdgeInsets(top: 0, left: -imageView!.intrinsicContentSize.width, bottom: -((imageView?.intrinsicContentSize.height)! + 4.0 / 2.0), right: 0) imageEdgeInsets = UIEdgeInsetsMake(-(titleLabel!.intrinsicContentSize.height + 4.0 / 2.0), 0, 0, -titleLabel!.intrinsicContentSize.width) case .middle: titleEdgeInsets = UIEdgeInsets(top: 0, left: -(imageView?.intrinsicContentSize.width)!, bottom: 0, right: 0) imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -(titleLabel?.intrinsicContentSize.width)!) } } }
40.25
193
0.645342
3a375bc6bb70fc96477cef06b812ac9fcbf9c5bd
2,207
// // NWDoneKeyboard.swift // NWDoneKeyboard // // Created by Nilusha Wimalasena on 2022-03-09. // import Foundation import UIKit extension UITextField{ @IBInspectable var doneAccessory: Bool{ get{ return self.doneAccessory } set (hasDone) { if hasDone{ addDoneButtonOnKeyboard() } } } func addDoneButtonOnKeyboard() { let doneToolbar: UIToolbar = UIToolbar(frame: CGRect.init(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50)) doneToolbar.barStyle = .default let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) let done: UIBarButtonItem = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(self.doneButtonAction)) let items = [flexSpace, done] doneToolbar.items = items doneToolbar.sizeToFit() self.inputAccessoryView = doneToolbar } @objc func doneButtonAction() { self.resignFirstResponder() } } extension UITextView{ @IBInspectable var doneAccessory: Bool{ get{ return self.doneAccessory } set (hasDone) { if hasDone{ addDoneButtonOnKeyboard() } } } func addDoneButtonOnKeyboard() { let doneToolbar: UIToolbar = UIToolbar(frame: CGRect.init(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50)) doneToolbar.barStyle = .default let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) let done: UIBarButtonItem = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(self.doneButtonAction)) let items = [flexSpace, done] doneToolbar.items = items doneToolbar.sizeToFit() self.inputAccessoryView = doneToolbar } @objc func doneButtonAction() { self.resignFirstResponder() } }
29.039474
140
0.568645
f8013179e4e336949bd603023a21fda3aca6d93b
2,645
//===----------------------------------------------------------------------===// // // This source file is part of the Hummingbird server framework project // // Copyright (c) 2021-2021 the Hummingbird authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// import AWSLambdaEvents import AWSLambdaRuntimeCore import Hummingbird import NIOCore import NIOHTTP1 extension HBLambda where In == APIGateway.V2.Request { /// Specialization of HBLambda.request where `In` is `APIGateway.Request` public func request(context: Lambda.Context, application: HBApplication, from: In) throws -> HBRequest { var request = try HBRequest(context: context, application: application, from: from) // store api gateway v2 request so it is available in routes request.extensions.set(\.apiGatewayV2Request, value: from) return request } } extension HBLambda where Out == APIGateway.V2.Response { /// Specialization of HBLambda.request where `Out` is `APIGateway.Response` public func output(from response: HBResponse) -> Out { return response.apiResponse() } } // conform `APIGateway.V2.Request` to `APIRequest` so we can use HBRequest.init(context:application:from) extension APIGateway.V2.Request: APIRequest { var path: String { // use routeKey as path has stage in it return String(routeKey.split(separator: " ", maxSplits: 1).last!) } var httpMethod: AWSLambdaEvents.HTTPMethod { context.http.method } var multiValueQueryStringParameters: [String: [String]]? { nil } var multiValueHeaders: HTTPMultiValueHeaders { [:] } } // conform `APIGateway.V2.Response` to `APIResponse` so we can use HBResponse.apiReponse() extension APIGateway.V2.Response: APIResponse { init( statusCode: AWSLambdaEvents.HTTPResponseStatus, headers: AWSLambdaEvents.HTTPHeaders?, multiValueHeaders: HTTPMultiValueHeaders?, body: String?, isBase64Encoded: Bool? ) { precondition(multiValueHeaders == nil, "Multi value headers are unavailable in APIGatewayV2") self.init(statusCode: statusCode, headers: headers, body: body, isBase64Encoded: isBase64Encoded, cookies: nil) } } extension HBRequest { /// `APIGateway.V2.Request` that generated this `HBRequest` public var apiGatewayV2Request: APIGateway.V2.Request { self.extensions.get(\.apiGatewayV2Request) } }
37.785714
119
0.677127
ef78f648def618f5400a23a6ea7cc4d7b0bd4573
5,378
// // RoseChartView+Preview.swift // SwiftRoseChartExample // // Created by Christoph Pageler on 02.12.19. // Copyright © 2019 the peak lab. gmbh & co. kg. All rights reserved. // #if canImport(SwiftUI) && DEBUG import SwiftUI import RoseChart @available(iOS 13.0, *) internal struct RoseChartViewPreview: PreviewProvider, UIViewPreviewProvider { static let uiPreviews: [Preview] = { let roseChartEnercon = RoseChartView() roseChartEnercon.backgroundColor = #colorLiteral(red: 0.04462639242, green: 0.2705356777, blue: 0.2626829743, alpha: 1) roseChartEnercon.scaleLineColors = [#colorLiteral(red: 0.04103877395, green: 0.2470057905, blue: 0.243075639, alpha: 1), #colorLiteral(red: 0.05565260351, green: 0.3293524086, blue: 0.3175765276, alpha: 1)] roseChartEnercon.scaleBackgroundColor = #colorLiteral(red: 0.03321847692, green: 0.2352537215, blue: 0.2234801054, alpha: 1) roseChartEnercon.stampBackgroundColors = [#colorLiteral(red: 0.05096390098, green: 0.3567913771, blue: 0.348937571, alpha: 1), #colorLiteral(red: 0.03655336052, green: 0.2666195333, blue: 0.254845351, alpha: 1)] roseChartEnercon.stampLineColors = [#colorLiteral(red: 0.03595770895, green: 0.294064343, blue: 0.2822898328, alpha: 1), #colorLiteral(red: 0.03595770895, green: 0.294064343, blue: 0.2822898328, alpha: 1)] let max = 144 var val = 0.40 var inc = 0.025 roseChartEnercon.bars = (0...max).map { i in val += inc if val >= 1 || val <= 0.4 { inc = inc * -1 } if Int.random(in: 0...7) == 7 { inc = inc * -1 } return RoseChartBar(val, color: #colorLiteral(red: 0.269954741, green: 0.999925673, blue: 0.9018553495, alpha: 1)) } roseChartEnercon.linePoints = (0...max).map { i in val += inc if val >= 1 || val <= 0.4 { inc = inc * -1 } if Int.random(in: 0...7) == 7 { inc = inc * -1 } return RoseChartLinePoint(val) } let roseChartEnerconPreview = Preview(roseChartEnercon, size: .fixed(CGSize(width: 300, height: 350)), displayName: "ENERCON") let roseChart1 = RoseChartView() roseChart1.backgroundColor = .red roseChart1.scale = .values(values: [ 5, 30, 50 ]) roseChart1.isStampVisible = false roseChart1.bars = [ RoseChartBar(5, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(10, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(25, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(20, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(25, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(30, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(35, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(40, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(45, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)), RoseChartBar(50, color: #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)) ] roseChart1.linePoints = [ RoseChartLinePoint(5), RoseChartLinePoint(10), RoseChartLinePoint(15), RoseChartLinePoint(20), RoseChartLinePoint(25), RoseChartLinePoint(30), RoseChartLinePoint(35), RoseChartLinePoint(40), RoseChartLinePoint(45), RoseChartLinePoint(50) ] let roseChart1Preview = Preview(roseChart1, size: .fixed(CGSize(width: 300, height: 350)), displayName: "Rose Chart 1") let roseChartWithMovedValues = RoseChartView() roseChartWithMovedValues.bars = [ RoseChartBar(10, color: .red), RoseChartBar(20, color: .red), RoseChartBar(30, color: .red), RoseChartBar(40, color: .red), RoseChartBar(50, color: .red), RoseChartBar(60, color: .red), RoseChartBar(70, color: .red), RoseChartBar(80, color: .red), RoseChartBar(90, color: .red), RoseChartBar(100, color: .red) ] let roseChartWithMovedValuesPreview = Preview(roseChartWithMovedValues, size: .fixed(CGSize(width: 300, height: 350)), displayName: "Rose Chart with moved values") return [roseChartEnerconPreview, roseChart1Preview, roseChartWithMovedValuesPreview] }() } #endif
45.576271
219
0.586649
1d105cf7ecf321fcb720234693c4769a402117fd
1,563
//: [Previous](@previous) import Foundation // Swift makes a heavy use of closures within its standard library // Think of function like filter(), map(), sort(), etc. // How about we try to make these function work with KeyPaths? // Let's begin with filter()! extension Sequence { func filter(_ keyPath: KeyPath<Element, Bool>) -> [Element] { return self.filter { $0[keyPath: keyPath] } } } let data = [1, 2, 3, 4, 5, 6, 7 ,8, 9] extension Int { var isEven: Bool { return (self % 2) == 0 } } data.filter(\.isEven) // Let's move on to map() 💪 extension Sequence { func map<T>(_ keyPath: KeyPath<Element, T>) -> [T] { return self.map { $0[keyPath: keyPath] } } } data.map(\.description) // That's pretty cool, but we need to write a wrapper for each function 😔 // However, notice how the two following expressions implement the same requirement let getterWithKeyPath = \String.count let getterWithClosure = { (string: String) in string.count } // How about we try to turn a KeyPath into a getter function? func get<Root, Value>(_ keyPath: KeyPath<Root, Value>) -> (Root) -> Value { return { (root: Root) -> Value in return root[keyPath: keyPath] } } data.map(get(\.description)) // And we can even aim for a shorter syntax! prefix operator ^ prefix func ^<Root, Value>(_ keyPath: KeyPath<Root, Value>) -> (Root) -> Value { return get(keyPath) } data.map(^\.description) // By adding a single character, many functions of the Standard Library now work with KeyPaths 🥳 //: [Next](@next)
23.328358
96
0.660909
0ae169d248ce02e3c5529565deafbed874cfdd09
798
// // Copyright 2021 Wultra s.r.o. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions // and limitations under the License. // import SwiftUI import PowerAuthShared @main struct KeychainTestAppApp: App { var body: some Scene { WindowGroup { ContentView(biometryInfo: BiometryInfo.current) } } }
28.5
75
0.716792
f87e38c273443e28a8e96e93f26ea9002b4a7d05
2,292
// // SNSPlatformManager.swift // SNSKit // // Created by wujianguo on 16/6/25. // Copyright © 2016年 wujianguo. All rights reserved. // import UIKit public enum SNSPlatformType { case None case Weibo case Wechat case WechatSession case WechatMoments case QQ case Alipay } public class SNSPlatformManager { public static let sharedInstance = SNSPlatformManager() public var availablePlatforms: Array<SNSPlatformBase> = [] public var shareablePlatforms: Array<SNSPlatformBase> { return availablePlatforms.filter { $0 is SNSPlatformShareable } } private init() {} public static func addPlatform(type: SNSPlatformType, appID: String, redirectURI: NSURL?, name: String, logo: UIImage, description: String) { var platform: SNSPlatformBase? switch type { case .Weibo: platform = SNSPlatformWeibo(appID: appID, redirectURI: redirectURI, name: name, logo: logo, description: description) case .Wechat: platform = SNSPlatformWechat(appID: appID, redirectURI: redirectURI, name: name, logo: logo, description: description) case .WechatMoments: platform = SNSPlatformWechatMoments(appID: appID, redirectURI: redirectURI, name: name, logo: logo, description: description) case .WechatSession: platform = SNSPlatformWechatSession(appID: appID, redirectURI: redirectURI, name: name, logo: logo, description: description) case .QQ: platform = SNSPlatformQQ(appID: appID, redirectURI: redirectURI, name: name, logo: logo, description: description) case .Alipay: platform = SNSPlatformAlipay(appID: appID, redirectURI: redirectURI, name: name, logo: logo, description: description) default: return } sharedInstance.availablePlatforms.append(platform!) } static func getPlatform(type: SNSPlatformType) -> SNSPlatformBase? { return nil } static func share(activityItems: [AnyObject], to: SNSPlatformType) -> Bool { if let platform = sharedInstance.availablePlatforms.filter({$0.platformType == to}).first as? SNSPlatformShareable { return platform.share(activityItems) } return false } }
36.380952
145
0.677574
89d181873943b5602531fbe7766868f5932f414b
2,431
// // PHAssetFetcher.swift // // // Created by Christian Elies on 30.11.19. // import Photos struct PHAssetFetcher { static var asset: PHAsset.Type = PHAsset.self static func fetchAssets<T: MediaProtocol>(in assetCollection: PHAssetCollection, options: PHFetchOptions) throws -> [T] { guard Media.isAccessAllowed else { throw Media.currentPermission.permissionError ?? PermissionError.unknown } let result = asset.fetchAssets(in: assetCollection, options: options) var items: [T] = [] result.enumerateObjects { asset, _, _ in let item = T.init(phAsset: asset) items.append(item) } return items } static func fetchAssets(in assetCollection: PHAssetCollection, options: PHFetchOptions) throws -> PHFetchResult<PHAsset> { guard Media.isAccessAllowed else { throw Media.currentPermission.permissionError ?? PermissionError.unknown } return asset.fetchAssets(in: assetCollection, options: options) } } extension PHAssetFetcher { static func fetchAssets<T: MediaProtocol>(options: PHFetchOptions) throws -> [T] { guard Media.isAccessAllowed else { throw Media.currentPermission.permissionError ?? PermissionError.unknown } let result = asset.fetchAssets(with: options) var items: [T] = [] result.enumerateObjects { asset, _, _ in let item = T.init(phAsset: asset) items.append(item) } return items } static func fetchAssets(options: PHFetchOptions) throws -> PHFetchResult<PHAsset> { guard Media.isAccessAllowed else { throw Media.currentPermission.permissionError ?? PermissionError.unknown } return asset.fetchAssets(with: options) } static func fetchAsset<T: MediaProtocol>( options: PHFetchOptions, filter: @escaping (PHAsset) -> Bool = { _ in true } ) throws -> T? { guard Media.isAccessAllowed else { throw Media.currentPermission.permissionError ?? PermissionError.unknown } let result = asset.fetchAssets(with: options) var item: T? result.enumerateObjects { asset, _, stop in if filter(asset) { item = T.init(phAsset: asset) stop.pointee = true } } return item } }
30.012346
126
0.627314
48213bf3ae576abf20aae1b53a29bcc1f13b7b4b
2,829
// DO NOT EDIT. This file is machine-generated and constantly overwritten. // Make changes to User.swift instead. import CoreData public enum UserAttributes: String { case created_at = "created_at" case id = "id" case name = "name" case updated_at = "updated_at" } public enum UserRelationships: String { case posts = "posts" } @objc public class _User: NSManagedObject { // MARK: - Class methods public class func entityName () -> String { return "User" } public class func entity(managedObjectContext: NSManagedObjectContext!) -> NSEntityDescription! { return NSEntityDescription.entityForName(self.entityName(), inManagedObjectContext: managedObjectContext); } // MARK: - Life cycle methods public override init(entity: NSEntityDescription, insertIntoManagedObjectContext context: NSManagedObjectContext!) { super.init(entity: entity, insertIntoManagedObjectContext: context) } public convenience init(managedObjectContext: NSManagedObjectContext!) { let entity = _User.entity(managedObjectContext) self.init(entity: entity, insertIntoManagedObjectContext: managedObjectContext) } // MARK: - Properties @NSManaged public var created_at: NSDate? // func validateCreated_at(value: AutoreleasingUnsafeMutablePointer<AnyObject>, error: NSErrorPointer) -> Bool {} @NSManaged public var id: NSNumber? // func validateId(value: AutoreleasingUnsafeMutablePointer<AnyObject>, error: NSErrorPointer) -> Bool {} @NSManaged public var name: String? // func validateName(value: AutoreleasingUnsafeMutablePointer<AnyObject>, error: NSErrorPointer) -> Bool {} @NSManaged public var updated_at: NSDate? // func validateUpdated_at(value: AutoreleasingUnsafeMutablePointer<AnyObject>, error: NSErrorPointer) -> Bool {} // MARK: - Relationships @NSManaged public var posts: NSOrderedSet } extension _User { func addPosts(objects: NSOrderedSet) { let mutable = self.posts.mutableCopy() as! NSMutableOrderedSet mutable.unionOrderedSet(objects) self.posts = mutable.copy() as! NSOrderedSet } func removePosts(objects: NSOrderedSet) { let mutable = self.posts.mutableCopy() as! NSMutableOrderedSet mutable.minusOrderedSet(objects) self.posts = mutable.copy() as! NSOrderedSet } func addPostsObject(value: Post!) { let mutable = self.posts.mutableCopy() as! NSMutableOrderedSet mutable.addObject(value) self.posts = mutable.copy() as! NSOrderedSet } func removePostsObject(value: Post!) { let mutable = self.posts.mutableCopy() as! NSMutableOrderedSet mutable.removeObject(value) self.posts = mutable.copy() as! NSOrderedSet } }
28.867347
120
0.703782
76ba72ed91a1acadb3b60c505ef94660b0e4051c
1,528
// Copyright 2016-2018 Cisco Systems Inc // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation extension URL { var queryParameters: [String: String] { var resultParameters = [String: String]() let pairs = self.query?.components(separatedBy: "&") ?? [] for pair in pairs { let kv = pair.components(separatedBy: "=") resultParameters.updateValue(kv[1], forKey: kv[0]) } return resultParameters } }
42.444444
80
0.713351
263a8fc69ad0ff46ba497a7fd97991fd20c97cb8
6,764
// // PropertyStoringTests.swift // RollingKit_Example // // Created by Max Deygin on 3/4/18. // Copyright © 2018 CocoaPods. All rights reserved. // import Foundation import Quick import Nimble @testable import RollingKit class ViewAnchorPointTests: QuickSpec { override func spec() { describe("View Anchor point storage") { context("No anchor point") { let view = UIView.init(frame: CGRect(x: 100, y: 100, width: 100, height: 100)) it("is expected to have default anchor point equals center point") { expect(view.anchorPoint).to(equal(CGPoint.init(x: view.frame.size.width/2, y: view.frame.size.height/2))) } } context("Anchor point set") { let view = UIView.init(frame: CGRect(x: 100, y: 100, width: 100, height: 100)) let point = CGPoint(x: 10, y: 10) view.anchorPoint = point it("is expected to get stored anchor point") { expect(view.anchorPoint).to(equal(point)) } } } } } class ViewCircularCoordinatesTests: QuickSpec { override func spec() { describe("View Circular Coordinates test") { context("Storage") { let superView = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 10, height: 10)) superView.addSubview(view) let coords = CircularCoords(angle: CGFloat.pi/2, radius: 30) view.circularPosition = coords; it("is expected to get what you have set") { expect(coords).to(equal(coords)) } } context("ResetCoordinates") { let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 10, height: 10)) let superView = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let coords = CircularCoords(angle: CGFloat.pi/2, radius: 30) it("no crash if no superview") { view.circularPosition = coords; } it("no crash if no coordinates set") { superView.addSubview(view); } } context("ResetAnchor") { let superView = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 10, height: 10)) superView.addSubview(view) let coords = CircularCoords(angle: 0, radius: 30) view.circularPosition = coords superView.anchorPoint = CGPoint(x: 70, y: 70) it("should reset subview coordinates when superview anchor is reset") { expect(view.center).to(equal(CGPoint(x: 70, y: 100))) } } context("custom angle") { let superView = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 10, height: 10)) superView.addSubview(view) let coords = CircularCoords(angle: 0, radius: 30) view.circularPosition = coords let angle = CGFloat(90.toRadians) superView.startAngleOffset = angle it("should reset subview coordinates when superview anchor is reset") { expect([Double(view.center.x),Double(view.center.y)]).to(beCloseTo([20.0, 50.0], within:0.1)) } } } } } class CoordsConversionsTests: QuickSpec { override func spec() { describe("Convert coordinates to point and back") { context("to coords") { let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let point = CGPoint(x:100, y:50) let coords = view.coords(from:point) it("should convert point to CircularCoords") { expect([Double(coords.angle).fromRadians,Double(coords.radius)]).to(beCloseTo([270.0,50.0], within: 1.0)) } } context("to coords 2") { let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let point = CGPoint(x:0, y:50) let coords = view.coords(from:point) it("should convert point to CircularCoords") { expect([Double(coords.angle).fromRadians,Double(coords.radius)]).to(beCloseTo([90, 50.0], within: 1.0)) } } context("to coords 3") { let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let point = CGPoint(x:50, y:0) let coords = view.coords(from:point) it("should convert point to CircularCoords") { expect([Double(coords.angle).fromRadians,Double(coords.radius)]).to(beCloseTo([180, 50.0], within: 1.0)) } } context("to coords 4") { let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let point = CGPoint(x:50, y:100) let coords = view.coords(from:point) it("should convert point to CircularCoords") { expect([Double(coords.angle).fromRadians,Double(coords.radius)]).to(beCloseTo([0, 50.0], within: 1.0)) } } context("to point") { let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let coords = CircularCoords(angle:CGFloat(90.0.toRadians), radius:50) let point = view.location(from:coords) it("should convert CircularCoords coordinates to CGPoint") { expect([Double(point.x), Double(point.y)]).to(beCloseTo([0.0, 50.0], within:0.1)) } } context("to point 1") { let view = UIView.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100)) let coords = CircularCoords(angle:CGFloat(270.0.toRadians), radius:50) let point = view.location(from:coords) it("should convert CircularCoords coordinates to CGPoint") { expect([Double(point.x), Double(point.y)]).to(beCloseTo([100.0, 50.0], within:0.1)) } } } } }
43.63871
125
0.514784
4b7f91ef6a90aa9c04a169e30aa595d054eb7871
4,042
// // LemonTreeViewRenderable.swift // LemonTree // // Created by Kevin Johnson on 8/22/20. // Copyright © 2020 Kevin Johnson. All rights reserved. // #if canImport(UIKit) import UIKit import CommonMark protocol LemonTreeViewRenderable { func markdownViews(styling: LemonTreeStyling) -> [UIView] } func defaultTextView() -> UITextView { let textView = UITextView() textView.isScrollEnabled = false textView.isEditable = false textView.adjustsFontForContentSizeCategory = true textView.textAlignment = .left textView.textContainerInset = .zero return textView } // MARK: - Heading extension Heading: LemonTreeViewRenderable { func markdownViews(styling: LemonTreeStyling) -> [UIView] { let stackView = UIStackView() stackView.spacing = UIStackView.spacingUseSystem stackView.axis = .horizontal let textView = defaultTextView() let headingFont = styling.headingFont(for: level) let headingTextStyle = styling.headingTextStyle(for: level) let headingTextColor = styling.headingTextColor(for: level) let attrString = children.map { $0.attributedString( attributes: [ .font: headingFont.scaledFont(for: headingTextStyle), .foregroundColor: headingTextColor ], textStyle: headingTextStyle, styling: styling ) }.joined() textView.attributedText = attrString stackView.addArrangedSubview(textView) switch level { case 1, 2: // TODO: this applies GH-flavored markdown, need to read spec and see what's okay let spacer = UIView() spacer.backgroundColor = .separator NSLayoutConstraint.activate([ spacer.heightAnchor.constraint(equalToConstant: 1) ]) return [stackView, spacer] case 3, 4, 5, 6: return [stackView] default: preconditionFailure("Invalid header level") } } } // MARK: - Paragraph extension Paragraph: LemonTreeViewRenderable { func markdownViews(styling: LemonTreeStyling) -> [UIView] { let stackView = UIStackView() stackView.axis = .horizontal stackView.spacing = UIStackView.spacingUseSystem let textView = defaultTextView() let attrString = self.children.map { $0.attributedString( attributes: [ .font: styling.bodyFont.scaledFont(for: styling.bodyTextStyle), .foregroundColor: styling.bodyTextColor ], textStyle: styling.bodyTextStyle, styling: styling ) }.joined() textView.attributedText = attrString stackView.addArrangedSubview(textView) return [stackView] } } // MARK: - List extension List: LemonTreeViewRenderable { func markdownViews(styling: LemonTreeStyling) -> [UIView] { let stackView = UIStackView() stackView.axis = .vertical stackView.spacing = UIStackView.spacingUseDefault let textView = defaultTextView() let attrString = children.enumerated().map { $0.element.attributedString(attributes: [ .font: styling.bodyFont.scaledFont(for: styling.bodyTextStyle), .foregroundColor: styling.bodyTextColor ], textStyle: styling.bodyTextStyle, position: $0.offset + 1, styling: styling ) }.joined() textView.attributedText = attrString stackView.addArrangedSubview(textView) return [stackView] } } // MARK: - BlockQuote extension BlockQuote: LemonTreeViewRenderable { func markdownViews(styling: LemonTreeStyling) -> [UIView] { // TODO: Next up print("BlockQuote") return [] } } #endif
31.092308
93
0.604899
765d850f869ff8a755dc9ff97b044a01aff86201
732
// // Copyright 2021 PLAID, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /// ライブラリの設定を表すタイプです。 /// /// **サブモジュールと連携するために用意している機能であり、通常利用で使用することはありません。** @objc public protocol LibraryConfiguration {}
33.272727
76
0.730874
3323155660215d02e2f6db0e1dc649a5c5409ccd
237
// // SwiftUI_TestApp.swift // SwiftUI Test // // Created by Alex Golub on 22.11.2021. // import SwiftUI @main struct SwiftUI_TestApp: App { var body: some Scene { WindowGroup { LoginView() } } }
13.166667
40
0.57384
d77df0f75b7ca26742e1107845ff231fe7b46e4e
1,203
// // KeyboardAwareModifier.swift // recipeat // // Created by Christopher Guirguis on 3/16/20. // Copyright © 2020 Christopher Guirguis. All rights reserved. // import Foundation import SwiftUI import Combine struct KeyboardAwareModifier: ViewModifier { @State private var keyboardHeight: CGFloat = 0 private var keyboardHeightPublisher: AnyPublisher<CGFloat, Never> { Publishers.Merge( NotificationCenter.default .publisher(for: UIResponder.keyboardWillShowNotification) .compactMap { $0.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue } .map { $0.cgRectValue.height }, NotificationCenter.default .publisher(for: UIResponder.keyboardWillHideNotification) .map { _ in CGFloat(0) } ).eraseToAnyPublisher() } func body(content: Content) -> some View { content .padding(.bottom, keyboardHeight) .onReceive(keyboardHeightPublisher) { self.keyboardHeight = $0 } } } extension View { func KeyboardAwarePadding() -> some View { ModifiedContent(content: self, modifier: KeyboardAwareModifier()) } }
30.075
97
0.660848
50d061509b83bceedd3bdc7ae4b2bac0de940d90
3,528
// // NotificationsDetailViewController.swift // iSWAD // // Created by Raul Alvarez on 16/05/16. // Copyright © 2016 Raul Alvarez. All rights reserved. // // Modified by Adrián Lara Roldán on 07/08/18. // import UIKit import SWXMLHash class NotificationsDetailViewController: UIViewController { @IBOutlet var notificationsContent: UITextView! @IBOutlet var personImage: UIImageView! @IBOutlet var from: UILabel! @IBOutlet var subject: UILabel! @IBOutlet var summary: UILabel! @IBOutlet var date: UILabel! @IBOutlet var toolbar: UIToolbar! var detailItem: AnyObject? { didSet(detailItem) { self.configureView() } } func configureView() { if let detail = self.detailItem { if self.notificationsContent != nil { var not = notification() not = detail as! notification self.notificationsContent.text = not.content.html2String self.notificationsContent.font = UIFont(name: "Helvetica", size: 20) self.from.text = not.from self.subject.text = not.location self.date.text = not.date self.summary.text = not.summary let url = URL(string: not.userPhoto) var img : UIImage! DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async { img = UIImage(named: "nouserswad") if let ur = url{ let data = try? Data(contentsOf: ur) if data != nil{ img = UIImage(data:data!) } } DispatchQueue.main.async(execute: { self.personImage.image = img }); } self.title = not.type if not.type == "Mensaje" { let answerButton = UIBarButtonItem(title: "Responder", style: UIBarButtonItem.Style.plain, target: self, action: #selector(NotificationsDetailViewController.onTouchAnswer(_:))) let flexibleSpace = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.flexibleSpace, target: nil, action: nil); toolbar.items = [flexibleSpace, flexibleSpace, answerButton] } let client = SyedAbsarClient() let defaults = UserDefaults.standard let requestReadNotification = MarkNotificationsAsRead() requestReadNotification.cpWsKey = defaults.string(forKey: Constants.wsKey) requestReadNotification.cpNotifications = not.id client.opMarkNotificationsAsRead(requestReadNotification){(error, response2: XMLIndexer?) in } } } } override func prepare(for segue: UIStoryboardSegue, sender: Any!) { let destinationVC = segue.destination as! MessagesViewController destinationVC.contentFromNotification = detailItem } override func viewDidLoad() { super.viewDidLoad() self.configureView() } override func loadView() { super.loadView() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } @IBAction func onTouchAnswer(_ sender: AnyObject){ performSegue(withIdentifier: "showAnswer", sender: nil) } }
36.371134
196
0.575113
aba71425478fd63feaba4990eaae1d758129dabd
949
// // Department.swift // StoreAppProject // // Created by admin on 6/3/21. // import Foundation import CoreData extension DBHelper { func getProductsForDepartment(name: String) -> [Product] { var dept = Department() let fetchReq = NSFetchRequest<NSManagedObject>(entityName:"Department") fetchReq.predicate = NSPredicate(format: "name == %@", name) fetchReq.fetchLimit = 1 var products = [Product]() do { let res = try context?.fetch(fetchReq) as! [Department] if (res.count != 0){ dept = res.first! for product in dept.products! { products.append(product as! Product) } } else { print("data not found") } } catch (let exception) { print(exception.localizedDescription) } return products } }
25.648649
79
0.531085
f4a0514d3416f60d670bb84b986df83bc96b91a0
805
import XCTest @testable import Zaphod final class ZSubscribeTests: XCTestCase { func testDecoding() { let objectString = """ {"app_user":{"id":"96381b13-0345-4fe0-8b09-7ad8cb8090eb"}} """ let data = objectString.data(using: .utf8)! guard let wrapper: ZSignupWrapper = data.decode() else { XCTAssert(false, "decode failed") return } XCTAssertEqual(wrapper.user.serverId?.uuidString.lowercased(), "96381b13-0345-4fe0-8b09-7ad8cb8090eb") let serverId = wrapper.user.serverId XCTAssertNotNil(serverId) XCTAssertEqual(makeString(uuid: serverId!), "string: 96381b13-0345-4fe0-8b09-7ad8cb8090eb".uppercased()) } func makeString(uuid: UUID) -> String { return "string: \(uuid)".uppercased() } }
28.75
112
0.649689
89dc3179e1888cc171717e4efc92b4d8882323e1
1,772
// // QrLabInvoiceViewController.swift // RaccoonWallet // // Created by Taizo Kusuda on 2018/08/30. // Copyright © 2018年 T TECH, LIMITED LIABILITY CO. All rights reserved. // import UIKit class QrLabInvoiceViewController: BaseViewController { var presenter: QrLabInvoicePresentation! { didSet { basePresenter = presenter } } @IBOutlet weak var qr: UIImageView! @IBOutlet weak var amountHeadline: UILabel! @IBOutlet weak var xem: UILabel! @IBOutlet weak var localCurrency: UILabel! @IBOutlet weak var localCurrencyUnit: UILabel! @IBOutlet weak var addressHeadline: UILabel! @IBOutlet weak var address: UILabel! override func setup() { super.setup() title = "My Wallet QR" amountHeadline.text = R.string.localizable.common_amount() amountHeadline.textColor = Theme.primary addressHeadline.text = R.string.localizable.common_destination() addressHeadline.textColor = Theme.primary let done = UIBarButtonItem() done.customView = createBarButton(image: R.image.icon_check_green()!, size: Constant.barIconSize, action: #selector(onTouchedOk(_:))) navigationItem.setRightBarButton(done, animated: false) } @objc func onTouchedOk(_ sender: Any) { presenter.didClickOk() } } extension QrLabInvoiceViewController: QrLabInvoiceView { func showAmount(_ amount: String) { xem.text = amount } func showLocalCurrency(_ amount: String, _ unit: String) { localCurrency.text = amount localCurrencyUnit.text = unit } func showQr(_ invoiceQrJson: String) { qr.setQrText(invoiceQrJson) } func showAddress(_ address: String) { self.address.text = address } }
28.580645
141
0.682844
e275b3193021e7ba69f6fe0637161b9f3647bbd3
588
// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s class A { init(handler: (() -> ())) { } } class B { } // CHECK: define {{.*}} @_TF11WeakCapture8functionFT_T_() func function() { let b = B() // Ensure that the local b and its weak copy are distinct local variables. // CHECK: %[[B:.*]] = alloca %C11WeakCapture1B* // CHECK: %[[BWEAK:.*]] = alloca %swift.weak* // CHECK: call void @llvm.dbg.declare({{.*}}[[B]] // CHECK: call void @llvm.dbg.declare({{.*}}[[BWEAK]] A(handler: { [weak b] _ in if b != nil { } }) } function()
25.565217
76
0.54932
6428d86a22ec42a09672c4463b4f51e221b8d6e3
450
// // Snooze.swift // Hompimpa // // Created by hendy evan on 23/11/18. // import Foundation open class Snooze { open func start() { let interval = TimeInterval(arc4random_uniform(100)) Thread.sleep(forTimeInterval: interval) } } extension String { var isBlanks: Bool { get { let trimmed = self.trimmingCharacters(in: .whitespacesAndNewlines) return trimmed.isEmpty } } }
18
78
0.613333
c1c91dbc0d3576c88e86fde7f9d6e79bafd51965
9,135
//# xsc 17.12.4-8c3504-20180321 import Foundation import SAPOData internal class APIMANAGEWORKFORCETIMESHEETEntitiesMetadataChanges: ObjectBase { override init() { } class func merge(metadata: CSDLDocument) -> Void { metadata.hasGeneratedProxies = true APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.document = metadata APIMANAGEWORKFORCETIMESHEETEntitiesMetadataChanges.merge1(metadata: metadata) try! APIMANAGEWORKFORCETIMESHEETEntitiesFactory.registerAll() } private class func merge1(metadata: CSDLDocument) -> Void { Ignore.valueOf_any(metadata) if !APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.isRemoved { APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields = metadata.complexType(withName: "API_MANAGE_WORKFORCE_TIMESHEET.TimeSheetDataFields") } if !APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.isRemoved { APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry = metadata.entityType(withName: "API_MANAGE_WORKFORCE_TIMESHEET.TimeSheetEntry") } if !APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntitySets.timeSheetEntryCollection.isRemoved { APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntitySets.timeSheetEntryCollection = metadata.entitySet(withName: "TimeSheetEntryCollection") } if !TimeSheetDataFields.controllingArea.isRemoved { TimeSheetDataFields.controllingArea = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "ControllingArea") } if !TimeSheetDataFields.senderCostCenter.isRemoved { TimeSheetDataFields.senderCostCenter = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "SenderCostCenter") } if !TimeSheetDataFields.receiverCostCenter.isRemoved { TimeSheetDataFields.receiverCostCenter = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "ReceiverCostCenter") } if !TimeSheetDataFields.internalOrder.isRemoved { TimeSheetDataFields.internalOrder = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "InternalOrder") } if !TimeSheetDataFields.activityType.isRemoved { TimeSheetDataFields.activityType = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "ActivityType") } if !TimeSheetDataFields.wbsElement.isRemoved { TimeSheetDataFields.wbsElement = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "WBSElement") } if !TimeSheetDataFields.workItem.isRemoved { TimeSheetDataFields.workItem = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "WorkItem") } if !TimeSheetDataFields.billingControlCategory.isRemoved { TimeSheetDataFields.billingControlCategory = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "BillingControlCategory") } if !TimeSheetDataFields.purchaseOrder.isRemoved { TimeSheetDataFields.purchaseOrder = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "PurchaseOrder") } if !TimeSheetDataFields.purchaseOrderItem.isRemoved { TimeSheetDataFields.purchaseOrderItem = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "PurchaseOrderItem") } if !TimeSheetDataFields.timeSheetTaskType.isRemoved { TimeSheetDataFields.timeSheetTaskType = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "TimeSheetTaskType") } if !TimeSheetDataFields.timeSheetTaskLevel.isRemoved { TimeSheetDataFields.timeSheetTaskLevel = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "TimeSheetTaskLevel") } if !TimeSheetDataFields.timeSheetTaskComponent.isRemoved { TimeSheetDataFields.timeSheetTaskComponent = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "TimeSheetTaskComponent") } if !TimeSheetDataFields.timeSheetNote.isRemoved { TimeSheetDataFields.timeSheetNote = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "TimeSheetNote") } if !TimeSheetDataFields.recordedHours.isRemoved { TimeSheetDataFields.recordedHours = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "RecordedHours") } if !TimeSheetDataFields.recordedQuantity.isRemoved { TimeSheetDataFields.recordedQuantity = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "RecordedQuantity") } if !TimeSheetDataFields.hoursUnitOfMeasure.isRemoved { TimeSheetDataFields.hoursUnitOfMeasure = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "HoursUnitOfMeasure") } if !TimeSheetDataFields.rejectionReason.isRemoved { TimeSheetDataFields.rejectionReason = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.ComplexTypes.timeSheetDataFields.property(withName: "RejectionReason") } if !TimeSheetEntry.timeSheetDataFields.isRemoved { TimeSheetEntry.timeSheetDataFields = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetDataFields") } if !TimeSheetEntry.personWorkAgreementExternalID.isRemoved { TimeSheetEntry.personWorkAgreementExternalID = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "PersonWorkAgreementExternalID") } if !TimeSheetEntry.companyCode.isRemoved { TimeSheetEntry.companyCode = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "CompanyCode") } if !TimeSheetEntry.timeSheetRecord.isRemoved { TimeSheetEntry.timeSheetRecord = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetRecord") } if !TimeSheetEntry.personWorkAgreement.isRemoved { TimeSheetEntry.personWorkAgreement = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "PersonWorkAgreement") } if !TimeSheetEntry.timeSheetDate.isRemoved { TimeSheetEntry.timeSheetDate = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetDate") } if !TimeSheetEntry.timeSheetIsReleasedOnSave.isRemoved { TimeSheetEntry.timeSheetIsReleasedOnSave = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetIsReleasedOnSave") } if !TimeSheetEntry.timeSheetPredecessorRecord.isRemoved { TimeSheetEntry.timeSheetPredecessorRecord = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetPredecessorRecord") } if !TimeSheetEntry.timeSheetStatus.isRemoved { TimeSheetEntry.timeSheetStatus = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetStatus") } if !TimeSheetEntry.timeSheetIsExecutedInTestRun.isRemoved { TimeSheetEntry.timeSheetIsExecutedInTestRun = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetIsExecutedInTestRun") } if !TimeSheetEntry.timeSheetOperation.isRemoved { TimeSheetEntry.timeSheetOperation = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "TimeSheetOperation") } if !TimeSheetEntry.yy1EndTimeTIM.isRemoved { TimeSheetEntry.yy1EndTimeTIM = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "YY1_EndTime_TIM") } if !TimeSheetEntry.yy1StartTimeTIM.isRemoved { TimeSheetEntry.yy1StartTimeTIM = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "YY1_StartTime_TIM") } if !TimeSheetEntry.yy1EndTimeTIMF.isRemoved { TimeSheetEntry.yy1EndTimeTIMF = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "YY1_EndTime_TIMF") } if !TimeSheetEntry.yy1StartTimeTIMF.isRemoved { TimeSheetEntry.yy1StartTimeTIMF = APIMANAGEWORKFORCETIMESHEETEntitiesMetadata.EntityTypes.timeSheetEntry.property(withName: "YY1_StartTime_TIMF") } } }
70.813953
181
0.781719
67e05fd0254569d1adbe007556ff0911cc8739cc
503
// // XY.swift // GeoHex3.swift // // Created by nekowen on 2017/03/30. // License: MIT License // public class XY { fileprivate var _x: Double fileprivate var _y: Double public init(x: Double, y: Double) { self._x = x self._y = y } var x: Double { return self._x } var y: Double { return self._y } } extension XY: Equatable {} public func ==(lhs: XY, rhs: XY) -> Bool { return lhs.x == rhs.x && lhs.y == rhs.y }
15.71875
43
0.530815
691732602ae3b4ed4d4c906f1aafffdf284847af
2,165
// // AppDelegate.swift // myWeibo // // Created by 张乐文 on 2017/11/6. // Copyright © 2017年 com.alexzlw. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
46.06383
285
0.754734
2614d9417ac74c4af781110370ef789bd839262f
302
// // ___FILENAME___ // ___PROJECTNAME___ // // Created by ___FULLUSERNAME___ on ___DATE___. // Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved. // // import XCTest import RxTest import RxSwift import RxCocoa class ___VARIABLE_sceneName___WorkerTests: XCTestCase { }
14.380952
73
0.758278
b9b766b344ecf56644ee9c95d233d19b3c467eff
1,818
import SwiftUI struct AboutView: View { var shortVersion: String { Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String } var version: String { Bundle.main.infoDictionary?["CFBundleVersion"] as! String } var body: some View { VStack { Image("Icon") .resizable() .aspectRatio(contentMode: .fit) .frame(width: 150) .cornerRadius(30) .shadow(radius: 10) Text("Mensa Dresden") .font(.largeTitle) .fontWeight(.medium) Text("\(shortVersion) (\(version))") .font(.subheadline) .foregroundColor(.gray) .padding(.bottom) VStack(alignment: .leading) { Text("info.developed-by") .font(.caption) .bold() Button { UIApplication.shared.open(URL(string: "https://twitter.com/kiliankoe")!) } label: { Text("Kilian Költzsch") } .padding(.bottom, 10) Text("info.image-rights") .font(.caption) .bold() Text("Studentenwerk Dresden") .padding(.bottom, 10) Text("info.icon") .font(.caption) .bold() Text("info.nounproject") .padding(.bottom, 30) Text("info.thanks") } .padding(.horizontal) Spacer() } } } struct InfoView_Previews: PreviewProvider { static var previews: some View { NavigationView { AboutView() } } }
26.347826
92
0.444444
4851b25e598f80cef4d5fceb5d78d874b7b35d39
526
// // ShoppingListApp.swift // Shopping List // // Created by Gundars Kokins on 10/05/2021. // import SwiftUI @main struct ShoppingListApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @StateObject var database = RealtimeDatabase(url: "https://shopping-list-6172f-default-rtdb.europe-west1.firebasedatabase.app/", path: "shopping-list/baskets") var body: some Scene { WindowGroup { ContentView() .environmentObject(database) } } }
23.909091
163
0.669202
164537510e96c58f8ba11c6dd9638441188f24b2
1,397
// // ImageDownloader.swift // TheMovieDb // // Created by Misael Chávez on 29/11/21. // import UIKit import os struct ImageDownloader { private static let logger = Logger(subsystem: Constants.subsystemName, category: "ImageDownloader") static let cache = NSCache<NSString, UIImage>() static func downloadImage(withURL url: URL, completion: @escaping (_ image: UIImage?) -> Void) { let dataTask = URLSession.shared.dataTask(with: url) { data, _, error in var downloadedImage: UIImage? if let error = error { logger.error("\(error.localizedDescription)") return } if let data = data { downloadedImage = UIImage(data: data) } if downloadedImage != nil { cache.setObject(downloadedImage!, forKey: url.absoluteString as NSString) } DispatchQueue.main.async { completion(downloadedImage) } } dataTask.resume() } static func getImage(withURL url: URL, completion: @escaping (_ image: UIImage?) -> Void) { if let image = cache.object(forKey: url.absoluteString as NSString) { completion(image) } else { downloadImage(withURL: url, completion: completion) } } }
29.723404
103
0.566929
89e9d3f58ac86f6aa256a729fd011e75b2a7f0a8
245
// // CharactersResponse.swift // MarvelApp // // Created by Rafael Lucena on 11/18/19. // Copyright © 2019 RLMG. All rights reserved. // import Foundation struct CharactersResultsResponse: Codable { var results: [CharacterResponse] }
17.5
47
0.718367
4a074a0710209f4312ad531fa8bd52460d01d427
541
// // CharacterViewModel.swift // ComicsInfo // // Created by Aleksandar Dinic on 11/05/2020. // Copyright © 2020 Aleksandar Dinic. All rights reserved. // import Foundation struct CharacterViewModel { private let character: Character init(from character: Character) { self.character = character } var name: String { character.name } var thumbnail: String { character.thumbnail ?? "" } var thumbnailSystemName: String { "person.crop.circle" } }
16.90625
59
0.617375
117c1126430809f1db7231715735afb7206d3c94
120
import XCTest import StarChartTests var tests = [XCTestCaseEntry]() tests += StarChartTests.allTests() XCTMain(tests)
15
34
0.783333
4ace13ff601df76f4517ee4ae6ee11a5cb17ccfa
5,124
// // ExportTool+Photo.swift // AnyImageKit // // Created by 刘栋 on 2019/9/27. // Copyright © 2019 AnyImageProject.org. All rights reserved. // import UIKit import Photos public struct PhotoFetchOptions { public let size: CGSize public let resizeMode: PHImageRequestOptionsResizeMode public let version: PHImageRequestOptionsVersion public let isNetworkAccessAllowed: Bool public let progressHandler: PHAssetImageProgressHandler? public init(size: CGSize = PHImageManagerMaximumSize, resizeMode: PHImageRequestOptionsResizeMode = .fast, version: PHImageRequestOptionsVersion = .current, isNetworkAccessAllowed: Bool = true, progressHandler: PHAssetImageProgressHandler? = nil) { self.size = size self.resizeMode = resizeMode self.version = version self.isNetworkAccessAllowed = isNetworkAccessAllowed self.progressHandler = progressHandler } } public struct PhotoFetchResponse { public let image: UIImage public let isDegraded: Bool } public typealias PhotoFetchCompletion = (Result<PhotoFetchResponse, AnyImageError>, PHImageRequestID) -> Void public typealias PhotoSaveCompletion = (Result<PHAsset, AnyImageError>) -> Void extension ExportTool { /// Fetch local photo 获取本地图片资源 /// - Note: Fetch local photo only. If you want to fetch iCloud photo, please use `requestPhotoData` instead. /// - Note: 该方法仅用于获取本地图片资源,若要获取iCloud图片,请使用`requestPhotoData`方法。 @discardableResult public static func requestPhoto(for asset: PHAsset, options: PhotoFetchOptions = .init(), completion: @escaping PhotoFetchCompletion) -> PHImageRequestID { let requestOptions = PHImageRequestOptions() requestOptions.version = options.version requestOptions.resizeMode = options.resizeMode requestOptions.isSynchronous = false let requestID = PHImageManager.default().requestImage(for: asset, targetSize: options.size, contentMode: .aspectFill, options: requestOptions) { (image, info) in let requestID = (info?[PHImageResultRequestIDKey] as? PHImageRequestID) ?? 0 guard let info = info else { completion(.failure(.invalidInfo), requestID) return } let isCancelled = info[PHImageCancelledKey] as? Bool ?? false let error = info[PHImageErrorKey] as? Error let isDegraded = info[PHImageResultIsDegradedKey] as? Bool ?? false let isDownload = !isCancelled && error == nil if isDownload, let image = image { completion(.success(.init(image: image, isDegraded: isDegraded)), requestID) } else { let isInCloud = info[PHImageResultIsInCloudKey] as? Bool ?? false if isInCloud { completion(.failure(AnyImageError.cannotFindInLocal), requestID) } else { completion(.failure(AnyImageError.invalidData), requestID) } } } return requestID } public static func savePhoto(image: UIImage, completion: PhotoSaveCompletion? = nil) { // Write to album library var localIdentifier: String = "" PHPhotoLibrary.shared().performChanges({ let request = PHAssetChangeRequest.creationRequestForAsset(from: image) localIdentifier = request.placeholderForCreatedAsset?.localIdentifier ?? "" }) { (isSuccess, error) in DispatchQueue.main.async { if isSuccess { if let asset = PHAsset.fetchAssets(withLocalIdentifiers: [localIdentifier], options: nil).firstObject { completion?(.success(asset)) } else { completion?(.failure(.savePhotoFailed)) } } else if let error = error { _print("Save photo error: \(error.localizedDescription)") completion?(.failure(.savePhotoFailed)) } } } } public static func savePhoto(url: URL, completion: PhotoSaveCompletion? = nil) { var localIdentifier: String = "" PHPhotoLibrary.shared().performChanges({ let request = PHAssetChangeRequest.creationRequestForAssetFromImage(atFileURL: url) localIdentifier = request?.placeholderForCreatedAsset?.localIdentifier ?? "" }) { (isSuccess, error) in DispatchQueue.main.async { if isSuccess { if let asset = PHAsset.fetchAssets(withLocalIdentifiers: [localIdentifier], options: nil).firstObject { completion?(.success(asset)) } else { completion?(.failure(.savePhotoFailed)) } } else if let error = error { _print("Save photo error: \(error.localizedDescription)") completion?(.failure(.savePhotoFailed)) } } } } }
42.347107
169
0.62139
9cc85bcd6e6f98fd9d939217921fecd8b338667c
2,185
// // AppDelegate.swift // OpenExchangeRatesClient // // Created by shawnbaek on 09/02/2018. // Copyright (c) 2018 shawnbaek. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
46.489362
285
0.756064
9b55aedc2277d1dd007944402ab081c1207746e4
4,078
// // TestViewController.swift // media-picker-service // // Created by Martin Lindhof Simonsen on 26/02/2019. // Copyright © 2019 makeable. All rights reserved. // import UIKit import Photos class TestViewController: UIViewController { var mediaPickerService: MediaPickerService? override func viewDidLoad() { super.viewDidLoad() mediaPickerService = MediaPickerService(owner: self) setupMediaPickerSettings() setupMediaPickerCallbacks() } func setupMediaPickerSettings() { let settings = MediaPickerServiceSettings.Builder() .setAutoCloseOnSingleSelect(false) .setShowsCancelButton(true) .setGeoTagImages(true) .setMaxSelectableCount(0) .setAssetsPerRow(3) .setTitleFontSize(17) .setButtonFontSize(17) .setInsets(UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)) .setCornerRadius(0) .setNavigationBarTitle("Media Picker") .setImagesSegmentTitle("Images") .setVideosSegmentTitle("Videos") .setCancelButtonTitle("Cancel") .setDoneButtonTitle("Done") .setCameraSourceText("Take Photo") .setVideoSourceText("Record Video") .setAlertMaxSelectableAssetsTitle("Maximum assets reached") .setAlertMaxSelectableAssetsMessage("You can't pick more assets.") .setPermissionDeniedAlertTitle("Permission denied") .setPermissionDeniedCameraAlertMessage("You need to give the app permission to use your camera to be able to take a photo.") .setPermissionDeniedPhotoLibraryAlertMessage("You need to give the app permission to use your photo library to use the asset picker.") .setPermissionDeniedMicrophoneAlertMessage("You need to give the app permission to use your microphone to record a video.") .setGoToSettingsButtonText("Go to settings") .setContinueWithoutButtonText("Continue without") .setLocationServicesNotEnabledTitle("Location services is disabled") .setLocationServicesNotEnabledMessage("For the app to be able to geotag your images you have to turn location services on in settings on your iPhone.\n(Anonymity -> Location Services)") .setLocationPermissionNotAcceptedTitle("Location permission denied") .setLocationPermissionNotAcceptedMessage("For the app to be able to geotag your images you have to give the app permission to use your location in the app settings") .setNavigationBarColor(.white) .setBackgroundColor(.white) .setCollectionViewBackgroundColor(.white) .setTitleColor(.black) .setButtonColor(.black) .setSourceCellBackgroundColor(.white) .setSourceCellTintColor(.black) .setSegmentedControlTintColor(.black) .setGeneralTextColor(.black) .setAssetBorderColor(.black) .setAssetCountLabelColor(.white) .setTextFont(.systemFont(ofSize: 14)) .setCameraSourceImageName("MAMediaCameraIcon") .setVideoSourceImageName("MAMediaVideoIcon") .setAssetType(.both) .setSourceType(.both) .build() mediaPickerService?.setSettings(settings) } func setupMediaPickerCallbacks() { mediaPickerService?.setDidCancelCallback { // Callback when the user closes the picker by pressing the cancel button. print("didCancelMediaPicker") } mediaPickerService?.setDidSelectAssetsCallback(completion: { (assets) in // Callback when the user presses the done button in the picker containing the picked assets in the picked order. print("didSelectAssets count: \(assets.count)") }) } @IBAction func openMediaPickerButtonPressed(_ sender: UIButton) { mediaPickerService?.presentPicker(animated: true, completion: nil) } }
43.849462
197
0.663561