-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STITCH-1818 Expose StitchServiceClient and add AWSServiceClient (#89)
- Loading branch information
Showing
74 changed files
with
1,710 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...Services/StitchCoreAWSS3Service/Sources/StitchCoreAWSS3Service/AWSS3PutObjectResult.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...ervices/StitchCoreAWSS3Service/Sources/StitchCoreAWSS3Service/AWSS3SignPolicyResult.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
Core/Services/StitchCoreAWSSESService/Sources/StitchCoreAWSSESService/AWSSESSendResult.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
/*.xcodeproj | ||
vendor | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
all: prepare build | ||
git: | ||
git init | ||
git add . | ||
git commit --allow-empty -m "init" | ||
lint: | ||
swiftlint | ||
clean: | ||
swift package --build-path ../../../.build clean | ||
build: | ||
swift build --build-path ../../../.build -Xcc -I../../../vendor/MobileSDKs/include/libbson-1.0/ -Xcc -I../../../vendor/MobileSDKs/include/libmongoc-1.0 | ||
resolve: | ||
swift package --build-path ../../../.build resolve | ||
update: | ||
swift package --build-path ../../../.build update | ||
test: | ||
# temporary until a fix is in for .brew dependency for libmongoc | ||
xcodebuild test -workspace ../../../Stitch.xcworkspace/ -scheme StitchCoreAWSService-Package -configuration Debug -destination "platform=iOS Simulator,name=iPhone 7,OS=11.2" | ||
project: | ||
swift package generate-xcodeproj --xcconfig-overrides StitchCoreAWSService.xcconfig | ||
prepare: git resolve project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// swift-tools-version:4.0 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "StitchCoreAWSService", | ||
products: [ | ||
.library( | ||
name: "StitchCoreAWSService", | ||
targets: ["StitchCoreAWSService"]), | ||
], | ||
dependencies: [ | ||
.package(url: "../../StitchCoreSDK", .branch("master")) | ||
], | ||
targets: [ | ||
.target( | ||
name: "StitchCoreAWSService", | ||
dependencies: ["StitchCoreSDK"]), | ||
.testTarget( | ||
name: "StitchCoreAWSServiceTests", | ||
dependencies: ["StitchCoreAWSService", "StitchCoreSDKMocks"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# StitchCoreAWSService | ||
|
||
A description of this package. |
106 changes: 106 additions & 0 deletions
106
Core/Services/StitchCoreAWSService/Sources/StitchCoreAWSService/AWSRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import Foundation | ||
import MongoSwift | ||
|
||
/** | ||
* An error that the `AWSRequestBuilder` can throw if it is missing certain configuration properties. | ||
*/ | ||
public enum AWSRequestBuilderError: Error { | ||
case missingService | ||
case missingAction | ||
} | ||
|
||
/** | ||
* An AWSRequest encapsulates the details of an AWS request over the AWS service. | ||
*/ | ||
public struct AWSRequest { | ||
/** | ||
* The service that the action in the request will be performed against. | ||
*/ | ||
public let service: String | ||
|
||
/** | ||
* The action within the AWS service to perform. | ||
*/ | ||
public let action: String | ||
|
||
/** | ||
* The region that service in this request should be scoped to. | ||
*/ | ||
public let region: String? | ||
|
||
/** | ||
* The arguments that will be used in the action. | ||
*/ | ||
public let arguments: Document | ||
} | ||
|
||
/** | ||
* A builder that can build an `AWSRequest` | ||
*/ | ||
public class AWSRequestBuilder { | ||
internal var service: String? | ||
internal var action: String? | ||
internal var region: String? | ||
internal var arguments: Document? | ||
|
||
/** | ||
* Initializes a new builder for an AWS request. | ||
*/ | ||
public init() { } | ||
|
||
/** | ||
* Sets the service that the action in the request will be performed against. | ||
*/ | ||
@discardableResult | ||
public func with(service: String) -> Self { | ||
self.service = service | ||
return self | ||
} | ||
|
||
/** | ||
* Sets the action within the AWS service to perform. | ||
*/ | ||
@discardableResult | ||
public func with(action: String) -> Self { | ||
self.action = action | ||
return self | ||
} | ||
|
||
/** | ||
* Sets the region that service in this request should be scoped to. | ||
*/ | ||
@discardableResult | ||
public func with(region: String) -> Self { | ||
self.region = region | ||
return self | ||
} | ||
|
||
/** | ||
* Sets the arguments that will be used in the action. | ||
*/ | ||
@discardableResult | ||
public func with(arguments: Document) -> Self { | ||
self.arguments = arguments | ||
return self | ||
} | ||
|
||
/** | ||
* Builds, validates, and returns the `AWSRequest`. | ||
*/ | ||
public func build() throws -> AWSRequest { | ||
guard let service = service, service != "" else { | ||
throw AWSRequestBuilderError.missingService | ||
} | ||
|
||
guard let action = action, action != "" else { | ||
throw AWSRequestBuilderError.missingAction | ||
} | ||
|
||
return AWSRequest.init( | ||
service: service, | ||
action: action, | ||
region: region, | ||
arguments: arguments ?? Document.init() | ||
) | ||
} | ||
} |
Oops, something went wrong.