UNPKG

@axway/axway-central-cli

Version:

Manage APIs, services and publish to the Amplify Marketplace

75 lines (70 loc) 4.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resourceRegex = exports.namespaceRegex = exports.maskingRegex = exports.keyFromKeyValuePairRegex = exports.invalidResourceMsg = exports.invalidNamespace = exports.invalidDosaName = exports.invalidDomainName = exports.frequencyRegex = exports.dosaRegex = exports.domainNameRegex = exports.WSO2RegexPatterns = exports.SensediaRegexPatterns = exports.KafkaRegexPatterns = exports.GitLabRegexPatterns = exports.GitHubRegexPatterns = exports.AzureRegexPatterns = exports.AkamaiRegexPatterns = exports.AWSRegexPatterns = exports.APIGEEXRegexPatterns = void 0; const resourceRegex = exports.resourceRegex = '^(?:[a-z0-9]*(?:\\.(?=[a-z0-9])|-+(?=[a-z0-9]))?)+[a-z0-9]$'; const namespaceRegex = exports.namespaceRegex = '^[a-z0-9]?(?:[-a-z0-9]*[a-z0-9]){1,100}?$'; const domainNameRegex = exports.domainNameRegex = '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)+([A-Za-z]){2,}$'; const dosaRegex = exports.dosaRegex = '^[\\w\\s-()[\\]]{1,100}$'; const frequencyRegex = exports.frequencyRegex = '^(\\d*[d])?(\\d*[h])?(\\d*[m])?$|^$'; const maskingRegex = exports.maskingRegex = '^[a-zA-Z0-9-*#^~.{}]{0,5}$'; const keyFromKeyValuePairRegex = exports.keyFromKeyValuePairRegex = '^[A-Za-z]+[_\-\w]+$'; const invalidDosaName = exports.invalidDosaName = 'Account name can contain A-z 0-9 _ - ( ) [ ] and can include 1-100 characters.'; const invalidNamespace = exports.invalidNamespace = `Namespace must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character, and be fewer than 100 characters long.`; const invalidDomainName = exports.invalidDomainName = 'The host must be valid according to RFC 1123 specification'; const invalidResourceMsg = resource => { return `${resource} must consist of lower case alphanumeric characters, ' - ' or '.', and be fewer than 100 characters long`; }; // AWSRegexPatterns - regex patters to validate user inputs exports.invalidResourceMsg = invalidResourceMsg; const AWSRegexPatterns = exports.AWSRegexPatterns = { AWS_REGEXP: '^[0-9A-Za-z\\.\\-_]*(?<!/\\.)$', AWS_REGEXP_LOG_GROUP_NAME: '^[0-9A-Za-z\\.\\-_]*(?<!/\\.)$|^$', AWS_REGEXP_VPC_ID: '^vpc-[0-9a-z]*$|^$', AWS_REGEXP_SECURITY_GROUP: '^sg-[0-9a-z]*$|^$', AWS_REGEXP_SUBNET: '^subnet-[0-9a-z]*$|^$', AWS_REGEXP_SSH_LOCATION: '^\\d{1,3}(\\.\\d{1,3}){3}\\/\\d{1,2}$', AWS_REGEXP_ACCESS_KEY_ID: '((?:ASIA|AKIA|AROA|AIDA)([A-Z0-7]{16}))', AWS_REGEXP_SECRET_ACCESS_KEY: '[a-zA-Z0-9+/]{40}', AWS_REGEXP_ROLE_ARN: '^arn:aws[a-zA-Z-]*:iam::\\d{12}:role\\/?[a-zA-Z0-9+=,.@\\-_\\/]{1,128}$', AWS_ACCESS_LOG_ARN: '^arn:aws[a-zA-Z-]*:logs:[a-zA-Z0-9\-]*:\\d{12}:log-group:[a-zA-Z0-9_\\-\\/\\.#]{1,512}$' }; // APIGEEXRegexPatterns - regex patters to validate user inputs const APIGEEXRegexPatterns = exports.APIGEEXRegexPatterns = { APIGEEX_REGEXP_PROJECT_ID: '^[a-z][a-z0-9-]{4,28}[a-z0-9]$', APIGEEX_REGEXP_EMAIL_ADDRESS: '^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$' }; // AzureRegexPatterns - regex patters to validate user inputs const AzureRegexPatterns = exports.AzureRegexPatterns = { azureApiManagementServiceNameRegex: '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$', azureEventHubConsumerGroupRegex: '^[a-zA-Z0-9$][a-zA-Z0-9._\-]{0,48}[a-zA-Z0-9]$' }; // GitHubRegexPatterns - regex patters to validate user inputs const GitHubRegexPatterns = exports.GitHubRegexPatterns = { gitHubAccessTokenRegex: '^ghp_[a-zA-Z0-9]{36}$', gitHubRepositoryOwnerRegex: '^(?!-)(?!.*--)[a-zA-Z0-9-]{1,37}(?<!-)$', gitHubRepositoryNameRegex: '^[\\w-\\.]+$', gitHubFilePathRegex: '^\/.*$' }; const GitLabRegexPatterns = exports.GitLabRegexPatterns = { gitLabAccessTokenRegex: '^[0-9a-zA-Z\-]{20}$', gitLabBaseURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$', gitHubRepositoryIDRegex: '^[0-9]*$', gitLabPathRegex: '^\/.*$' }; const KafkaRegexPatterns = exports.KafkaRegexPatterns = { bootstrapServerRegex: '^(SASL_SSL:\/\/|SASL_PLAINTEXT:\/\/|PLAINTEXT:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z0-9]{1,5}(:[0-9]{1,5})$', urlRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$' }; const WSO2RegexPatterns = exports.WSO2RegexPatterns = { wso2BaseURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$' }; const SensediaRegexPatterns = exports.SensediaRegexPatterns = { noCommaRegex: '^[^,]+$', emailRegex: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$', urlRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$' }; const AkamaiRegexPatterns = exports.AkamaiRegexPatterns = { baseURLRegex: '^(http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$' };