Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Config File Parsing Logic to Parse Services Section #309

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ extension FileBasedConfiguration {
public enum SectionType {
case profile
case ssoSession
case services
}

/// Source of file based config
Expand Down Expand Up @@ -197,6 +198,7 @@ extension FileBasedConfiguration.SectionType {
switch self {
case .profile: return AWS_PROFILE_SECTION_TYPE_PROFILE
case .ssoSession: return AWS_PROFILE_SECTION_TYPE_SSO_SESSION
case .services: return AWS_PROFILE_SECTION_TYPE_SERVICES
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Test/AwsCommonRuntimeKitTests/Resources/example_profile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ credential_process = echo '{"Version": 1, "AccessKeyId": "AccessKey123", "Secret
aws_access_key_id = example_access_key_id
aws_secret_access_key = example_secret_access_key

[services test-service]
s3 = test-url

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class FileBasedConfigurationTests: XCBaseTestCase {
XCTAssertEqual("accessKey1", credSection.getProperty(name: "aws_access_key_id")?.value)
XCTAssertEqual(credSection.propertyCount, 2)

let servicesSection = fileBasedConfiguration.getSection(name: "test-service", sectionType: .services)!
XCTAssertEqual("test-url", servicesSection.getProperty(name: "s3")?.value)
XCTAssertEqual(servicesSection.propertyCount, 1)
}

func testCollectionOutOfScope() throws {
Expand Down
Loading