// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT-0
import React, {FunctionComponent, useEffect, useState} from 'react';
import {ColumnLayout, Column, Container, Box, Button} from "aws-northstar";
import Stack from "aws-northstar/layouts/Stack";
import './styles.css';
import approtation from "./approtation.png";
import {useOktaAuth} from "@okta/okta-react";
import {IUserInfo} from "../../interfaces";
import {useDispatch} from "react-redux";
import {useHistory} from "react-router-dom";
const Homepage: FunctionComponent = () => {
return
}
// The content in the main content area of the App layout
export function HomepageContent() {
// const [request, setRequest] = useState(false);
// const [review, setReview] = useState(false);
// const [audit, setAudit] = useState(false);
//
// const {oktaAuth} = useOktaAuth();
//
// const dispatch = useDispatch();
const history = useHistory();
//
// function createAccountMap(groups: string[]) {
// let accountMap = new Map();
// for (var group of groups) {
// if (group === 'aws-temp#Reviewer') {
// setReview(true);
// ApiHandler.reviewer = true;
// } else if (group === 'aws-temp#Auditor') {
// setAudit(true)
// ApiHandler.auditor = true;
// } else {
// let words = group.split('#');
// let account = words[2]
// let role = words[1]
// if (accountMap.has(account)) {
// accountMap.get(account).push(role)
// } else {
// let roles: Array = [];
// roles.push(role);
// accountMap.set(account, roles)
// }
// setRequest(true);
// ApiHandler.requester = true;
// }
// }
// return accountMap;
// }
//
// const login = async () => {
// if (oktaAuth.isLoginRedirect()) {
// await oktaAuth.handleLoginRedirect();
// } else if (!await oktaAuth.isAuthenticated()) {
// // Start the browser based oidc flow, then parse tokens from the redirect callback url
// oktaAuth.signInWithRedirect();
// }
// }
//
// const secinfo = async () => {
//
// const userInfo: IUserInfo = {
// token: "",
// user: "",
//
// requester: false,
// reviewer: false,
// auditor: false,
//
// accountMap: new Map([])
// }
//
// const claims = await oktaAuth.getUser();
// userInfo.user = claims.email ? claims.email : "";
// userInfo.accountMap = createAccountMap(claims.groups);
//
// const tokenManager = oktaAuth.tokenManager;
// const accessToken = await tokenManager.get('accessToken');
// const idToken = await tokenManager.get('idToken');
// if ("accessToken" in accessToken && "idToken" in idToken) {
// const authorization_value1 = 'Bearer '.concat(accessToken.accessToken ? accessToken.accessToken : "");
// const authorization_value2 = authorization_value1.concat(' ');
// const authorization_value3 = authorization_value2.concat(idToken.idToken ? idToken.idToken : "");
//
// userInfo.token = authorization_value3;
// }
//
// userInfo.requester = request;
// userInfo.reviewer = review;
// userInfo.auditor = audit;
// dispatch(storeUserInfoAction(userInfo));
// }
const onOpenClick = () => {
history.push(getLink());
}
const getLink = () => {
return "/app-state";
}
return (
App Rotation
Rotate Applications to Different Region
{/*
How it works
*/}
{/*
How it works
*/}
Customer has identified two inter-dependent applications Trade Matching and Settlement to explore resiliency requirements and design resilient architecture.
Customer has tiering system for their clearing and settlement applications ranging from critical (Tier 0/1/2) to less critical (Tier 3/4//5). The two apps selected are Tier 1.
The trade matching and settlement applications should meet Customer Tier 1 RPO/RTO requirement. RPO=30s & RTO=2hrs.
Investment Managers and Brokers submit trade messages through different channels (Queue, SFTP, Stream, HTTP) into the Trade Matching system. Trade Matching system performs matching function, sends acknowledgement to the client and sends settlement instruction to the Settlement system.
Clearing Agents submit settlement instructions to the Settlement system and Trade Matching system sends Settlement messages to the Settlement system. Settlement system performs matching function and sends matching status back to Trade Matching system and Clearing Agent.
Trade Matching system and Settlement system runs actively in one region and stand-by in another region. They can be active in the same region or a different region. E.g. Trade Matching system is active in us-east-1 and Settlement system is active in us-west-2. Customer operates in us-east-1 and us-west-2.
Both systems are rotatable between regions. They can be run in a given region for an extended period of time, and can be rotated to another region independently. Each of the the system is a separate “consistency group”, which means the subcomponents are expected to run in the same region.
Two scenarios need to be accounted for 1) App Rotation – Planned Failover and 2) Disaster Recovery – Unplanned Failover, for an extended period.
Performance of the system is not critical at this point, but expected to process thousands of messages per second