import {z} from 'zod' export type ConnectionConfigApacheActiveMqDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, activeMqConnectionProtocolType?: ('AMQP' | 'TCP') | undefined, brokerURL?: string | undefined, username?: string | undefined, password?: string | undefined, destinationType?: ('QUEUE' | 'TOPIC') | undefined, destinationName?: string | undefined, sessionAcknowledgement?: ('CLIENT_ACKNOWLEDGE' | 'SESSION_TRANSACTED' | 'AUTO_ACKNOWLEDGE' | 'DUPS_OK_ACKNOWLEDGE') | undefined, sendTimeout?: number | undefined, requestTimeout?: number | undefined, closeTimeout?: number | undefined, connectTimeout?: number | undefined, contentType?: string | undefined, clientID?: string | undefined, contentEncoding?: string | undefined}; export type ElasticHost = {scheme?: string | undefined, host?: string | undefined, port?: number | undefined, status?: string | undefined, clusterName?: string | undefined, resolvedHost?: string | undefined}; export type ElasticsearchIndexLifecyclePolicy = {policyName?: string | undefined, enableHotPhase?: boolean | undefined, maxAgeOfRollover?: number | undefined, maxIndexSizeOfRollover?: number | undefined, maxDocCountOfRollover?: number | undefined, enableWarmPhase?: boolean | undefined, numberOfReplicasForWarm?: number | undefined, maxNumShardsForShrink?: number | undefined, maxNumSegmentsForForceMerge?: number | undefined, enableColdPhase?: boolean | undefined, minAgeOfCold?: number | undefined, numberOfReplicasForCold?: number | undefined, enableDeletePhase?: boolean | undefined, minAgeOfDelete?: number | undefined}; export type ConnectionConfigElasticsearchDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, administrate?: boolean | undefined, elasticHostList?: Array | undefined, authenticate?: boolean | undefined, elasticUsername?: string | undefined, elasticPassword?: string | undefined, encryptCommunication?: boolean | undefined, encryptCommunicationType?: ('CA_CERTIFICATE_IN_PKCS_12' | 'CA_IN_PEM_FILE' | 'CERT_AND_PRIVATE_KEY_IN_PKCS_12') | undefined, caCertInPkcs12File?: string | undefined, caCertInPkcs12FileContentType?: string | undefined, caInPemFile?: string | undefined, caInPemFileContentType?: string | undefined, caTruststoreFile?: string | undefined, caTruststoreFileContentType?: string | undefined, caTruststoreFilePass?: string | undefined, caKeystoreFile?: string | undefined, caKeystoreFileContentType?: string | undefined, caKeystoreFilePass?: string | undefined, disableHostnameVerification?: boolean | undefined, indexLifecyclePolicyCreated?: boolean | undefined, indexLifecyclePolicy?: ElasticsearchIndexLifecyclePolicy | undefined, dataStreamCreated?: boolean | undefined, indexTemplateCreated?: boolean | undefined, lastStatusCheckFailed?: boolean | undefined, indexTemplateName?: string | undefined, indexName?: string | undefined, indexTemplateNumberOfShards?: number | undefined, indexTemplateNumberOfReplicas?: number | undefined, indexTemplateRefreshInterval?: string | undefined, indexTemplateLoadFixedBitsetFiltersEagerly?: boolean | undefined, connectionTimeoutInMs?: number | undefined, responseTimeoutSeconds?: number | undefined, elasticsearchMajorVersion?: ('AUTO_DETECT' | 'ES_7' | 'ES_8' | 'ES_9' | 'UNKNOWN') | undefined, bulkBufferCapacity?: number | undefined, bulkFlushIntervalMs?: number | undefined, bulkMaxBatchSize?: number | undefined, elasticsearchType?: ('READ_WRITE' | 'READ') | undefined}; export type EmailAdditionalProperty = {key?: string | undefined, value?: string | undefined, resolvedValue?: string | undefined, resolvedKey?: string | undefined}; export type ConnectionConfigEmailDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, host?: string | undefined, port?: number | undefined, enableStartTls?: boolean | undefined, auth?: boolean | undefined, username?: string | undefined, password?: string | undefined, defaultEncoding?: string | undefined, addressToTest?: string | undefined, from?: string | undefined, additionalProperties?: Array | undefined, useSsl?: boolean | undefined, certificateId?: string | undefined, certificateName?: string | undefined, checkServerIdentity?: boolean | undefined}; export type ConnectionConfigFtpDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, host?: string | undefined, port?: number | undefined, username?: string | undefined, password?: string | undefined, workingDir?: string | undefined, protocol?: ('ftp' | 'sftp' | 'ftps') | undefined, timeout?: number | undefined, retryCount?: number | undefined, useImplicit?: boolean | undefined, useExplicit?: boolean | undefined, sslProtocol?: string | undefined, verifyServerCertificate?: boolean | undefined}; export type ConnectionConfigGraylogDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, hostname?: string | undefined, port?: number | undefined, transportType?: ('TCP' | 'UDP') | undefined, tlsEnabled?: boolean | undefined, tlsCertVerificationEnabled?: boolean | undefined, compressionType?: ('GZIP' | 'ZLIB' | 'NONE') | undefined, gelfMessageLevel?: ('EMERGENCY(0)' | 'ALERT(1)' | 'CRITICAL(2)' | 'ERROR(3)' | 'WARNING(4)' | 'NOTICE(5)' | 'INFO(6)' | 'DEBUG(7)') | undefined, queueSize?: number | undefined, reconnectDelay?: number | undefined, connectTimeout?: number | undefined, tcpNoDelay?: boolean | undefined, tcpKeepAlive?: boolean | undefined, sendBufferSize?: number | undefined, maxInflightSends?: number | undefined, threads?: number | undefined, tlsTrustCertChainFile?: string | undefined, tlsTrustCertChainFileName?: string | undefined, appendToAttributes?: boolean | undefined, appendToMessage?: boolean | undefined}; export type MapValue = {value?: string | undefined, valueType?: ('STRING' | 'BOOLEAN' | 'INTEGER' | 'LONG' | 'DOUBLE' | 'FLOAT' | 'STRING_LIST' | 'URI') | undefined, resolvedValueByType: unknown}; export type ConnectionConfigKafkaDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, topicName?: string | undefined, propertiesMap?: {[key: string]: MapValue} | undefined, enableSecure?: boolean | undefined, protocolTypes?: (Array<'TLS_1_3' | 'TLS_1_2' | 'TLS_1_1' | 'TLS_1_0' | 'SSL_3_0'>) | undefined, keyStoreId?: string | undefined, keyStoreName?: string | undefined, trustStoreId?: string | undefined, trustStoreName?: string | undefined}; export type ConnectionConfigLinuxScriptDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, hostName?: string | undefined, sshPort?: number | undefined, username?: string | undefined, password?: string | undefined}; export type ConnectionConfigLogbackDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, logPath?: string | undefined, logFileName?: string | undefined, logPodName?: string | undefined, logFilenamePattern?: string | undefined, logPattern?: string | undefined, maxFileSize?: number | undefined, maxHistory?: number | undefined, totalSizeCap?: number | undefined}; export type ConfigRabbitMqHostPort = {host?: string | undefined, port?: number | undefined, resolvedHost?: string | undefined}; export type ConnectionConfigRabbitMqDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, hostPortList?: Array | undefined, connectionFactoryVirtualHost?: string | undefined, authenticationEnabled?: boolean | undefined, connectionFactoryUsername?: string | undefined, connectionFactoryPassword?: string | undefined, connectionFactoryConnectionTimeout?: number | undefined, connectionFactoryClientProperties?: {[key: string]: unknown} | undefined, connectionFactoryRequestedChannelMax?: number | undefined, connectionFactoryRequestedFrameMax?: number | undefined, connectionFactoryRequestedHeartbeat?: number | undefined, connectionFactoryUseSslProtocol?: boolean | undefined, connectionFactorySslProtocol?: string | undefined, channelExchange?: string | undefined, channelRoutingKey?: string | undefined, basicPropertiesAppId?: string | undefined, basicPropertiesContentType?: string | undefined, basicPropertiesContentEncoding?: string | undefined, basicPropertiesDeliveryMode?: number | undefined, basicPropertiesPriority?: number | undefined, basicPropertiesReplyTo?: string | undefined, basicPropertiesExpiration?: string | undefined, basicPropertiesType?: string | undefined, basicPropertiesUserId?: string | undefined, basicPropertiesClusterId?: string | undefined}; export type ConnectionConfigSNMPDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, version?: ('V1' | 'V2c' | 'V3') | undefined, connectionString?: string | undefined, securityOrCommunityName?: string | undefined, retryCount?: number | undefined, timeout?: number | undefined, messageType?: ('INFORM' | 'TRAP') | undefined, securityLevel?: ('NOAUTH_NOPRIV' | 'AUTH_NOPRIV' | 'AUTH_PRIV') | undefined, privacyProtocolList?: (Array<'PrivAES128' | 'PrivAES192' | 'PrivAES192with3DES' | 'PrivAES256' | 'PrivAES256with3DES' | 'PrivDES' | 'Priv3DES'>) | undefined, enableUserAuthentication?: boolean | undefined, securityName?: string | undefined, usmUserAuthenticationProtocol?: ('AuthMD5' | 'AuthSHA' | 'AuthHMAC128SHA224' | 'AuthHMAC192SHA256' | 'AuthHMAC256SHA384' | 'AuthHMAC384SHA512') | undefined, authPassphrase?: string | undefined, usmUserPrivacyProtocol?: ('PrivAES128' | 'PrivAES192' | 'PrivAES192with3DES' | 'PrivAES256' | 'PrivAES256with3DES' | 'PrivDES' | 'Priv3DES') | undefined, privPassphrase?: string | undefined, pduOidForMessage?: string | undefined, pduOidForTime?: string | undefined, pduVariableMap?: {[key: string]: string} | undefined}; export type ConnectionConfigSyslogDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, syslogProtocolType?: ('TCP' | 'UDP') | undefined, syslogMessageHostname?: string | undefined, syslogServerHostname?: string | undefined, syslogPort?: number | undefined, syslogTimeout?: number | undefined, syslogMessageFormat?: ('RFC_3164' | 'RFC_5424' | 'RFC_5425') | undefined, syslogAppName?: string | undefined, syslogFacility?: ('KERN' | 'USER' | 'MAIL' | 'DAEMON' | 'AUTH' | 'SYSLOG' | 'LPR' | 'NEWS' | 'UUCP' | 'CRON' | 'AUTHPRIV' | 'FTP' | 'NTP' | 'AUDIT' | 'ALERT' | 'CLOCK' | 'LOCAL0' | 'LOCAL1' | 'LOCAL2' | 'LOCAL3' | 'LOCAL4' | 'LOCAL5' | 'LOCAL6' | 'LOCAL7') | undefined, syslogSeverity?: ('EMERGENCY' | 'ALERT' | 'CRITICAL' | 'ERROR' | 'WARNING' | 'NOTICE' | 'INFORMATIONAL' | 'DEBUG') | undefined, syslogSslEnabled?: boolean | undefined, syslogQueueCapacity?: number | undefined, syslogWriteTimeoutSeconds?: number | undefined, syslogFramingType?: ('AUTO' | 'NON_TRANSPARENT' | 'OCTET_COUNTING') | undefined, syslogConnectionCount?: number | undefined, syslogBufferMemoryBytes?: number | undefined, syslogOfferTimeoutMillis?: number | undefined, syslogBatchFlushFrames?: number | undefined, syslogMaxMessageBytes?: number | undefined, keyStoreId?: string | undefined, keyStoreName?: string | undefined, trustStoreId?: string | undefined, trustStoreName?: string | undefined, syslogTlsHostnameVerification?: boolean | undefined, syslogStructuredDataEnabled?: boolean | undefined, syslogEnterpriseId?: string | undefined}; export type ApinizerBasicHeader = {name?: string | undefined, value?: string | undefined, resolvedName?: string | undefined, resolvedValue?: string | undefined}; export type ConnectionConfigWebhookDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, httpMethod?: ('GET' | 'POST' | 'PUT' | 'HEAD' | 'OPTIONS' | 'DELETE' | 'PATCH' | 'TRACE' | 'ALL' | 'QUERY') | undefined, fullUrl?: string | undefined, headerList?: Array | undefined, timeout?: number | undefined, connectionPoolMaxConnectionPerHost?: number | undefined, connectionPoolMaxConnectionTotal?: number | undefined, webhookTrustStoreId?: string | undefined, webhookTrustStoreName?: string | undefined, webhookKeyStoreId?: string | undefined, webhookKeyStoreName?: string | undefined, webhookVerifyHostname?: boolean | undefined, connectTimeoutSeconds?: number | undefined, responseTimeoutSeconds?: number | undefined, connectionRequestTimeoutSeconds?: number | undefined, socketTimeoutSeconds?: number | undefined, writeStallTimeoutSeconds?: number | undefined, webhookBatchEnabled?: boolean | undefined, webhookBatchMaxEvents?: number | undefined, webhookBatchMaxBytes?: number | undefined, webhookBatchMaxDelayMillis?: number | undefined, webhookProducerThrottleMillis?: number | undefined, webhookBatchBufferMemoryBytes?: number | undefined, webhookGzipEnabled?: boolean | undefined, webhookMaxRetryCount?: number | undefined, webhookRetryBackoffMillis?: number | undefined, webhookMaxRetryAfterSeconds?: number | undefined, webhookRetryNonIdempotent?: boolean | undefined, webhookHecModeEnabled?: boolean | undefined, webhookHecIndex?: string | undefined, webhookHecSourcetype?: string | undefined, webhookHecSource?: string | undefined, webhookHecHost?: string | undefined, webhookHecUseAck?: boolean | undefined, webhookHecAckTimeoutSeconds?: number | undefined, webhookHecMaxAckResend?: number | undefined}; export type ConnectionPoolDefDbDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, dbType?: ('ORACLE' | 'MYSQL' | 'POSTGRES' | 'SQL_SERVER' | 'SYBASE' | 'DB2' | 'APACHE_HIVE' | 'APACHE_IMPALA' | 'MONGODB' | 'TRINO') | undefined, jdbcUrl?: string | undefined, useCredentials?: boolean | undefined, username?: string | undefined, databaseName?: string | undefined, password?: string | undefined, initialPoolSize?: number | undefined, minPoolSize?: number | undefined, maxPoolSize?: number | undefined, incrementCount?: number | undefined, maxStatements?: number | undefined, idleConnectionTestPeriod?: number | undefined, connectionTimeout?: number | undefined, testConnectionOnCheckout?: boolean | undefined, testConnectionOnCheckin?: boolean | undefined, maxConnectionAge?: number | undefined, maxIdleTime?: number | undefined, defaultLogSchema?: string | undefined, logTableSchemaOverrides?: {[key: string]: string} | undefined, logTableNameOverrides?: {[key: string]: string} | undefined}; export type ConnectionPoolDefLdapDTO = {id?: string | undefined, name?: string | undefined, description?: string | undefined, enabled?: boolean | undefined, projectName?: string | undefined, circuitBreakerEnabled?: boolean | undefined, errorThresholdValue?: number | undefined, sleepWindow?: number | undefined, type: string, serverAddress?: string | undefined, requireCertificateType?: ('NOT_REQUIRED' | 'REQUIRED_CN' | 'REQUIRED_AN_PN') | undefined, username?: string | undefined, password?: string | undefined, customFilter?: string | undefined, searchScope?: ('OBJECT' | 'ONE_LEVEL' | 'SUBTREE') | undefined, baseDn?: string | undefined, certificateId?: string | undefined, certificateName?: string | undefined, useSsl?: boolean | undefined, useTls?: boolean | undefined, connectionTimeout?: number | undefined, directoryVendor?: ('ACTIVE_DIRECTORY' | 'OPENLDAP' | 'DS389_FREEIPA' | 'GENERIC') | undefined}; export type UpdateApiApiopsProjectsProjectNameConnectionsConnectionNameArgs = {projectName: string, connectionName: string, body: ConnectionConfigApacheActiveMqDTO | ConnectionConfigElasticsearchDTO | ConnectionConfigEmailDTO | ConnectionConfigFtpDTO | ConnectionConfigGraylogDTO | ConnectionConfigKafkaDTO | ConnectionConfigLinuxScriptDTO | ConnectionConfigLogbackDTO | ConnectionConfigRabbitMqDTO | ConnectionConfigSNMPDTO | ConnectionConfigSyslogDTO | ConnectionConfigWebhookDTO | ConnectionPoolDefDbDTO | ConnectionPoolDefLdapDTO}; export type UpdateApiApiopsProjectsProjectNameConnectionsConnectionNameOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const deploymentResult = z.object({envName: z.string().optional(), podName: z.string().optional(), podIp: z.string().optional(), success: z.boolean().optional(), detail: z.string().optional(), responseTime: z.number().int().optional(), detailList: z.array(z.unknown()).optional(), firstFromApiResultList: z.unknown()}); export const apiOpsAdvisoryDTO = z.object({level: z.string().optional(), key: z.string().optional(), params: z.record(z.string(), z.unknown()).optional()}); export const apiOpsResponseSuccess = z.object({status: z.enum(["SUCCESS", "FAILURE"]).optional(), resultMessage: z.string().optional(), resultList: z.array(z.string()).optional(), resultCount: z.number().int().optional(), deploymentResult: deploymentResult.optional(), unresolvedReferences: z.array(z.string()).optional(), advisories: z.array(apiOpsAdvisoryDTO).optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Updates an existing connection at specified project * * PUT /apiops/projects/{projectName}/connections/{connectionName}/ */ export const updateApiApiopsProjectsProjectNameConnectionsConnectionName = async (args: UpdateApiApiopsProjectsProjectNameConnectionsConnectionNameArgs, options?: UpdateApiApiopsProjectsProjectNameConnectionsConnectionNameOptions) => { const {baseUrl = "http://167.86.118.166:32080", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/apiops/projects/${encodeURIComponent(String(args.projectName))}/connections/${encodeURIComponent(String(args.connectionName))}/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(apiOpsResponseSuccess, await res.json()) };