Skip to content

Commit bfe7512

Browse files
authored
feat(foundation): Add Foundation libraries (#4150)
* feat: add definitions for foundational apis (#4135) * feat: add definitions for foundational apis * add AmplifyFoundation as library to Package manifest * update code * feat: add foundational bridge module (#4136) * feat: add definitions for foundational apis * add AmplifyFoundation as library to Package manifest * update code * feat: add foundational bridge module * feat: add logging definitions (#4139) * feat: add definitions for foundational apis * add AmplifyFoundation as library to Package manifest * update code * feat: add foundational bridge module * feat: add logging definitions * add tests and restructure code * address review comments * feat: add smithy/crt credential providers extensions (#4147) * feat: add smithy/crt credential providers extensions * add adapters to crt/sdk credential providers * rename Error to FoundationBridgeError * chore: add foundation tests to github actions (#4148) * chore: add foundation tests to github actions * update AmplifyFoundationBridge scheme
1 parent b20851c commit bfe7512

23 files changed

Lines changed: 1925 additions & 19 deletions

.github/workflows/unit_test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ jobs:
7676
AWSPredictionsPlugin,
7777
AWSPinpointAnalyticsPlugin,
7878
AWSPinpointPushNotificationsPlugin,
79-
AWSS3StoragePlugin
79+
AWSS3StoragePlugin,
80+
AmplifyFoundation,
81+
AmplifyFoundationBridge
8082
]
8183
uses: ./.github/workflows/run_unit_tests_platforms.yml
8284
with:
@@ -101,7 +103,9 @@ jobs:
101103
{ scheme: AWSPredictionsPlugin, flags: 'Predictions_plugin_unit_test,unit_tests' },
102104
{ scheme: AWSPinpointAnalyticsPlugin, flags: 'Analytics_plugin_unit_test,unit_tests' },
103105
{ scheme: AWSPinpointPushNotificationsPlugin, flags: 'PushNotifications_plugin_unit_test,unit_tests' },
104-
{ scheme: AWSS3StoragePlugin, flags: 'Storage_plugin_unit_test,unit_tests' }
106+
{ scheme: AWSS3StoragePlugin, flags: 'Storage_plugin_unit_test,unit_tests' },
107+
{ scheme: AmplifyFoundation, flags: 'Amplify_Foundation_unit_test,unit_tests' },
108+
{ scheme: AmplifyFoundationBridge, flags: 'Amplify_Foundation_Bridge_unit_test,unit_tests' }
105109
]
106110
uses: ./.github/workflows/upload_coverage_report.yml
107111
with:

