From ca54382924f5a27063eabbc5b2a81b3d44496b58 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期四, 14 四月 2022 15:30:59 +0800
Subject: [PATCH] PIPLController0414

---
 force-app/main/default/classes/AWSServiceTool.cls |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/AWSServiceTool.cls b/force-app/main/default/classes/AWSServiceTool.cls
new file mode 100644
index 0000000..049cffd
--- /dev/null
+++ b/force-app/main/default/classes/AWSServiceTool.cls
@@ -0,0 +1,29 @@
+/*
+ * Author: Bubba Li
+ * Created Date: 01/25/2022
+ * Purpose: Utility class for AWS Servicw
+ * Test Class: AWSServiceTool
+ * History: 
+ *      01/25/2022 - Bubba Li - Initial Code.
+ * 
+ * */
+public without sharing class AWSServiceTool {
+    public static String getAWSToken(){
+        AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt  WHERE DeveloperName = 'AWS_Default_Configuration'];
+        if (awsConfiguration == null) {
+            System.debug('AWS_Integration_Info__mdt娌¢厤缃�');
+            return null;
+        }
+        String awsAppId = awsConfiguration.App_Id__c;
+        String awsAppSecret = awsConfiguration.App_Secret__c;
+        Http http = new Http();
+        HttpRequest request = new HttpRequest();
+        String url = awsConfiguration.Token_URL__c;
+        request.setEndpoint(url);
+        request.setMethod('GET');
+        HttpResponse response = http.send(request);
+        Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
+        String token = (String)results.get('object');
+        return token;
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1