Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. let credentialsProvider = AWSCognitoCredentialsProvider(regionType: config.region, identityPoolId: config.identityPoolId)
  2. let configuration = AWSServiceConfiguration(region: config.region, credentialsProvider: credentialsProvider)
  3. AWSServiceManager.default().defaultServiceConfiguration = configuration
  4.  
  5. func setupGatewayClient() {
  6. guard let configuration = AWSServiceManager.default().defaultServiceConfiguration else {
  7. return
  8. }
  9. gatewayClient = AWSAPIGatewayClient()
  10. gatewayClient.configuration = configuration.copy() as! AWSServiceConfiguration
  11. let URLString: String = <My endpont URL>
  12. let endpoint = AWSEndpoint(region: configuration.regionType, service: .APIGateway, url: URL(string: URLString))
  13. gatewayClient.configuration.endpoint = endpoint
  14.  
  15. let signer: AWSSignatureV4Signer = AWSSignatureV4Signer(credentialsProvider: configuration.credentialsProvider, endpoint: endpoint)
  16. if let endpoint = endpoint {
  17. gatewayClient.configuration.baseURL = endpoint.url
  18. }
  19. gatewayClient.configuration.requestInterceptors = [AWSNetworkingRequestInterceptor(), signer]
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement