retryableStatusCodes) {
16 | this.retryableStatusCodes = retryableStatusCodes;
17 | }
18 |
19 | @Override
20 | public Exception decode(String methodKey, Response response) {
21 | // Default error decoder converts response to either FeignException or RetryableException(if
22 | // Retry-After header is present in response).
23 |
24 | Exception ex = super.decode(methodKey, response);
25 | if (ex instanceof RetryableException) {
26 | return ex;
27 | } else if (ex instanceof FeignException) {
28 | ex.printStackTrace();
29 | FeignException feignException = (FeignException) ex;
30 | if (retryableStatusCodes.contains(feignException.status())) {
31 | return new RetryableException(
32 | 0, feignException.getMessage(), response.request().httpMethod(), feignException, null, null);
33 | }
34 | return feignException;
35 | }
36 | return ex;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/AWS/EKSKubernetesManifests/HotelService.yaml:
--------------------------------------------------------------------------------
1 |
2 | apiVersion: v1
3 | kind: ConfigMap
4 | metadata:
5 | name: hotel-service
6 | data:
7 | rapidapi.key: << Placeholder for rapid api key >>
8 | api.awsUtilityUrl: http://aws-utility-service:80/
9 | ---
10 | apiVersion: apps/v1
11 | kind: Deployment
12 | metadata:
13 | name: hotel-service
14 | labels:
15 | app: hotel-service
16 | s1p: hotel
17 | spec:
18 | replicas: 1
19 | selector:
20 | matchLabels:
21 | app: hotel-service
22 | template:
23 | metadata:
24 | labels:
25 | app: hotel-service
26 | spec:
27 | containers:
28 | - name: hotel-service
29 | image: pavithravasudevan/hotelsearchservice:0.0.1-SNAPSHOT
30 | imagePullPolicy: Always
31 | envFrom:
32 | - configMapRef:
33 | name: hotel-service
34 | resources:
35 | requests:
36 | cpu: "500m"
37 | memory: "512Mi"
38 | limits:
39 | cpu: "500m"
40 | memory: "1Gi"
41 | ports:
42 | - containerPort: 8102
43 | ---
44 | apiVersion: v1
45 | kind: Service
46 | metadata:
47 | name: hotel-service
48 | labels:
49 | s1p: hotel
50 | annotations:
51 | alb.ingress.kubernetes.io/healthcheck-path: /actuator/health/readiness
52 | spec:
53 | type: NodePort
54 | selector:
55 | app: hotel-service
56 | ports:
57 | - port: 80
58 | targetPort: 8102
--------------------------------------------------------------------------------
/AWS/EKSKubernetesManifests/AwsUtility.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: aws-utitlity-service
5 | data:
6 | kubernetes.profile: "Y"
7 | ---
8 | apiVersion: apps/v1
9 | kind: Deployment
10 | metadata:
11 | name: aws-utility-service
12 | labels:
13 | app: aws-utility-service
14 | s1p: aws-utility
15 | spec:
16 | selector:
17 | matchLabels:
18 | app: aws-utility-service
19 | template:
20 | metadata:
21 | labels:
22 | app: aws-utility-service
23 | spec:
24 | serviceAccountName: hotelservice
25 | containers:
26 | - name: aws-utility-service
27 | image: pavithravasudevan/aws-utility-service:0.0.1-SNAPSHOT
28 | imagePullPolicy: Always
29 | resources:
30 | requests:
31 | cpu: "300m"
32 | memory: "512Mi"
33 | limits:
34 | cpu: "500m"
35 | memory: "1Gi"
36 | envFrom:
37 | - configMapRef:
38 | name: aws-utitlity-service
39 | ports:
40 | - containerPort: 8080
41 | ---
42 | apiVersion: v1
43 | kind: Service
44 | metadata:
45 | name: aws-utility-service
46 | labels:
47 | s1p: aws-utility
48 | annotations:
49 | alb.ingress.kubernetes.io/healthcheck-path: /actuator/health/readiness
50 | spec:
51 | type: ClusterIP
52 | selector:
53 | app: aws-utility-service
54 | ports:
55 | - port: 80
56 | targetPort: 8080
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/App.js:
--------------------------------------------------------------------------------
1 |
2 | import './App.scss';
3 | import Layout from './components/ui/Layout';
4 | import FlightBooking from './pages/FlightBooking';
5 | import HotelBooking from './pages/HotelBooking';
6 | import HotelDetails from './pages/HotelDetails';
7 | import { Route, Routes, Navigate, Link } from 'react-router-dom';
8 | import FavoriteHotels from './components/hotel/FavoriteHotels';
9 | import RequireAuth from './util/RequireAuth';
10 |
11 |
12 |
13 | Number.prototype.format = function(n, x) {
14 | var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\.' : '$') + ')';
15 | return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&,');
16 | };
17 |
18 | function App() {
19 |
20 | return (
21 |
22 |
23 |
24 |
25 |
26 | } />
27 | }/>
28 | } />
29 | } />
30 | }>
31 |
32 | } />
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | );
42 | }
43 |
44 | export default App;
45 |
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/App.js:
--------------------------------------------------------------------------------
1 |
2 | import './App.scss';
3 | import Layout from './components/ui/Layout';
4 | import FlightBooking from './pages/FlightBooking';
5 | import HotelBooking from './pages/HotelBooking';
6 | import HotelDetails from './pages/HotelDetails';
7 | import { Route, Routes, Navigate, Link } from 'react-router-dom';
8 | import FavoriteHotels from './components/hotel/FavoriteHotels';
9 | import RequireAuth from './util/RequireAuth';
10 |
11 |
12 |
13 | Number.prototype.format = function(n, x) {
14 | var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\.' : '$') + ')';
15 | return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&,');
16 | };
17 |
18 | function App() {
19 |
20 | return (
21 |
22 |
23 |
24 |
25 |
26 | } />
27 | }/>
28 | } />
29 | } />
30 | }>
31 |
32 | } />
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | );
42 | }
43 |
44 | export default App;
45 |
--------------------------------------------------------------------------------
/Azure/AKSManifests/manifests/bookingservice.yml:
--------------------------------------------------------------------------------
1 |
2 | apiVersion: v1
3 | kind: ConfigMap
4 | metadata:
5 | name: hotel-service
6 | data:
7 | # Register and get the key from https://rapidapi.com/tipsters/api/booking-com/
8 | rapidapi.key: <>
9 | api.azureUtilityUrl: "azure-utitlity-service.default.svc.cluster.local"
10 | ---
11 | apiVersion: apps/v1
12 | kind: Deployment
13 | metadata:
14 | name: hotel-service
15 | labels:
16 | app: hotel-service
17 |
18 | spec:
19 | replicas: 1
20 | selector:
21 | matchLabels:
22 | app: hotel-service
23 | template:
24 | metadata:
25 | labels:
26 | app: hotel-service
27 | spec:
28 | containers:
29 | - name: hotel-service
30 | image: pavithravasudevan/hotelsearchserviceazure:0.0.1-SNAPSHOT
31 | imagePullPolicy: Always
32 | resources:
33 | requests:
34 | cpu: "100m"
35 | memory: "256Mi"
36 | limits:
37 | cpu: "500m"
38 | memory: "512Mi"
39 | envFrom:
40 | - configMapRef:
41 | name: hotel-service
42 | ports:
43 | - containerPort: 8103
44 | ---
45 | apiVersion: v1
46 | kind: Service
47 | metadata:
48 | name: hotel-service
49 | labels:
50 | app: hotel-service
51 | spec:
52 | type: ClusterIP
53 | selector:
54 | app: hotel-service
55 | ports:
56 | - port: 80
57 | targetPort: 8103
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/hooks/use-http.js:
--------------------------------------------------------------------------------
1 | import { useReducer, useCallback } from 'react';
2 |
3 | function httpReducer(state, action) {
4 | if (action.type === 'SEND') {
5 | return {
6 | data: null,
7 | error: null,
8 | status: 'pending',
9 | };
10 | }
11 |
12 | if (action.type === 'SUCCESS') {
13 | return {
14 | data: action.responseData,
15 | error: null,
16 | status: 'completed',
17 | };
18 | }
19 |
20 | if (action.type === 'ERROR') {
21 | return {
22 | data: null,
23 | error: action.errorMessage,
24 | status: 'completed',
25 | };
26 | }
27 |
28 | return state;
29 | }
30 |
31 | function useHttp(requestFunction, startWithPending = false) {
32 | const [httpState, dispatch] = useReducer(httpReducer, {
33 | status: startWithPending ? 'pending' : null,
34 | data: null,
35 | error: null,
36 | });
37 |
38 | const sendRequest = useCallback(
39 | async function (requestData) {
40 | dispatch({ type: 'SEND' });
41 | try {
42 | const responseData = await requestFunction(requestData);
43 | dispatch({ type: 'SUCCESS', responseData });
44 | } catch (error) {
45 | dispatch({
46 | type: 'ERROR',
47 | errorMessage: error.message || 'Something went wrong!',
48 | });
49 | }
50 | },
51 | [requestFunction]
52 | );
53 |
54 | return {
55 | sendRequest,
56 | ...httpState,
57 | };
58 | }
59 |
60 | export default useHttp;
61 |
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/hooks/use-http.js:
--------------------------------------------------------------------------------
1 | import { useReducer, useCallback } from 'react';
2 |
3 | function httpReducer(state, action) {
4 | if (action.type === 'SEND') {
5 | return {
6 | data: null,
7 | error: null,
8 | status: 'pending',
9 | };
10 | }
11 |
12 | if (action.type === 'SUCCESS') {
13 | return {
14 | data: action.responseData,
15 | error: null,
16 | status: 'completed',
17 | };
18 | }
19 |
20 | if (action.type === 'ERROR') {
21 | return {
22 | data: null,
23 | error: action.errorMessage,
24 | status: 'completed',
25 | };
26 | }
27 |
28 | return state;
29 | }
30 |
31 | function useHttp(requestFunction, startWithPending = false) {
32 | const [httpState, dispatch] = useReducer(httpReducer, {
33 | status: startWithPending ? 'pending' : null,
34 | data: null,
35 | error: null,
36 | });
37 |
38 | const sendRequest = useCallback(
39 | async function (requestData) {
40 | dispatch({ type: 'SEND' });
41 | try {
42 | const responseData = await requestFunction(requestData);
43 | dispatch({ type: 'SUCCESS', responseData });
44 | } catch (error) {
45 | dispatch({
46 | type: 'ERROR',
47 | errorMessage: error.message || 'Something went wrong!',
48 | });
49 | }
50 | },
51 | [requestFunction]
52 | );
53 |
54 | return {
55 | sendRequest,
56 | ...httpState,
57 | };
58 | }
59 |
60 | export default useHttp;
61 |
--------------------------------------------------------------------------------
/Azure/AKSManifests/azure-pipelines.yml:
--------------------------------------------------------------------------------
1 | # Maven package Java project Web App to Linux on Azure
2 | # Build your Java project and deploy it to Azure as a Linux web app
3 | # Add steps that analyze code, save build artifacts, deploy, and more:
4 | # https://docs.microsoft.com/azure/devops/pipelines/languages/java
5 |
6 | trigger:
7 | - main
8 | stages:
9 | - stage: Build
10 | displayName: Build stage
11 | jobs:
12 | - job: PublishArtifacts
13 | displayName: Publish Artifacts
14 | pool:
15 | vmImage: ubuntu-latest
16 |
17 | steps:
18 |
19 |
20 | - task: PublishPipelineArtifact@1
21 | inputs:
22 | artifactName: 'manifests'
23 | path: 'manifests'
24 |
25 | - stage: Deploy
26 | displayName: Deploy stage
27 | dependsOn: Build
28 | jobs:
29 | - deployment: Deploy
30 | displayName: Deploy job
31 | pool:
32 | vmImage: ubuntu-latest
33 | environment: pills
34 |
35 | strategy:
36 | runOnce:
37 | deploy:
38 | steps:
39 | - task: DownloadPipelineArtifact@2
40 | inputs:
41 | artifactName: 'manifests'
42 | downloadPath: '$(System.ArtifactsDirectory)/manifests'
43 |
44 | - task: KubernetesManifest@0
45 | inputs:
46 | action: 'deploy'
47 | kubernetesServiceConnection: 'BookingServiceAKSConnection'
48 | namespace: 'default'
49 | manifests: '$(System.ArtifactsDirectory)/manifests/*.yml'
50 |
51 |
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/components/hotel/HotelReview.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { ResultDiv } from '../ui/Themes';
3 | import { Grid, Typography } from '@mui/material';
4 |
5 |
6 | const HotelReviews = (props)=>{
7 |
8 | return props.reviews.map(review=>{ return (
9 |
10 |
11 |
12 |
13 | {review.title}
14 |
15 |
16 | {review.author.name} reviewed this on {review.date}
17 |
18 |
19 |
20 |
21 | Pros: {review.pros}
22 |
23 |
24 | Cons: {review.cons}
25 |
26 |
27 | {props.showMoreReviews &&
28 | View More Reviews
29 | }
30 |
31 |
32 |
33 | )
34 | })
35 |
36 | }
37 |
38 | export default HotelReviews;
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/components/hotel/HotelReview.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { ResultDiv } from '../ui/Themes';
3 | import { Grid, Typography } from '@mui/material';
4 |
5 |
6 | const HotelReviews = (props)=>{
7 |
8 | return props.reviews.map(review=>{ return (
9 |
10 |
11 |
12 |
13 | {review.title}
14 |
15 |
16 | {review.author.name} reviewed this on {review.date}
17 |
18 |
19 |
20 |
21 | Pros: {review.pros}
22 |
23 |
24 | Cons: {review.cons}
25 |
26 |
27 | {props.showMoreReviews &&
28 | View More Reviews
29 | }
30 |
31 |
32 |
33 | )
34 | })
35 |
36 | }
37 |
38 | export default HotelReviews;
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/store/travelervice-slice.js:
--------------------------------------------------------------------------------
1 | import { createSlice } from '@reduxjs/toolkit';
2 |
3 | const searchCriteria ={id:'',labelVal:'',fromDate:'',toDate:''};
4 |
5 |
6 | const travelServiceSlice = createSlice({
7 | name: 'travelService',
8 | initialState: { bookmarkedProperties: {},hotelsList:{},topFlightsList:{},searchedFlightsList:{},progress:false,hotelSearchCriteria:searchCriteria},
9 | reducers: {
10 | setBookmarkedProperties(state,action) {
11 | state.bookmarkedProperties = action.payload.bookmarkedProperties;
12 |
13 | },
14 | setHotelsList(state,action){
15 | state.hotelsList=action.payload.hotelsList;
16 | },
17 | setTopFlightsList(state,action){
18 | state.topFlightsList=action.payload.topFlightsList;
19 |
20 | },
21 | setSearchedFlightsList(state,action){
22 | state.searchedFlightsList=action.payload.searchedFlightsList
23 | },
24 |
25 | setProgress(state,action){
26 | state.progress=action.payload.progress;
27 | },
28 | setHotelSearchCritera(state,action){
29 | state.hotelSearchCriteria=action.payload.criteria;
30 | },
31 | logout: state => {
32 |
33 | state.bookmarkedProperties ={};
34 | state.hotelsList={};
35 | state.progress={};
36 | state.searchedFlightsList={};
37 | state.topFlightsList={};
38 | state.searchedFlightsList={};
39 |
40 | }
41 |
42 | },
43 | });
44 |
45 | export const travelServiceActions = travelServiceSlice.actions;
46 |
47 | export default travelServiceSlice;
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/store/travelervice-slice.js:
--------------------------------------------------------------------------------
1 | import { createSlice } from '@reduxjs/toolkit';
2 |
3 | const searchCriteria ={id:'',labelVal:'',fromDate:'',toDate:''};
4 |
5 |
6 | const travelServiceSlice = createSlice({
7 | name: 'travelService',
8 | initialState: { bookmarkedProperties: {},hotelsList:{},topFlightsList:{},searchedFlightsList:{},progress:false,hotelSearchCriteria:searchCriteria},
9 | reducers: {
10 | setBookmarkedProperties(state,action) {
11 | state.bookmarkedProperties = action.payload.bookmarkedProperties;
12 |
13 | },
14 | setHotelsList(state,action){
15 | state.hotelsList=action.payload.hotelsList;
16 | },
17 | setTopFlightsList(state,action){
18 | state.topFlightsList=action.payload.topFlightsList;
19 |
20 | },
21 | setSearchedFlightsList(state,action){
22 | state.searchedFlightsList=action.payload.searchedFlightsList
23 | },
24 |
25 | setProgress(state,action){
26 | state.progress=action.payload.progress;
27 | },
28 | setHotelSearchCritera(state,action){
29 | state.hotelSearchCriteria=action.payload.criteria;
30 | },
31 | logout: state => {
32 |
33 | state.bookmarkedProperties ={};
34 | state.hotelsList={};
35 | state.progress={};
36 | state.searchedFlightsList={};
37 | state.topFlightsList={};
38 | state.searchedFlightsList={};
39 |
40 | }
41 |
42 | },
43 | });
44 |
45 | export const travelServiceActions = travelServiceSlice.actions;
46 |
47 | export default travelServiceSlice;
--------------------------------------------------------------------------------
/Azure/TerraformAzureAPIMFunctionApp/apim_custom_domain/main.tf:
--------------------------------------------------------------------------------
1 | //https://github.com/hashicorp/terraform-provider-azurerm/issues/15256
2 | //resource "null_resource" "previous" {}
3 |
4 | data "azurerm_client_config" "current" {}
5 |
6 | data "azurerm_key_vault" "cert-keyvault" {
7 | name = var.keyvault_name
8 | resource_group_name = var.keyvault_resgroup_name
9 | }
10 |
11 |
12 | resource "azurerm_key_vault_access_policy" "apim_said" {
13 | key_vault_id = data.azurerm_key_vault.cert-keyvault.id
14 | object_id = var.apim_principal_id
15 | tenant_id = data.azurerm_client_config.current.tenant_id
16 | secret_permissions = [
17 | "Get",
18 | "List"
19 | ]
20 |
21 | }
22 |
23 |
24 |
25 | /**resource "time_sleep" "wait_60_seconds" {
26 | depends_on = [azurerm_key_vault_access_policy.apim_said]
27 |
28 | create_duration = "60s"
29 | }*/
30 |
31 | resource "azurerm_api_management_custom_domain" "apimcustomdomain" {
32 | api_management_id = var.apim_id
33 |
34 | proxy {
35 | host_name = var.host_name
36 | key_vault_id = var.cert_key_vault_secret_id
37 | }
38 |
39 | /*depends_on = [
40 | time_sleep.wait_60_seconds
41 | ]*/
42 | }
43 |
44 |
45 | data "azurerm_dns_zone" "dnszone" {
46 | name = var.dns_zone_name
47 | resource_group_name = var.dns_zone_rg
48 | }
49 |
50 | resource "azurerm_dns_cname_record" "cnamerecord" {
51 | name = var.prefix
52 | zone_name = data.azurerm_dns_zone.dnszone.name
53 | resource_group_name = data.azurerm_dns_zone.dnszone.resource_group_name
54 | ttl = 300
55 | record = var.apim_url
56 | }
--------------------------------------------------------------------------------
/Azure/TerraformAKS/aks-roles.tf:
--------------------------------------------------------------------------------
1 | data "azurerm_user_assigned_identity" "ingressid" {
2 | name = "ingressapplicationgateway-${var.prefix}-aks"
3 | resource_group_name = module.aks.node_resource_group
4 | depends_on = [module.aks, azurerm_role_assignment.aks_dns_role]
5 | }
6 |
7 |
8 | resource "azurerm_role_assignment" "aks_dns_role" {
9 | scope = data.azurerm_resource_group.dnszone.id
10 | role_definition_name = data.azurerm_role_definition.contributor.name
11 | principal_id = module.aks.kubelet_identity[0].object_id
12 | }
13 |
14 | resource "azurerm_role_assignment" "aks_network_role" {
15 | scope = azurerm_resource_group.aksresgroup.id
16 | role_definition_name = data.azurerm_role_definition.contributor.name
17 | principal_id = module.aks.kubelet_identity[0].object_id
18 | }
19 |
20 | //data "azurerm_subscription" "primary" {}
21 | // dependency is added to postpone for rectifying the
22 | resource "azurerm_role_assignment" "aks_accessvnet_role" {
23 |
24 | scope = azurerm_resource_group.aksresgroup.id
25 | role_definition_name = "Contributor"
26 | principal_id = data.azurerm_user_assigned_identity.ingressid.principal_id
27 | //client_id=data.azurerm_user_assigned_identity.ingressid.client_id
28 | depends_on = [module.aks, azurerm_role_assignment.aks_dns_role]
29 | }
30 |
31 | resource "azurerm_role_assignment" "aks_networkingress_role" {
32 | scope = module.network.vnet_id
33 | role_definition_name = "Network Contributor"
34 | principal_id = data.azurerm_user_assigned_identity.ingressid.principal_id
35 |
36 | depends_on = [module.aks]
37 | }
38 |
--------------------------------------------------------------------------------
/AWS/TerraformEKS/vpc.tf:
--------------------------------------------------------------------------------
1 |
2 | provider "aws" {
3 | region = var.region
4 | }
5 |
6 | data "aws_availability_zones" "available" {}
7 |
8 |
9 |
10 | resource "random_string" "suffix" {
11 | length = 8
12 | special = false
13 | }
14 |
15 | module "vpc" {
16 | source = "terraform-aws-modules/vpc/aws"
17 | version = "3.2.0"
18 |
19 | name = "education-vpc"
20 | cidr = var.vpc_cidr_block
21 | azs = data.aws_availability_zones.available.names
22 | private_subnets = [cidrsubnet(var.vpc_cidr_block, 8, 0), cidrsubnet(var.vpc_cidr_block, 8, 2), cidrsubnet(var.vpc_cidr_block, 8, 3)]
23 | public_subnets = [cidrsubnet(var.vpc_cidr_block, 8, 4), cidrsubnet(var.vpc_cidr_block, 8, 5), cidrsubnet(var.vpc_cidr_block, 8, 6)]
24 | enable_nat_gateway = true
25 | single_nat_gateway = true
26 | enable_dns_hostnames = true
27 |
28 | tags = {
29 | "kubernetes.io/cluster/${local.cluster_name}" = "shared"
30 | }
31 |
32 | public_subnet_tags = {
33 | "kubernetes.io/cluster/${local.cluster_name}" = "shared"
34 | "kubernetes.io/role/elb" = "1"
35 | }
36 |
37 | private_subnet_tags = {
38 | "kubernetes.io/cluster/${local.cluster_name}" = "shared"
39 | "kubernetes.io/role/internal-elb" = "1"
40 | }
41 | }
42 |
43 | resource "aws_vpc_endpoint" "dynamodb" {
44 | vpc_id = module.vpc.vpc_id
45 | service_name = "com.amazonaws.${var.region}.dynamodb"
46 | vpc_endpoint_type = "Gateway"
47 | route_table_ids = module.vpc.private_route_table_ids
48 | tags = {
49 | Name = "Dynamo DB VPC Endpoint Gateway - ${var.prefix}"
50 | Environment = var.prefix
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Azure/AKSManifests/manifests/azureutilityservice.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: azure-utitlity-service
5 | data:
6 | spring.data.mongodb.database: <>
7 | #spring.data.mongodb.uri: mongodb://bookmarkedhotels:szVggF782fH1g5cjE1iyIkxiQRzQJu7fh2Y2A4nAIkGJSER5YvMToEeqSazRJPGyQZmTXx3Du5LGOgc5yjKryw==@bookmarkedhotels.mongo.cosmos.azure.com:10255/?ssl=true&retrywrites=false&replicaSet=globaldb&maxIdleTimeMS=120000&appName=@bookmarkedhotels@
8 | spring.data.mongodb.uri: << placeholder for connection string>>
9 | ---
10 | apiVersion: apps/v1
11 | kind: Deployment
12 | metadata:
13 | name: azure-utitlity-service
14 | labels:
15 | app: azure-utitlity-service
16 | spec:
17 | replicas: 1
18 | selector:
19 | matchLabels:
20 | app: azure-utitlity-service
21 | template:
22 | metadata:
23 | labels:
24 | app: azure-utitlity-service
25 | spec:
26 | containers:
27 | - name: azure-utitlity-service
28 | image: pavithravasudevan/azureutitlityservice:0.0.1-SNAPSHOT
29 | imagePullPolicy: Always
30 | resources:
31 | requests:
32 | cpu: "100m"
33 | memory: "256Mi"
34 | limits:
35 | cpu: "500m"
36 | memory: "512Mi"
37 |
38 | envFrom:
39 | - configMapRef:
40 | name: azure-utitlity-service
41 | ports:
42 | - containerPort: 8080
43 | ---
44 | apiVersion: v1
45 | kind: Service
46 | metadata:
47 | name: azure-utitlity-service
48 | spec:
49 | type: ClusterIP
50 | selector:
51 | app: azure-utitlity-service
52 | ports:
53 | - port: 80
54 | targetPort: 8080
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/pages/HotelDetails.js:
--------------------------------------------------------------------------------
1 |
2 | import React, { useEffect } from 'react';
3 | import Box from '@mui/material/Box';
4 | import Grid from '@mui/material/Grid';
5 |
6 | import HotelTopBar from '../components/hotel/HotelTopBar';
7 | import ImgSlider from '../components/hotel/HotelImages';
8 | import HotelDescription from '../components/hotel/HotelDescription';
9 |
10 | import HotelFacilites from '../components/hotel/HotelFacilities';
11 | import { useParams } from 'react-router-dom';
12 | import MainReview from '../components/hotel/MainReview';
13 | const HotelDetails = () => {
14 | const params = useParams();
15 |
16 |
17 | const { hotelId,hotelName } = params;
18 |
19 | useEffect(() => {
20 | window.scrollTo({
21 | top: 0,
22 | behavior: "smooth"
23 | });
24 |
25 |
26 | }, []);
27 |
28 |
29 | return
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | }
52 |
53 | export default HotelDetails;
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/pages/HotelDetails.js:
--------------------------------------------------------------------------------
1 |
2 | import React, { useEffect } from 'react';
3 | import Box from '@mui/material/Box';
4 | import Grid from '@mui/material/Grid';
5 |
6 | import HotelTopBar from '../components/hotel/HotelTopBar';
7 | import ImgSlider from '../components/hotel/HotelImages';
8 | import HotelDescription from '../components/hotel/HotelDescription';
9 |
10 | import HotelFacilites from '../components/hotel/HotelFacilities';
11 | import { useParams } from 'react-router-dom';
12 | import MainReview from '../components/hotel/MainReview';
13 | const HotelDetails = () => {
14 | const params = useParams();
15 |
16 |
17 | const { hotelId,hotelName } = params;
18 |
19 | useEffect(() => {
20 | window.scrollTo({
21 | top: 0,
22 | behavior: "smooth"
23 | });
24 |
25 |
26 | }, []);
27 |
28 |
29 | return
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | }
52 |
53 | export default HotelDetails;
--------------------------------------------------------------------------------
/Azure/TerraformAzureAPIMFunctionApp/lambda_functions.tf:
--------------------------------------------------------------------------------
1 | resource "azurerm_function_app" "functions" {
2 | name = "${var.prefix}-${var.environment}"
3 | location = var.location
4 | resource_group_name = azurerm_resource_group.rg.name
5 | app_service_plan_id = azurerm_app_service_plan.asp.id
6 | storage_account_access_key = azurerm_storage_account.storage.primary_access_key
7 | storage_account_name = azurerm_storage_account.storage.name
8 | version = "~3"
9 |
10 | app_settings = {
11 | https_only = true
12 | FUNCTIONS_EXTENSION_VERSION = "~3"
13 | rapidapikey = var.rapidapi_key
14 | MONGODB_URL = var.mongodb_url
15 | MONGODB_DATABASE_NAME = var.mongodb_name
16 | MONGODB_COLLECTION_NAME = var.mongodb_container_name
17 | FUNCTIONS_WORKER_RUNTIME = "node"
18 | WEBSITE_CONTENTAZUREFILECONNECTIONSTRING = "${azurerm_storage_account.storage.primary_connection_string}"
19 | WEBSITE_CONTENTSHARE = "${azurerm_storage_account.storage.name}"
20 | HASH = "${base64encode(filesha256("${path.module}/functioncode/Functions.zip"))}"
21 | WEBSITE_NODE_DEFAULT_VERSION = "~14"
22 | WEBSITE_RUN_FROM_PACKAGE = "https://${azurerm_storage_account.storage.name}.blob.core.windows.net/${azurerm_storage_container.deployments.name}/${azurerm_storage_blob.appcode.name}${data.azurerm_storage_account_sas.example.sas}"
23 | }
24 | }
25 |
26 | output "fnhost" {
27 | value = azurerm_function_app.functions.default_hostname
28 |
29 | }
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bookingservicefrontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.7.0",
7 | "@emotion/styled": "^11.6.0",
8 | "@mui/icons-material": "^5.2.1",
9 | "@mui/lab": "^5.0.0-alpha.59",
10 | "@mui/material": "^5.2.2",
11 | "@mui/styled-engine-sc": "^5.1.0",
12 | "@reduxjs/toolkit": "^1.7.1",
13 | "@testing-library/jest-dom": "^5.16.1",
14 | "@testing-library/react": "^11.2.7",
15 | "@testing-library/user-event": "^12.8.3",
16 | "amazon-cognito-identity-js": "^5.2.4",
17 | "currency-symbol-map": "^5.0.1",
18 | "date-fns": "^2.27.0",
19 | "dateformat": "^5.0.2",
20 | "html-react-parser": "^1.4.4",
21 | "react": "^17.0.2",
22 | "react-dom": "^17.0.2",
23 | "react-redux": "^7.2.6",
24 | "react-router-dom": "^6.2.1",
25 | "react-scripts": "4.0.3",
26 | "react-slick": "^0.28.1",
27 | "slick-carousel": "^1.8.1",
28 | "styled-components": "^5.3.3",
29 | "web-vitals": "^1.1.2"
30 | },
31 | "scripts": {
32 | "start": "react-scripts start",
33 | "build": "CI=false && react-scripts build",
34 | "test": "react-scripts test",
35 | "eject": "react-scripts eject"
36 | },
37 | "eslintConfig": {
38 | "extends": [
39 | "react-app",
40 | "react-app/jest"
41 | ]
42 | },
43 | "browserslist": {
44 | "production": [
45 | ">0.2%",
46 | "not dead",
47 | "not op_mini all"
48 | ],
49 | "development": [
50 | "last 1 chrome version",
51 | "last 1 firefox version",
52 | "last 1 safari version"
53 | ]
54 | },
55 | "devDependencies": {
56 | "sass": "^1.44.0",
57 | "sass-loader": "^12.4.0"
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/AWS/TerraformS3DNS/cloudfront.tf:
--------------------------------------------------------------------------------
1 |
2 | resource "aws_cloudfront_distribution" "travel_service_distribution" {
3 | origin {
4 | domain_name = aws_s3_bucket.websitebucket.website_endpoint
5 | origin_id = "S3-${local.computed_bucket_name}"
6 |
7 | custom_origin_config {
8 | http_port = 80
9 | https_port = 443
10 | origin_protocol_policy = "http-only"
11 | origin_ssl_protocols = ["TLSv1", "TLSv1.1", "TLSv1.2"]
12 | }
13 | }
14 |
15 | enabled = true
16 | is_ipv6_enabled = true
17 | default_root_object = "index.html"
18 |
19 | aliases = ["${var.prefix}.${var.domain_name}"]
20 |
21 | custom_error_response {
22 | error_caching_min_ttl = 0
23 | error_code = 404
24 | response_code = 200
25 | response_page_path = "/index.html"
26 | }
27 |
28 | default_cache_behavior {
29 | allowed_methods = ["GET", "HEAD"]
30 | cached_methods = ["GET", "HEAD"]
31 | target_origin_id = "S3-${local.computed_bucket_name}"
32 |
33 | forwarded_values {
34 | query_string = false
35 |
36 | cookies {
37 | forward = "none"
38 | }
39 | }
40 |
41 | viewer_protocol_policy = "redirect-to-https"
42 | min_ttl = 31536000
43 | default_ttl = 31536000
44 | max_ttl = 31536000
45 | compress = true
46 | }
47 |
48 | restrictions {
49 | geo_restriction {
50 | restriction_type = "none"
51 | }
52 | }
53 |
54 | viewer_certificate {
55 | acm_certificate_arn = module.acm.acm_certificate_arn
56 | ssl_support_method = "sni-only"
57 | minimum_protocol_version = "TLSv1.1_2016"
58 | }
59 |
60 | tags = local.common_tags
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/Azure/TerraformAzureAPIMFunctionApp/locals.tf:
--------------------------------------------------------------------------------
1 | locals {
2 | api_paths = [
3 | {
4 | url_path = "/HotelLocations"
5 | operation_id = "get-hotel-location"
6 | method = "GET"
7 | description = "Get list of locations"
8 | jwtAuth = true
9 | }, {
10 | url_path = "/Hotels"
11 | operation_id = "get-hotels"
12 | method = "GET"
13 | description = "Get list of hotels"
14 | jwtAuth = false
15 | }, {
16 | url_path = "/HotelReviews"
17 | operation_id = "get-reviews"
18 | method = "GET"
19 | description = "Get list of reviews for the hotel"
20 | jwtAuth = false
21 | }, {
22 | url_path = "/HotelPhotos"
23 | operation_id = "get-photos"
24 | method = "GET"
25 | description = "Get list of photos for the hotel"
26 | jwtAuth = false
27 | }, {
28 | url_path = "/HotelFacilities"
29 | operation_id = "get-facilities"
30 | method = "GET"
31 | description = "Get list of Facilities for the selected hotel"
32 | jwtAuth = false
33 | },
34 | {
35 | url_path = "/HotelDescription"
36 | operation_id = "get-description"
37 | method = "GET"
38 | description = "Get hotel Description"
39 | jwtAuth = false
40 | },
41 | {
42 | url_path = "/FavoriteHotels"
43 | operation_id = "get-favhotels"
44 | method = "GET"
45 | description = "Get Bookmarked Props"
46 | jwtAuth = false
47 | },
48 | {
49 | url_path = "/FavoriteHotels"
50 | operation_id = "post-favhotels"
51 | method = "POST"
52 | description = "Bookmark a property"
53 | jwtAuth = false
54 | }
55 | ]
56 |
57 |
58 | }
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "travelpocfrontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.2",
7 | "@testing-library/react": "^12.1.2",
8 | "@testing-library/user-event": "^13.5.0",
9 | "@azure/msal-browser": "^2.15.0",
10 | "@azure/msal-react": "^1.0.1",
11 | "@emotion/react": "^11.7.0",
12 | "@emotion/styled": "^11.6.0",
13 | "@mui/icons-material": "^5.2.1",
14 | "@mui/lab": "^5.0.0-alpha.59",
15 | "@mui/material": "^5.2.2",
16 | "@mui/styled-engine-sc": "^5.1.0",
17 | "@reduxjs/toolkit": "^1.7.1",
18 | "amazon-cognito-identity-js": "^5.2.4",
19 | "currency-symbol-map": "^5.0.1",
20 | "date-fns": "^2.27.0",
21 | "dateformat": "^5.0.2",
22 | "html-react-parser": "^1.4.4",
23 | "react": "^17.0.2",
24 | "react-dom": "^17.0.2",
25 | "react-scripts": "5.0.0",
26 | "react-redux": "^7.2.6",
27 | "react-router-dom": "^6.2.1",
28 | "react-slick": "^0.28.1",
29 | "slick-carousel": "^1.8.1",
30 | "styled-components": "^5.3.3",
31 | "web-vitals": "^2.1.4"
32 | },
33 | "scripts": {
34 | "start": "react-scripts start",
35 | "build": "react-scripts build",
36 | "test": "react-scripts test",
37 | "eject": "react-scripts eject"
38 | },
39 | "eslintConfig": {
40 | "extends": [
41 | "react-app",
42 | "react-app/jest"
43 | ]
44 | },
45 | "browserslist": {
46 | "production": [
47 | ">0.2%",
48 | "not dead",
49 | "not op_mini all"
50 | ],
51 | "development": [
52 | "last 1 chrome version",
53 | "last 1 firefox version",
54 | "last 1 safari version"
55 | ]
56 | },
57 | "devDependencies": {
58 | "sass": "^1.44.0",
59 | "sass-loader": "^12.4.0"
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/AWS/TerraformECS/security_groups.tf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | module "loadbalancer_sg" {
5 | source = "terraform-aws-modules/security-group/aws"
6 | version = "3.18.0"
7 |
8 | name = "loadbalancer-sg"
9 | description = "Security Group with HTTP open for entire Internet (IPv4 CIDR), egress ports are all world open"
10 | vpc_id = module.vpc.vpc_id
11 | # Ingress Rules & CIDR Blocks
12 | ingress_rules = ["http-80-tcp", "https-443-tcp"]
13 | ingress_cidr_blocks = ["0.0.0.0/0"]
14 | # Egress Rule - all-all open
15 | egress_rules = ["all-all"]
16 | tags = local.common_tags
17 |
18 | # Open to CIDRs blocks (rule or from_port+to_port+protocol+description)
19 | ingress_with_cidr_blocks = [
20 | {
21 | from_port = 81
22 | to_port = 81
23 | protocol = 6
24 | description = "Allow Port 81 from internet"
25 | cidr_blocks = "0.0.0.0/0"
26 | },
27 | ]
28 | }
29 |
30 | module "ecstask_sg" {
31 | source = "terraform-aws-modules/security-group/aws"
32 | version = "3.18.0"
33 | name = "ecs-sg"
34 | description = "Security Group with HTTP open for entire Internet (IPv4 CIDR), egress ports are all world open"
35 | vpc_id = module.vpc.vpc_id
36 | ingress_rules = ["http-80-tcp", "https-443-tcp"]
37 | ingress_with_cidr_blocks = [
38 |
39 | {
40 | from_port = 80
41 | to_port = 8102
42 | protocol = 6
43 | description = "Allow "
44 | cidr_blocks = module.vpc.vpc_cidr_block
45 | },
46 | {
47 | from_port = 8102
48 | to_port = 8102
49 | protocol = 6
50 | description = "Allow "
51 | cidr_blocks = module.vpc.vpc_cidr_block
52 | },
53 | ]
54 | ingress_cidr_blocks = [module.vpc.vpc_cidr_block]
55 | egress_rules = ["all-all"]
56 | tags = local.common_tags
57 |
58 | }
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/AWS/TerraformEKS/service_accounts/main.tf:
--------------------------------------------------------------------------------
1 | resource "aws_iam_policy" "awsservicepolicy" {
2 | name = var.name
3 | path = var.path
4 | description = var.description
5 |
6 | policy = var.policy
7 | }
8 |
9 | data "aws_iam_policy_document" "sa_service_role" {
10 | statement {
11 | actions = ["sts:AssumeRoleWithWebIdentity"]
12 |
13 | principals {
14 | type = "Federated"
15 | identifiers = [
16 | "arn:aws:iam::${var.account_id}:oidc-provider/${replace(var.oidc_issuer_url, "https://", "")}"
17 | ]
18 | }
19 |
20 | condition {
21 | test = "StringEquals"
22 | variable = "${replace(var.oidc_issuer_url, "https://", "")}:sub"
23 | values = [
24 | "system:serviceaccount:${var.k8s_service_account_namespace}:${var.k8s_service_account_name}"
25 | ]
26 | }
27 | condition {
28 | test = "StringEquals"
29 | variable = "${replace(var.oidc_issuer_url, "https://", "")}:aud"
30 | values = [
31 | "sts.amazonaws.com"
32 | ]
33 | }
34 | }
35 | }
36 | resource "random_string" "random" {
37 | length = 10
38 | special = false
39 |
40 | }
41 | resource "aws_iam_role" "sa_service_role" {
42 | name = "sa-awsservice-role-${random_string.random.result}"
43 | assume_role_policy = data.aws_iam_policy_document.sa_service_role.json
44 | }
45 |
46 | resource "aws_iam_role_policy_attachment" "test-attach" {
47 | role = aws_iam_role.sa_service_role.name
48 | policy_arn = aws_iam_policy.awsservicepolicy.arn
49 | }
50 |
51 | resource "kubernetes_service_account" "sa_service_role" {
52 | metadata {
53 | name = var.k8s_service_account_name
54 | namespace = var.k8s_service_account_namespace
55 | annotations = {
56 | "eks.amazonaws.com/role-arn" = aws_iam_role.sa_service_role.arn
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/AWS/EKSKubernetesManifests/external-dns.yaml:
--------------------------------------------------------------------------------
1 |
2 | apiVersion: rbac.authorization.k8s.io/v1beta1
3 | kind: ClusterRole
4 | metadata:
5 | name: external-dns
6 | rules:
7 | - apiGroups: [""]
8 | resources: ["services"]
9 | verbs: ["get","watch","list"]
10 | - apiGroups: [""]
11 | resources: ["pods"]
12 | verbs: ["get","watch","list"]
13 | - apiGroups: ["extensions"]
14 | resources: ["ingresses"]
15 | verbs: ["get","watch","list"]
16 | - apiGroups: [""]
17 | resources: ["nodes"]
18 | verbs: ["list"]
19 | ---
20 | apiVersion: rbac.authorization.k8s.io/v1beta1
21 | kind: ClusterRoleBinding
22 | metadata:
23 | name: external-dns-viewer
24 | roleRef:
25 | apiGroup: rbac.authorization.k8s.io
26 | kind: ClusterRole
27 | name: external-dns
28 | subjects:
29 | - kind: ServiceAccount
30 | name: external-dns
31 | namespace: default
32 | ---
33 | apiVersion: apps/v1
34 | kind: Deployment
35 | metadata:
36 | name: external-dns
37 | spec:
38 | selector:
39 | matchLabels:
40 | app: external-dns
41 | strategy:
42 | type: Recreate
43 | template:
44 | metadata:
45 | labels:
46 | app: external-dns
47 | spec:
48 | serviceAccountName: external-dns
49 | containers:
50 | - name: external-dns
51 | image: bitnami/external-dns:0.7.1
52 | args:
53 | - --source=service
54 | - --source=ingress
55 | - --domain-filter=pavithraavasudevan.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
56 | - --provider=aws
57 | - --policy=upsert-only # would prevent ExternalDNS from deleting any records, omit to enable full synchronization
58 | - --aws-zone-type=public # only look at public hosted zones (valid values are public, private or no value for both)
59 | - --registry=txt
60 | - --txt-owner-id=my-identifier
61 | ---
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/components/hotel/MainReview.js:
--------------------------------------------------------------------------------
1 | import React,{useEffect,useContext,useState, Fragment,useCallback} from 'react';
2 | import AuthContext from '../../store/auth-context';
3 | import { HOTEL_SERVICE_URL } from '../../util/Constants';
4 | import Modal from '../ui/Modal';
5 | import HotelReviews from './HotelReview';
6 | import { checkArray,delay } from '../../util/UtilFunctions';
7 |
8 | const MainReview = (props)=>{
9 | const authCtx=useContext(AuthContext);
10 | const [showMoreReviews, setShowMoreReviews] = useState(false);
11 | const [reviews,setReviews]=useState();
12 | const showDialog = useCallback(() => setShowMoreReviews(true));
13 | const hideDialog = useCallback(() => setShowMoreReviews(false));
14 | const fetchHotelReviews=useCallback(async ()=>{
15 |
16 | delay(2000);
17 | const response = await fetch(HOTEL_SERVICE_URL + 'HotelReviews?locale=en-gb&hotelId=' + props.hotelId, authCtx.reqHeader);
18 | if (!response.ok) {
19 | // alert('Could not fetch details!');
20 | setReviews([]);
21 |
22 | }
23 | const reviewList = await response.json();
24 | setReviews(reviewList);
25 | },[props.hotelId,authCtx]);
26 |
27 | useEffect(() => {
28 | //rapid api throws error for more that 3 requests in a second.. so adding delay here
29 | fetchHotelReviews();
30 |
31 | }, [fetchHotelReviews]);
32 | let details ='';
33 | if(reviews && checkArray(reviews.result)){
34 | details = <>
35 |
36 |
37 |
38 |
39 | >
40 | }
41 | return
42 |
43 |
44 | {details}
45 |
46 |
47 |
48 | }
49 |
50 | export default MainReview;
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/components/hotel/MainReview.js:
--------------------------------------------------------------------------------
1 | import React,{useEffect,useContext,useState, Fragment,useCallback} from 'react';
2 | import AuthContext from '../../store/auth-context';
3 | import { HOTEL_SERVICE_URL } from '../../util/Constants';
4 | import Modal from '../ui/Modal';
5 | import HotelReviews from './HotelReview';
6 | import { checkArray,delay } from '../../util/UtilFunctions';
7 |
8 | const MainReview = (props)=>{
9 | const authCtx=useContext(AuthContext);
10 | const [showMoreReviews, setShowMoreReviews] = useState(false);
11 | const [reviews,setReviews]=useState();
12 | const showDialog = useCallback(() => setShowMoreReviews(true));
13 | const hideDialog = useCallback(() => setShowMoreReviews(false));
14 | const fetchHotelReviews=useCallback(async ()=>{
15 |
16 | delay(2000);
17 | const response = await fetch(HOTEL_SERVICE_URL + 'HotelReviews?locale=en-gb&hotelId=' + props.hotelId, authCtx.reqHeader);
18 | if (!response.ok) {
19 | // alert('Could not fetch details!');
20 | setReviews([]);
21 |
22 | }
23 | const reviewList = await response.json();
24 | setReviews(reviewList);
25 | },[props.hotelId,authCtx]);
26 |
27 | useEffect(() => {
28 | //rapid api throws error for more that 3 requests in a second.. so adding delay here
29 | fetchHotelReviews();
30 |
31 | }, [fetchHotelReviews]);
32 | let details ='';
33 | if(reviews && checkArray(reviews.result)){
34 | details = <>
35 |
36 |
37 |
38 |
39 | >
40 | }
41 | return
42 |
43 |
44 | {details}
45 |
46 |
47 |
48 | }
49 |
50 | export default MainReview;
--------------------------------------------------------------------------------
/AWS/SpringBootApps/aws-utility-service/src/main/java/com/awsservice/model/HotelDetailsConverter.java:
--------------------------------------------------------------------------------
1 | package com.awsservice.model;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import org.slf4j.Logger;
7 | import org.slf4j.LoggerFactory;
8 |
9 | import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter;
10 | import com.awsservice.UtitlityController;
11 | import com.fasterxml.jackson.core.JsonParseException;
12 | import com.fasterxml.jackson.core.JsonProcessingException;
13 | import com.fasterxml.jackson.core.type.TypeReference;
14 | import com.fasterxml.jackson.databind.JsonMappingException;
15 | import com.fasterxml.jackson.databind.ObjectMapper;
16 |
17 | public class HotelDetailsConverter implements DynamoDBTypeConverter> {
18 |
19 | private Logger logger = LoggerFactory.getLogger(HotelDetailsConverter.class);
20 | @Override
21 | public String convert(List objects) {
22 |
23 | ObjectMapper objectMapper = new ObjectMapper();
24 | try {
25 | String objectsString = objectMapper.writeValueAsString(objects);
26 |
27 | return objectsString;
28 | } catch (JsonProcessingException e) {
29 | logger.error(e.getMessage());
30 | }
31 | return null;
32 | }
33 |
34 | @Override
35 | public List unconvert(String jsonString) {
36 | ObjectMapper objectMapper = new ObjectMapper();
37 | try {
38 | List hotelDetailsList = objectMapper.readValue(jsonString, new TypeReference>(){});
39 | return hotelDetailsList;
40 | } catch (JsonParseException e) {
41 | logger.error(e.getMessage());
42 |
43 | } catch (JsonMappingException e) {
44 | logger.error(e.getMessage());
45 | } catch (IOException e) {
46 | logger.error(e.getMessage());
47 | }
48 | return null;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Azure/TerraformAzureAPIMFunctionApp/storage_accounts.tf:
--------------------------------------------------------------------------------
1 | resource "azurerm_storage_account" "storage" {
2 | name = random_string.storage_name.result
3 | resource_group_name = azurerm_resource_group.rg.name
4 | location = var.location
5 | account_tier = "Standard"
6 | account_replication_type = "LRS"
7 | }
8 |
9 | resource "azurerm_storage_container" "deployments" {
10 | name = "function-releases"
11 | storage_account_name = azurerm_storage_account.storage.name
12 | container_access_type = "private"
13 | }
14 |
15 | resource "azurerm_storage_blob" "appcode" {
16 | name = "Functions.zip"
17 | storage_account_name = azurerm_storage_account.storage.name
18 | storage_container_name = azurerm_storage_container.deployments.name
19 | type = "Block"
20 | source = "${path.module}/functioncode/Functions.zip"
21 | }
22 |
23 | data "azurerm_storage_account_sas" "example" {
24 | connection_string = azurerm_storage_account.storage.primary_connection_string
25 | https_only = true
26 | signed_version = "2017-07-29"
27 |
28 | resource_types {
29 | service = true
30 | container = true
31 | object = true
32 | }
33 |
34 | services {
35 | blob = true
36 | queue = false
37 | table = false
38 | file = false
39 | }
40 |
41 | start = "2022-02-13T00:00:00Z"
42 | expiry = "2022-03-31T00:00:00Z"
43 |
44 | permissions {
45 | read = true
46 | write = true
47 | delete = false
48 | list = false
49 | add = true
50 | create = true
51 | update = false
52 | process = false
53 | }
54 | }
55 |
56 | resource "azurerm_app_service_plan" "asp" {
57 | name = "${var.prefix}-plan"
58 | resource_group_name = azurerm_resource_group.rg.name
59 | location = var.location
60 | kind = "FunctionApp"
61 | sku {
62 | tier = "Dynamic"
63 | size = "Y1"
64 | }
65 | }
--------------------------------------------------------------------------------
/AWS/TerraformEKS/locals.tf:
--------------------------------------------------------------------------------
1 | locals {
2 | cluster_name = "${var.prefix}-${random_string.suffix.result}"
3 | k8s_service_account_namespace = "default"
4 | k8s_service_account_name = "hotelservice"
5 | k8s_externaldns_service_account_name = "external-dns"
6 | dynamodb_table_name = "BookmarkedHotels"
7 | cluster_version = "1.21"
8 |
9 | common_tags = {
10 | app = "${var.prefix}"
11 | version = "V1"
12 | }
13 | monitoring_values = file(
14 | "${path.module}/helm_chart_config/monitoring_custom_values.yml")
15 |
16 | service_account_policies = [{
17 | name = "dynamodb_access_policy"
18 | description = "DynamoDB Access Policy"
19 | service_account_name = "hotelservice"
20 | path = "/"
21 | policy = jsonencode({
22 | "Version" : "2012-10-17",
23 | "Statement" : [
24 | {
25 |
26 | "Effect" : "Allow",
27 | "Action" : ["dynamodb:*"],
28 | "Resource" : "arn:aws:dynamodb:${var.region}:${var.account_id}:table/${local.dynamodb_table_name}"
29 | }
30 | ]
31 | })
32 |
33 | }, {
34 | name = "externaldns_access_policy"
35 | service_account_name = "external-dns"
36 | description = "External DNS Access Policy"
37 | path = "/"
38 | policy = jsonencode({
39 | "Version" : "2012-10-17",
40 | "Statement" : [
41 | {
42 | "Effect" : "Allow",
43 | "Action" : [
44 | "route53:ChangeResourceRecordSets"
45 | ],
46 | "Resource" : [
47 | "arn:aws:route53:::hostedzone/${var.hosted_zone_id}"
48 | ]
49 | },
50 | {
51 | "Effect" : "Allow",
52 | "Action" : [
53 | "route53:ListHostedZones",
54 | "route53:ListResourceRecordSets"
55 | ],
56 | "Resource" : [
57 | "*"
58 | ]
59 | }
60 | ]
61 | })
62 |
63 | }]
64 | }
65 |
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/pages/Login.module.scss:
--------------------------------------------------------------------------------
1 | .login {
2 |
3 | max-width: 40rem;
4 | margin: 2rem auto;
5 | padding: 20px;
6 | box-shadow:0 8px 16px 2px rgba(200, 198, 207, 0.2);
7 | height: calc(100% - 122px);
8 | width:90%;
9 | background-color: #050b24;
10 | }
11 |
12 | .actions {
13 | text-align: center;
14 | margin-top:20px;
15 | }
16 | .floatRight{
17 | margin-left: auto;
18 | margin-right: 0;
19 | float:right;
20 |
21 | }
22 | .btnActions {
23 | margin-top: 1.5rem;
24 | display: flex;
25 | flex-direction: column;
26 | align-items: center;
27 | }
28 | .borderBottom{
29 | padding:10px;
30 | margin-bottom: 20px;
31 | border-bottom: 1px solid;
32 | }
33 | .cfInputField {
34 | appearance: none;
35 | background-color: #202028;
36 | border-radius: 4px;
37 | border: 2px solid #383846;
38 | box-sizing: border-box;
39 | color: #bec2cc;
40 | font-family: 'Rubik', Helvetica, Arial, Tahoma, Verdana, sans-serif;
41 | font-weight: 500;
42 | outline: none;
43 | position: relative;
44 | transition: background-color 0.25s ease, border-color 0.25s ease,
45 | color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
46 | width: 100%;
47 | z-index: 1;
48 |
49 | &:hover {
50 | background-color: #202028;
51 | border-color: mix(#383846, #00a3ff, 50%);
52 | color: #d4d7dd;
53 | }
54 |
55 | &:focus {
56 | background-color: #202028;
57 | border-color: #00a3ff;
58 | box-shadow: 0 0 6px 0 #00a3ff;
59 | color: #ffffff;
60 | }
61 |
62 | &::-webkit-input-placeholder {
63 | color: #757888;
64 | font-style: italic;
65 | font-weight: 500 !important;
66 | }
67 | &::-moz-placeholder {
68 | color: #757888;
69 | font-style: italic;
70 | font-weight: 500 !important;
71 | }
72 | &:-ms-input-placeholder {
73 | color: #757888;
74 | font-style: italic;
75 | font-weight: 500 !important;
76 | }
77 | &:-moz-placeholder {
78 | color: #757888;
79 | font-style: italic;
80 | font-weight: 500 !important;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/pages/Login.module.scss:
--------------------------------------------------------------------------------
1 | .login {
2 |
3 | max-width: 40rem;
4 | margin: 2rem auto;
5 | padding: 20px;
6 | box-shadow:0 8px 16px 2px rgba(200, 198, 207, 0.2);
7 | height: calc(100% - 122px);
8 | width:90%;
9 | background-color: #050b24;
10 | }
11 |
12 | .actions {
13 | text-align: center;
14 | margin-top:20px;
15 | }
16 | .floatRight{
17 | margin-left: auto;
18 | margin-right: 0;
19 | float:right;
20 |
21 | }
22 | .btnActions {
23 | margin-top: 1.5rem;
24 | display: flex;
25 | flex-direction: column;
26 | align-items: center;
27 | }
28 | .borderBottom{
29 | padding:10px;
30 | margin-bottom: 20px;
31 | border-bottom: 1px solid;
32 | }
33 | .cfInputField {
34 | appearance: none;
35 | background-color: #202028;
36 | border-radius: 4px;
37 | border: 2px solid #383846;
38 | box-sizing: border-box;
39 | color: #bec2cc;
40 | font-family: 'Rubik', Helvetica, Arial, Tahoma, Verdana, sans-serif;
41 | font-weight: 500;
42 | outline: none;
43 | position: relative;
44 | transition: background-color 0.25s ease, border-color 0.25s ease,
45 | color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
46 | width: 100%;
47 | z-index: 1;
48 |
49 | &:hover {
50 | background-color: #202028;
51 | border-color: mix(#383846, #00a3ff, 50%);
52 | color: #d4d7dd;
53 | }
54 |
55 | &:focus {
56 | background-color: #202028;
57 | border-color: #00a3ff;
58 | box-shadow: 0 0 6px 0 #00a3ff;
59 | color: #ffffff;
60 | }
61 |
62 | &::-webkit-input-placeholder {
63 | color: #757888;
64 | font-style: italic;
65 | font-weight: 500 !important;
66 | }
67 | &::-moz-placeholder {
68 | color: #757888;
69 | font-style: italic;
70 | font-weight: 500 !important;
71 | }
72 | &:-ms-input-placeholder {
73 | color: #757888;
74 | font-style: italic;
75 | font-weight: 500 !important;
76 | }
77 | &:-moz-placeholder {
78 | color: #757888;
79 | font-style: italic;
80 | font-weight: 500 !important;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
19 |
20 |
29 | React App
30 |
31 |
32 |
33 |
34 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/AWS/TerraformAPIGatewayLambda/locals.tf:
--------------------------------------------------------------------------------
1 | locals {
2 | dynamodb_table_name = "BookmarkedHotels"
3 | lambda_list = [
4 | {
5 |
6 | function_name = "Hotel_Location"
7 | file_name = "LocationFn"
8 | route = "/HotelLocations"
9 | method = "GET"
10 | dynamodbAccess =false
11 |
12 | },
13 | {
14 | function_name = "Hotel_Search"
15 | file_name = "SearchFn"
16 | route = "/Hotels"
17 | method = "GET"
18 | dynamodbAccess =false
19 | },
20 | {
21 | function_name = "Hotel_Description"
22 | file_name = "DescriptionFn"
23 | route = "/HotelDescription"
24 | method = "GET"
25 | dynamodbAccess =false
26 | },
27 | {
28 | function_name = "Hotel_Facilties"
29 | file_name = "FacilitiesFn"
30 | route = "/HotelFacilities"
31 | method = "GET"
32 | dynamodbAccess =false
33 | },
34 | {
35 | function_name = "Hotel_Reviews"
36 | file_name = "ReviewsFn"
37 | route = "/HotelReviews"
38 | method = "GET"
39 | dynamodbAccess =false
40 | },
41 | {
42 | function_name = "Hotel_Data"
43 | file_name = "HotelDataFn"
44 | route = "/HotelData"
45 | method = "GET"
46 | dynamodbAccess =false
47 | },
48 | {
49 | function_name = "Hotel_Photos"
50 | file_name = "PhotosFn"
51 | route = "/HotelPhotos"
52 | method = "GET"
53 | dynamodbAccess =false
54 | }]
55 | authenticated_lambda_list = [{
56 |
57 | function_name = "Fav_Hotels"
58 | file_name = "FavHotelsFn"
59 | route = "/FavoriteHotels"
60 | method = "GET"
61 | dynamodbAccess =true
62 |
63 | },
64 | {
65 | function_name = "Fav_Hotels_Post"
66 | file_name = "PostFavHotelsFn"
67 | route = "/FavoriteHotels"
68 | method = "POST"
69 | dynamodbAccess =true
70 | }]
71 |
72 | combined_lambdas_list=flatten([local.lambda_list,local.authenticated_lambda_list])
73 | }
--------------------------------------------------------------------------------
/Azure/SpringBootApps/hotelsearchserviceazure/src/main/java/com/hotelsearchservice/security/SecurityConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.hotelsearchservice.security;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
9 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
10 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
11 | import org.springframework.web.cors.CorsConfiguration;
12 | import org.springframework.web.cors.CorsConfigurationSource;
13 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
14 |
15 |
16 | @Configuration
17 | public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
18 |
19 | @Autowired
20 | private AzureADB2CJwtAuthFilter azureADB2CFilter;
21 |
22 | @Override
23 | protected void configure(HttpSecurity http) throws Exception {
24 |
25 | http.headers().cacheControl();
26 | http.csrf().disable()
27 | .authorizeRequests()
28 | .antMatchers("**/health").permitAll()
29 | .antMatchers("/Hotel").permitAll()
30 | .antMatchers("/").permitAll()
31 | .antMatchers("/FavoriteHotels").authenticated()
32 | .and()
33 | .addFilterBefore(azureADB2CFilter, UsernamePasswordAuthenticationFilter.class);
34 | http.cors();
35 | }
36 |
37 | @Bean
38 | public CorsConfigurationSource corsConfigurationSource() {
39 | final CorsConfiguration configuration = new CorsConfiguration();
40 | configuration.setAllowedOrigins(List.of("*"));
41 | configuration.setAllowedMethods(List.of("HEAD",
42 | "GET", "POST", "PUT", "DELETE", "PATCH"));
43 | configuration.setAllowCredentials(false);
44 | configuration.setAllowedHeaders(List.of("Authorization", "Cache-Control", "Content-Type"));
45 | final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
46 | source.registerCorsConfiguration("/**", configuration);
47 | return source;
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/src/components/hotel/HotelTopBar.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useEffect, useState } from 'react';
2 | import { useTheme } from '@mui/material/styles';
3 | import Box from '@mui/material/Box';
4 |
5 | import Typography from '@mui/material/Typography';
6 |
7 | import CardContent from '@mui/material/CardContent';
8 |
9 | import { styled } from '@mui/material/styles';
10 | import { StyledCard } from '../ui/Themes';
11 |
12 | import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder';
13 | import FavoriteIcon from '@mui/icons-material/Favorite';
14 | import { pink } from '@mui/material/colors';
15 | import AuthContext from '../../store/auth-context';
16 | import { useDispatch, useSelector } from 'react-redux';
17 | import { postBookmarkHotel } from '../../store/travelservice-actions';
18 |
19 | const HotelTopBar = (props) => {
20 | const dispatch = useDispatch();
21 | const bookmarkedProps = useSelector((state) => state.travelService.bookmarkedProperties);
22 | const authCtx=useContext(AuthContext);
23 | const [isFavorite,setFavorite]=useState(false);
24 | useEffect(()=>{
25 |
26 | const elem=bookmarkedProps.hotelsList.find(x=>x.hotelId===props.hotelId);
27 | if(elem!==undefined)
28 | setFavorite(true);
29 |
30 | },[])
31 |
32 | const addToFavHandler = ()=>{
33 | if(authCtx.isLoggedIn){
34 |
35 | if (authCtx.reqHeader !== null && authCtx.reqHeader !== undefined) {
36 |
37 | dispatch(postBookmarkHotel(authCtx.reqHeader, authCtx.userName,props.hotelId));
38 | }
39 | }else{
40 | alert('Please login');
41 | }
42 |
43 | }
44 | return (
45 |
46 |
47 |
48 | {props.name}
49 |
50 |
51 |
52 |
53 | {isFavorite?:}
54 |
55 | );
56 | }
57 |
58 | export default HotelTopBar;
--------------------------------------------------------------------------------
/Azure/TerraformAzureAPIMFunctionApp/.terraform.lock.hcl:
--------------------------------------------------------------------------------
1 | # This file is maintained automatically by "terraform init".
2 | # Manual edits may be lost in future updates.
3 |
4 | provider "registry.terraform.io/hashicorp/azurerm" {
5 | version = "2.96.0"
6 | constraints = "~> 2.26"
7 | hashes = [
8 | "h1:2nm+GD6yWznX+SATc9TdvXdxpRSgWVAhsu260Yfzvtw=",
9 | "zh:15ea84e6e223125fe733f50b7a3d46772f9d990e8b96ecdf9a649e6e222666e2",
10 | "zh:17c5a37d5a8e9fda3265ec26ef8d9a7625b70c51cc26635762aec1ff8542adb2",
11 | "zh:36f5367b55c882281a0b612e9b6efdfa49780991d335c2b0aa61497e3a41f1c9",
12 | "zh:6e8e29440f82b509d4231e15ed73ee3c35c759daeea8c7e6b227dce2e02c9b3b",
13 | "zh:73f5b54c99c24c14bf75d0c72c211d3a47c3d66d8ac8d60719d7dbd43c47a895",
14 | "zh:95c3e033a139d439c863745e949580eed4f2075f57c6c95d9ae2c30c6048163d",
15 | "zh:c7ce8e461b1813c65bb6aa268b2c7301c8bfd1e0fc25e1e42871d5be80e36838",
16 | "zh:d6544ad6fb14274b8b281319c737a571abcfd8b941d47f363f760868c3651acc",
17 | "zh:e90fd0d7615654f725ddef72698635b1a96703220d60a8fe5c50e76d03b37bef",
18 | "zh:e92ed224f4b2f2d95d46fb4270217ec1737d04998850fd191f032a30f1ff2eaa",
19 | "zh:ebfc2cc7005d83c6a405e9fa8ee241e68bda37f7686ed79782d347bde3d53222",
20 | ]
21 | }
22 |
23 | provider "registry.terraform.io/hashicorp/random" {
24 | version = "3.1.0"
25 | hashes = [
26 | "h1:EPIax4Ftp2SNdB9pUfoSjxoueDoLc/Ck3EUoeX0Dvsg=",
27 | "zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc",
28 | "zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626",
29 | "zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff",
30 | "zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2",
31 | "zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992",
32 | "zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427",
33 | "zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc",
34 | "zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f",
35 | "zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b",
36 | "zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7",
37 | "zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a",
38 | ]
39 | }
40 |
--------------------------------------------------------------------------------
/AWS/HotelSearchServiceFrontEnd/.github/workflows/node.js.yml:
--------------------------------------------------------------------------------
1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3 |
4 | name: Node.js CI
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | pull_request:
10 | branches: [ main ]
11 |
12 |
13 | jobs:
14 | build:
15 |
16 | runs-on: ubuntu-latest
17 | strategy:
18 | matrix:
19 | node-version: [14.x]
20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21 |
22 | steps:
23 | - uses: actions/checkout@v2
24 | - name: Use Node.js ${{ matrix.node-version }}
25 | uses: actions/setup-node@v2
26 | with:
27 | node-version: ${{ matrix.node-version }}
28 | cache: 'npm'
29 | - run: npm install
30 | - run: echo ${GITHUB_WORKSPACE}
31 | - run: npm run build
32 | - name: Upload a Build Artifact
33 | uses: actions/upload-artifact@v2.3.1
34 | with:
35 | name: artifact
36 | path: /home/runner/work/HotelSearchServiceFrontEnd/HotelSearchServiceFrontEnd/build
37 |
38 | if-no-files-found: warn
39 | retention-days: 2
40 |
41 |
42 | deploy:
43 | name: Deploy to S3
44 | needs: build
45 | runs-on: ubuntu-latest
46 | steps:
47 | - name: Configure AWS Credentials
48 | uses: aws-actions/configure-aws-credentials@v1
49 | with:
50 | aws-access-key-id: ${{ secrets.aws_access_key_id }}
51 | aws-secret-access-key: ${{ secrets.aws_access_key_secret }}
52 | aws-region: us-east-1
53 | - name: Workspace value
54 | run: echo ${GITHUB_WORKSPACE}
55 | - name: show contents
56 | run: ls ${GITHUB_WORKSPACE}
57 | - name: Retrieve artifacts
58 | uses: actions/download-artifact@v2
59 | with:
60 | name: artifact
61 | path: /home/runner/work/HotelSearchServiceFrontEnd/HotelSearchServiceFrontEnd/build
62 |
63 | - name: Deploy static site to S3 bucket
64 | run: aws s3 sync ${GITHUB_WORKSPACE}/build s3://hotelsearch.pavithraavasudevan.com.d0e --delete
65 |
--------------------------------------------------------------------------------
/AWS/TerraformECS/alb_output.tf:
--------------------------------------------------------------------------------
1 | # Terraform AWS Application Load Balancer (ALB) Outputs
2 | output "lb_id" {
3 | description = "The ID and ARN of the load balancer we created."
4 | value = module.alb.lb_id
5 | }
6 |
7 | output "lb_arn" {
8 | description = "The ID and ARN of the load balancer we created."
9 | value = module.alb.lb_arn
10 | }
11 |
12 | output "lb_dns_name" {
13 | description = "The DNS name of the load balancer."
14 | value = module.alb.lb_dns_name
15 | }
16 |
17 | output "lb_arn_suffix" {
18 | description = "ARN suffix of our load balancer - can be used with CloudWatch."
19 | value = module.alb.lb_arn_suffix
20 | }
21 |
22 | output "lb_zone_id" {
23 | description = "The zone_id of the load balancer to assist with creating DNS records."
24 | value = module.alb.lb_zone_id
25 | }
26 |
27 | output "http_tcp_listener_arns" {
28 | description = "The ARN of the TCP and HTTP load balancer listeners created."
29 | value = module.alb.http_tcp_listener_arns
30 | }
31 |
32 | output "http_tcp_listener_ids" {
33 | description = "The IDs of the TCP and HTTP load balancer listeners created."
34 | value = module.alb.http_tcp_listener_ids
35 | }
36 |
37 | output "https_listener_arns" {
38 | description = "The ARNs of the HTTPS load balancer listeners created."
39 | value = module.alb.https_listener_arns
40 | }
41 |
42 | output "https_listener_ids" {
43 | description = "The IDs of the load balancer listeners created."
44 | value = module.alb.https_listener_ids
45 | }
46 |
47 | output "target_group_arns" {
48 | description = "ARNs of the target groups. Useful for passing to your Auto Scaling group."
49 | value = module.alb.target_group_arns
50 | }
51 |
52 | output "target_group_arn_suffixes" {
53 | description = "ARN suffixes of our target groups - can be used with CloudWatch."
54 | value = module.alb.target_group_arn_suffixes
55 | }
56 |
57 | output "target_group_names" {
58 | description = "Name of the target group. Useful for passing to your CodeDeploy Deployment Group."
59 | value = module.alb.target_group_names
60 | }
61 |
62 | output "target_group_attachments" {
63 | description = "ARNs of the target group attachment IDs."
64 | value = module.alb.target_group_attachments
65 | }
66 |
--------------------------------------------------------------------------------
/AWS/TerraformECS/.terraform.lock.hcl:
--------------------------------------------------------------------------------
1 | # This file is maintained automatically by "terraform init".
2 | # Manual edits may be lost in future updates.
3 |
4 | provider "registry.terraform.io/hashicorp/aws" {
5 | version = "3.52.0"
6 | constraints = ">= 2.42.0, >= 2.65.0, >= 2.70.0, ~> 3.0"
7 | hashes = [
8 | "h1:/dJnTVQFb4tQ4yFP4tUbP6EPPcGwze0XaewTUFE1R1c=",
9 | "zh:04a4f8a1b34292fd6a72c1efe03f6f10186ecbdc318df36d462d0be1c21ce72d",
10 | "zh:0601006f14f437489902555720dd8fb4e67450356438bab64b61cf6d0e1af681",
11 | "zh:14214e996b8db0a2038b74a2ddbea7356b3e53f73003cde2c9069294d9a6c421",
12 | "zh:17d1ecc280d776271b0fc0fd6a4033933be8e67eb6a39b7bfb3c242cd218645f",
13 | "zh:247ae4bc3b52fba96ed1593e7b23d62da0d2c99498fc0d968fcf28020df3c3aa",
14 | "zh:2e0432fabeb5e44d756a5566168768f1b6dea3cc0e5650fac966820e90d18367",
15 | "zh:34f6f95b88c5d8c105d9a3b7d2712e7df1181948bfbef33bb6a87d7a77c20c0d",
16 | "zh:3de6bf02b9499bf8dc13843da72a03db5ae8188b8157f0e7b3d5bf1d7cd1ac8b",
17 | "zh:43198a223ea6d6dfb82deac62b29181c3be18dc77b9ef9f8d44c32b08e44ea5c",
18 | "zh:a7de44c9445c100a2823c371df03fcaa9ecb1642750ccdc02294fa6cd1095859",
19 | "zh:c3c44bd07e5b6cdb776ff674e39feb708ba3ee3d0dff2c88d1d5db323094d942",
20 | ]
21 | }
22 |
23 | provider "registry.terraform.io/hashicorp/null" {
24 | version = "3.1.0"
25 | constraints = "~> 3.0"
26 | hashes = [
27 | "h1:SFT7X3zY18CLWjoH2GfQyapxsRv6GDKsy9cF1aRwncc=",
28 | "zh:02a1675fd8de126a00460942aaae242e65ca3380b5bb192e8773ef3da9073fd2",
29 | "zh:53e30545ff8926a8e30ad30648991ca8b93b6fa496272cd23b26763c8ee84515",
30 | "zh:5f9200bf708913621d0f6514179d89700e9aa3097c77dac730e8ba6e5901d521",
31 | "zh:9ebf4d9704faba06b3ec7242c773c0fbfe12d62db7d00356d4f55385fc69bfb2",
32 | "zh:a6576c81adc70326e4e1c999c04ad9ca37113a6e925aefab4765e5a5198efa7e",
33 | "zh:a8a42d13346347aff6c63a37cda9b2c6aa5cc384a55b2fe6d6adfa390e609c53",
34 | "zh:c797744d08a5307d50210e0454f91ca4d1c7621c68740441cf4579390452321d",
35 | "zh:cecb6a304046df34c11229f20a80b24b1603960b794d68361a67c5efe58e62b8",
36 | "zh:e1371aa1e502000d9974cfaff5be4cfa02f47b17400005a16f14d2ef30dc2a70",
37 | "zh:fc39cc1fe71234a0b0369d5c5c7f876c71b956d23d7d6f518289737a001ba69b",
38 | "zh:fea4227271ebf7d9e2b61b89ce2328c7262acd9fd190e1fd6d15a591abfa848e",
39 | ]
40 | }
41 |
--------------------------------------------------------------------------------
/Azure/TravelPOCFrontend/src/components/hotel/HotelTopBar.js:
--------------------------------------------------------------------------------
1 | import React, { useContext, useEffect, useState } from 'react';
2 | import { useTheme } from '@mui/material/styles';
3 | import Box from '@mui/material/Box';
4 |
5 | import Typography from '@mui/material/Typography';
6 |
7 | import CardContent from '@mui/material/CardContent';
8 |
9 | import { styled } from '@mui/material/styles';
10 | import { StyledCard } from '../ui/Themes';
11 |
12 | import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder';
13 | import FavoriteIcon from '@mui/icons-material/Favorite';
14 | import { pink } from '@mui/material/colors';
15 | import AuthContext from '../../store/auth-context';
16 | import { useDispatch, useSelector } from 'react-redux';
17 | import { postBookmarkHotel } from '../../store/travelservice-actions';
18 |
19 | const HotelTopBar = (props) => {
20 | const dispatch = useDispatch();
21 | const bookmarkedProps = useSelector((state) => state.travelService.bookmarkedProperties);
22 | const authCtx=useContext(AuthContext);
23 | const [isFavorite,setFavorite]=useState(false);
24 | useEffect(()=>{
25 |
26 | if(bookmarkedProps && bookmarkedProps.hotelsList){
27 | const elem=bookmarkedProps.hotelsList.find(x=>x.hotelId===props.hotelId);
28 | if(elem!==undefined)
29 | setFavorite(true);
30 | }
31 |
32 |
33 | },[])
34 |
35 | const addToFavHandler = ()=>{
36 | if(authCtx.isLoggedIn){
37 |
38 | if (authCtx.reqHeader !== null && authCtx.reqHeader !== undefined) {
39 |
40 | dispatch(postBookmarkHotel(authCtx.reqHeader, authCtx.userName,props.hotelId));
41 | }
42 | }else{
43 | alert('Please login');
44 | }
45 |
46 | }
47 | return (
48 |
49 |
50 |
51 | {props.name}
52 |
53 |
54 |
55 |
56 | {isFavorite?:}
57 |
58 | );
59 | }
60 |
61 | export default HotelTopBar;
--------------------------------------------------------------------------------