.swiftpm/xcode/xcshareddata/xcschemes/Amplify-Package.xcscheme

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,34 @@
496496
ReferencedContainer = "container:">
497497
</BuildableReference>
498498
</BuildActionEntry>
499+
<BuildActionEntry
500+
buildForTesting = "YES"
501+
buildForRunning = "YES"
502+
buildForProfiling = "NO"
503+
buildForArchiving = "NO"
504+
buildForAnalyzing = "YES">
505+
<BuildableReference
506+
BuildableIdentifier = "primary"
507+
BlueprintIdentifier = "AmplifyFoundation"
508+
BuildableName = "AmplifyFoundation"
509+
BlueprintName = "AmplifyFoundation"
510+
ReferencedContainer = "container:">
511+
</BuildableReference>
512+
</BuildActionEntry>
513+
<BuildActionEntry
514+
buildForTesting = "YES"
515+
buildForRunning = "YES"
516+
buildForProfiling = "YES"
517+
buildForArchiving = "YES"
518+
buildForAnalyzing = "YES">
519+
<BuildableReference
520+
BuildableIdentifier = "primary"
521+
BlueprintIdentifier = "AmplifyFoundationBridge"
522+
BuildableName = "AmplifyFoundationBridge"
523+
BlueprintName = "AmplifyFoundationBridge"
524+
ReferencedContainer = "container:">
525+
</BuildableReference>
526+
</BuildActionEntry>
499527
</BuildActionEntries>
500528
</BuildAction>
501529
<TestAction
@@ -765,6 +793,26 @@
765793
ReferencedContainer = "container:">
766794
</BuildableReference>
767795
</TestableReference>
796+
<TestableReference
797+
skipped = "NO">
798+
<BuildableReference
799+
BuildableIdentifier = "primary"
800+
BlueprintIdentifier = "AmplifyFoundationBridgeTests"
801+
BuildableName = "AmplifyFoundationBridgeTests"
802+
BlueprintName = "AmplifyFoundationBridgeTests"
803+
ReferencedContainer = "container:">
804+
</BuildableReference>
805+
</TestableReference>
806+
<TestableReference
807+
skipped = "NO">
808+
<BuildableReference
809+
BuildableIdentifier = "primary"
810+
BlueprintIdentifier = "AmplifyFoundationTests"
811+
BuildableName = "AmplifyFoundationTests"
812+
BlueprintName = "AmplifyFoundationTests"
813+
ReferencedContainer = "container:">
814+
</BuildableReference>
815+
</TestableReference>
768816
</Testables>
769817
</TestAction>
770818
<LaunchAction
@@ -791,6 +839,15 @@
791839
savedToolIdentifier = ""
792840
useCustomWorkingDirectory = "NO"
793841
debugDocumentVersioning = "YES">
842+
<MacroExpansion>
843+
<BuildableReference
844+
BuildableIdentifier = "primary"
845+
BlueprintIdentifier = "Amplify"
846+
BuildableName = "Amplify"
847+
BlueprintName = "Amplify"
848+
ReferencedContainer = "container:">
849+
</BuildableReference>
850+
</MacroExpansion>
794851
</ProfileAction>
795852
<AnalyzeAction
796853
buildConfiguration = "Debug">
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "2600"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "AmplifyFoundation"
18+
BuildableName = "AmplifyFoundation"
19+
BlueprintName = "AmplifyFoundation"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "NO"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "NO">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "AmplifyFoundationTests"
32+
BuildableName = "AmplifyFoundationTests"
33+
BlueprintName = "AmplifyFoundationTests"
34+
ReferencedContainer = "container:">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
</BuildActionEntries>
38+
</BuildAction>
39+
<TestAction
40+
buildConfiguration = "Debug"
41+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<TestPlans>
45+
<TestPlanReference
46+
reference = "container:AmplifyFoundation/AmplifyFoundation.xctestplan"
47+
default = "YES">
48+
</TestPlanReference>
49+
</TestPlans>
50+
</TestAction>
51+
<LaunchAction
52+
buildConfiguration = "Debug"
53+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
54+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
55+
launchStyle = "0"
56+
useCustomWorkingDirectory = "NO"
57+
ignoresPersistentStateOnLaunch = "NO"
58+
debugDocumentVersioning = "YES"
59+
debugServiceExtension = "internal"
60+
allowLocationSimulation = "YES">
61+
</LaunchAction>
62+
<ProfileAction
63+
buildConfiguration = "Release"
64+
shouldUseLaunchSchemeArgsEnv = "YES"
65+
savedToolIdentifier = ""
66+
useCustomWorkingDirectory = "NO"
67+
debugDocumentVersioning = "YES">
68+
<MacroExpansion>
69+
<BuildableReference
70+
BuildableIdentifier = "primary"
71+
BlueprintIdentifier = "AmplifyFoundation"
72+
BuildableName = "AmplifyFoundation"
73+
BlueprintName = "AmplifyFoundation"
74+
ReferencedContainer = "container:">
75+
</BuildableReference>
76+
</MacroExpansion>
77+
</ProfileAction>
78+
<AnalyzeAction
79+
buildConfiguration = "Debug">
80+
</AnalyzeAction>
81+
<ArchiveAction
82+
buildConfiguration = "Release"
83+
revealArchiveInOrganizer = "YES">
84+
</ArchiveAction>
85+
</Scheme>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "2600"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "AmplifyFoundationBridge"
19+
BuildableName = "AmplifyFoundationBridge"
20+
BlueprintName = "AmplifyFoundationBridge"
21+
ReferencedContainer = "container:">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
<BuildActionEntry
25+
buildForTesting = "YES"
26+
buildForRunning = "YES"
27+
buildForProfiling = "YES"
28+
buildForArchiving = "YES"
29+
buildForAnalyzing = "YES">
30+
<BuildableReference
31+
BuildableIdentifier = "primary"
32+
BlueprintIdentifier = "AmplifyFoundationBridgeTests"
33+
BuildableName = "AmplifyFoundationBridgeTests"
34+
BlueprintName = "AmplifyFoundationBridgeTests"
35+
ReferencedContainer = "container:">
36+
</BuildableReference>
37+
</BuildActionEntry>
38+
</BuildActionEntries>
39+
</BuildAction>
40+
<TestAction
41+
buildConfiguration = "Debug"
42+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
43+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
44+
shouldUseLaunchSchemeArgsEnv = "YES">
45+
<TestPlans>
46+
<TestPlanReference
47+
reference = "container:AmplifyFoundationBridge/AmplifyFoundationBridge.xctestplan"
48+
default = "YES">
49+
</TestPlanReference>
50+
</TestPlans>
51+
</TestAction>
52+
<LaunchAction
53+
buildConfiguration = "Debug"
54+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
55+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
56+
launchStyle = "0"
57+
useCustomWorkingDirectory = "NO"
58+
ignoresPersistentStateOnLaunch = "NO"
59+
debugDocumentVersioning = "YES"
60+
debugServiceExtension = "internal"
61+
allowLocationSimulation = "YES">
62+
</LaunchAction>
63+
<ProfileAction
64+
buildConfiguration = "Release"
65+
shouldUseLaunchSchemeArgsEnv = "YES"
66+
savedToolIdentifier = ""
67+
useCustomWorkingDirectory = "NO"
68+
debugDocumentVersioning = "YES">
69+
<MacroExpansion>
70+
<BuildableReference
71+
BuildableIdentifier = "primary"
72+
BlueprintIdentifier = "AmplifyFoundationBridge"
73+
BuildableName = "AmplifyFoundationBridge"
74+
BlueprintName = "AmplifyFoundationBridge"
75+
ReferencedContainer = "container:">
76+
</BuildableReference>
77+
</MacroExpansion>
78+
</ProfileAction>
79+
<AnalyzeAction
80+
buildConfiguration = "Debug">
81+
</AnalyzeAction>
82+
<ArchiveAction
83+
buildConfiguration = "Release"
84+
revealArchiveInOrganizer = "YES">
85+
</ArchiveAction>
86+
</Scheme>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "ED15D4A7-6C95-44D8-AEB3-02F1B0880CFF",
5+
"name" : "Configuration 1",
6+
"options" : {
7+
8+
}
9+
}
10+
],
11+
"defaultOptions" : {
12+
13+
},
14+
"testTargets" : [
15+
{
16+
"target" : {
17+
"containerPath" : "container:",
18+
"identifier" : "AmplifyFoundationTests",
19+
"name" : "AmplifyFoundationTests"
20+
}
21+
}
22+
],
23+
"version" : 1
24+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// Copyright Amazon.com Inc. or its affiliates.
3+
// All Rights Reserved.
4+
//
5+
// SPDX-License-Identifier: Apache-2.0
6+
//
7+
import Foundation
8+
9+
/**
10+
Represents AWS credentials.
11+
12+
Typically refers to long-term credentials that do not expire unless manually rotated or deactivated.
13+
These credentials are generally associated with an IAM (Identity and Access Management) user and are used to authenticate API requests to AWS services.
14+
15+
- Properties:
16+
- accessKeyId: A unique identifier.
17+
- secretAccessKey: A secret key used to sign requests cryptographically.
18+
*/
19+
public protocol AWSCredentials {
20+
var accessKeyId: String { get }
21+
var secretAccessKey: String { get }
22+
}
23+
24+
/**
25+
Represents temporary AWS credentials.
26+
27+
Refers to short-term credentials generated by AWS STS (Security Token Service).
28+
These credentials are used for temporary access, often for applications, temporary roles, federated users, or scenarios requiring limited-time access.
29+
30+
- Inherits: AWSCredentials
31+
32+
- Properties:
33+
- sessionToken: A token that is required when using temporary security credentials to sign requests.
34+
- expiration: The expiration date and time of the temporary credentials.
35+
*/
36+
public protocol AWSTemporaryCredentials: AWSCredentials {
37+
var sessionToken: String { get }
38+
var expiration: Date { get }
39+
}
40+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// Copyright Amazon.com Inc. or its affiliates.
3+
// All Rights Reserved.
4+
//
5+
// SPDX-License-Identifier: Apache-2.0
6+
//
7+
8+
/**
9+
Protocol to implement for providers vending AWS credentials
10+
*/
11+
public protocol AWSCredentialsProvider {
12+
func resolve() async throws -> AWSCredentials
13+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Copyright Amazon.com Inc. or its affiliates.
3+
// All Rights Reserved.
4+
//
5+
// SPDX-License-Identifier: Apache-2.0
6+
//
7+
import Foundation
8+
9+
public typealias ErrorDescription = String
10+
public typealias RecoverySuggestion = String
11+
12+
/// This is the high level exception in the Amplify framework. Client specific exceptions should extend this.
13+
/// It includes user friendly message
14+
public protocol AmplifyError: Error {
15+
/// A localized message describing what error occurred.
16+
var errorDescription: ErrorDescription { get }
17+
18+
/// A localized message describing how one might recover from the failure.
19+
var recoverySuggestion: RecoverySuggestion { get }
20+
21+
/// The underlying error that caused the error condition
22+
var underlyingError: Error? { get }
23+
24+
init(
25+
errorDescription: ErrorDescription,
26+
recoverySuggestion: RecoverySuggestion,
27+
error: Error?
28+
)
29+
}

0 commit comments

Comments
 (0)