Extending OracleApplication Express withOracle Cloud FeaturesA Guide to Enhancing APEX WebApplications with Cloud-Nativeand Machine Learning TechnologiesAdrian PngHeli HelskyahoExtending Oracle Application Express with Oracle Cloud Features: A Guide toEnhancing APEX Web Applications with Cloud-Native and Machine LearningTechnologies Adrian Png Heli Helskyaho Whitehorse, YT, Canada Helsinki, Finland ISBN-13 (pbk): 978-1-4842-8169-7 ISBN-13 (electronic): 978-1-4842-8170-3 https://doi.org/10.1007/978-1-4842-8170-3 Copyright 2022 by Adrian Png and Heli Helskyaho This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made.
The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Jonathan Gennick Development Editor: Laura Berendson Coordinating Editor: Jill Balzano Cover image designed by Freepik (www.freepik.com) Distributed to the book trade worldwide by Springer Science+Business Media LLC, 1 New York Plaza, Suite 4600, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm. com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub (https://github.com/Apress). For more detailed information, please visit http://www.apress.com/source- code.
Printed on acid-free paper Dedicated to Joel R. Kallman.Thank you for showing us what angels look like.Table of Contents About the Authors xi About the Technical Reviewer xiii Acknowledgments xv Introduction xvii Chapter 1: Architecting a Secure Infrastructure for APEX 1 Network Components 2 Virtual Cloud Network 3 Network Security Groups 7 Bastion 11 Infrastructure as Code 17 Terraform and the Resource Manager 18 The OCI Designer Toolkit 19 Deploying APEX to a Database System 20 Oracle Autonomous Linux 20 Load Balancer 21 APEX on an Autonomous Database 21 Private Endpoint 22 Vanity URL 24 Web Application Firewall 25 Vulnerability Scanning 28 Logs, Metrics, and Alarms 31 Summary 33 v Table of ConTenTs Chapter 2: Storing Large Objects Using Object Storage 35 Oracle Cloud Infrastructure 36 Storing Files in the Oracle Database 37 The OCI Object Storage Alternative 37 Using OCI Object Storage with APEX 39 Create a Compartment 39 Create an OCI Object Storage Bucket 40 Create an Oracle Autonomous Database (Optional) 41 Create Identity and Access Management Resources 42 The APEX Application 48 Considerations 62 Summary 63 Chapter 3: Using Oracle Cloud Functions 65 Image Processing 65 Processing Images on the Client Browser 68 Custom Image Processing REST API 68 Using Third-Party REST APIs 68 Oracle Cloud Functions 69 Required Software and Tools 70 Virtual Cloud Network 72 Identity and Access Management 74 Set Up Fn Project CLI 82 Oracle Cloud Infrastructure Container Registry 85 Validate Setup 85 Thumbnail Generator Function 86 Approach to Development 93 Configuration Parameters 97 Triggering Functions with Oracle Events 97 Resource Principals 100 Complete Function and Deploy 103 Troubleshooting and Logging 105 vi Table of ConTenTs Thumbnails Applied 107 Summary 110 Chapter 4: Exposing Functionality with API Gateway 111 Use Case Definition 112 Deploy the Language Translation Engine 115 Oracle Functions for Language Translation 123 API Gateway for Language Translation 124 Calling the API Gateway from APEX 132 Security and Logging 136 Summary 138 Chapter 5: Oracle Machine Learning in Autonomous Database 139 Setting Up the Oracle Machine Learning Environment 139 Creating an Autonomous Database 139 Obtaining the URLs Needed for Using the OML Service 145 Creating an OML User 146 Oracle Machine Learning 151 An Introduction to Oracle Machine Learning User Interface 151 Administration 154 Notebooks 158 AutoML 167 Models 177 Oracle Machine Learning for SQL (OML4SQL) 181 Oracle Machine Learning for Python (OML4Py) 184 In-Database Machine Learning and APEX 190 Summary 191 Chapter 6: Oracle Machine Learning REST Services 193 A Short Introduction to REST APIs 193 Introduction to OML REST Services 196 REST API for Oracle Machine Learning Services 196 REST API for Embedded Python Execution 198 vii Table of ConTenTs Using OML REST Services 200 Installing and Setting Up a REST Client (cURL) 200 Creating an Access Token 201 Examples of Using OML REST Services 203 Using OML REST Services from APEX 213 Summary 232 Chapter 7: Data Labeling 233 Setting Up the Service 233 Datasets, Records, and Labeling 243 Creating a Dataset and Records 244 Labeling Records in a Dataset 249 Adding New Records to the Dataset 252 Data Labeling Errors 252 Data Labeling with APEX Using OCI APIs 255 Data Labeling APIs 255 Setting Up APEX for Data Labeling APIs 255 Using Data Labeling APIs with APEX 261 Summary 268 Chapter 8: Anomaly Detection 269 Setting Up the Anomaly Detection Service 270 Compartment, Policies, User Groups, and a User 270 Vault, Keys, and Secrets 280 Anomaly Detection Service 289 Requirements for the Data 289 Creating a Machine Learning Model and Detecting Anomalies 293 Metrics 310 Anomaly Detection with APEX Using the OCI API 313 Anomaly Detection API 313 Setting Up APEX for Anomaly Detection API 313 Using Anomaly Detection APIs with APEX 315 Summary 317 viii Table of ConTenTs Chapter 9: Language 319 Different Use Cases for Language Service 319 Language Detection 320 Text Classification 321 Key Phrase Extraction 321 Named Entity Recognition 322 Sentiment Analysis 323 Setting Up the Service 324 Analyzing Text with the OCI Console 329 Analyzing Text with the OCI Language API and APEX 334 Language API 334 Setting Up APEX for Language API 335 Using Language API with APEX 339 Summary 344 Chapter 10: Vision 345 Working with OCI REST APIs 346 OCI Object Storage 347 OCI Vision 349 Summary 366 Chapter 11: Email Delivery Services 367 Setting Up OCI Resources 368 Identity and Access Management 368 Regions, Availability, and Server Information 376 Email Domains 377 Approved Senders 386 Suppression List 388 Configure APEX Instance for OCI Email Delivery Service 389 Email Deliverability 393 ix Table of ConTenTs Testing Deliverability 394 Troubleshooting Deliverability 396 Other Essentials 400 Summary 401 Index 403 x
Next page