Skip to content

Commit

Permalink
Updates for Swift SDK 0.28.0
Browse files Browse the repository at this point in the history
Updated tests to use the new names for return structs.
The old *OutputResponse types are now *Output.
  • Loading branch information
shepazon authored and ford-at-aws committed Oct 13, 2023
1 parent 0798eab commit 3874ab1
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion swift/example_code/ddb/ListTables/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
.package(
url: "https://github.com/awslabs/aws-sdk-swift",
from: "0.10.0"
from: "0.28.0"
),
.package(
url: "https://github.com/apple/swift-argument-parser.git",
Expand Down
10 changes: 5 additions & 5 deletions swift/example_code/ddb/ListTables/Sources/DatabaseManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public protocol DatabaseSession {
/// A mockable entry point for the Amazon DynamoDB function
/// `listTables()`. A DynamoDB implementation of `DatabaseSession` should
/// call through to `DynamoDBClient.listTables()`, while a mocked
/// implementation should generate and return a `ListTablesOutputResponse`
/// implementation should generate and return a `ListTablesOutput`
/// object with the desired results for testing purposes.
///
/// - Parameter input: A `ListTablesInput` object specifying the input
/// parameters for the call to `listTables()`.
///
/// - Returns: A `ListTablesOutputResponse` structure with the results.
func listTables(input: ListTablesInput) async throws -> ListTablesOutputResponse
/// - Returns: A `ListTablesOutput` structure with the results.
func listTables(input: ListTablesInput) async throws -> ListTablesOutput
}

// snippet-start:[ddb.swift.dynamodbsession]
Expand Down Expand Up @@ -49,10 +49,10 @@ public struct DynamoDBSession: DatabaseSession {
/// - Parameter input: The `input` parameter for `listTables()` as a
/// `ListTablesInput` object.
///
/// - Returns: The `ListTablesOutputResponse` returned by `listTables()`.
/// - Returns: The `ListTablesOutput` returned by `listTables()`.
///
/// - Throws: Errors from DynamoDB are thrown as usual.
public func listTables(input: ListTablesInput) async throws -> ListTablesOutputResponse {
public func listTables(input: ListTablesInput) async throws -> ListTablesOutput {
return try await client.listTables(input: input)
}
// snippet-end:[ddb.swift.dynamodbsession.listtables]
Expand Down
4 changes: 2 additions & 2 deletions swift/example_code/ddb/ListTables/Tests/ListTablesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public struct MockDBSession: DatabaseSession {
/// Mock version of the DynamoDB client's `listTables()` function. Returns
/// values from the string array `fakeTableNames` or the one specified as
/// an optional input when creating the `MockDBSession`.
public func listTables(input: ListTablesInput) async throws -> ListTablesOutputResponse {
var output = ListTablesOutputResponse(
public func listTables(input: ListTablesInput) async throws -> ListTablesOutput {
var output = ListTablesOutput(
lastEvaluatedTableName: nil,
tableNames: nil
)
Expand Down
2 changes: 1 addition & 1 deletion swift/example_code/s3/ListBuckets/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
.package(
url: "https://github.com/awslabs/aws-sdk-swift",
from: "0.20.0"
from: "0.28.0"
),
.package(
url: "https://github.com/apple/swift-argument-parser.git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import AWSS3
/// A protocol defining the Amazon S3 functions we want to mock
/// during testing.
public protocol S3SessionProtocol {
func listBuckets(input: ListBucketsInput) async throws -> ListBucketsOutputResponse
func listBuckets(input: ListBucketsInput) async throws -> ListBucketsOutput
}
// snippet-end:[s3.swift.listbuckets.s3sessionprotocol]

Expand All @@ -41,9 +41,9 @@ public struct S3Session: S3SessionProtocol {
/// Call through to the ``S3Client`` function `listBuckets()`.
/// - Parameter input: The input to pass through to the SDK function
/// `listBuckets()`.
/// - Returns: A ``ListBucketsOutputResponse`` with the returned data.
/// - Returns: A ``ListBucketsOutput`` with the returned data.
public func listBuckets(input: ListBucketsInput) async throws
-> ListBucketsOutputResponse {
-> ListBucketsOutput {
return try await self.client.listBuckets(input: input)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public struct MockS3Session: S3SessionProtocol {
///
/// - Parameter input: The input to the `listBuckets()` function.
///
/// - Returns: A `ListBucketsOutputResponse` object containing the list of
/// - Returns: A `ListBucketsOutput` object containing the list of
/// buckets.
public func listBuckets(input: ListBucketsInput) async throws
-> ListBucketsOutputResponse {
-> ListBucketsOutput {
var bucketList: [S3ClientTypes.Bucket] = []
let df = DateFormatter()
df.dateFormat = "M/d/yy, h:mm:ss a z"
Expand All @@ -62,10 +62,10 @@ public struct MockS3Session: S3SessionProtocol {
bucketList.append(bucket)
}

// Create and return the `ListBucketsOutputResponse` object containing
// Create and return the `ListBucketsOutput` object containing
// the results.

let response = ListBucketsOutputResponse(
let response = ListBucketsOutput(
buckets: bucketList,
owner: nil
)
Expand Down
2 changes: 1 addition & 1 deletion swift/example_code/swift-sdk/mocking/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
.package(
url: "https://github.com/awslabs/aws-sdk-swift",
from: "0.20.0"
from: "0.28.0"
)
],
// snippet-start:[mocking.swift.package.targets]
Expand Down
6 changes: 3 additions & 3 deletions swift/example_code/swift-sdk/mocking/Sources/S3Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import AWSS3
/// instead return mock results.
public protocol S3SessionProtocol {
func listBuckets(input: ListBucketsInput) async throws
-> ListBucketsOutputResponse
-> ListBucketsOutput
}
// snippet-end:[mocking.swift.protocol]

Expand All @@ -44,11 +44,11 @@ public class S3Session: S3SessionProtocol {
/// - Parameter input: The input to pass through to the SDK function
/// `listBuckets()`.
///
/// - Returns: A ``ListBucketsOutputResponse`` with the returned data.
/// - Returns: A ``ListBucketsOutput`` with the returned data.
///
// snippet-start:[mocking.swift.implement-real]
public func listBuckets(input: ListBucketsInput) async throws
-> ListBucketsOutputResponse {
-> ListBucketsOutput {
return try await self.client.listBuckets(input: input)
}
// snippet-end:[mocking.swift.implement-real]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public class MockS3Session: S3SessionProtocol {
///
/// - Parameter input: The input to the `listBuckets()` function.
///
/// - Returns: A `ListBucketsOutputResponse` object containing the list of
/// - Returns: A `ListBucketsOutput` object containing the list of
/// buckets.
public func listBuckets(input: ListBucketsInput) async throws
-> ListBucketsOutputResponse {
let response = ListBucketsOutputResponse(
-> ListBucketsOutput {
let response = ListBucketsOutput(
buckets: self.mockBuckets,
owner: nil
)
Expand Down

0 comments on commit 3874ab1

Please sign in to comment.