All files / modules/75-ce constants.ts

98.41% Statements 62/63
100% Branches 20/20
90.91% Functions 10/11
98.39% Lines 61/62

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203              57x     57x                                   57x 57x 57x     57x 57x 57x 57x     57x                         57x               57x     57x 57x 57x 57x     57x         57x 57x 57x 57x 57x 57x     57x 57x 57x 57x     57x         57x               57x           57x   57x         57x 57x 57x 57x 57x 57x 57x     57x         57x 57x 57x 57x 57x 57x 57x 57x     57x 57x     57x   57x 57x 57x     57x 57x 57x     57x                             57x                                       57x           57x              
/*
 * Copyright 2022 Harness Inc. All rights reserved.
 * Use of this source code is governed by the PolyForm Shield 1.0.0 license
 * that can be found in the licenses directory at the root of this repository, also available at
 * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
 */
 
import { getConfig } from 'services/config'
import type { Provider } from './components/COCreateGateway/models'
 
export const allProviders: Provider[] = [
  {
    name: 'AWS',
    value: 'aws',
    icon: 'service-aws'
  },
  {
    name: 'Azure',
    value: 'azure',
    icon: 'service-azure'
  },
  {
    name: 'GCP',
    value: 'gcp',
    icon: 'gcp'
  }
]
 
export enum PAGE_NAME {
  PERSPECTIVE_EXPLORER,
  CREATE_PERSPECTIVE
}
 
export enum PROVIDER_TYPES {
  AWS = 'aws',
  AZURE = 'azure',
  GCP = 'gcp'
}
 
export const ceConnectorTypes: Record<string, PROVIDER_TYPES> = {
  GcpCloudCost: PROVIDER_TYPES.GCP,
  CEAws: PROVIDER_TYPES.AWS,
  CEAzure: PROVIDER_TYPES.AZURE
}
 
type GetGraphQLAPIConfigReturnType = {
  path: string
  queryParams: {
    accountIdentifier: string
  }
}
 
export const getGraphQLAPIConfig: (accountId: string) => GetGraphQLAPIConfigReturnType = (accountId: string) => {
  return {
    path: getConfig('ccm/api/graphql'),
    queryParams: {
      accountIdentifier: accountId
    }
  }
}
export const VALID_DOMAIN_REGEX =
  /((https?):\/\/)?(www.)?[a-z0-9-]+(\.[a-z]{2,}){1,3}(#?\/?[a-zA-Z0-9#-]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/
 
export enum ASRuleTabs {
  CONFIGURATION = 'configuration',
  SETUP_ACCESS = 'setupAccess',
  REVIEW = 'review'
}
 
export const ConnectorStatus = {
  SUCCESS: 'SUCCESS',
  FAILURE: 'FAILURE'
}
 
export enum GatewayKindType {
  INSTANCE = 'instance',
  KUBERNETES = 'k8s',
  DATABASE = 'database',
  CONTAINERS = 'containers',
  CLUSTERS = 'clusters'
}
 
export enum CCM_CHART_TYPES {
  COLUMN = 'column',
  AREA = 'area',
  LINE = 'line'
}
 
export const portProtocolMap: { [key: number]: string } = {
  80: 'http',
  443: 'https'
}
 
export const DEFAULT_ACCESS_DETAILS = {
  dnsLink: { selected: false },
  ssh: { selected: false },
  rdp: { selected: false },
  backgroundTasks: { selected: false },
  ipaddress: { selected: false }
}
 
export const providerLoadBalancerRefMap: Record<string, string> = {
  azure: 'Application Gateway',
  aws: 'Load Balancer',
  gcp: 'Load Balancer'
}
 
export const CONFIG_STEP_IDS = ['configStep1', 'configStep2', 'configStep3', 'configStep4']
 
export const CONFIG_IDLE_TIME_CONSTRAINTS = {
  MIN: 5,
  MAX: 600
}
 
export enum RESOURCES {
  INSTANCES = 'INSTANCES',
  ASG = 'ASG',
  KUBERNETES = 'KUBERNETES',
  ECS = 'ECS',
  RDS = 'RDS',
  IG = 'IG'
}
 
export const CONFIG_TOTAL_STEP_COUNTS = {
  DEFAULT: 4,
  MODIFIED: 3
}
 
export enum DaysOfWeek {
  SUNDAY = 0,
  MONDAY = 1,
  TUESDAY = 2,
  WEDNESDAY = 3,
  THURSDAY = 4,
  FRIDAY = 5,
  SATURDAY = 6
}
 
export enum AS_RESOURCE_TYPE {
  rule = 'autostop_rule'
}
 
export const ENFORCEMENT_USAGE_THRESHOLD = 90
 
export enum AdvancedConfigTabs {
  deps = 'deps',
  schedules = 'schedules'
}
 
export enum AccessPointFormStep {
  FIRST = 1,
  SECOND = 2
}
 
export const allCloudProvidersList = [
  {
    label: 'AWS',
    value: 'aws'
  },
  {
    label: 'Azure',
    value: 'azure'
  },
  {
    label: 'GCP',
    value: 'gcp'
  }
]
 
export const notificationChannelsList = [
  {
    label: 'ce.anomalyDetection.notificationAlerts.slackChannelLabel',
    value: 'SLACK',
    icon: { name: 'service-slack' }
  },
  {
    label: 'ce.anomalyDetection.notificationAlerts.emailChannelLabel',
    value: 'EMAIL',
    icon: { name: 'email-inline' }
  },
  {
    label: 'ce.anomalyDetection.notificationAlerts.microsoftTeamChannelLabel',
    value: 'MSTEAMS',
    icon: { name: 'service-msteams' }
  }
]
 
export type channels = 'EMAIL' | 'SLACK' | 'PAGERDUTY' | 'MSTEAMS'
 
export const channelNameUrlMapping = {
  SLACK: 'slackWebHookUrl',
  EMAIL: 'emails',
  MSTEAMS: 'microsoftTeamsUrl'
}
 
export const channelImgMap = {
  SLACK: 'service-slack',
  EMAIL: 'email-inline',
  MSTEAMS: 'service-msteams',
  DEFAULT: '',
  PAGERDUTY: 'service-pagerduty'
}