UNPKG

@axway/axway-central-cli

Version:

Manage APIs, services and publish to the Amplify Marketplace

801 lines (796 loc) 34.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.docsUrl = exports.commonCmdArgsDescription = exports.cliVersionHeader = exports.YesNoChoices = exports.YesNo = exports.WAIT_TIMEOUT = exports.TrueFalseChoices = exports.TrueFalse = exports.TraceableRegionType = exports.TraceabilityConfig = exports.SingleEntryPointUrls = exports.SaaSGatewayTypes = exports.Regions = exports.PublicRepoUrl = exports.PublicDockerRepoBaseUrl = exports.Protocol = exports.ProdBaseUrls = exports.Platforms = exports.OutputTypes = exports.MAX_TABLE_STRING_LENGTH = exports.MAX_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = exports.LoggingSource = exports.LanguageTypes = exports.KindTypes = exports.Kind = exports.IstioProfileChoices = exports.IstioInstallValues = exports.IstioAgentValues = exports.IngestionProtocolToHosts = exports.IngestionProtocol = exports.IngestionHostsHTTP = exports.IngestionHosts = exports.IngestionHTTPHosts = exports.IDPType = exports.IDPConfiguration = exports.IDPClientSecretAuthMethod = exports.IDPAuthType = exports.IDPAuthConfiguration = exports.IDPAuthClientSecret = exports.IDPAuthAccessToken = exports.GatewayTypes = exports.GatewayTypeToDataPlane = exports.GatewayMode = exports.EnvironmentConfigInfo = exports.DosaAccount = exports.DataPlaneNames = exports.DOSAConfigInfo = exports.ConfigTypes = exports.CloudFormationConfig = exports.Certificate = exports.CentralAgentConfig = exports.CACHE_FILE_TTL_MILLISECONDS = exports.BundleType = exports.BasePaths = exports.AzureDataplaneMode = exports.AuthUrls = exports.ApigeeMetricsFilterConfig = exports.AgentTypes = exports.AgentResourceKind = exports.AgentNames = exports.AgentInstallSwitches = exports.AgentInstallConfig = exports.AgentConfigTypes = exports.AWSRegions = exports.APIGEEXDISCOVERYMODES = exports.APIGEEXAuthType = exports.APICDeployments = exports.ABORT_TIMEOUT = void 0; var _dataService = require("./dataService"); var _utils = require("./utils"); function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } const cliVersionHeader = exports.cliVersionHeader = 'x-axway-cli-version'; const docsUrl = exports.docsUrl = 'https://docs.axway.com/bundle/amplify-central/page/docs/index.html'; const ABORT_TIMEOUT = exports.ABORT_TIMEOUT = process.env.NODE_ENV === 'test' ? 1e3 : process.env.DEBUG || process.env.SNOOPLOGG ? 1e9 : 30e3; const MAX_TABLE_STRING_LENGTH = exports.MAX_TABLE_STRING_LENGTH = 50; const MAX_FILE_SIZE = exports.MAX_FILE_SIZE = process.env.NODE_ENV === 'test' ? 1e5 : 20 * 1024 * 1024; const MAX_CACHE_FILE_SIZE = exports.MAX_CACHE_FILE_SIZE = 5 * 1024 * 1024; // 12 hours const CACHE_FILE_TTL_MILLISECONDS = exports.CACHE_FILE_TTL_MILLISECONDS = process.env.NODE_ENV === 'test' ? 100 : 60000 * 60 * 12; const WAIT_TIMEOUT = exports.WAIT_TIMEOUT = process.env.NODE_ENV === 'test' ? 1e3 : 1e4; let Kind = exports.Kind = /*#__PURE__*/function (Kind) { Kind["Environment"] = "Environment"; Kind["APIService"] = "APIService"; Kind["APIServiceRevision"] = "APIServiceRevision"; Kind["APIServiceInstance"] = "APIServiceInstance"; Kind["Asset"] = "Asset"; Kind["AssetMapping"] = "AssetMapping"; Kind["Product"] = "Product"; Kind["ReleaseTag"] = "ReleaseTag"; Kind["Secret"] = "Secret"; Kind["Webhook"] = "Webhook"; Kind["ConsumerSubscriptionDefinition"] = "ConsumerSubscriptionDefinition"; Kind["ConsumerInstance"] = "ConsumerInstance"; return Kind; }({}); /** * temporary solution to validate "kind" values. * NOTE: order of this array is used to orchestrate bulk api calls (see utils/compareDocsByKind) */ const KindTypes = exports.KindTypes = [Kind.Environment, Kind.APIService, Kind.APIServiceRevision, Kind.APIServiceInstance, Kind.Secret, Kind.Webhook, Kind.ConsumerSubscriptionDefinition, Kind.ConsumerInstance]; const PublicRepoUrl = exports.PublicRepoUrl = 'https://axway.jfrog.io'; const PublicDockerRepoBaseUrl = exports.PublicDockerRepoBaseUrl = 'axway.jfrog.io/ampc-public-docker-release'; let BasePaths = exports.BasePaths = /*#__PURE__*/function (BasePaths) { BasePaths["ApiServer"] = "/apis"; BasePaths["ApiCentral"] = "/api/v1"; BasePaths["Platform"] = "/platform/api/v1"; BasePaths["V7Agents"] = "/artifactory/ampc-public-generic-release/v7-agents"; BasePaths["AWSAgents"] = "/artifactory/ampc-public-generic-release/aws-agents"; BasePaths["DockerAgentPublicRepo"] = "/agent"; BasePaths["DockerAgentAPIRepoPath"] = "/artifactory/api/docker/ampc-public-docker-release/v2/agent"; return BasePaths; }({}); let ConfigTypes = exports.ConfigTypes = /*#__PURE__*/function (ConfigTypes) { ConfigTypes["APIC_DEPLOYMENT"] = "apic-deployment"; ConfigTypes["BASE_URL"] = "base-url"; ConfigTypes["EXTENSIONS"] = "extensions"; ConfigTypes["REGION"] = "region"; ConfigTypes["PLATFORM"] = "platform"; ConfigTypes["AXWAY_MANAGED"] = "axway-managed"; ConfigTypes["CLIENT_ID"] = "client-id"; return ConfigTypes; }({}); let AuthUrls = exports.AuthUrls = /*#__PURE__*/function (AuthUrls) { AuthUrls["Staging"] = "https://login.axwaytest.net"; AuthUrls["Prod"] = "https://login.axway.com"; return AuthUrls; }({}); const SingleEntryPointUrls = exports.SingleEntryPointUrls = { US: 'https://ingestion.platform.axway.com', EU: 'https://ingestion-eu.platform.axway.com', AP: 'https://ingestion-ap-sg.platform.axway.com' }; let Regions = exports.Regions = /*#__PURE__*/function (Regions) { Regions["US"] = "US"; Regions["EU"] = "EU"; Regions["AP"] = "AP"; return Regions; }({}); let Platforms = exports.Platforms = /*#__PURE__*/function (Platforms) { Platforms["prod"] = "prod"; Platforms["staging"] = "staging"; return Platforms; }({}); const ProdBaseUrls = exports.ProdBaseUrls = { US: 'https://apicentral.axway.com', EU: 'https://central.eu-fr.axway.com', AP: 'https://central.ap-sg.axway.com' }; let IngestionProtocol = exports.IngestionProtocol = /*#__PURE__*/function (IngestionProtocol) { IngestionProtocol["Lumberjack"] = "tcp"; IngestionProtocol["HTTPS"] = "https"; return IngestionProtocol; }({}); const IngestionHosts = exports.IngestionHosts = { EU: 'ingestion.visibility.eu-fr.axway.com:5044', EUStaging: 'ingestion.visibility.eu-fr.axwaypreprod.net:5044', QA: 'ingestion.condor.staging.axwaytest.net:5044', US: 'ingestion.datasearch.axway.com:5044', USStaging: 'ingestion.search.axwaytest.net:5044', AP: 'ingestion.visibility.ap-sg.axway.com:5044', APStaging: 'ingestion.visibility.ap-sg.axwaypreprod.net:5044' }; const IngestionHTTPHosts = exports.IngestionHTTPHosts = { US: 'ingestion.datasearch.axway.com:443', USStaging: 'ingestion.search.axwaytest.net:443', EU: 'ingestion.visibility.eu-fr.axway.com:443', EUStaging: 'ingestion.visibility.eu-fr.axwaypreprod.net:443', AP: 'ingestion.visibility.ap-sg.axway.com:443', APStaging: 'ingestion.visibility.ap-sg.axwaypreprod.net:443' }; const IngestionHostsHTTP = exports.IngestionHostsHTTP = { US: 'ingestion.datasearch.axway.com:443', EU: 'ingestion.visibility.eu-fr.axway.com:443', AP: 'ingestion.visibility.ap-sg.axway.com:443' }; const IngestionProtocolToHosts = exports.IngestionProtocolToHosts = { tcp: IngestionHosts, https: IngestionHostsHTTP }; const APICDeployments = exports.APICDeployments = { EU: 'prod-eu', EUStaging: 'staging-eu', QA: 'qa', US: 'prod', USStaging: 'staging', TEAMS: 'teams', AP: 'prod-ap', APStaging: 'preprod' }; const commonCmdArgsDescription = exports.commonCmdArgsDescription = { '--account [value]': 'Override your default account config', '--region [value]': 'Override your region config', '--no-cache': 'Do not use cache when communicating with the server', '--base-url [value]': { hidden: true }, '--apic-deployment [value]': { hidden: true }, '--axway-managed': { hidden: true } }; let OutputTypes = exports.OutputTypes = /*#__PURE__*/function (OutputTypes) { OutputTypes["yaml"] = "yaml"; OutputTypes["json"] = "json"; return OutputTypes; }({}); let LanguageTypes = exports.LanguageTypes = /*#__PURE__*/function (LanguageTypes) { LanguageTypes["French"] = "fr-fr"; LanguageTypes["US"] = "en-us"; LanguageTypes["German"] = "de-de"; LanguageTypes["Portugese"] = "pt-br"; return LanguageTypes; }({}); let TrueFalse = exports.TrueFalse = /*#__PURE__*/function (TrueFalse) { TrueFalse["True"] = "True"; TrueFalse["False"] = "False"; return TrueFalse; }({}); const TrueFalseChoices = exports.TrueFalseChoices = [{ name: TrueFalse.True, value: TrueFalse.True }, { name: TrueFalse.False, value: TrueFalse.False }]; let YesNo = exports.YesNo = /*#__PURE__*/function (YesNo) { YesNo["Yes"] = "Yes"; YesNo["No"] = "No"; return YesNo; }({}); const YesNoChoices = exports.YesNoChoices = [{ name: YesNo.Yes, value: YesNo.Yes }, { name: YesNo.No, value: YesNo.No }]; const IstioProfileChoices = exports.IstioProfileChoices = [{ name: 'default', value: 'default' }, { name: 'demo', value: 'demo' }, { name: 'empty', value: 'empty' }, { name: 'minimal', value: 'minimal' }, { name: 'openshift', value: 'openshift' }, { name: 'preview', value: 'preview' }]; // exporting for tests let AgentConfigTypes = exports.AgentConfigTypes = /*#__PURE__*/function (AgentConfigTypes) { AgentConfigTypes["HOSTED"] = "Hosted"; AgentConfigTypes["BINARIES"] = "Binaries"; AgentConfigTypes["DOCKERIZED"] = "Dockerized"; AgentConfigTypes["HELM"] = "Helm"; return AgentConfigTypes; }({}); let GatewayMode = exports.GatewayMode = /*#__PURE__*/function (GatewayMode) { GatewayMode["GatewayManagerMode"] = "With API Manager"; GatewayMode["GatewayOnlyMode"] = "Gateway only"; return GatewayMode; }({}); let LoggingSource = exports.LoggingSource = /*#__PURE__*/function (LoggingSource) { LoggingSource["Event"] = "event"; LoggingSource["OpenTraffic"] = "open traffic"; return LoggingSource; }({}); let BundleType = exports.BundleType = /*#__PURE__*/function (BundleType) { BundleType["ALL_AGENTS"] = "All Agents"; BundleType["DISCOVERY"] = "Discovery"; BundleType["TRACEABILITY"] = "Traceability"; BundleType["TRACEABILITY_OFFLINE"] = "Traceability offline mode"; return BundleType; }({}); let AgentNames = exports.AgentNames = /*#__PURE__*/function (AgentNames) { AgentNames["AWS_DA"] = "aws-apigw-discovery-agent"; AgentNames["AWS_TA"] = "aws-apigw-traceability-agent"; AgentNames["GITHUB_DA"] = "github-discovery-agent"; AgentNames["GITLAB_DA"] = "gitlab-discovery-agent"; AgentNames["APIGEEX_DA"] = "apigeex-discovery-agent"; AgentNames["APIGEEX_TA"] = "apigeex-traceability-agent"; AgentNames["AZURE_DA"] = "azure-discovery-agent"; AgentNames["AZURE_TA"] = "azure-traceability-agent"; AgentNames["AZURE_EVENTHUB_DA"] = "azure-eventhub-discovery-agent"; AgentNames["EDGE_DA"] = "v7-discovery-agent"; AgentNames["EDGE_TA"] = "v7-traceability-agent"; AgentNames["KAFKA_DA"] = "kafka-discovery-agent"; AgentNames["KAFKA_TA"] = "kafka-traceability-agent"; AgentNames["SWAGGERHUB_DA"] = "swaggerhub-discovery-agent"; AgentNames["GRAYLOG_CA"] = "graylog-compliance-agent"; AgentNames["IBMAPICONNECT_DA"] = "ibm-apiconnect-discovery-agent"; AgentNames["IBMAPICONNECT_TA"] = "ibm-apiconnect-traceability-agent"; AgentNames["TRACEABLE_CA"] = "traceable-compliance-agent"; AgentNames["SOFTWAREAGWEBMETHODS_DA"] = "software-ag-webmethods-discovery-agent"; AgentNames["SOFTWAREAGWEBMETHODS_TA"] = "software-ag-webmethods-traceability-agent"; AgentNames["BACKSTAGE_DA"] = "backstage-discovery-agent"; AgentNames["SAPAPIPORTAL_DA"] = "sap-discovery-agent"; AgentNames["SAPAPIPORTAL_TA"] = "sap-traceability-agent"; AgentNames["WSO2_DA"] = "wso2-discovery-agent"; AgentNames["WSO2_TA"] = "wso2-traceability-agent"; return AgentNames; }({}); let GatewayTypes = exports.GatewayTypes = /*#__PURE__*/function (GatewayTypes) { GatewayTypes["EDGE_GATEWAY"] = "Amplify API Gateway"; GatewayTypes["APIGEEX_GATEWAY"] = "Apigee X Gateway"; GatewayTypes["AWS_GATEWAY"] = "Amazon API Gateway"; GatewayTypes["AZURE_GATEWAY"] = "Azure API Gateway"; GatewayTypes["AZURE_EVENTHUB"] = "Azure EventHub"; GatewayTypes["GITLAB"] = "GitLab"; GatewayTypes["ISTIO"] = "Istio"; GatewayTypes["EDGE_GATEWAY_ONLY"] = "Amplify API Gateway only"; GatewayTypes["KAFKA"] = "Kafka"; GatewayTypes["GRAYLOG"] = "Graylog"; GatewayTypes["IBMAPICONNECT"] = "IBM API Connect"; GatewayTypes["SOFTWAREAGWEBMETHODS"] = "Software AG WebMethods"; GatewayTypes["TRACEABLE"] = "Traceable"; GatewayTypes["BACKSTAGE"] = "Backstage"; GatewayTypes["SAPAPIPORTAL"] = "SAP API Portal"; GatewayTypes["WSO2"] = "WSO2"; return GatewayTypes; }({}); let SaaSGatewayTypes = exports.SaaSGatewayTypes = /*#__PURE__*/function (SaaSGatewayTypes) { SaaSGatewayTypes["AWS_GATEWAY"] = "Amazon API Gateway"; SaaSGatewayTypes["APIGEEX_GATEWAY"] = "Apigee X Gateway"; SaaSGatewayTypes["GITHUB"] = "GitHub"; SaaSGatewayTypes["SWAGGERHUB"] = "SwaggerHub"; return SaaSGatewayTypes; }({}); let DataPlaneNames = exports.DataPlaneNames = /*#__PURE__*/function (DataPlaneNames) { DataPlaneNames["APIGEEX"] = "Apigee X"; DataPlaneNames["AWS"] = "AWS"; DataPlaneNames["GITHUB"] = "GitHub"; DataPlaneNames["GITLAB"] = "GitLab"; DataPlaneNames["AZURE"] = "Azure"; DataPlaneNames["EDGE"] = "APIM"; DataPlaneNames["KAFKA"] = "Kafka"; DataPlaneNames["GRAYLOG"] = "Graylog"; DataPlaneNames["IBMAPICONNECT"] = "APIConnect"; DataPlaneNames["KONG"] = "Kong"; DataPlaneNames["SOFTWAREAGWEBMETHODS"] = "WebMethods"; DataPlaneNames["SWAGGERHUB"] = "SwaggerHub"; DataPlaneNames["TRACEABLE"] = "Traceable"; DataPlaneNames["MULESOFT"] = "Mulesoft"; DataPlaneNames["BACKSTAGE"] = "Backstage"; DataPlaneNames["SAPAPIPORTAL"] = "SAP API Portal"; DataPlaneNames["WSO2"] = "WSO2"; DataPlaneNames["OTHER"] = "Unidentified"; return DataPlaneNames; }({}); const GatewayTypeToDataPlane = exports.GatewayTypeToDataPlane = { [GatewayTypes.EDGE_GATEWAY]: DataPlaneNames.EDGE, [GatewayTypes.EDGE_GATEWAY_ONLY]: DataPlaneNames.EDGE, [GatewayTypes.APIGEEX_GATEWAY]: DataPlaneNames.APIGEEX, [GatewayTypes.AWS_GATEWAY]: DataPlaneNames.AWS, [SaaSGatewayTypes.GITHUB]: DataPlaneNames.GITHUB, [GatewayTypes.GITLAB]: DataPlaneNames.GITLAB, [GatewayTypes.AZURE_GATEWAY]: DataPlaneNames.AZURE, [GatewayTypes.AZURE_EVENTHUB]: DataPlaneNames.AZURE, [GatewayTypes.ISTIO]: 'Istio', [GatewayTypes.KAFKA]: DataPlaneNames.KAFKA, [GatewayTypes.SOFTWAREAGWEBMETHODS]: DataPlaneNames.SOFTWAREAGWEBMETHODS, [SaaSGatewayTypes.SWAGGERHUB]: DataPlaneNames.SWAGGERHUB, [GatewayTypes.GRAYLOG]: DataPlaneNames.GRAYLOG, [GatewayTypes.IBMAPICONNECT]: DataPlaneNames.IBMAPICONNECT, [GatewayTypes.TRACEABLE]: DataPlaneNames.TRACEABLE, [GatewayTypes.BACKSTAGE]: DataPlaneNames.BACKSTAGE, [GatewayTypes.SAPAPIPORTAL]: DataPlaneNames.SAPAPIPORTAL, [GatewayTypes.WSO2]: DataPlaneNames.WSO2 }; let AgentResourceKind = exports.AgentResourceKind = /*#__PURE__*/function (AgentResourceKind) { AgentResourceKind["da"] = "DiscoveryAgent"; AgentResourceKind["ta"] = "TraceabilityAgent"; AgentResourceKind["ca"] = "ComplianceAgent"; return AgentResourceKind; }({}); let AgentTypes = exports.AgentTypes = /*#__PURE__*/function (AgentTypes) { AgentTypes["da"] = "da"; AgentTypes["ta"] = "ta"; AgentTypes["ca"] = "ca"; return AgentTypes; }({}); // AWSRegions - base set of regions, may use option outside this list let AWSRegions = exports.AWSRegions = /*#__PURE__*/function (AWSRegions) { AWSRegions["US_EAST_1"] = "us-east-1"; AWSRegions["US_EAST_2"] = "us-east-2"; AWSRegions["US_WEST_1"] = "us-west-1"; AWSRegions["US_WEST_2"] = "us-west-2"; AWSRegions["EU_WEST_1"] = "eu-west-1"; AWSRegions["EU_WEST_2"] = "eu-west-2"; AWSRegions["EU_WEST_3"] = "eu-west-3"; return AWSRegions; }({}); let APIGEEXDISCOVERYMODES = exports.APIGEEXDISCOVERYMODES = /*#__PURE__*/function (APIGEEXDISCOVERYMODES) { APIGEEXDISCOVERYMODES["PROXY"] = "proxy"; APIGEEXDISCOVERYMODES["PRODUCT"] = "product"; return APIGEEXDISCOVERYMODES; }({}); let AzureDataplaneMode = exports.AzureDataplaneMode = /*#__PURE__*/function (AzureDataplaneMode) { AzureDataplaneMode["APIM"] = "APIM"; AzureDataplaneMode["EventHub"] = "EventHub"; return AzureDataplaneMode; }({}); class EnvironmentConfigInfo { constructor() { _defineProperty(this, "name", void 0); _defineProperty(this, "isNew", void 0); _defineProperty(this, "isUpdated", void 0); _defineProperty(this, "referencedEnvironments", void 0); _defineProperty(this, "referencedIdentityProviders", void 0); this.name = ''; this.isNew = false; this.isUpdated = false; this.referencedEnvironments = []; this.referencedIdentityProviders = []; } } exports.EnvironmentConfigInfo = EnvironmentConfigInfo; class DOSAConfigInfo { constructor() { _defineProperty(this, "clientId", void 0); _defineProperty(this, "name", void 0); _defineProperty(this, "isNew", void 0); this.clientId = null; this.name = ''; this.isNew = false; } } exports.DOSAConfigInfo = DOSAConfigInfo; class CentralAgentConfig { constructor() { _defineProperty(this, "orgId", void 0); _defineProperty(this, "ampcEnvInfo", void 0); _defineProperty(this, "ampcDosaInfo", void 0); _defineProperty(this, "ampcTeamName", void 0); _defineProperty(this, "ingestionProtocol", void 0); _defineProperty(this, "daAgentName", void 0); _defineProperty(this, "taAgentName", void 0); _defineProperty(this, "caAgentName", void 0); _defineProperty(this, "dosaAccount", void 0); _defineProperty(this, "environment", void 0); _defineProperty(this, "environmentId", void 0); _defineProperty(this, "url", void 0); _defineProperty(this, "authUrl", void 0); _defineProperty(this, "region", void 0); _defineProperty(this, "deployment", void 0); _defineProperty(this, "host", void 0); _defineProperty(this, "singleEntryPointUrl", void 0); _defineProperty(this, "scheme", void 0); _defineProperty(this, "production", void 0); _defineProperty(this, "axwayManaged", void 0); _defineProperty(this, "apiServerClient", void 0); _defineProperty(this, "definitionManager", void 0); _defineProperty(this, "gatewayConfig", void 0); _defineProperty(this, "setBaseHost", async () => { this.url = await (0, _dataService.getBaseUrl)(undefined, undefined, this.region); [this.scheme, this.host] = this.url.split('://'); }); this.orgId = ''; this.ampcTeamName = ''; this.region = Regions.US; this.ingestionProtocol = IngestionProtocol.Lumberjack; this.daAgentName = ''; this.taAgentName = ''; this.caAgentName = ''; this.ampcEnvInfo = new EnvironmentConfigInfo(); this.ampcDosaInfo = new DOSAConfigInfo(); this.dosaAccount = new DosaAccount(); this.environment = ''; this.environmentId = ''; this.deployment = ''; this.url = ProdBaseUrls[this.region]; this.authUrl = `${AuthUrls.Prod}/auth`; [this.scheme, this.host] = this.url.split('://'); this.production = false; this.axwayManaged = false; this.singleEntryPointUrl = SingleEntryPointUrls[this.region]; } } exports.CentralAgentConfig = CentralAgentConfig; class AgentInstallSwitches { constructor() { _defineProperty(this, "isDaEnabled", void 0); _defineProperty(this, "isTaEnabled", void 0); _defineProperty(this, "isHostedInstall", void 0); _defineProperty(this, "isHelmInstall", void 0); _defineProperty(this, "isGatewayOnly", void 0); _defineProperty(this, "isDockerInstall", void 0); _defineProperty(this, "isBinaryInstall", void 0); _defineProperty(this, "isOrgRep", void 0); this.isDaEnabled = false; this.isTaEnabled = false; this.isHostedInstall = false; this.isHelmInstall = false; this.isGatewayOnly = false; this.isDockerInstall = false; this.isBinaryInstall = false; this.isOrgRep = false; } } exports.AgentInstallSwitches = AgentInstallSwitches; class AgentInstallConfig { constructor() { _defineProperty(this, "centralConfig", void 0); _defineProperty(this, "bundleType", void 0); _defineProperty(this, "gatewayType", void 0); _defineProperty(this, "deploymentType", void 0); _defineProperty(this, "daVersion", void 0); _defineProperty(this, "taVersion", void 0); _defineProperty(this, "gatewayConfig", void 0); _defineProperty(this, "idpConfig", void 0); _defineProperty(this, "traceabilityConfig", void 0); _defineProperty(this, "switches", void 0); this.centralConfig = new CentralAgentConfig(); this.bundleType = BundleType.ALL_AGENTS; this.gatewayType = GatewayTypes.EDGE_GATEWAY; this.deploymentType = AgentConfigTypes.DOCKERIZED; this.gatewayConfig = new Object(); this.idpConfig = [[], []]; this.daVersion = 'latest'; this.taVersion = 'latest'; this.switches = new AgentInstallSwitches(); this.traceabilityConfig = new TraceabilityConfig(); } } exports.AgentInstallConfig = AgentInstallConfig; class DosaAccount { constructor(clientId, publicKey, privateKey) { _defineProperty(this, "clientId", void 0); _defineProperty(this, "privateKey", void 0); _defineProperty(this, "publicKey", void 0); _defineProperty(this, "templatePrivateKey", void 0); _defineProperty(this, "templatePublicKey", void 0); _defineProperty(this, "updateKeyTemplateValues", configType => { switch (configType) { case AgentConfigTypes.BINARIES: { this.templatePrivateKey = 'private_key.pem'; this.templatePublicKey = 'public_key.pem'; break; } case AgentConfigTypes.DOCKERIZED: { this.templatePrivateKey = '/keys/private_key.pem'; this.templatePublicKey = '/keys/public_key.pem'; break; } default: { this.templatePrivateKey = this.privateKey; this.templatePublicKey = this.publicKey; break; } } }); this.clientId = clientId || ''; this.privateKey = privateKey || 'private_key.pem'; this.publicKey = publicKey || 'public_key.pem'; } } exports.DosaAccount = DosaAccount; class TraceabilityConfig { constructor() { _defineProperty(this, "host", void 0); _defineProperty(this, "protocol", void 0); _defineProperty(this, "usageReportingOffline", void 0); this.host = IngestionHosts.US; this.protocol = IngestionProtocol.Lumberjack; this.usageReportingOffline = false; } } exports.TraceabilityConfig = TraceabilityConfig; let Protocol = exports.Protocol = /*#__PURE__*/function (Protocol) { Protocol["HTTP"] = "http"; Protocol["HTTPS"] = "https"; return Protocol; }({}); let Certificate = exports.Certificate = /*#__PURE__*/function (Certificate) { Certificate["PROVIDE"] = "PROVIDE"; Certificate["GENERATE"] = "GENERATE"; return Certificate; }({}); class CloudFormationConfig { constructor() { _defineProperty(this, "AgentResourcesBucket", void 0); _defineProperty(this, "APIGWCWRoleSetup", void 0); _defineProperty(this, "APIGWTrafficLogGroupName", void 0); _defineProperty(this, "DeploymentType", void 0); _defineProperty(this, "EC2VPCID", void 0); _defineProperty(this, "EC2KeyName", void 0); _defineProperty(this, "EC2InstanceType", void 0); _defineProperty(this, "EC2SSHLocation", void 0); _defineProperty(this, "EC2PublicIPAddress", void 0); _defineProperty(this, "ECSClusterName", void 0); _defineProperty(this, "ECSCentralOrganizationID", void 0); _defineProperty(this, "ECSCentralEnvironmentName", void 0); _defineProperty(this, "ECSCentralDiscoveryAgentName", void 0); _defineProperty(this, "ECSCentralTraceabilityAgentName", void 0); _defineProperty(this, "ECSCentralClientID", void 0); _defineProperty(this, "ECSCentralRegion", void 0); _defineProperty(this, "DiscoveryAgentLogGroupName", void 0); _defineProperty(this, "DiscoveryAgentVersion", void 0); _defineProperty(this, "TraceabilityAgentLogGroupName", void 0); _defineProperty(this, "TraceabilityAgentVersion", void 0); _defineProperty(this, "SSMPrivateKeyParameter", void 0); _defineProperty(this, "SSMPublicKeyParameter", void 0); _defineProperty(this, "SecurityGroup", void 0); _defineProperty(this, "Subnet", void 0); this.AgentResourcesBucket = ''; this.APIGWCWRoleSetup = 'true'; this.APIGWTrafficLogGroupName = 'aws-apigw-traffic-logs'; this.DeploymentType = 'EC2'; this.EC2VPCID = ''; this.EC2KeyName = ''; this.EC2InstanceType = 't3.micro'; this.EC2SSHLocation = '0.0.0.0/0'; this.EC2PublicIPAddress = 'true'; this.ECSClusterName = ''; this.ECSCentralOrganizationID = ''; this.ECSCentralEnvironmentName = ''; this.ECSCentralClientID = ''; this.ECSCentralDiscoveryAgentName = ''; this.ECSCentralTraceabilityAgentName = ''; this.ECSCentralRegion = ''; this.DiscoveryAgentLogGroupName = 'amplify-discovery-agent-logs'; this.DiscoveryAgentVersion = 'latest'; this.TraceabilityAgentLogGroupName = 'amplify-traceability-agent-logs'; this.TraceabilityAgentVersion = 'latest'; this.SSMPrivateKeyParameter = 'AmplifyPrivateKey'; this.SSMPublicKeyParameter = 'AmplifyPublicKey'; this.SecurityGroup = ''; this.Subnet = ''; } } exports.CloudFormationConfig = CloudFormationConfig; class IstioAgentValues { constructor() { _defineProperty(this, "alsEnabled", void 0); _defineProperty(this, "alsMode", void 0); _defineProperty(this, "apicDeployment", void 0); _defineProperty(this, "envoyFilterNamespace", void 0); _defineProperty(this, "clientId", void 0); _defineProperty(this, "clusterName", void 0); _defineProperty(this, "keysSecretName", void 0); _defineProperty(this, "discoveryEnabled", void 0); _defineProperty(this, "namespace", void 0); _defineProperty(this, "discoveryNamespaces", void 0); // The extra Overrides listed below are not used in the actual hybridTemplate _defineProperty(this, "demoSvcEnabled", void 0); this.alsEnabled = false; this.alsMode = 'default'; this.apicDeployment = ''; this.envoyFilterNamespace = ''; this.clientId = ''; this.clusterName = ''; this.keysSecretName = 'amplify-agents-keys'; this.discoveryEnabled = true; this.namespace = { name: '', isNew: false }; this.demoSvcEnabled = false; this.discoveryNamespaces = []; } } exports.IstioAgentValues = IstioAgentValues; class IstioInstallValues { constructor() { _defineProperty(this, "alsNamespace", void 0); _defineProperty(this, "certSecretName", void 0); _defineProperty(this, "enableAls", void 0); _defineProperty(this, "enableTracing", void 0); _defineProperty(this, "envoyFilterNamespace", void 0); _defineProperty(this, "host", void 0); _defineProperty(this, "isNewInstall", void 0); _defineProperty(this, "port", void 0); _defineProperty(this, "protocol", void 0); _defineProperty(this, "profile", void 0); _defineProperty(this, "targetPort", void 0); // The extra IstioOverrides listed below are not used in the actual istioOverrideTemplate _defineProperty(this, "certificateOption", void 0); this.alsNamespace = 'amplify-agents'; this.certificateOption = ''; this.enableAls = false; this.enableTracing = false; this.envoyFilterNamespace = 'istio-system'; this.host = ''; this.isNewInstall = true; this.port = 8080; this.profile = 'demo'; this.protocol = Protocol.HTTP; this.targetPort = 0; } } /** Provides information for a platform team. */ /** * Invoked multiple times to indicate progress on something, such as download progress. * @param progress Value ranging from 0 to 100. */ exports.IstioInstallValues = IstioInstallValues; class ReqHeadersQParams { constructor() { _defineProperty(this, "requestHeaders", void 0); _defineProperty(this, "queryParameters", void 0); } } class IDPConfiguration extends ReqHeadersQParams { constructor() { super(); _defineProperty(this, "title", void 0); _defineProperty(this, "type", void 0); _defineProperty(this, "metadataURL", void 0); _defineProperty(this, "clientProperties", void 0); _defineProperty(this, "clientTimeout", void 0); this.title = ''; this.type = IDPType.Generic; this.metadataURL = ''; this.clientTimeout = 60; } getSpec() { let spec = new Map([['metadataUrl', this.metadataURL], ['providerType', this.type], ['clientTimeout', this.clientTimeout], ['requestHeaders', this.requestHeaders ? (0, _utils.KeyValueMapToNameValueArray)(this.requestHeaders) : undefined], ['queryParameters', this.queryParameters ? (0, _utils.KeyValueMapToNameValueArray)(this.queryParameters) : undefined], ['additionalClientProperties', this.clientProperties ? (0, _utils.KeyValueMapToNameValueArray)(this.clientProperties) : undefined]]); let omitUndefinedSpec = new Map(); spec.forEach((v, k) => { if (v !== undefined) { omitUndefinedSpec.set(k, v); } }); return Object.fromEntries(omitUndefinedSpec.entries()); } } exports.IDPConfiguration = IDPConfiguration; class IDPAuthConfiguration extends ReqHeadersQParams { constructor() { super(); _defineProperty(this, "authType", void 0); _defineProperty(this, "authConfig", void 0); this.authType = IDPAuthType.AccessToken; this.authConfig = new IDPAuthAccessToken(); } getAccessData() { return this.authConfig.getAccessData(); } setAccessData(data) { this.authConfig.setAccessData(data); } getSpec() { let spec = new Map([['type', this.authType], ['config', this.authConfig.getSpec(this.authType)], ['requestHeaders', this.requestHeaders ? (0, _utils.KeyValueMapToNameValueArray)(this.requestHeaders) : undefined], ['queryParameters', this.queryParameters ? (0, _utils.KeyValueMapToNameValueArray)(this.queryParameters) : undefined]]); let omitUndefinedSpec = new Map(); spec.forEach((v, k) => { if (v !== undefined) { omitUndefinedSpec.set(k, v); } }); return Object.fromEntries(omitUndefinedSpec.entries()); } } // IDPType - which idp configuration can be used exports.IDPAuthConfiguration = IDPAuthConfiguration; let IDPType = exports.IDPType = /*#__PURE__*/function (IDPType) { IDPType["KeyCloak"] = "keycloak"; IDPType["Okta"] = "okta"; IDPType["Generic"] = "generic"; return IDPType; }({}); class IDPAuthAccessToken { constructor() { _defineProperty(this, "token", void 0); this.token = ''; } getAccessData() { return JSON.stringify({ token: this.token }); } setAccessData(data) { this.token = data; } getSpec(authType) { return { type: authType, token: this.token }; } } exports.IDPAuthAccessToken = IDPAuthAccessToken; class IDPAuthClientSecret { constructor() { _defineProperty(this, "authMethod", void 0); _defineProperty(this, "clientID", void 0); _defineProperty(this, "clientSecret", void 0); _defineProperty(this, "clientScopes", void 0); this.authMethod = IDPClientSecretAuthMethod.ClientSecretBasic; this.clientID = ''; this.clientSecret = ''; } getAccessData() { return JSON.stringify({ clientSecret: this.clientSecret }); } setAccessData(data) { this.clientSecret = data; } getSpec(authType) { let spec = new Map([['type', authType], ['authMethod', this.authMethod], ['clientId', this.clientID], ['clientSecret', this.clientSecret], ['clientScopes', this.clientScopes ? this.clientScopes : undefined]]); let omitUndefinedSpec = new Map(); spec.forEach((v, k) => { if (v !== undefined) { omitUndefinedSpec.set(k, v); } }); return Object.fromEntries(omitUndefinedSpec.entries()); } } exports.IDPAuthClientSecret = IDPAuthClientSecret; let IDPClientSecretAuthMethod = exports.IDPClientSecretAuthMethod = /*#__PURE__*/function (IDPClientSecretAuthMethod) { IDPClientSecretAuthMethod["ClientSecretBasic"] = "client_secret_basic"; IDPClientSecretAuthMethod["ClientSecretPost"] = "client_secret_post"; IDPClientSecretAuthMethod["ClientSecretJWT"] = "client_secret_jwt"; return IDPClientSecretAuthMethod; }({}); let IDPAuthType = exports.IDPAuthType = /*#__PURE__*/function (IDPAuthType) { IDPAuthType["AccessToken"] = "AccessToken"; IDPAuthType["ClientSecret"] = "ClientSecret"; return IDPAuthType; }({}); let TraceableRegionType = exports.TraceableRegionType = /*#__PURE__*/function (TraceableRegionType) { TraceableRegionType["US"] = "US"; TraceableRegionType["US1"] = "US-1"; TraceableRegionType["EU"] = "EU"; TraceableRegionType["APAC"] = "APAC"; TraceableRegionType["APAC2"] = "APAC-2"; TraceableRegionType["Canada"] = "Canada"; TraceableRegionType["UAE"] = "UAE"; return TraceableRegionType; }({}); // APIGEEXAuthType - how the agent will authenticate to APIGEEX let APIGEEXAuthType = exports.APIGEEXAuthType = /*#__PURE__*/function (APIGEEXAuthType) { APIGEEXAuthType["IMP_SVC_ACC"] = "Impersonate Service Account"; APIGEEXAuthType["ACCESS_CREDENTIAL"] = "Access Credential"; return APIGEEXAuthType; }({}); class ApigeeMetricsFilterConfig { constructor(filterMetrics, filteredAPIs) { _defineProperty(this, "filterMetrics", void 0); _defineProperty(this, "filteredAPIs", void 0); this.filterMetrics = filterMetrics; this.filteredAPIs = filteredAPIs; } } exports.ApigeeMetricsFilterConfig = ApigeeMetricsFilterConfig;