Skip to content

Commit

Permalink
fix(predictions): region handling for creating correct streaming endp…
Browse files Browse the repository at this point in the history
…oint from region (#3880)

* Added region handling for creating correct streaming endpoint

* Added region handling for creating correct streaming endpoint

---------

Co-authored-by: Pramod Prajapati <prampraj@amazon.com>
  • Loading branch information
ppraja22 and Pramod Prajapati authored Sep 24, 2024
1 parent 39e820a commit 6b301f0
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@

import Foundation

private let isoPartitionBaseDomain: String = "csp.hci.ic.gov"
private let defaultBaseDomain: String = "amazonaws.com"

func streamingSessionURL(for region: String) throws -> URL {
let urlString = "wss://streaming-rekognition.\(region).amazonaws.com/start-face-liveness-session-websocket"

// Determine the base domain based on the region
let baseDomain: String
if region.lowercased().starts(with: "us-isof") {
baseDomain = isoPartitionBaseDomain
} else {
baseDomain = defaultBaseDomain
}

let urlString = "wss://streaming-rekognition.\(region).\(baseDomain)/start-face-liveness-session-websocket"
guard let url = URL(string: urlString) else {
throw FaceLivenessSessionError.invalidRegion
}
Expand Down

0 comments on commit 6b301f0

Please sign in to comment.