├── .commitlintrc.json ├── .eslintignore ├── .eslintrc.json ├── .github ├── actions │ └── checkout-and-install-node │ │ └── action.yml ├── dependabot.yml └── workflows │ ├── pr-checks.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── .husky └── commit-msg ├── .nvmrc ├── .releaserc.json ├── AUTHORS ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── config └── jest.ts ├── examples ├── .nvmrc ├── ai-translate.ts ├── compute-instance-create.ts ├── functions.ts ├── iot-data.ts ├── kms.ts ├── package-lock.json ├── package.json ├── resourcemanager-cloud-list.ts ├── storage.ts ├── stream-stt │ ├── index.ts │ └── test.wav └── utils │ ├── get-env.ts │ └── logger.ts ├── package-lock.json ├── package.json ├── scripts ├── check-endpoints.ts ├── generate-code.ts └── services.ts ├── src ├── errors.ts ├── generated │ ├── google │ │ ├── api │ │ │ ├── annotations.ts │ │ │ └── http.ts │ │ ├── protobuf │ │ │ ├── any.ts │ │ │ ├── descriptor.ts │ │ │ ├── duration.ts │ │ │ ├── empty.ts │ │ │ ├── field_mask.ts │ │ │ ├── struct.ts │ │ │ ├── timestamp.ts │ │ │ └── wrappers.ts │ │ ├── rpc │ │ │ ├── code.ts │ │ │ └── status.ts │ │ └── type │ │ │ ├── dayofweek.ts │ │ │ └── timeofday.ts │ ├── typeRegistry.ts │ └── yandex │ │ └── cloud │ │ ├── access │ │ ├── access.ts │ │ └── index.ts │ │ ├── ai │ │ ├── index.ts │ │ ├── llm │ │ │ └── v1alpha │ │ │ │ ├── llm.ts │ │ │ │ └── llm_service.ts │ │ ├── ocr │ │ │ └── v1 │ │ │ │ ├── ocr.ts │ │ │ │ └── ocr_service.ts │ │ ├── stt │ │ │ ├── v2 │ │ │ │ └── stt_service.ts │ │ │ └── v3 │ │ │ │ ├── stt.ts │ │ │ │ └── stt_service.ts │ │ ├── translate │ │ │ └── v2 │ │ │ │ ├── translation.ts │ │ │ │ └── translation_service.ts │ │ ├── tts │ │ │ └── v3 │ │ │ │ ├── tts.ts │ │ │ │ └── tts_service.ts │ │ └── vision │ │ │ ├── v1 │ │ │ ├── classification.ts │ │ │ ├── face_detection.ts │ │ │ ├── image_copy_search.ts │ │ │ ├── primitives.ts │ │ │ ├── text_detection.ts │ │ │ └── vision_service.ts │ │ │ └── v2 │ │ │ ├── image.ts │ │ │ ├── image_classifier.ts │ │ │ └── image_classifier_service.ts │ │ ├── api │ │ ├── index.ts │ │ └── operation.ts │ │ ├── apploadbalancer │ │ ├── index.ts │ │ └── v1 │ │ │ ├── backend_group.ts │ │ │ ├── backend_group_service.ts │ │ │ ├── http_router.ts │ │ │ ├── http_router_service.ts │ │ │ ├── load_balancer.ts │ │ │ ├── load_balancer_service.ts │ │ │ ├── logging.ts │ │ │ ├── payload.ts │ │ │ ├── target_group.ts │ │ │ ├── target_group_service.ts │ │ │ ├── tls.ts │ │ │ ├── virtual_host.ts │ │ │ └── virtual_host_service.ts │ │ ├── backup │ │ ├── index.ts │ │ └── v1 │ │ │ ├── backup.ts │ │ │ ├── backup_service.ts │ │ │ ├── policy.ts │ │ │ ├── policy_service.ts │ │ │ ├── provider_service.ts │ │ │ ├── resource.ts │ │ │ └── resource_service.ts │ │ ├── billing │ │ ├── index.ts │ │ └── v1 │ │ │ ├── billable_object.ts │ │ │ ├── billing_account.ts │ │ │ ├── billing_account_service.ts │ │ │ ├── budget.ts │ │ │ ├── budget_service.ts │ │ │ ├── customer.ts │ │ │ ├── customer_service.ts │ │ │ ├── service.ts │ │ │ ├── service_service.ts │ │ │ ├── sku.ts │ │ │ └── sku_service.ts │ │ ├── cdn │ │ ├── index.ts │ │ └── v1 │ │ │ ├── cache_service.ts │ │ │ ├── origin.ts │ │ │ ├── origin_group.ts │ │ │ ├── origin_group_service.ts │ │ │ ├── origin_service.ts │ │ │ ├── provider_service.ts │ │ │ ├── raw_logs.ts │ │ │ ├── raw_logs_service.ts │ │ │ ├── resource.ts │ │ │ └── resource_service.ts │ │ ├── certificatemanager │ │ ├── index.ts │ │ └── v1 │ │ │ ├── certificate.ts │ │ │ ├── certificate_content_service.ts │ │ │ └── certificate_service.ts │ │ ├── compute │ │ ├── index.ts │ │ └── v1 │ │ │ ├── disk.ts │ │ │ ├── disk_placement_group.ts │ │ │ ├── disk_placement_group_service.ts │ │ │ ├── disk_service.ts │ │ │ ├── disk_type.ts │ │ │ ├── disk_type_service.ts │ │ │ ├── filesystem.ts │ │ │ ├── filesystem_service.ts │ │ │ ├── gpu_cluster.ts │ │ │ ├── gpu_cluster_service.ts │ │ │ ├── host_group.ts │ │ │ ├── host_group_service.ts │ │ │ ├── host_type.ts │ │ │ ├── host_type_service.ts │ │ │ ├── image.ts │ │ │ ├── image_service.ts │ │ │ ├── instance.ts │ │ │ ├── instance_service.ts │ │ │ ├── instancegroup │ │ │ ├── instance_group.ts │ │ │ └── instance_group_service.ts │ │ │ ├── placement_group.ts │ │ │ ├── placement_group_service.ts │ │ │ ├── snapshot.ts │ │ │ ├── snapshot_schedule.ts │ │ │ ├── snapshot_schedule_service.ts │ │ │ ├── snapshot_service.ts │ │ │ ├── zone.ts │ │ │ └── zone_service.ts │ │ ├── containerregistry │ │ ├── index.ts │ │ └── v1 │ │ │ ├── blob.ts │ │ │ ├── image.ts │ │ │ ├── image_service.ts │ │ │ ├── ip_permission.ts │ │ │ ├── lifecycle_policy.ts │ │ │ ├── lifecycle_policy_service.ts │ │ │ ├── registry.ts │ │ │ ├── registry_service.ts │ │ │ ├── repository.ts │ │ │ ├── repository_service.ts │ │ │ ├── scan_policy.ts │ │ │ ├── scan_policy_service.ts │ │ │ ├── scanner.ts │ │ │ └── scanner_service.ts │ │ ├── dataproc │ │ ├── index.ts │ │ ├── manager │ │ │ └── v1 │ │ │ │ ├── job.ts │ │ │ │ ├── job_service.ts │ │ │ │ └── manager_service.ts │ │ └── v1 │ │ │ ├── cluster.ts │ │ │ ├── cluster_service.ts │ │ │ ├── common.ts │ │ │ ├── job.ts │ │ │ ├── job_service.ts │ │ │ ├── resource_preset.ts │ │ │ ├── resource_preset_service.ts │ │ │ ├── subcluster.ts │ │ │ └── subcluster_service.ts │ │ ├── datasphere │ │ ├── index.ts │ │ ├── v1 │ │ │ ├── app_token_service.ts │ │ │ ├── folder_budget_service.ts │ │ │ ├── node_execution_error_details.ts │ │ │ ├── node_service.ts │ │ │ ├── project.ts │ │ │ ├── project_data_service.ts │ │ │ └── project_service.ts │ │ └── v2 │ │ │ ├── community.ts │ │ │ ├── community_service.ts │ │ │ ├── dataset.ts │ │ │ ├── project.ts │ │ │ ├── project_service.ts │ │ │ ├── secret.ts │ │ │ └── user.ts │ │ ├── datatransfer │ │ ├── index.ts │ │ └── v1 │ │ │ ├── endpoint.ts │ │ │ ├── endpoint │ │ │ ├── clickhouse.ts │ │ │ ├── common.ts │ │ │ ├── kafka.ts │ │ │ ├── mongo.ts │ │ │ ├── mysql.ts │ │ │ ├── parsers.ts │ │ │ ├── postgres.ts │ │ │ ├── serializers.ts │ │ │ └── ydb.ts │ │ │ ├── endpoint_service.ts │ │ │ ├── transfer.ts │ │ │ └── transfer_service.ts │ │ ├── dns │ │ ├── index.ts │ │ └── v1 │ │ │ ├── dns_zone.ts │ │ │ └── dns_zone_service.ts │ │ ├── endpoint │ │ ├── api_endpoint.ts │ │ ├── api_endpoint_service.ts │ │ └── index.ts │ │ ├── iam │ │ ├── index.ts │ │ └── v1 │ │ │ ├── api_key.ts │ │ │ ├── api_key_service.ts │ │ │ ├── awscompatibility │ │ │ ├── access_key.ts │ │ │ └── access_key_service.ts │ │ │ ├── iam_token_service.ts │ │ │ ├── key.ts │ │ │ ├── key_service.ts │ │ │ ├── role.ts │ │ │ ├── role_service.ts │ │ │ ├── service_account.ts │ │ │ ├── service_account_service.ts │ │ │ ├── user_account.ts │ │ │ ├── user_account_service.ts │ │ │ └── yandex_passport_user_account_service.ts │ │ ├── index.ts │ │ ├── iot │ │ ├── broker │ │ │ └── v1 │ │ │ │ ├── broker.ts │ │ │ │ ├── broker_data_service.ts │ │ │ │ └── broker_service.ts │ │ ├── devices │ │ │ └── v1 │ │ │ │ ├── device.ts │ │ │ │ ├── device_data_service.ts │ │ │ │ ├── device_service.ts │ │ │ │ ├── registry.ts │ │ │ │ ├── registry_data_service.ts │ │ │ │ └── registry_service.ts │ │ └── index.ts │ │ ├── k8s │ │ ├── index.ts │ │ └── v1 │ │ │ ├── cluster.ts │ │ │ ├── cluster_service.ts │ │ │ ├── maintenance.ts │ │ │ ├── node.ts │ │ │ ├── node_group.ts │ │ │ ├── node_group_service.ts │ │ │ ├── version.ts │ │ │ └── version_service.ts │ │ ├── kms │ │ ├── index.ts │ │ └── v1 │ │ │ ├── asymmetricencryption │ │ │ ├── asymmetric_encryption_crypto_service.ts │ │ │ ├── asymmetric_encryption_key.ts │ │ │ └── asymmetric_encryption_key_service.ts │ │ │ ├── asymmetricsignature │ │ │ ├── asymmetric_signature_crypto_service.ts │ │ │ ├── asymmetric_signature_key.ts │ │ │ └── asymmetric_signature_key_service.ts │ │ │ ├── symmetric_crypto_service.ts │ │ │ ├── symmetric_key.ts │ │ │ └── symmetric_key_service.ts │ │ ├── loadbalancer │ │ ├── index.ts │ │ └── v1 │ │ │ ├── health_check.ts │ │ │ ├── network_load_balancer.ts │ │ │ ├── network_load_balancer_service.ts │ │ │ ├── target_group.ts │ │ │ └── target_group_service.ts │ │ ├── loadtesting │ │ ├── agent │ │ │ └── v1 │ │ │ │ ├── agent.ts │ │ │ │ ├── agent_registration_service.ts │ │ │ │ ├── agent_service.ts │ │ │ │ ├── job_service.ts │ │ │ │ ├── monitoring_service.ts │ │ │ │ ├── test.ts │ │ │ │ ├── test_service.ts │ │ │ │ └── trail_service.ts │ │ ├── api │ │ │ └── v1 │ │ │ │ ├── agent │ │ │ │ ├── agent.ts │ │ │ │ ├── create_compute_instance.ts │ │ │ │ └── status.ts │ │ │ │ └── agent_service.ts │ │ └── index.ts │ │ ├── lockbox │ │ ├── index.ts │ │ └── v1 │ │ │ ├── payload.ts │ │ │ ├── payload_service.ts │ │ │ ├── secret.ts │ │ │ └── secret_service.ts │ │ ├── logging │ │ ├── index.ts │ │ └── v1 │ │ │ ├── export.ts │ │ │ ├── export_service.ts │ │ │ ├── log_entry.ts │ │ │ ├── log_group.ts │ │ │ ├── log_group_service.ts │ │ │ ├── log_ingestion_service.ts │ │ │ ├── log_reading_service.ts │ │ │ ├── log_resource.ts │ │ │ ├── sink.ts │ │ │ └── sink_service.ts │ │ ├── marketplace │ │ ├── index.ts │ │ ├── licensemanager │ │ │ └── v1 │ │ │ │ ├── instance.ts │ │ │ │ ├── instance_service.ts │ │ │ │ ├── lock.ts │ │ │ │ ├── lock_service.ts │ │ │ │ └── template.ts │ │ ├── metering │ │ │ └── v1 │ │ │ │ ├── image_product_usage_service.ts │ │ │ │ └── usage_record.ts │ │ └── v1 │ │ │ └── metering │ │ │ ├── image_product_usage_service.ts │ │ │ └── usage_record.ts │ │ ├── mdb │ │ ├── clickhouse │ │ │ └── v1 │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ └── clickhouse.ts │ │ │ │ ├── database.ts │ │ │ │ ├── database_service.ts │ │ │ │ ├── format_schema.ts │ │ │ │ ├── format_schema_service.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── ml_model.ts │ │ │ │ ├── ml_model_service.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ ├── resource_preset_service.ts │ │ │ │ ├── user.ts │ │ │ │ ├── user_service.ts │ │ │ │ ├── version.ts │ │ │ │ └── versions_service.ts │ │ ├── elasticsearch │ │ │ └── v1 │ │ │ │ ├── auth.ts │ │ │ │ ├── auth_service.ts │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ └── elasticsearch.ts │ │ │ │ ├── extension.ts │ │ │ │ ├── extension_service.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ ├── resource_preset_service.ts │ │ │ │ ├── user.ts │ │ │ │ └── user_service.ts │ │ ├── greenplum │ │ │ └── v1 │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config.ts │ │ │ │ ├── host.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── pxf.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ └── resource_preset_service.ts │ │ ├── index.ts │ │ ├── kafka │ │ │ └── v1 │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── common.ts │ │ │ │ ├── connector.ts │ │ │ │ ├── connector_service.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ ├── resource_preset_service.ts │ │ │ │ ├── topic.ts │ │ │ │ ├── topic_service.ts │ │ │ │ ├── user.ts │ │ │ │ └── user_service.ts │ │ ├── mongodb │ │ │ └── v1 │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ ├── mongodb3_6.ts │ │ │ │ ├── mongodb4_0.ts │ │ │ │ ├── mongodb4_2.ts │ │ │ │ ├── mongodb4_4.ts │ │ │ │ ├── mongodb4_4_enterprise.ts │ │ │ │ ├── mongodb5_0.ts │ │ │ │ ├── mongodb5_0_enterprise.ts │ │ │ │ ├── mongodb6_0.ts │ │ │ │ └── mongodb6_0_enterprise.ts │ │ │ │ ├── database.ts │ │ │ │ ├── database_service.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ ├── resource_preset_service.ts │ │ │ │ ├── user.ts │ │ │ │ └── user_service.ts │ │ ├── mysql │ │ │ ├── v1 │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ │ ├── mysql5_7.ts │ │ │ │ │ └── mysql8_0.ts │ │ │ │ ├── database.ts │ │ │ │ ├── database_service.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ ├── resource_preset_service.ts │ │ │ │ ├── user.ts │ │ │ │ └── user_service.ts │ │ │ └── v1alpha │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ └── mysql5_7.ts │ │ │ │ ├── database.ts │ │ │ │ ├── database_service.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ ├── resource_preset_service.ts │ │ │ │ ├── user.ts │ │ │ │ └── user_service.ts │ │ ├── opensearch │ │ │ └── v1 │ │ │ │ ├── auth.ts │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ └── opensearch.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ └── resource_preset_service.ts │ │ ├── postgresql │ │ │ └── v1 │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ ├── host10.ts │ │ │ │ ├── host10_1c.ts │ │ │ │ ├── host11.ts │ │ │ │ ├── host11_1c.ts │ │ │ │ ├── host12.ts │ │ │ │ ├── host12_1c.ts │ │ │ │ ├── host13.ts │ │ │ │ ├── host13_1c.ts │ │ │ │ ├── host14.ts │ │ │ │ ├── host14_1c.ts │ │ │ │ ├── host15.ts │ │ │ │ ├── host15_1c.ts │ │ │ │ ├── host16.ts │ │ │ │ ├── host16_1c.ts │ │ │ │ ├── host9_6.ts │ │ │ │ ├── postgresql10.ts │ │ │ │ ├── postgresql10_1c.ts │ │ │ │ ├── postgresql11.ts │ │ │ │ ├── postgresql11_1c.ts │ │ │ │ ├── postgresql12.ts │ │ │ │ ├── postgresql12_1c.ts │ │ │ │ ├── postgresql13.ts │ │ │ │ ├── postgresql13_1c.ts │ │ │ │ ├── postgresql14.ts │ │ │ │ ├── postgresql14_1c.ts │ │ │ │ ├── postgresql15.ts │ │ │ │ ├── postgresql15_1c.ts │ │ │ │ ├── postgresql16.ts │ │ │ │ ├── postgresql16_1c.ts │ │ │ │ └── postgresql9_6.ts │ │ │ │ ├── database.ts │ │ │ │ ├── database_service.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── perf_diag.ts │ │ │ │ ├── perf_diag_service.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ ├── resource_preset_service.ts │ │ │ │ ├── user.ts │ │ │ │ └── user_service.ts │ │ ├── redis │ │ │ └── v1 │ │ │ │ ├── backup.ts │ │ │ │ ├── backup_service.ts │ │ │ │ ├── cluster.ts │ │ │ │ ├── cluster_service.ts │ │ │ │ ├── config │ │ │ │ ├── redis.ts │ │ │ │ ├── redis5_0.ts │ │ │ │ ├── redis6_0.ts │ │ │ │ ├── redis6_2.ts │ │ │ │ └── redis7_0.ts │ │ │ │ ├── maintenance.ts │ │ │ │ ├── resource_preset.ts │ │ │ │ └── resource_preset_service.ts │ │ └── sqlserver │ │ │ └── v1 │ │ │ ├── backup.ts │ │ │ ├── backup_service.ts │ │ │ ├── cluster.ts │ │ │ ├── cluster_service.ts │ │ │ ├── config │ │ │ ├── sqlserver2016sp2.ts │ │ │ ├── sqlserver2017.ts │ │ │ └── sqlserver2019.ts │ │ │ ├── database.ts │ │ │ ├── database_service.ts │ │ │ ├── resource_preset.ts │ │ │ ├── resource_preset_service.ts │ │ │ ├── user.ts │ │ │ └── user_service.ts │ │ ├── monitoring │ │ ├── index.ts │ │ └── v3 │ │ │ ├── chart_widget.ts │ │ │ ├── dashboard.ts │ │ │ ├── dashboard_service.ts │ │ │ ├── downsampling.ts │ │ │ ├── parametrization.ts │ │ │ ├── text_widget.ts │ │ │ ├── title_widget.ts │ │ │ ├── unit_format.ts │ │ │ └── widget.ts │ │ ├── oauth │ │ ├── claims.ts │ │ └── index.ts │ │ ├── operation │ │ ├── index.ts │ │ ├── operation.ts │ │ └── operation_service.ts │ │ ├── organizationmanager │ │ ├── index.ts │ │ └── v1 │ │ │ ├── group.ts │ │ │ ├── group_mapping.ts │ │ │ ├── group_mapping_service.ts │ │ │ ├── group_service.ts │ │ │ ├── organization.ts │ │ │ ├── organization_service.ts │ │ │ ├── saml │ │ │ ├── certificate.ts │ │ │ ├── certificate_service.ts │ │ │ ├── federation.ts │ │ │ └── federation_service.ts │ │ │ ├── ssh_certificate_service.ts │ │ │ ├── user_account.ts │ │ │ └── user_service.ts │ │ ├── quota │ │ ├── index.ts │ │ └── quota.ts │ │ ├── reference │ │ ├── index.ts │ │ └── reference.ts │ │ ├── resourcemanager │ │ ├── index.ts │ │ └── v1 │ │ │ ├── cloud.ts │ │ │ ├── cloud_service.ts │ │ │ ├── folder.ts │ │ │ └── folder_service.ts │ │ ├── serverless │ │ ├── apigateway │ │ │ ├── v1 │ │ │ │ ├── apigateway.ts │ │ │ │ └── apigateway_service.ts │ │ │ └── websocket │ │ │ │ └── v1 │ │ │ │ ├── connection.ts │ │ │ │ └── connection_service.ts │ │ ├── containers │ │ │ └── v1 │ │ │ │ ├── container.ts │ │ │ │ └── container_service.ts │ │ ├── functions │ │ │ └── v1 │ │ │ │ ├── function.ts │ │ │ │ └── function_service.ts │ │ ├── index.ts │ │ ├── mdbproxy │ │ │ └── v1 │ │ │ │ ├── proxy.ts │ │ │ │ └── proxy_service.ts │ │ └── triggers │ │ │ └── v1 │ │ │ ├── predicate.ts │ │ │ ├── trigger.ts │ │ │ └── trigger_service.ts │ │ ├── service_clients.ts │ │ ├── storage │ │ ├── index.ts │ │ └── v1 │ │ │ ├── bucket.ts │ │ │ └── bucket_service.ts │ │ ├── validation.ts │ │ ├── vpc │ │ ├── index.ts │ │ └── v1 │ │ │ ├── address.ts │ │ │ ├── address_service.ts │ │ │ ├── gateway.ts │ │ │ ├── gateway_service.ts │ │ │ ├── network.ts │ │ │ ├── network_service.ts │ │ │ ├── route_table.ts │ │ │ ├── route_table_service.ts │ │ │ ├── security_group.ts │ │ │ ├── security_group_service.ts │ │ │ ├── subnet.ts │ │ │ └── subnet_service.ts │ │ └── ydb │ │ ├── index.ts │ │ └── v1 │ │ ├── backup.ts │ │ ├── backup_service.ts │ │ ├── database.ts │ │ ├── database_service.ts │ │ ├── location.ts │ │ ├── location_service.ts │ │ ├── resource_preset.ts │ │ ├── resource_preset_service.ts │ │ ├── storage_type.ts │ │ └── storage_type_service.ts ├── index.ts ├── middleware │ ├── error-metadata.ts │ └── retry.ts ├── service-endpoints.test.ts ├── service-endpoints.ts ├── session.ts ├── token-service │ ├── iam-token-service.ts │ └── metadata-token-service.ts ├── types.ts └── utils │ ├── client-factory.ts │ ├── decode-message.ts │ ├── logger.ts │ └── operation │ ├── index.ts │ ├── time-spent.ts │ └── wait-for.ts ├── tsconfig.eslint.json └── tsconfig.json /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "@commitlint/config-conventional" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | src/generated/** 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "commonjs": true 5 | }, 6 | "extends": [ 7 | "eslint:recommended", 8 | "airbnb-base", 9 | "airbnb-typescript/base", 10 | "plugin:unicorn/recommended", 11 | "plugin:@typescript-eslint/recommended" 12 | ], 13 | "parser": "@typescript-eslint/parser", 14 | "plugins": [ 15 | "@typescript-eslint", 16 | "unicorn", 17 | "import", 18 | "prefer-arrow-functions" 19 | ], 20 | "parserOptions": { 21 | "project": "tsconfig.eslint.json" 22 | }, 23 | "rules": { 24 | "@typescript-eslint/lines-between-class-members": "off", 25 | "unicorn/no-array-reduce": "off", 26 | "no-continue": "off", 27 | "no-restricted-syntax": "off", 28 | "unicorn/prefer-node-protocol": "off", 29 | "class-methods-use-this": "off", 30 | "@typescript-eslint/no-unused-vars": "off", 31 | "import/prefer-default-export": "off", 32 | "comma-dangle": ["error", "always-multiline"], 33 | "indent": "off", 34 | "@typescript-eslint/indent": ["error", 4], 35 | "max-len": ["error", 140], 36 | "@typescript-eslint/ban-ts-comment": "off", 37 | "@typescript-eslint/prefer-optional-chain": "error", 38 | "prefer-arrow-functions/prefer-arrow-functions": ["error"], 39 | "unicorn/prevent-abbreviations": "off", 40 | "newline-after-var": "error", 41 | "newline-before-return": "error", 42 | "no-plusplus": "off", 43 | "unicorn/import-style": "off", 44 | "@typescript-eslint/no-var-requires": "off", 45 | "no-underscore-dangle": ["error", { 46 | "allowAfterThis": true, 47 | "allowAfterSuper": false 48 | }], 49 | "unicorn/no-null": "off", 50 | "import/no-extraneous-dependencies": ["error", { 51 | "devDependencies": true 52 | }], 53 | "import/no-cycle": "off" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /.github/actions/checkout-and-install-node/action.yml: -------------------------------------------------------------------------------- 1 | name: 'checkout-and-install-node' 2 | description: 'Checkout from VCS and install NodeJS from .nvmrc' 3 | inputs: 4 | persist-credentials: 5 | description: 'Whether to configure the token or SSH key with the local git config' 6 | required: false 7 | default: 'true' 8 | runs: 9 | using: 'composite' 10 | steps: 11 | - uses: actions/checkout@v2 12 | with: 13 | fetch-depth: 0 14 | persist-credentials: ${{ inputs.persist-credentials }} 15 | submodules: ${{ inputs.submodules }} 16 | - uses: actions/setup-node@v2 17 | with: 18 | node-version-file: '.nvmrc' 19 | - uses: actions/cache@v4 20 | id: cache 21 | with: 22 | path: node_modules 23 | key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} 24 | - name: Install Depencendies 25 | if: steps.cache.outputs.cache-hit != 'true' 26 | run: npm ci 27 | shell: bash 28 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "npm" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | commit-message: 8 | prefix: "fix(deps):" 9 | open-pull-requests-limit: 0 10 | -------------------------------------------------------------------------------- /.github/workflows/pr-checks.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Automated Checks 2 | on: 3 | pull_request: 4 | branches: 5 | - master 6 | - alpha 7 | - beta 8 | jobs: 9 | tests: 10 | runs-on: ubuntu-24.04 11 | steps: 12 | - uses: yandex-cloud/nodejs-sdk/.github/actions/checkout-and-install-node@d6b5322d8dbc130126ec1fa00bc0f2d6cc2f53db 13 | - run: npm run test 14 | check-endpoints: 15 | runs-on: ubuntu-24.04 16 | # Currently, the check-endpoints script fails on the master branch. 17 | # So we need to continue on error. 18 | continue-on-error: true 19 | steps: 20 | - uses: yandex-cloud/nodejs-sdk/.github/actions/checkout-and-install-node@d6b5322d8dbc130126ec1fa00bc0f2d6cc2f53db 21 | with: 22 | submodules: recursive 23 | - run: npm run check-endpoints 24 | lint: 25 | runs-on: ubuntu-24.04 26 | steps: 27 | - uses: yandex-cloud/nodejs-sdk/.github/actions/checkout-and-install-node@d6b5322d8dbc130126ec1fa00bc0f2d6cc2f53db 28 | - run: npm run lint 29 | build: 30 | runs-on: ubuntu-24.04 31 | steps: 32 | - uses: yandex-cloud/nodejs-sdk/.github/actions/checkout-and-install-node@d6b5322d8dbc130126ec1fa00bc0f2d6cc2f53db 33 | - run: npm run build 34 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - alpha 7 | - beta 8 | jobs: 9 | release: 10 | if: github.actor != 'yandex-cloud-bot' 11 | name: Release 12 | runs-on: ubuntu-24.04 13 | steps: 14 | - uses: yandex-cloud/nodejs-sdk/.github/actions/checkout-and-install-node@d6b5322d8dbc130126ec1fa00bc0f2d6cc2f53db 15 | with: 16 | persist-credentials: false 17 | - env: 18 | GITHUB_TOKEN: ${{ secrets.YANDEX_CLOUD_BOT_TOKEN }} 19 | GIT_AUTHOR_NAME: yandex-cloud-bot 20 | GIT_AUTHOR_EMAIL: ycloud-bot@yandex.ru 21 | GIT_COMMITTER_NAME: yandex-cloud-bot 22 | GIT_COMMITTER_EMAIL: ycloud-bot@yandex.ru 23 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 24 | run: npx --no-install semantic-release 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | dist 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cloudapi"] 2 | path = cloudapi 3 | url = git@github.com:yandex-cloud/cloudapi.git 4 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ -n "$CI" ] && exit 0 3 | 4 | . "$(dirname "$0")/_/husky.sh" 5 | 6 | npx --no -- commitlint --edit "$1" 7 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 22.15.0 2 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "branches": [ 3 | "master", 4 | { 5 | "name": "beta", 6 | "prerelease": "beta" 7 | }, 8 | { 9 | "name": "alpha", 10 | "prerelease": "alpha" 11 | } 12 | ], 13 | "plugins": [ 14 | "@semantic-release/commit-analyzer", 15 | "@semantic-release/release-notes-generator", 16 | "@semantic-release/npm", 17 | "@semantic-release/github", 18 | "@semantic-release/git" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The following authors have created the source code of "Yandex.Cloud NodeJS SDK" 2 | published and distributed by YANDEX LLC as the owner: 3 | 4 | Gleb Borisov 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Notice to external contributors 2 | 3 | 4 | ## General info 5 | 6 | Hello! In order for us (YANDEX LLC) to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the “**CLA**”). The current version of the CLA can be found here: 7 | 1) https://yandex.ru/legal/cla/?lang=en (in English) and 8 | 2) https://yandex.ru/legal/cla/?lang=ru (in Russian). 9 | 10 | By adopting the CLA, you state the following: 11 | 12 | * You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA, 13 | * You have read the terms and conditions of the CLA and agree with them in full, 14 | * You are legally able to provide and license your contributions as stated, 15 | * We may use your contributions for our open source projects and for any other our project too, 16 | * We rely on your assurances concerning the rights of third parties in relation to your contributions. 17 | 18 | If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you have already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA. 19 | 20 | ## Provide contributions 21 | 22 | If you have already adopted terms and conditions of the CLA, you are able to provide your contributions. When you submit your pull request, please add the following information into it: 23 | 24 | ``` 25 | I hereby agree to the terms of the CLA available at: [link]. 26 | ``` 27 | 28 | Replace the bracketed text as follows: 29 | * [link] is the link to the current version of the CLA: https://yandex.ru/legal/cla/?lang=en (in English) or https://yandex.ru/legal/cla/?lang=ru (in Russian). 30 | 31 | It is enough to provide us such notification once. 32 | 33 | ## Other questions 34 | 35 | If you have any questions, please mail us at opensource@yandex-team.ru. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 YANDEX LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Yandex.Cloud SDK (nodejs) 2 | 3 | [![npm](https://img.shields.io/npm/v/@yandex-cloud/nodejs-sdk.svg)](https://www.npmjs.com/package/@yandex-cloud/nodejs-sdk) 4 | [![License](https://img.shields.io/github/license/yandex-cloud/nodejs-sdk.svg)](https://github.com/yandex-cloud/nodejs-sdk/blob/master/LICENSE) 5 | 6 | Need to automate your infrastructure or use services provided by Yandex.Cloud? We've got you covered. 7 | 8 | ## Requirements 9 | - nodejs >= 22.15 10 | 11 | ## Installation 12 | `npm install @yandex-cloud/nodejs-sdk` 13 | 14 | ## Getting started 15 | 16 | There are three options for authorization your requests: 17 | - [OAuth Token](https://cloud.yandex.com/en-ru/docs/iam/concepts/authorization/oauth-token) 18 | - [IAM token](https://cloud.yandex.com/en-ru/docs/iam/operations/iam-token/create) 19 | - [Metadata Service](https://cloud.yandex.com/en-ru/docs/compute/concepts/vm-metadata) (if you're executing code inside VMs or Functions 20 | running in Yandex.Cloud) 21 | 22 | ### OAuth Token 23 | 24 | ```typescript 25 | import { Session, cloudApi, serviceClients } from '@yandex-cloud/nodejs-sdk'; 26 | 27 | const { resourcemanager: { cloud_service: { ListCloudsRequest } } } = cloudApi; 28 | 29 | // Initialize SDK with your token 30 | const session = new Session({ oauthToken: 'YOUR_TOKEN' }); 31 | 32 | // Create service client 33 | const cloudService = session.client(serviceClients.CloudServiceClient); 34 | 35 | // Issue request (returns Promise) 36 | const response = await cloudService.list(ListCloudsRequest.fromPartial({ 37 | pageSize: 100, 38 | })); 39 | ``` 40 | 41 | ### Metadata Service 42 | 43 | Don't forget to assign Service Account for your Instance or Function. 44 | 45 | ```typescript 46 | import { Session, cloudApi, serviceClients } from '@yandex-cloud/nodejs-sdk'; 47 | 48 | const { resourcemanager: { cloud_service: { ListCloudsRequest } } } = cloudApi; 49 | 50 | // Initialize SDK with your token 51 | const session = new Session(); 52 | 53 | // Create service client 54 | const cloudService = session.client(serviceClients.CloudServiceClient); 55 | 56 | // Issue request (returns Promise) 57 | const response = await cloudService.list(ListCloudsRequest.fromPartial({ 58 | pageSize: 100, 59 | })); 60 | ``` 61 | 62 | ### IAM Token 63 | 64 | ```typescript 65 | import { Session, cloudApi, serviceClients } from '@yandex-cloud/nodejs-sdk'; 66 | 67 | const { resourcemanager: { cloud_service: { ListCloudsRequest } } } = cloudApi; 68 | 69 | // Initialize SDK with your token 70 | const session = new Session({ iamToken: 'YOUR_TOKEN' }); 71 | 72 | // Create service client 73 | const cloudService = session.client(serviceClients.CloudServiceClient); 74 | 75 | // Issue request (returns Promise) 76 | const response = await cloudService.list(ListCloudsRequest.fromPartial({ 77 | pageSize: 100, 78 | })); 79 | ``` 80 | 81 | Check [examples](./examples) directory for more examples. 82 | 83 | To run example scripts, you should execute the following commands: 84 | ```bash 85 | cd examples 86 | npm i 87 | YC_OAUTH_TOKEN=... YC_FOLDER_ID=... npm run start path/to/example.ts 88 | ``` 89 | 90 | ## Services 91 | 92 | * AI Translate; 93 | * AI Vision. 94 | * Application Load Balancer 95 | * Billing 96 | * Cloud CDN 97 | * Certificate Manager 98 | * Compute Cloud 99 | * Container Registry 100 | * Data Proc 101 | * DataSphere 102 | * Data Transfer 103 | * DNS 104 | * Identity and Access Management (IAM) 105 | * IoT Core 106 | * Managed Service for Kubernetes 107 | * Key Management Service (KMS) 108 | * Load Balancer 109 | * Lockbox 110 | * Logging 111 | * Managed DataBase 112 | * ClickHouse 113 | * ElasticSearch 114 | * Greenplum 115 | * Kafka 116 | * MongoDB 117 | * MySQL 118 | * PostgreSQL 119 | * Redis 120 | * MS SQL Server 121 | * Organization Manager 122 | * Resource Manager 123 | * Serverless 124 | * Functions 125 | * API Gateway 126 | * Containers 127 | * Triggers 128 | * MDB Proxy 129 | * Virtual Private Cloud (VPC) 130 | * Yandex Database (YDB) 131 | 132 | If you need generated client for other Yandex.Cloud services, just open an issue. 133 | -------------------------------------------------------------------------------- /config/jest.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | 3 | /* 4 | * For a detailed explanation regarding each configuration property and type check, visit: 5 | * https://jestjs.io/docs/configuration 6 | */ 7 | 8 | export default { 9 | moduleFileExtensions: [ 10 | 'js', 11 | 'ts', 12 | ], 13 | preset: 'ts-jest', 14 | rootDir: path.resolve('./src/'), 15 | transform: { 16 | '^.+\\.[tj]s$': 'ts-jest', 17 | }, 18 | transformIgnorePatterns: ['node_modules/(?!axios)'], 19 | }; 20 | -------------------------------------------------------------------------------- /examples/.nvmrc: -------------------------------------------------------------------------------- 1 | 16.13.1 -------------------------------------------------------------------------------- /examples/ai-translate.ts: -------------------------------------------------------------------------------- 1 | import { serviceClients, Session, cloudApi } from '@yandex-cloud/nodejs-sdk'; 2 | import { getEnv } from './utils/get-env'; 3 | import { log } from './utils/logger'; 4 | 5 | const { ai: { translate_translation_service: { TranslateRequest, TranslateRequest_Format: Format } } } = cloudApi; 6 | 7 | const TEXTS = ['NodeJS SDK examples', 'Powerful, but easy to use library']; 8 | const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN'); 9 | const FOLDER_ID = getEnv('YC_FOLDER_ID'); 10 | 11 | (async () => { 12 | const session = new Session({ oauthToken: AUTH_TOKEN }); 13 | const client = session.client(serviceClients.TranslationServiceClient); 14 | 15 | const response = await client.translate(TranslateRequest.fromPartial({ 16 | targetLanguageCode: 'ru', 17 | format: Format.PLAIN_TEXT, 18 | folderId: FOLDER_ID, 19 | texts: TEXTS, 20 | })); 21 | 22 | for (const [idx, text] of response.translations.entries()) { 23 | log(`translated '${TEXTS[idx]}' => '${text.text}'`); 24 | } 25 | })(); 26 | -------------------------------------------------------------------------------- /examples/compute-instance-create.ts: -------------------------------------------------------------------------------- 1 | import { 2 | serviceClients, Session, cloudApi, waitForOperation, decodeMessage, 3 | } from '@yandex-cloud/nodejs-sdk'; 4 | import { getEnv } from './utils/get-env'; 5 | import { log } from './utils/logger'; 6 | 7 | const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN'); 8 | const FOLDER_ID = getEnv('YC_FOLDER_ID'); 9 | const TARGET_ZONE_ID = 'ru-central1-a'; 10 | 11 | const { 12 | vpc: { 13 | network_service: { 14 | ListNetworksRequest, 15 | ListNetworkSubnetsRequest, 16 | }, 17 | }, 18 | compute: { 19 | image_service: { 20 | GetImageLatestByFamilyRequest, 21 | }, 22 | instance_service: { 23 | CreateInstanceRequest, 24 | DeleteInstanceRequest, 25 | }, 26 | instance: { 27 | IpVersion, 28 | }, 29 | }, 30 | } = cloudApi; 31 | 32 | (async () => { 33 | const session = new Session({ oauthToken: AUTH_TOKEN }); 34 | const imageClient = session.client(serviceClients.ComputeImageServiceClient); 35 | const instanceClient = session.client(serviceClients.InstanceServiceClient); 36 | const networkClient = session.client(serviceClients.NetworkServiceClient); 37 | 38 | const networkResponse = await networkClient.list(ListNetworksRequest.fromPartial({ 39 | folderId: FOLDER_ID, 40 | })); 41 | 42 | log(`Found ${networkResponse.networks.length} networks in folder ${FOLDER_ID}`); 43 | 44 | const network = networkResponse.networks.pop(); 45 | 46 | if (!network) { 47 | throw new Error(`There are no networks in folder ${FOLDER_ID}`); 48 | } 49 | 50 | const subnetsResponse = await networkClient.listSubnets(ListNetworkSubnetsRequest.fromPartial({ 51 | networkId: network.id, 52 | })); 53 | const subnet = subnetsResponse.subnets.find((s) => s.zoneId === TARGET_ZONE_ID); 54 | 55 | if (!subnet) { 56 | throw new Error(`There is no subnet in zone ${TARGET_ZONE_ID} in folder ${FOLDER_ID}`); 57 | } 58 | 59 | const image = await imageClient.getLatestByFamily(GetImageLatestByFamilyRequest.fromPartial({ 60 | family: 'ubuntu-1804-lts', 61 | folderId: 'standard-images', 62 | })); 63 | 64 | const createOp = await instanceClient.create(CreateInstanceRequest.fromPartial({ 65 | folderId: FOLDER_ID, 66 | zoneId: TARGET_ZONE_ID, 67 | platformId: 'standard-v2', 68 | labels: { 'nodejs-sdk': 'yes' }, 69 | resourcesSpec: { 70 | memory: 2 * 1024 * 1024 * 1024, 71 | cores: 2, 72 | }, 73 | bootDiskSpec: { 74 | autoDelete: true, 75 | diskSpec: { 76 | size: 10 * 1024 * 1024 * 1024, 77 | imageId: image.id, 78 | }, 79 | }, 80 | networkInterfaceSpecs: [ 81 | { 82 | subnetId: subnet.id, 83 | primaryV4AddressSpec: { 84 | oneToOneNatSpec: { ipVersion: IpVersion.IPV4 }, 85 | }, 86 | }, 87 | ], 88 | })); 89 | 90 | log(`Instance create operation id: ${createOp.id}`); 91 | 92 | const finishedCreateOp = await waitForOperation(createOp, session); 93 | 94 | if (finishedCreateOp.response) { 95 | const instance = decodeMessage(finishedCreateOp.response); 96 | 97 | log(`Instance ${instance.id} created`); 98 | 99 | const removeOp = await instanceClient.delete(DeleteInstanceRequest.fromPartial({ 100 | instanceId: instance.id, 101 | })); 102 | 103 | const finishedRemoveOp = await waitForOperation(removeOp, session); 104 | 105 | if (finishedRemoveOp.error) { 106 | log(`Failed to remove instance ${instance.id}`); 107 | } else { 108 | log(`Successfully remove instance ${instance.id}`); 109 | } 110 | } 111 | })(); 112 | -------------------------------------------------------------------------------- /examples/functions.ts: -------------------------------------------------------------------------------- 1 | import { serviceClients, Session, cloudApi } from '@yandex-cloud/nodejs-sdk'; 2 | import { getEnv } from './utils/get-env'; 3 | import { log } from './utils/logger'; 4 | 5 | const { serverless: { functions_function_service: { ListFunctionsRequest } } } = cloudApi; 6 | const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN'); 7 | const FOLDER_ID = getEnv('YC_FOLDER_ID'); 8 | 9 | (async () => { 10 | const session = new Session({ oauthToken: AUTH_TOKEN }); 11 | const client = session.client(serviceClients.FunctionServiceClient); 12 | 13 | const response = await client.list(ListFunctionsRequest.fromPartial({ folderId: FOLDER_ID })); 14 | 15 | for (const func of response.functions) { 16 | log(`Function: ${func.name}, id: ${func.id}, invoke URL: ${func.httpInvokeUrl}`); 17 | } 18 | })(); 19 | -------------------------------------------------------------------------------- /examples/iot-data.ts: -------------------------------------------------------------------------------- 1 | import { serviceClients, Session, cloudApi } from '@yandex-cloud/nodejs-sdk'; 2 | import { getEnv } from './utils/get-env'; 3 | import { log } from './utils/logger'; 4 | 5 | const { 6 | iot: { 7 | devices_registry_service: { ListRegistriesRequest }, 8 | devices_registry_data_service: { PublishRegistryDataRequest }, 9 | }, 10 | } = cloudApi; 11 | const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN'); 12 | const FOLDER_ID = getEnv('YC_FOLDER_ID'); 13 | 14 | (async () => { 15 | const session = new Session({ oauthToken: AUTH_TOKEN }); 16 | const registryClient = session.client(serviceClients.IotRegistryServiceClient); 17 | const dataClient = session.client(serviceClients.RegistryDataServiceClient); 18 | 19 | const registries = await registryClient.list(ListRegistriesRequest.fromPartial({ 20 | folderId: FOLDER_ID, 21 | })); 22 | 23 | log(`Found ${registries.registries.length} registries in folder ${FOLDER_ID}`); 24 | 25 | for (const registry of registries.registries) { 26 | log(`Broadcasting to ${registry.id}`); 27 | 28 | dataClient.publish(PublishRegistryDataRequest.fromPartial({ 29 | registryId: registry.id, 30 | topic: `$registries/${registry.id}/commands/heartbeat`, 31 | data: Buffer.from('{"hello": "world"}'), 32 | })); 33 | } 34 | 35 | log('Broadcasted to all registries'); 36 | })(); 37 | -------------------------------------------------------------------------------- /examples/kms.ts: -------------------------------------------------------------------------------- 1 | import { 2 | serviceClients, Session, cloudApi, waitForOperation, decodeMessage, 3 | } from '@yandex-cloud/nodejs-sdk'; 4 | import { getEnv } from './utils/get-env'; 5 | import { log } from './utils/logger'; 6 | 7 | const { 8 | kms: { 9 | symmetric_key_service: { CreateSymmetricKeyRequest, DeleteSymmetricKeyRequest }, 10 | symmetric_key: { SymmetricAlgorithm }, 11 | symmetric_crypto_service: { SymmetricEncryptRequest, SymmetricDecryptRequest }, 12 | }, 13 | } = cloudApi; 14 | 15 | (async () => { 16 | const authToken = getEnv('YC_OAUTH_TOKEN'); 17 | const folderId = getEnv('YC_FOLDER_ID'); 18 | const session = new Session({ oauthToken: authToken }); 19 | const keyClient = session.client(serviceClients.SymmetricKeyServiceClient); 20 | const cryptoClient = session.client(serviceClients.SymmetricCryptoServiceClient); 21 | 22 | const keyCreateOp = await keyClient.create(CreateSymmetricKeyRequest.fromPartial({ 23 | folderId, 24 | defaultAlgorithm: SymmetricAlgorithm.AES_256, 25 | })); 26 | const finishedKeyCreateOp = await waitForOperation(keyCreateOp, session); 27 | 28 | if (finishedKeyCreateOp.response) { 29 | const key = decodeMessage(finishedKeyCreateOp.response); 30 | 31 | const encrypted = await cryptoClient.encrypt(SymmetricEncryptRequest.fromPartial({ 32 | keyId: key.id, 33 | plaintext: Buffer.from('example message'), 34 | })); 35 | 36 | log(`Got "${encrypted.ciphertext}" from KMS`); 37 | 38 | const decrypted = await cryptoClient.decrypt(SymmetricDecryptRequest.fromPartial({ 39 | keyId: key.id, 40 | ciphertext: encrypted.ciphertext, 41 | })); 42 | 43 | log(`Got "${decrypted.plaintext}" from KMS`); 44 | 45 | const keyRemoveOp = await keyClient.delete(DeleteSymmetricKeyRequest.fromPartial({ 46 | keyId: key.id, 47 | })); 48 | 49 | await waitForOperation(keyRemoveOp, session); 50 | } 51 | })(); 52 | -------------------------------------------------------------------------------- /examples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "ts-node -T -P ../tsconfig.json" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@yandex-cloud/nodejs-sdk": "../", 14 | "wav": "^1.0.2" 15 | }, 16 | "devDependencies": { 17 | "@types/wav": "^1.0.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/resourcemanager-cloud-list.ts: -------------------------------------------------------------------------------- 1 | import { serviceClients, Session, cloudApi } from '@yandex-cloud/nodejs-sdk'; 2 | import { getEnv } from './utils/get-env'; 3 | import { log } from './utils/logger'; 4 | 5 | const { resourcemanager: { cloud_service: { ListCloudsRequest } } } = cloudApi; 6 | const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN'); 7 | 8 | (async () => { 9 | const session = new Session({ oauthToken: AUTH_TOKEN }); 10 | const client = session.client(serviceClients.CloudServiceClient); 11 | 12 | const response = await client.list(ListCloudsRequest.fromPartial({ pageSize: 200 })); 13 | 14 | for (const cloud of response.clouds) { 15 | log(`Found cloud id = ${cloud.id}, name = ${cloud.name}`); 16 | } 17 | })(); 18 | -------------------------------------------------------------------------------- /examples/storage.ts: -------------------------------------------------------------------------------- 1 | import { serviceClients, Session, cloudApi } from '@yandex-cloud/nodejs-sdk'; 2 | import { getEnv } from './utils/get-env'; 3 | import { log } from './utils/logger'; 4 | 5 | const { storage: { bucket_service: { ListBucketsRequest } } } = cloudApi; 6 | const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN'); 7 | const FOLDER_ID = getEnv('YC_FOLDER_ID'); 8 | 9 | (async () => { 10 | const session = new Session({ oauthToken: AUTH_TOKEN }); 11 | const client = session.client(serviceClients.BucketServiceClient); 12 | 13 | const response = await client.list(ListBucketsRequest.fromPartial({ folderId: FOLDER_ID })); 14 | 15 | for (const bucket of response.buckets) { 16 | log(`Bucket: ${bucket.name}, id: ${bucket.id}`); 17 | } 18 | })(); 19 | -------------------------------------------------------------------------------- /examples/stream-stt/index.ts: -------------------------------------------------------------------------------- 1 | import { serviceClients, Session } from '@yandex-cloud/nodejs-sdk'; 2 | import { 3 | RecognitionSpec_AudioEncoding, 4 | StreamingRecognitionRequest, 5 | } from '@yandex-cloud/nodejs-sdk/dist/generated/yandex/cloud/ai/stt/v2/stt_service'; 6 | import * as fs from 'fs'; 7 | import * as path from 'path'; 8 | import * as stream from 'stream'; 9 | import * as wav from 'wav'; 10 | import { getEnv } from '../utils/get-env'; 11 | import { log } from '../utils/logger'; 12 | 13 | // eslint-disable-next-line unicorn/prefer-module 14 | const file = fs.createReadStream(path.join(__dirname, 'test.wav')); 15 | const reader = new wav.Reader(); 16 | const data = new stream.PassThrough(); 17 | 18 | const formatPromise = new Promise((resolve) => { 19 | // the "format" event gets emitted at the end of the WAVE header 20 | reader.on('format', (format: wav.Format) => { 21 | // pass the format object 22 | resolve(format); 23 | }); 24 | }); 25 | 26 | // pipe the WAVE file to the Reader instance 27 | file.pipe(reader); 28 | reader.pipe(data); 29 | 30 | (async () => { 31 | const authToken = getEnv('YC_OAUTH_TOKEN'); 32 | const folderId = getEnv('YC_FOLDER_ID'); 33 | const session = new Session({ oauthToken: authToken }); 34 | const client = session.client(serviceClients.SttServiceClient); 35 | 36 | async function* createRequest(): AsyncIterable { 37 | const format = await formatPromise; 38 | 39 | yield StreamingRecognitionRequest.fromPartial({ 40 | config: { 41 | specification: { 42 | audioEncoding: RecognitionSpec_AudioEncoding.LINEAR16_PCM, 43 | sampleRateHertz: format.sampleRate, 44 | audioChannelCount: format.channels, 45 | }, 46 | folderId, 47 | }, 48 | }); 49 | for await (const chunk of data) { 50 | yield StreamingRecognitionRequest.fromPartial({ 51 | audioContent: chunk, 52 | }); 53 | } 54 | } 55 | 56 | try { 57 | for await (const response of client.streamingRecognize(createRequest())) { 58 | log(JSON.stringify(response, null, 2)); 59 | } 60 | } catch (error) { 61 | log(error); 62 | } 63 | })(); 64 | -------------------------------------------------------------------------------- /examples/stream-stt/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yandex-cloud/nodejs-sdk/d61b1b5af2c0fffbda97c8c2cbe4cd5b35cced74/examples/stream-stt/test.wav -------------------------------------------------------------------------------- /examples/utils/get-env.ts: -------------------------------------------------------------------------------- 1 | export const getEnv = (envName: string, defaultValue?: string): string => { 2 | const envValue = process.env[envName] || defaultValue; 3 | 4 | if (!envValue) { 5 | throw new Error(`Env variable ${envName} is not defined`); 6 | } 7 | 8 | return envValue; 9 | }; 10 | -------------------------------------------------------------------------------- /examples/utils/logger.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 2 | export const log = (message: any) => { 3 | // eslint-disable-next-line no-console 4 | console.log(message); 5 | }; 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@yandex-cloud/nodejs-sdk", 3 | "version": "2.9.0", 4 | "description": "Yandex.Cloud NodeJS SDK", 5 | "keywords": [ 6 | "yandex-cloud", 7 | "sdk", 8 | "cloud" 9 | ], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/yandex-cloud/nodejs-sdk.git" 13 | }, 14 | "author": "Yandex LLC", 15 | "license": "MIT", 16 | "main": "dist/index.js", 17 | "bugs": { 18 | "url": "https://github.com/yandex-cloud/nodejs-sdk/issues" 19 | }, 20 | "files": [ 21 | "dist" 22 | ], 23 | "homepage": "https://github.com/yandex-cloud/nodejs-sdk#readme", 24 | "dependencies": { 25 | "@grpc/grpc-js": "^1.6.12", 26 | "abort-controller-x": "^0.4.1", 27 | "axios": "^1.8.2", 28 | "jsonwebtoken": "^9.0.0", 29 | "lodash": "^4.17.21", 30 | "log4js": "^6.4.0", 31 | "long": "^5.2.0", 32 | "luxon": "^2.2.0", 33 | "nice-grpc": "^1.0.6", 34 | "nice-grpc-client-middleware-deadline": "^1.0.6", 35 | "node-abort-controller": "^3.1.1", 36 | "protobufjs": "^7.2.4", 37 | "utility-types": "^3.10.0" 38 | }, 39 | "devDependencies": { 40 | "@commitlint/cli": "^17.6.1", 41 | "@commitlint/config-conventional": "^15.0.0", 42 | "@semantic-release/git": "^10.0.1", 43 | "@types/jest": "^27.0.3", 44 | "@types/jsonwebtoken": "^8.5.6", 45 | "@types/lodash": "^4.14.178", 46 | "@types/luxon": "^2.0.8", 47 | "@types/node": "^16.11.3", 48 | "@typescript-eslint/eslint-plugin": "^5.7.0", 49 | "@typescript-eslint/parser": "^5.7.0", 50 | "cross-env": "^7.0.3", 51 | "eslint": "^8.4.1", 52 | "eslint-config-airbnb-base": "^15.0.0", 53 | "eslint-config-airbnb-typescript": "^16.1.0", 54 | "eslint-plugin-import": "^2.25.3", 55 | "eslint-plugin-jsx-a11y": "^6.5.1", 56 | "eslint-plugin-prefer-arrow-functions": "^3.1.4", 57 | "eslint-plugin-unicorn": "^39.0.0", 58 | "fast-glob": "^3.2.7", 59 | "grpc-tools": "^1.12.4", 60 | "husky": "^7.0.4", 61 | "jest": "^27.4.5", 62 | "semantic-release": "^21.0.1", 63 | "ts-jest": "^27.1.1", 64 | "ts-node": "^10.4.0", 65 | "ts-proto": "^1.95.1", 66 | "typescript": "^4.5.4" 67 | }, 68 | "scripts": { 69 | "test": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" jest -c config/jest.ts --passWithNoTests '.*\\.test\\.ts$'", 70 | "lint": "eslint src config", 71 | "build": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" tsc -p .", 72 | "generate-code": "ts-node scripts/generate-code.ts", 73 | "check-endpoints": "ts-node scripts/check-endpoints.ts", 74 | "prepare": "husky install", 75 | "prepublishOnly": "npm run build" 76 | }, 77 | "engines": { 78 | "node": ">=22.15.0" 79 | }, 80 | "publishConfig": { 81 | "access": "public" 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /scripts/check-endpoints.ts: -------------------------------------------------------------------------------- 1 | import * as fg from 'fast-glob'; 2 | import * as path from 'path'; 3 | import { 4 | Namespace, NamespaceBase, Root, Service, 5 | } from 'protobufjs'; 6 | import { SERVICE_ENDPOINTS_LIST } from '../src/service-endpoints'; 7 | 8 | const PROTO_DIR = path.resolve('./cloudapi'); 9 | 10 | const protoFiles = fg.sync('**/*.proto', { cwd: PROTO_DIR }); 11 | 12 | const pbRoot = new Root(); 13 | 14 | pbRoot.resolvePath = (origin, target) => { 15 | const targets = target.split('/'); 16 | 17 | switch (targets[0]) { 18 | case 'google': { 19 | switch (targets[1]) { 20 | case 'protobuf': { 21 | return `./node_modules/protobufjs/${target}`; 22 | } 23 | default: { 24 | return `./cloudapi/third_party/googleapis/${target}`; 25 | } 26 | } 27 | } 28 | case 'third_party': { 29 | return `./cloudapi/${target}`; 30 | } 31 | case 'yandex': { 32 | return `./cloudapi/${target}`; 33 | } 34 | default: { 35 | return target; 36 | } 37 | } 38 | }; 39 | 40 | const SERVICES: Service[] = []; 41 | const findServices = (node: T) => { 42 | for (const child of Object.values(node.nested ?? {}) 43 | .sort((a, b) => (a.name < b.name ? -1 : (a.name === b.name ? 0 : 1)))) { 44 | if (child instanceof Service) { 45 | SERVICES.push(child); 46 | } else if (child instanceof Namespace) { 47 | findServices(child); 48 | } 49 | } 50 | }; 51 | 52 | // eslint-disable-next-line unicorn/prefer-top-level-await 53 | pbRoot.load(protoFiles, { alternateCommentMode: true }).then((loadedRoot) => { 54 | const SERVICE_IDS = new Set(); 55 | let hasMissing = false; 56 | 57 | for (const serviceEndpoint of SERVICE_ENDPOINTS_LIST) { 58 | for (const service of serviceEndpoint.serviceIds) { 59 | SERVICE_IDS.add(service); 60 | } 61 | } 62 | 63 | findServices(loadedRoot); 64 | for (const s of SERVICES) { 65 | // full name without leading dot 66 | const fullName = s.fullName.slice(1); 67 | 68 | if (!SERVICE_IDS.has(fullName)) { 69 | // eslint-disable-next-line no-console 70 | console.log('Missing service', fullName); 71 | hasMissing = true; 72 | } 73 | } 74 | 75 | if (hasMissing) { 76 | // eslint-disable-next-line unicorn/no-process-exit 77 | process.exit(1); 78 | } 79 | }); 80 | -------------------------------------------------------------------------------- /src/errors.ts: -------------------------------------------------------------------------------- 1 | import { Metadata } from 'nice-grpc'; 2 | 3 | export class ApiError extends Error { 4 | metadata: Metadata; 5 | 6 | constructor(error: Error, metadata: Metadata) { 7 | super(error.message); 8 | this.name = 'ApiError'; 9 | this.stack = error.stack; 10 | this.metadata = metadata; 11 | } 12 | 13 | /** 14 | * Getter for the request ID from the metadata. 15 | * Will provide additional information in case of opening a support ticket. 16 | * @returns {string | undefined} The request ID if it exists, undefined otherwise. 17 | */ 18 | get requestId(): string | undefined { 19 | return this.metadata.get('x-request-id'); 20 | } 21 | 22 | /** 23 | * Getter for the server trace ID from the metadata. 24 | * Will provide additional information in case of opening a support ticket. 25 | * @returns {string | undefined} The server trace ID if it exists, undefined otherwise. 26 | */ 27 | get serverTraceId(): string | undefined { 28 | return this.metadata.get('x-server-trace-id'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/generated/google/api/annotations.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import Long from "long"; 3 | import _m0 from "protobufjs/minimal"; 4 | 5 | export const protobufPackage = "google.api"; 6 | 7 | if (_m0.util.Long !== Long) { 8 | _m0.util.Long = Long as any; 9 | _m0.configure(); 10 | } 11 | -------------------------------------------------------------------------------- /src/generated/google/protobuf/empty.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "google.protobuf"; 7 | 8 | /** 9 | * A generic empty message that you can re-use to avoid defining duplicated 10 | * empty messages in your APIs. A typical example is to use it as the request 11 | * or the response type of an API method. For instance: 12 | * 13 | * service Foo { 14 | * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 15 | * } 16 | * 17 | * The JSON representation for `Empty` is empty JSON object `{}`. 18 | */ 19 | export interface Empty { 20 | $type: "google.protobuf.Empty"; 21 | } 22 | 23 | const baseEmpty: object = { $type: "google.protobuf.Empty" }; 24 | 25 | export const Empty = { 26 | $type: "google.protobuf.Empty" as const, 27 | 28 | encode(_: Empty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { 29 | return writer; 30 | }, 31 | 32 | decode(input: _m0.Reader | Uint8Array, length?: number): Empty { 33 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 34 | let end = length === undefined ? reader.len : reader.pos + length; 35 | const message = { ...baseEmpty } as Empty; 36 | while (reader.pos < end) { 37 | const tag = reader.uint32(); 38 | switch (tag >>> 3) { 39 | default: 40 | reader.skipType(tag & 7); 41 | break; 42 | } 43 | } 44 | return message; 45 | }, 46 | 47 | fromJSON(_: any): Empty { 48 | const message = { ...baseEmpty } as Empty; 49 | return message; 50 | }, 51 | 52 | toJSON(_: Empty): unknown { 53 | const obj: any = {}; 54 | return obj; 55 | }, 56 | 57 | fromPartial, I>>(_: I): Empty { 58 | const message = { ...baseEmpty } as Empty; 59 | return message; 60 | }, 61 | }; 62 | 63 | messageTypeRegistry.set(Empty.$type, Empty); 64 | 65 | type Builtin = 66 | | Date 67 | | Function 68 | | Uint8Array 69 | | string 70 | | number 71 | | boolean 72 | | undefined; 73 | 74 | export type DeepPartial = T extends Builtin 75 | ? T 76 | : T extends Array 77 | ? Array> 78 | : T extends ReadonlyArray 79 | ? ReadonlyArray> 80 | : T extends {} 81 | ? { [K in Exclude]?: DeepPartial } 82 | : Partial; 83 | 84 | type KeysOfUnion = T extends T ? keyof T : never; 85 | export type Exact = P extends Builtin 86 | ? P 87 | : P & { [K in keyof P]: Exact } & Record< 88 | Exclude | "$type">, 89 | never 90 | >; 91 | 92 | if (_m0.util.Long !== Long) { 93 | _m0.util.Long = Long as any; 94 | _m0.configure(); 95 | } 96 | -------------------------------------------------------------------------------- /src/generated/google/type/dayofweek.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import Long from "long"; 3 | import _m0 from "protobufjs/minimal"; 4 | 5 | export const protobufPackage = "google.type"; 6 | 7 | /** Represents a day of week. */ 8 | export enum DayOfWeek { 9 | /** DAY_OF_WEEK_UNSPECIFIED - The unspecified day-of-week. */ 10 | DAY_OF_WEEK_UNSPECIFIED = 0, 11 | /** MONDAY - The day-of-week of Monday. */ 12 | MONDAY = 1, 13 | /** TUESDAY - The day-of-week of Tuesday. */ 14 | TUESDAY = 2, 15 | /** WEDNESDAY - The day-of-week of Wednesday. */ 16 | WEDNESDAY = 3, 17 | /** THURSDAY - The day-of-week of Thursday. */ 18 | THURSDAY = 4, 19 | /** FRIDAY - The day-of-week of Friday. */ 20 | FRIDAY = 5, 21 | /** SATURDAY - The day-of-week of Saturday. */ 22 | SATURDAY = 6, 23 | /** SUNDAY - The day-of-week of Sunday. */ 24 | SUNDAY = 7, 25 | UNRECOGNIZED = -1, 26 | } 27 | 28 | export function dayOfWeekFromJSON(object: any): DayOfWeek { 29 | switch (object) { 30 | case 0: 31 | case "DAY_OF_WEEK_UNSPECIFIED": 32 | return DayOfWeek.DAY_OF_WEEK_UNSPECIFIED; 33 | case 1: 34 | case "MONDAY": 35 | return DayOfWeek.MONDAY; 36 | case 2: 37 | case "TUESDAY": 38 | return DayOfWeek.TUESDAY; 39 | case 3: 40 | case "WEDNESDAY": 41 | return DayOfWeek.WEDNESDAY; 42 | case 4: 43 | case "THURSDAY": 44 | return DayOfWeek.THURSDAY; 45 | case 5: 46 | case "FRIDAY": 47 | return DayOfWeek.FRIDAY; 48 | case 6: 49 | case "SATURDAY": 50 | return DayOfWeek.SATURDAY; 51 | case 7: 52 | case "SUNDAY": 53 | return DayOfWeek.SUNDAY; 54 | case -1: 55 | case "UNRECOGNIZED": 56 | default: 57 | return DayOfWeek.UNRECOGNIZED; 58 | } 59 | } 60 | 61 | export function dayOfWeekToJSON(object: DayOfWeek): string { 62 | switch (object) { 63 | case DayOfWeek.DAY_OF_WEEK_UNSPECIFIED: 64 | return "DAY_OF_WEEK_UNSPECIFIED"; 65 | case DayOfWeek.MONDAY: 66 | return "MONDAY"; 67 | case DayOfWeek.TUESDAY: 68 | return "TUESDAY"; 69 | case DayOfWeek.WEDNESDAY: 70 | return "WEDNESDAY"; 71 | case DayOfWeek.THURSDAY: 72 | return "THURSDAY"; 73 | case DayOfWeek.FRIDAY: 74 | return "FRIDAY"; 75 | case DayOfWeek.SATURDAY: 76 | return "SATURDAY"; 77 | case DayOfWeek.SUNDAY: 78 | return "SUNDAY"; 79 | default: 80 | return "UNKNOWN"; 81 | } 82 | } 83 | 84 | if (_m0.util.Long !== Long) { 85 | _m0.util.Long = Long as any; 86 | _m0.configure(); 87 | } 88 | -------------------------------------------------------------------------------- /src/generated/google/type/timeofday.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "google.type"; 7 | 8 | /** 9 | * Represents a time of day. The date and time zone are either not significant 10 | * or are specified elsewhere. An API may choose to allow leap seconds. Related 11 | * types are [google.type.Date](https://github.com/googleapis/googleapis/blob/master/google/type/date.proto) and [google.protobuf.Timestamp](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto). 12 | */ 13 | export interface TimeOfDay { 14 | $type: "google.type.TimeOfDay"; 15 | /** 16 | * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose 17 | * to allow the value "24:00:00" for scenarios like business closing time. 18 | */ 19 | hours: number; 20 | /** Minutes of hour of day. Must be from 0 to 59. */ 21 | minutes: number; 22 | /** 23 | * Seconds of minutes of the time. Must normally be from 0 to 59. An API may 24 | * allow the value 60 if it allows leap-seconds. 25 | */ 26 | seconds: number; 27 | /** Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. */ 28 | nanos: number; 29 | } 30 | 31 | const baseTimeOfDay: object = { 32 | $type: "google.type.TimeOfDay", 33 | hours: 0, 34 | minutes: 0, 35 | seconds: 0, 36 | nanos: 0, 37 | }; 38 | 39 | export const TimeOfDay = { 40 | $type: "google.type.TimeOfDay" as const, 41 | 42 | encode( 43 | message: TimeOfDay, 44 | writer: _m0.Writer = _m0.Writer.create() 45 | ): _m0.Writer { 46 | if (message.hours !== 0) { 47 | writer.uint32(8).int32(message.hours); 48 | } 49 | if (message.minutes !== 0) { 50 | writer.uint32(16).int32(message.minutes); 51 | } 52 | if (message.seconds !== 0) { 53 | writer.uint32(24).int32(message.seconds); 54 | } 55 | if (message.nanos !== 0) { 56 | writer.uint32(32).int32(message.nanos); 57 | } 58 | return writer; 59 | }, 60 | 61 | decode(input: _m0.Reader | Uint8Array, length?: number): TimeOfDay { 62 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 63 | let end = length === undefined ? reader.len : reader.pos + length; 64 | const message = { ...baseTimeOfDay } as TimeOfDay; 65 | while (reader.pos < end) { 66 | const tag = reader.uint32(); 67 | switch (tag >>> 3) { 68 | case 1: 69 | message.hours = reader.int32(); 70 | break; 71 | case 2: 72 | message.minutes = reader.int32(); 73 | break; 74 | case 3: 75 | message.seconds = reader.int32(); 76 | break; 77 | case 4: 78 | message.nanos = reader.int32(); 79 | break; 80 | default: 81 | reader.skipType(tag & 7); 82 | break; 83 | } 84 | } 85 | return message; 86 | }, 87 | 88 | fromJSON(object: any): TimeOfDay { 89 | const message = { ...baseTimeOfDay } as TimeOfDay; 90 | message.hours = 91 | object.hours !== undefined && object.hours !== null 92 | ? Number(object.hours) 93 | : 0; 94 | message.minutes = 95 | object.minutes !== undefined && object.minutes !== null 96 | ? Number(object.minutes) 97 | : 0; 98 | message.seconds = 99 | object.seconds !== undefined && object.seconds !== null 100 | ? Number(object.seconds) 101 | : 0; 102 | message.nanos = 103 | object.nanos !== undefined && object.nanos !== null 104 | ? Number(object.nanos) 105 | : 0; 106 | return message; 107 | }, 108 | 109 | toJSON(message: TimeOfDay): unknown { 110 | const obj: any = {}; 111 | message.hours !== undefined && (obj.hours = Math.round(message.hours)); 112 | message.minutes !== undefined && 113 | (obj.minutes = Math.round(message.minutes)); 114 | message.seconds !== undefined && 115 | (obj.seconds = Math.round(message.seconds)); 116 | message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); 117 | return obj; 118 | }, 119 | 120 | fromPartial, I>>( 121 | object: I 122 | ): TimeOfDay { 123 | const message = { ...baseTimeOfDay } as TimeOfDay; 124 | message.hours = object.hours ?? 0; 125 | message.minutes = object.minutes ?? 0; 126 | message.seconds = object.seconds ?? 0; 127 | message.nanos = object.nanos ?? 0; 128 | return message; 129 | }, 130 | }; 131 | 132 | messageTypeRegistry.set(TimeOfDay.$type, TimeOfDay); 133 | 134 | type Builtin = 135 | | Date 136 | | Function 137 | | Uint8Array 138 | | string 139 | | number 140 | | boolean 141 | | undefined; 142 | 143 | export type DeepPartial = T extends Builtin 144 | ? T 145 | : T extends Array 146 | ? Array> 147 | : T extends ReadonlyArray 148 | ? ReadonlyArray> 149 | : T extends {} 150 | ? { [K in Exclude]?: DeepPartial } 151 | : Partial; 152 | 153 | type KeysOfUnion = T extends T ? keyof T : never; 154 | export type Exact = P extends Builtin 155 | ? P 156 | : P & { [K in keyof P]: Exact } & Record< 157 | Exclude | "$type">, 158 | never 159 | >; 160 | 161 | if (_m0.util.Long !== Long) { 162 | _m0.util.Long = Long as any; 163 | _m0.configure(); 164 | } 165 | -------------------------------------------------------------------------------- /src/generated/typeRegistry.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import _m0 from "protobufjs/minimal"; 3 | 4 | export interface MessageType { 5 | $type: Message["$type"]; 6 | encode(message: Message, writer?: _m0.Writer): _m0.Writer; 7 | decode(input: _m0.Reader | Uint8Array, length?: number): Message; 8 | fromJSON(object: any): Message; 9 | toJSON(message: Message): unknown; 10 | fromPartial(object: DeepPartial): Message; 11 | } 12 | 13 | export type UnknownMessage = { $type: string }; 14 | 15 | export const messageTypeRegistry = new Map(); 16 | 17 | type Builtin = 18 | | Date 19 | | Function 20 | | Uint8Array 21 | | string 22 | | number 23 | | boolean 24 | | undefined; 25 | export type DeepPartial = T extends Builtin 26 | ? T 27 | : T extends Array 28 | ? Array> 29 | : T extends ReadonlyArray 30 | ? ReadonlyArray> 31 | : T extends {} 32 | ? { [K in Exclude]?: DeepPartial } 33 | : Partial; 34 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/access/index.ts: -------------------------------------------------------------------------------- 1 | export * as access from './access' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ai/index.ts: -------------------------------------------------------------------------------- 1 | export * as ocr from './ocr/v1/ocr' 2 | export * as ocr_service from './ocr/v1/ocr_service' 3 | export * as stt_service from './stt/v2/stt_service' 4 | export * as translate_translation from './translate/v2/translation' 5 | export * as translate_translation_service from './translate/v2/translation_service' 6 | export * as tts from './tts/v3/tts' 7 | export * as tts_service from './tts/v3/tts_service' 8 | export * as vision_classification from './vision/v1/classification' 9 | export * as vision_face_detection from './vision/v1/face_detection' 10 | export * as vision_image_copy_search from './vision/v1/image_copy_search' 11 | export * as vision_primitives from './vision/v1/primitives' 12 | export * as vision_text_detection from './vision/v1/text_detection' 13 | export * as vision_service from './vision/v1/vision_service' 14 | export * as vision_image from './vision/v2/image' 15 | export * as vision_image_classifier from './vision/v2/image_classifier' 16 | export * as vision_image_classifier_service from './vision/v2/image_classifier_service' 17 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ai/tts/v3/tts_service.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import Long from "long"; 3 | import { 4 | makeGenericClientConstructor, 5 | ChannelCredentials, 6 | ChannelOptions, 7 | UntypedServiceImplementation, 8 | handleServerStreamingCall, 9 | Client, 10 | CallOptions, 11 | ClientReadableStream, 12 | Metadata, 13 | } from "@grpc/grpc-js"; 14 | import _m0 from "protobufjs/minimal"; 15 | import { 16 | UtteranceSynthesisRequest, 17 | UtteranceSynthesisResponse, 18 | } from "../../../../../yandex/cloud/ai/tts/v3/tts"; 19 | 20 | export const protobufPackage = "speechkit.tts.v3"; 21 | 22 | /** A set of methods for voice synthesis. */ 23 | export const SynthesizerService = { 24 | /** Synthesizing text into speech. */ 25 | utteranceSynthesis: { 26 | path: "/speechkit.tts.v3.Synthesizer/UtteranceSynthesis", 27 | requestStream: false, 28 | responseStream: true, 29 | requestSerialize: (value: UtteranceSynthesisRequest) => 30 | Buffer.from(UtteranceSynthesisRequest.encode(value).finish()), 31 | requestDeserialize: (value: Buffer) => 32 | UtteranceSynthesisRequest.decode(value), 33 | responseSerialize: (value: UtteranceSynthesisResponse) => 34 | Buffer.from(UtteranceSynthesisResponse.encode(value).finish()), 35 | responseDeserialize: (value: Buffer) => 36 | UtteranceSynthesisResponse.decode(value), 37 | }, 38 | } as const; 39 | 40 | export interface SynthesizerServer extends UntypedServiceImplementation { 41 | /** Synthesizing text into speech. */ 42 | utteranceSynthesis: handleServerStreamingCall< 43 | UtteranceSynthesisRequest, 44 | UtteranceSynthesisResponse 45 | >; 46 | } 47 | 48 | export interface SynthesizerClient extends Client { 49 | /** Synthesizing text into speech. */ 50 | utteranceSynthesis( 51 | request: UtteranceSynthesisRequest, 52 | options?: Partial 53 | ): ClientReadableStream; 54 | utteranceSynthesis( 55 | request: UtteranceSynthesisRequest, 56 | metadata?: Metadata, 57 | options?: Partial 58 | ): ClientReadableStream; 59 | } 60 | 61 | export const SynthesizerClient = makeGenericClientConstructor( 62 | SynthesizerService, 63 | "speechkit.tts.v3.Synthesizer" 64 | ) as unknown as { 65 | new ( 66 | address: string, 67 | credentials: ChannelCredentials, 68 | options?: Partial 69 | ): SynthesizerClient; 70 | service: typeof SynthesizerService; 71 | }; 72 | 73 | if (_m0.util.Long !== Long) { 74 | _m0.util.Long = Long as any; 75 | _m0.configure(); 76 | } 77 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ai/vision/v1/face_detection.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | import { Polygon } from "../../../../../yandex/cloud/ai/vision/v1/primitives"; 6 | 7 | export const protobufPackage = "yandex.cloud.ai.vision.v1"; 8 | 9 | export interface FaceAnnotation { 10 | $type: "yandex.cloud.ai.vision.v1.FaceAnnotation"; 11 | /** An array of detected faces for the specified image. */ 12 | faces: Face[]; 13 | } 14 | 15 | export interface Face { 16 | $type: "yandex.cloud.ai.vision.v1.Face"; 17 | /** Area on the image where the face is located. */ 18 | boundingBox?: Polygon; 19 | } 20 | 21 | const baseFaceAnnotation: object = { 22 | $type: "yandex.cloud.ai.vision.v1.FaceAnnotation", 23 | }; 24 | 25 | export const FaceAnnotation = { 26 | $type: "yandex.cloud.ai.vision.v1.FaceAnnotation" as const, 27 | 28 | encode( 29 | message: FaceAnnotation, 30 | writer: _m0.Writer = _m0.Writer.create() 31 | ): _m0.Writer { 32 | for (const v of message.faces) { 33 | Face.encode(v!, writer.uint32(10).fork()).ldelim(); 34 | } 35 | return writer; 36 | }, 37 | 38 | decode(input: _m0.Reader | Uint8Array, length?: number): FaceAnnotation { 39 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 40 | let end = length === undefined ? reader.len : reader.pos + length; 41 | const message = { ...baseFaceAnnotation } as FaceAnnotation; 42 | message.faces = []; 43 | while (reader.pos < end) { 44 | const tag = reader.uint32(); 45 | switch (tag >>> 3) { 46 | case 1: 47 | message.faces.push(Face.decode(reader, reader.uint32())); 48 | break; 49 | default: 50 | reader.skipType(tag & 7); 51 | break; 52 | } 53 | } 54 | return message; 55 | }, 56 | 57 | fromJSON(object: any): FaceAnnotation { 58 | const message = { ...baseFaceAnnotation } as FaceAnnotation; 59 | message.faces = (object.faces ?? []).map((e: any) => Face.fromJSON(e)); 60 | return message; 61 | }, 62 | 63 | toJSON(message: FaceAnnotation): unknown { 64 | const obj: any = {}; 65 | if (message.faces) { 66 | obj.faces = message.faces.map((e) => (e ? Face.toJSON(e) : undefined)); 67 | } else { 68 | obj.faces = []; 69 | } 70 | return obj; 71 | }, 72 | 73 | fromPartial, I>>( 74 | object: I 75 | ): FaceAnnotation { 76 | const message = { ...baseFaceAnnotation } as FaceAnnotation; 77 | message.faces = object.faces?.map((e) => Face.fromPartial(e)) || []; 78 | return message; 79 | }, 80 | }; 81 | 82 | messageTypeRegistry.set(FaceAnnotation.$type, FaceAnnotation); 83 | 84 | const baseFace: object = { $type: "yandex.cloud.ai.vision.v1.Face" }; 85 | 86 | export const Face = { 87 | $type: "yandex.cloud.ai.vision.v1.Face" as const, 88 | 89 | encode(message: Face, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { 90 | if (message.boundingBox !== undefined) { 91 | Polygon.encode(message.boundingBox, writer.uint32(10).fork()).ldelim(); 92 | } 93 | return writer; 94 | }, 95 | 96 | decode(input: _m0.Reader | Uint8Array, length?: number): Face { 97 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 98 | let end = length === undefined ? reader.len : reader.pos + length; 99 | const message = { ...baseFace } as Face; 100 | while (reader.pos < end) { 101 | const tag = reader.uint32(); 102 | switch (tag >>> 3) { 103 | case 1: 104 | message.boundingBox = Polygon.decode(reader, reader.uint32()); 105 | break; 106 | default: 107 | reader.skipType(tag & 7); 108 | break; 109 | } 110 | } 111 | return message; 112 | }, 113 | 114 | fromJSON(object: any): Face { 115 | const message = { ...baseFace } as Face; 116 | message.boundingBox = 117 | object.boundingBox !== undefined && object.boundingBox !== null 118 | ? Polygon.fromJSON(object.boundingBox) 119 | : undefined; 120 | return message; 121 | }, 122 | 123 | toJSON(message: Face): unknown { 124 | const obj: any = {}; 125 | message.boundingBox !== undefined && 126 | (obj.boundingBox = message.boundingBox 127 | ? Polygon.toJSON(message.boundingBox) 128 | : undefined); 129 | return obj; 130 | }, 131 | 132 | fromPartial, I>>(object: I): Face { 133 | const message = { ...baseFace } as Face; 134 | message.boundingBox = 135 | object.boundingBox !== undefined && object.boundingBox !== null 136 | ? Polygon.fromPartial(object.boundingBox) 137 | : undefined; 138 | return message; 139 | }, 140 | }; 141 | 142 | messageTypeRegistry.set(Face.$type, Face); 143 | 144 | type Builtin = 145 | | Date 146 | | Function 147 | | Uint8Array 148 | | string 149 | | number 150 | | boolean 151 | | undefined; 152 | 153 | export type DeepPartial = T extends Builtin 154 | ? T 155 | : T extends Array 156 | ? Array> 157 | : T extends ReadonlyArray 158 | ? ReadonlyArray> 159 | : T extends {} 160 | ? { [K in Exclude]?: DeepPartial } 161 | : Partial; 162 | 163 | type KeysOfUnion = T extends T ? keyof T : never; 164 | export type Exact = P extends Builtin 165 | ? P 166 | : P & { [K in keyof P]: Exact } & Record< 167 | Exclude | "$type">, 168 | never 169 | >; 170 | 171 | if (_m0.util.Long !== Long) { 172 | _m0.util.Long = Long as any; 173 | _m0.configure(); 174 | } 175 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ai/vision/v2/image_classifier_service.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import Long from "long"; 3 | import { 4 | makeGenericClientConstructor, 5 | ChannelCredentials, 6 | ChannelOptions, 7 | UntypedServiceImplementation, 8 | handleUnaryCall, 9 | Client, 10 | ClientUnaryCall, 11 | Metadata, 12 | CallOptions, 13 | ServiceError, 14 | } from "@grpc/grpc-js"; 15 | import _m0 from "protobufjs/minimal"; 16 | import { 17 | AnnotationRequest, 18 | AnnotationResponse, 19 | } from "../../../../../yandex/cloud/ai/vision/v2/image_classifier"; 20 | 21 | export const protobufPackage = "yandex.cloud.ai.vision.v2"; 22 | 23 | export const ImageClassifierServiceService = { 24 | annotate: { 25 | path: "/yandex.cloud.ai.vision.v2.ImageClassifierService/Annotate", 26 | requestStream: false, 27 | responseStream: false, 28 | requestSerialize: (value: AnnotationRequest) => 29 | Buffer.from(AnnotationRequest.encode(value).finish()), 30 | requestDeserialize: (value: Buffer) => AnnotationRequest.decode(value), 31 | responseSerialize: (value: AnnotationResponse) => 32 | Buffer.from(AnnotationResponse.encode(value).finish()), 33 | responseDeserialize: (value: Buffer) => AnnotationResponse.decode(value), 34 | }, 35 | } as const; 36 | 37 | export interface ImageClassifierServiceServer 38 | extends UntypedServiceImplementation { 39 | annotate: handleUnaryCall; 40 | } 41 | 42 | export interface ImageClassifierServiceClient extends Client { 43 | annotate( 44 | request: AnnotationRequest, 45 | callback: (error: ServiceError | null, response: AnnotationResponse) => void 46 | ): ClientUnaryCall; 47 | annotate( 48 | request: AnnotationRequest, 49 | metadata: Metadata, 50 | callback: (error: ServiceError | null, response: AnnotationResponse) => void 51 | ): ClientUnaryCall; 52 | annotate( 53 | request: AnnotationRequest, 54 | metadata: Metadata, 55 | options: Partial, 56 | callback: (error: ServiceError | null, response: AnnotationResponse) => void 57 | ): ClientUnaryCall; 58 | } 59 | 60 | export const ImageClassifierServiceClient = makeGenericClientConstructor( 61 | ImageClassifierServiceService, 62 | "yandex.cloud.ai.vision.v2.ImageClassifierService" 63 | ) as unknown as { 64 | new ( 65 | address: string, 66 | credentials: ChannelCredentials, 67 | options?: Partial 68 | ): ImageClassifierServiceClient; 69 | service: typeof ImageClassifierServiceService; 70 | }; 71 | 72 | if (_m0.util.Long !== Long) { 73 | _m0.util.Long = Long as any; 74 | _m0.configure(); 75 | } 76 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/api/index.ts: -------------------------------------------------------------------------------- 1 | export * as operation from './operation' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/api/operation.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.api"; 7 | 8 | /** 9 | * Operation is annotation for rpc that returns longrunning operation, describes 10 | * message types that will be returned in metadata [google.protobuf.Any], and 11 | * in response [google.protobuf.Any] (for successful operation). 12 | */ 13 | export interface Operation { 14 | $type: "yandex.cloud.api.Operation"; 15 | /** 16 | * Optional. If present, rpc returns operation which metadata field will 17 | * contains message of specified type. 18 | */ 19 | metadata: string; 20 | /** 21 | * Required. rpc returns operation, in case of success response will contains message of 22 | * specified field. 23 | */ 24 | response: string; 25 | } 26 | 27 | const baseOperation: object = { 28 | $type: "yandex.cloud.api.Operation", 29 | metadata: "", 30 | response: "", 31 | }; 32 | 33 | export const Operation = { 34 | $type: "yandex.cloud.api.Operation" as const, 35 | 36 | encode( 37 | message: Operation, 38 | writer: _m0.Writer = _m0.Writer.create() 39 | ): _m0.Writer { 40 | if (message.metadata !== "") { 41 | writer.uint32(10).string(message.metadata); 42 | } 43 | if (message.response !== "") { 44 | writer.uint32(18).string(message.response); 45 | } 46 | return writer; 47 | }, 48 | 49 | decode(input: _m0.Reader | Uint8Array, length?: number): Operation { 50 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 51 | let end = length === undefined ? reader.len : reader.pos + length; 52 | const message = { ...baseOperation } as Operation; 53 | while (reader.pos < end) { 54 | const tag = reader.uint32(); 55 | switch (tag >>> 3) { 56 | case 1: 57 | message.metadata = reader.string(); 58 | break; 59 | case 2: 60 | message.response = reader.string(); 61 | break; 62 | default: 63 | reader.skipType(tag & 7); 64 | break; 65 | } 66 | } 67 | return message; 68 | }, 69 | 70 | fromJSON(object: any): Operation { 71 | const message = { ...baseOperation } as Operation; 72 | message.metadata = 73 | object.metadata !== undefined && object.metadata !== null 74 | ? String(object.metadata) 75 | : ""; 76 | message.response = 77 | object.response !== undefined && object.response !== null 78 | ? String(object.response) 79 | : ""; 80 | return message; 81 | }, 82 | 83 | toJSON(message: Operation): unknown { 84 | const obj: any = {}; 85 | message.metadata !== undefined && (obj.metadata = message.metadata); 86 | message.response !== undefined && (obj.response = message.response); 87 | return obj; 88 | }, 89 | 90 | fromPartial, I>>( 91 | object: I 92 | ): Operation { 93 | const message = { ...baseOperation } as Operation; 94 | message.metadata = object.metadata ?? ""; 95 | message.response = object.response ?? ""; 96 | return message; 97 | }, 98 | }; 99 | 100 | messageTypeRegistry.set(Operation.$type, Operation); 101 | 102 | type Builtin = 103 | | Date 104 | | Function 105 | | Uint8Array 106 | | string 107 | | number 108 | | boolean 109 | | undefined; 110 | 111 | export type DeepPartial = T extends Builtin 112 | ? T 113 | : T extends Array 114 | ? Array> 115 | : T extends ReadonlyArray 116 | ? ReadonlyArray> 117 | : T extends {} 118 | ? { [K in Exclude]?: DeepPartial } 119 | : Partial; 120 | 121 | type KeysOfUnion = T extends T ? keyof T : never; 122 | export type Exact = P extends Builtin 123 | ? P 124 | : P & { [K in keyof P]: Exact } & Record< 125 | Exclude | "$type">, 126 | never 127 | >; 128 | 129 | if (_m0.util.Long !== Long) { 130 | _m0.util.Long = Long as any; 131 | _m0.configure(); 132 | } 133 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/apploadbalancer/index.ts: -------------------------------------------------------------------------------- 1 | export * as backend_group from './v1/backend_group' 2 | export * as backend_group_service from './v1/backend_group_service' 3 | export * as http_router from './v1/http_router' 4 | export * as http_router_service from './v1/http_router_service' 5 | export * as load_balancer from './v1/load_balancer' 6 | export * as load_balancer_service from './v1/load_balancer_service' 7 | export * as logging from './v1/logging' 8 | export * as payload from './v1/payload' 9 | export * as target_group from './v1/target_group' 10 | export * as target_group_service from './v1/target_group_service' 11 | export * as tls from './v1/tls' 12 | export * as virtual_host from './v1/virtual_host' 13 | export * as virtual_host_service from './v1/virtual_host_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/apploadbalancer/v1/payload.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.apploadbalancer.v1"; 7 | 8 | /** A health check payload resource. */ 9 | export interface Payload { 10 | $type: "yandex.cloud.apploadbalancer.v1.Payload"; 11 | /** Payload text. */ 12 | text: string | undefined; 13 | } 14 | 15 | const basePayload: object = { 16 | $type: "yandex.cloud.apploadbalancer.v1.Payload", 17 | }; 18 | 19 | export const Payload = { 20 | $type: "yandex.cloud.apploadbalancer.v1.Payload" as const, 21 | 22 | encode( 23 | message: Payload, 24 | writer: _m0.Writer = _m0.Writer.create() 25 | ): _m0.Writer { 26 | if (message.text !== undefined) { 27 | writer.uint32(10).string(message.text); 28 | } 29 | return writer; 30 | }, 31 | 32 | decode(input: _m0.Reader | Uint8Array, length?: number): Payload { 33 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 34 | let end = length === undefined ? reader.len : reader.pos + length; 35 | const message = { ...basePayload } as Payload; 36 | while (reader.pos < end) { 37 | const tag = reader.uint32(); 38 | switch (tag >>> 3) { 39 | case 1: 40 | message.text = reader.string(); 41 | break; 42 | default: 43 | reader.skipType(tag & 7); 44 | break; 45 | } 46 | } 47 | return message; 48 | }, 49 | 50 | fromJSON(object: any): Payload { 51 | const message = { ...basePayload } as Payload; 52 | message.text = 53 | object.text !== undefined && object.text !== null 54 | ? String(object.text) 55 | : undefined; 56 | return message; 57 | }, 58 | 59 | toJSON(message: Payload): unknown { 60 | const obj: any = {}; 61 | message.text !== undefined && (obj.text = message.text); 62 | return obj; 63 | }, 64 | 65 | fromPartial, I>>(object: I): Payload { 66 | const message = { ...basePayload } as Payload; 67 | message.text = object.text ?? undefined; 68 | return message; 69 | }, 70 | }; 71 | 72 | messageTypeRegistry.set(Payload.$type, Payload); 73 | 74 | type Builtin = 75 | | Date 76 | | Function 77 | | Uint8Array 78 | | string 79 | | number 80 | | boolean 81 | | undefined; 82 | 83 | export type DeepPartial = T extends Builtin 84 | ? T 85 | : T extends Array 86 | ? Array> 87 | : T extends ReadonlyArray 88 | ? ReadonlyArray> 89 | : T extends {} 90 | ? { [K in Exclude]?: DeepPartial } 91 | : Partial; 92 | 93 | type KeysOfUnion = T extends T ? keyof T : never; 94 | export type Exact = P extends Builtin 95 | ? P 96 | : P & { [K in keyof P]: Exact } & Record< 97 | Exclude | "$type">, 98 | never 99 | >; 100 | 101 | if (_m0.util.Long !== Long) { 102 | _m0.util.Long = Long as any; 103 | _m0.configure(); 104 | } 105 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/apploadbalancer/v1/tls.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.apploadbalancer.v1"; 7 | 8 | /** A TLS validation context resource. */ 9 | export interface ValidationContext { 10 | $type: "yandex.cloud.apploadbalancer.v1.ValidationContext"; 11 | trustedCaId: string | undefined; 12 | /** X.509 certificate contents in PEM format. */ 13 | trustedCaBytes: string | undefined; 14 | } 15 | 16 | const baseValidationContext: object = { 17 | $type: "yandex.cloud.apploadbalancer.v1.ValidationContext", 18 | }; 19 | 20 | export const ValidationContext = { 21 | $type: "yandex.cloud.apploadbalancer.v1.ValidationContext" as const, 22 | 23 | encode( 24 | message: ValidationContext, 25 | writer: _m0.Writer = _m0.Writer.create() 26 | ): _m0.Writer { 27 | if (message.trustedCaId !== undefined) { 28 | writer.uint32(10).string(message.trustedCaId); 29 | } 30 | if (message.trustedCaBytes !== undefined) { 31 | writer.uint32(18).string(message.trustedCaBytes); 32 | } 33 | return writer; 34 | }, 35 | 36 | decode(input: _m0.Reader | Uint8Array, length?: number): ValidationContext { 37 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 38 | let end = length === undefined ? reader.len : reader.pos + length; 39 | const message = { ...baseValidationContext } as ValidationContext; 40 | while (reader.pos < end) { 41 | const tag = reader.uint32(); 42 | switch (tag >>> 3) { 43 | case 1: 44 | message.trustedCaId = reader.string(); 45 | break; 46 | case 2: 47 | message.trustedCaBytes = reader.string(); 48 | break; 49 | default: 50 | reader.skipType(tag & 7); 51 | break; 52 | } 53 | } 54 | return message; 55 | }, 56 | 57 | fromJSON(object: any): ValidationContext { 58 | const message = { ...baseValidationContext } as ValidationContext; 59 | message.trustedCaId = 60 | object.trustedCaId !== undefined && object.trustedCaId !== null 61 | ? String(object.trustedCaId) 62 | : undefined; 63 | message.trustedCaBytes = 64 | object.trustedCaBytes !== undefined && object.trustedCaBytes !== null 65 | ? String(object.trustedCaBytes) 66 | : undefined; 67 | return message; 68 | }, 69 | 70 | toJSON(message: ValidationContext): unknown { 71 | const obj: any = {}; 72 | message.trustedCaId !== undefined && 73 | (obj.trustedCaId = message.trustedCaId); 74 | message.trustedCaBytes !== undefined && 75 | (obj.trustedCaBytes = message.trustedCaBytes); 76 | return obj; 77 | }, 78 | 79 | fromPartial, I>>( 80 | object: I 81 | ): ValidationContext { 82 | const message = { ...baseValidationContext } as ValidationContext; 83 | message.trustedCaId = object.trustedCaId ?? undefined; 84 | message.trustedCaBytes = object.trustedCaBytes ?? undefined; 85 | return message; 86 | }, 87 | }; 88 | 89 | messageTypeRegistry.set(ValidationContext.$type, ValidationContext); 90 | 91 | type Builtin = 92 | | Date 93 | | Function 94 | | Uint8Array 95 | | string 96 | | number 97 | | boolean 98 | | undefined; 99 | 100 | export type DeepPartial = T extends Builtin 101 | ? T 102 | : T extends Array 103 | ? Array> 104 | : T extends ReadonlyArray 105 | ? ReadonlyArray> 106 | : T extends {} 107 | ? { [K in Exclude]?: DeepPartial } 108 | : Partial; 109 | 110 | type KeysOfUnion = T extends T ? keyof T : never; 111 | export type Exact = P extends Builtin 112 | ? P 113 | : P & { [K in keyof P]: Exact } & Record< 114 | Exclude | "$type">, 115 | never 116 | >; 117 | 118 | if (_m0.util.Long !== Long) { 119 | _m0.util.Long = Long as any; 120 | _m0.configure(); 121 | } 122 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/backup/index.ts: -------------------------------------------------------------------------------- 1 | export * as backup from './v1/backup' 2 | export * as backup_service from './v1/backup_service' 3 | export * as policy from './v1/policy' 4 | export * as policy_service from './v1/policy_service' 5 | export * as provider_service from './v1/provider_service' 6 | export * as resource from './v1/resource' 7 | export * as resource_service from './v1/resource_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/billing/index.ts: -------------------------------------------------------------------------------- 1 | export * as billable_object from './v1/billable_object' 2 | export * as billing_account from './v1/billing_account' 3 | export * as billing_account_service from './v1/billing_account_service' 4 | export * as budget from './v1/budget' 5 | export * as budget_service from './v1/budget_service' 6 | export * as customer from './v1/customer' 7 | export * as customer_service from './v1/customer_service' 8 | export * as service from './v1/service' 9 | export * as service_service from './v1/service_service' 10 | export * as sku from './v1/sku' 11 | export * as sku_service from './v1/sku_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/billing/v1/service.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.billing.v1"; 7 | 8 | /** A Service resource. */ 9 | export interface Service { 10 | $type: "yandex.cloud.billing.v1.Service"; 11 | /** ID of the service. */ 12 | id: string; 13 | /** Name of the service, e.g. `Compute Cloud`, `VPC`. */ 14 | name: string; 15 | /** Description of the service. */ 16 | description: string; 17 | } 18 | 19 | const baseService: object = { 20 | $type: "yandex.cloud.billing.v1.Service", 21 | id: "", 22 | name: "", 23 | description: "", 24 | }; 25 | 26 | export const Service = { 27 | $type: "yandex.cloud.billing.v1.Service" as const, 28 | 29 | encode( 30 | message: Service, 31 | writer: _m0.Writer = _m0.Writer.create() 32 | ): _m0.Writer { 33 | if (message.id !== "") { 34 | writer.uint32(10).string(message.id); 35 | } 36 | if (message.name !== "") { 37 | writer.uint32(18).string(message.name); 38 | } 39 | if (message.description !== "") { 40 | writer.uint32(26).string(message.description); 41 | } 42 | return writer; 43 | }, 44 | 45 | decode(input: _m0.Reader | Uint8Array, length?: number): Service { 46 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 47 | let end = length === undefined ? reader.len : reader.pos + length; 48 | const message = { ...baseService } as Service; 49 | while (reader.pos < end) { 50 | const tag = reader.uint32(); 51 | switch (tag >>> 3) { 52 | case 1: 53 | message.id = reader.string(); 54 | break; 55 | case 2: 56 | message.name = reader.string(); 57 | break; 58 | case 3: 59 | message.description = reader.string(); 60 | break; 61 | default: 62 | reader.skipType(tag & 7); 63 | break; 64 | } 65 | } 66 | return message; 67 | }, 68 | 69 | fromJSON(object: any): Service { 70 | const message = { ...baseService } as Service; 71 | message.id = 72 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 73 | message.name = 74 | object.name !== undefined && object.name !== null 75 | ? String(object.name) 76 | : ""; 77 | message.description = 78 | object.description !== undefined && object.description !== null 79 | ? String(object.description) 80 | : ""; 81 | return message; 82 | }, 83 | 84 | toJSON(message: Service): unknown { 85 | const obj: any = {}; 86 | message.id !== undefined && (obj.id = message.id); 87 | message.name !== undefined && (obj.name = message.name); 88 | message.description !== undefined && 89 | (obj.description = message.description); 90 | return obj; 91 | }, 92 | 93 | fromPartial, I>>(object: I): Service { 94 | const message = { ...baseService } as Service; 95 | message.id = object.id ?? ""; 96 | message.name = object.name ?? ""; 97 | message.description = object.description ?? ""; 98 | return message; 99 | }, 100 | }; 101 | 102 | messageTypeRegistry.set(Service.$type, Service); 103 | 104 | type Builtin = 105 | | Date 106 | | Function 107 | | Uint8Array 108 | | string 109 | | number 110 | | boolean 111 | | undefined; 112 | 113 | export type DeepPartial = T extends Builtin 114 | ? T 115 | : T extends Array 116 | ? Array> 117 | : T extends ReadonlyArray 118 | ? ReadonlyArray> 119 | : T extends {} 120 | ? { [K in Exclude]?: DeepPartial } 121 | : Partial; 122 | 123 | type KeysOfUnion = T extends T ? keyof T : never; 124 | export type Exact = P extends Builtin 125 | ? P 126 | : P & { [K in keyof P]: Exact } & Record< 127 | Exclude | "$type">, 128 | never 129 | >; 130 | 131 | if (_m0.util.Long !== Long) { 132 | _m0.util.Long = Long as any; 133 | _m0.configure(); 134 | } 135 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/cdn/index.ts: -------------------------------------------------------------------------------- 1 | export * as cache_service from './v1/cache_service' 2 | export * as origin from './v1/origin' 3 | export * as origin_group from './v1/origin_group' 4 | export * as origin_group_service from './v1/origin_group_service' 5 | export * as origin_service from './v1/origin_service' 6 | export * as provider_service from './v1/provider_service' 7 | export * as raw_logs from './v1/raw_logs' 8 | export * as raw_logs_service from './v1/raw_logs_service' 9 | export * as resource from './v1/resource' 10 | export * as resource_service from './v1/resource_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/certificatemanager/index.ts: -------------------------------------------------------------------------------- 1 | export * as certificate from './v1/certificate' 2 | export * as certificate_content_service from './v1/certificate_content_service' 3 | export * as certificate_service from './v1/certificate_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/compute/index.ts: -------------------------------------------------------------------------------- 1 | export * as disk from './v1/disk' 2 | export * as disk_placement_group from './v1/disk_placement_group' 3 | export * as disk_placement_group_service from './v1/disk_placement_group_service' 4 | export * as disk_service from './v1/disk_service' 5 | export * as disk_type from './v1/disk_type' 6 | export * as disk_type_service from './v1/disk_type_service' 7 | export * as filesystem from './v1/filesystem' 8 | export * as filesystem_service from './v1/filesystem_service' 9 | export * as gpu_cluster from './v1/gpu_cluster' 10 | export * as gpu_cluster_service from './v1/gpu_cluster_service' 11 | export * as host_group from './v1/host_group' 12 | export * as host_group_service from './v1/host_group_service' 13 | export * as host_type from './v1/host_type' 14 | export * as host_type_service from './v1/host_type_service' 15 | export * as image from './v1/image' 16 | export * as image_service from './v1/image_service' 17 | export * as instance from './v1/instance' 18 | export * as instance_service from './v1/instance_service' 19 | export * as placement_group from './v1/placement_group' 20 | export * as placement_group_service from './v1/placement_group_service' 21 | export * as snapshot from './v1/snapshot' 22 | export * as snapshot_schedule from './v1/snapshot_schedule' 23 | export * as snapshot_schedule_service from './v1/snapshot_schedule_service' 24 | export * as snapshot_service from './v1/snapshot_service' 25 | export * as zone from './v1/zone' 26 | export * as zone_service from './v1/zone_service' 27 | export * as instance_group from './v1/instancegroup/instance_group' 28 | export * as instance_group_service from './v1/instancegroup/instance_group_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/compute/v1/disk_type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.compute.v1"; 7 | 8 | export interface DiskType { 9 | $type: "yandex.cloud.compute.v1.DiskType"; 10 | /** ID of the disk type. */ 11 | id: string; 12 | /** Description of the disk type. 0-256 characters long. */ 13 | description: string; 14 | /** Array of availability zones where the disk type is available. */ 15 | zoneIds: string[]; 16 | } 17 | 18 | const baseDiskType: object = { 19 | $type: "yandex.cloud.compute.v1.DiskType", 20 | id: "", 21 | description: "", 22 | zoneIds: "", 23 | }; 24 | 25 | export const DiskType = { 26 | $type: "yandex.cloud.compute.v1.DiskType" as const, 27 | 28 | encode( 29 | message: DiskType, 30 | writer: _m0.Writer = _m0.Writer.create() 31 | ): _m0.Writer { 32 | if (message.id !== "") { 33 | writer.uint32(10).string(message.id); 34 | } 35 | if (message.description !== "") { 36 | writer.uint32(18).string(message.description); 37 | } 38 | for (const v of message.zoneIds) { 39 | writer.uint32(26).string(v!); 40 | } 41 | return writer; 42 | }, 43 | 44 | decode(input: _m0.Reader | Uint8Array, length?: number): DiskType { 45 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 46 | let end = length === undefined ? reader.len : reader.pos + length; 47 | const message = { ...baseDiskType } as DiskType; 48 | message.zoneIds = []; 49 | while (reader.pos < end) { 50 | const tag = reader.uint32(); 51 | switch (tag >>> 3) { 52 | case 1: 53 | message.id = reader.string(); 54 | break; 55 | case 2: 56 | message.description = reader.string(); 57 | break; 58 | case 3: 59 | message.zoneIds.push(reader.string()); 60 | break; 61 | default: 62 | reader.skipType(tag & 7); 63 | break; 64 | } 65 | } 66 | return message; 67 | }, 68 | 69 | fromJSON(object: any): DiskType { 70 | const message = { ...baseDiskType } as DiskType; 71 | message.id = 72 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 73 | message.description = 74 | object.description !== undefined && object.description !== null 75 | ? String(object.description) 76 | : ""; 77 | message.zoneIds = (object.zoneIds ?? []).map((e: any) => String(e)); 78 | return message; 79 | }, 80 | 81 | toJSON(message: DiskType): unknown { 82 | const obj: any = {}; 83 | message.id !== undefined && (obj.id = message.id); 84 | message.description !== undefined && 85 | (obj.description = message.description); 86 | if (message.zoneIds) { 87 | obj.zoneIds = message.zoneIds.map((e) => e); 88 | } else { 89 | obj.zoneIds = []; 90 | } 91 | return obj; 92 | }, 93 | 94 | fromPartial, I>>(object: I): DiskType { 95 | const message = { ...baseDiskType } as DiskType; 96 | message.id = object.id ?? ""; 97 | message.description = object.description ?? ""; 98 | message.zoneIds = object.zoneIds?.map((e) => e) || []; 99 | return message; 100 | }, 101 | }; 102 | 103 | messageTypeRegistry.set(DiskType.$type, DiskType); 104 | 105 | type Builtin = 106 | | Date 107 | | Function 108 | | Uint8Array 109 | | string 110 | | number 111 | | boolean 112 | | undefined; 113 | 114 | export type DeepPartial = T extends Builtin 115 | ? T 116 | : T extends Array 117 | ? Array> 118 | : T extends ReadonlyArray 119 | ? ReadonlyArray> 120 | : T extends {} 121 | ? { [K in Exclude]?: DeepPartial } 122 | : Partial; 123 | 124 | type KeysOfUnion = T extends T ? keyof T : never; 125 | export type Exact = P extends Builtin 126 | ? P 127 | : P & { [K in keyof P]: Exact } & Record< 128 | Exclude | "$type">, 129 | never 130 | >; 131 | 132 | if (_m0.util.Long !== Long) { 133 | _m0.util.Long = Long as any; 134 | _m0.configure(); 135 | } 136 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/compute/v1/zone.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.compute.v1"; 7 | 8 | /** Availability zone. For more information, see [Availability zones](/docs/overview/concepts/geo-scope). */ 9 | export interface Zone { 10 | $type: "yandex.cloud.compute.v1.Zone"; 11 | /** ID of the zone. */ 12 | id: string; 13 | /** ID of the region. */ 14 | regionId: string; 15 | /** Status of the zone. */ 16 | status: Zone_Status; 17 | } 18 | 19 | export enum Zone_Status { 20 | STATUS_UNSPECIFIED = 0, 21 | /** UP - Zone is available. You can access the resources allocated in this zone. */ 22 | UP = 1, 23 | /** DOWN - Zone is not available. */ 24 | DOWN = 2, 25 | UNRECOGNIZED = -1, 26 | } 27 | 28 | export function zone_StatusFromJSON(object: any): Zone_Status { 29 | switch (object) { 30 | case 0: 31 | case "STATUS_UNSPECIFIED": 32 | return Zone_Status.STATUS_UNSPECIFIED; 33 | case 1: 34 | case "UP": 35 | return Zone_Status.UP; 36 | case 2: 37 | case "DOWN": 38 | return Zone_Status.DOWN; 39 | case -1: 40 | case "UNRECOGNIZED": 41 | default: 42 | return Zone_Status.UNRECOGNIZED; 43 | } 44 | } 45 | 46 | export function zone_StatusToJSON(object: Zone_Status): string { 47 | switch (object) { 48 | case Zone_Status.STATUS_UNSPECIFIED: 49 | return "STATUS_UNSPECIFIED"; 50 | case Zone_Status.UP: 51 | return "UP"; 52 | case Zone_Status.DOWN: 53 | return "DOWN"; 54 | default: 55 | return "UNKNOWN"; 56 | } 57 | } 58 | 59 | const baseZone: object = { 60 | $type: "yandex.cloud.compute.v1.Zone", 61 | id: "", 62 | regionId: "", 63 | status: 0, 64 | }; 65 | 66 | export const Zone = { 67 | $type: "yandex.cloud.compute.v1.Zone" as const, 68 | 69 | encode(message: Zone, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { 70 | if (message.id !== "") { 71 | writer.uint32(10).string(message.id); 72 | } 73 | if (message.regionId !== "") { 74 | writer.uint32(18).string(message.regionId); 75 | } 76 | if (message.status !== 0) { 77 | writer.uint32(24).int32(message.status); 78 | } 79 | return writer; 80 | }, 81 | 82 | decode(input: _m0.Reader | Uint8Array, length?: number): Zone { 83 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 84 | let end = length === undefined ? reader.len : reader.pos + length; 85 | const message = { ...baseZone } as Zone; 86 | while (reader.pos < end) { 87 | const tag = reader.uint32(); 88 | switch (tag >>> 3) { 89 | case 1: 90 | message.id = reader.string(); 91 | break; 92 | case 2: 93 | message.regionId = reader.string(); 94 | break; 95 | case 3: 96 | message.status = reader.int32() as any; 97 | break; 98 | default: 99 | reader.skipType(tag & 7); 100 | break; 101 | } 102 | } 103 | return message; 104 | }, 105 | 106 | fromJSON(object: any): Zone { 107 | const message = { ...baseZone } as Zone; 108 | message.id = 109 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 110 | message.regionId = 111 | object.regionId !== undefined && object.regionId !== null 112 | ? String(object.regionId) 113 | : ""; 114 | message.status = 115 | object.status !== undefined && object.status !== null 116 | ? zone_StatusFromJSON(object.status) 117 | : 0; 118 | return message; 119 | }, 120 | 121 | toJSON(message: Zone): unknown { 122 | const obj: any = {}; 123 | message.id !== undefined && (obj.id = message.id); 124 | message.regionId !== undefined && (obj.regionId = message.regionId); 125 | message.status !== undefined && 126 | (obj.status = zone_StatusToJSON(message.status)); 127 | return obj; 128 | }, 129 | 130 | fromPartial, I>>(object: I): Zone { 131 | const message = { ...baseZone } as Zone; 132 | message.id = object.id ?? ""; 133 | message.regionId = object.regionId ?? ""; 134 | message.status = object.status ?? 0; 135 | return message; 136 | }, 137 | }; 138 | 139 | messageTypeRegistry.set(Zone.$type, Zone); 140 | 141 | type Builtin = 142 | | Date 143 | | Function 144 | | Uint8Array 145 | | string 146 | | number 147 | | boolean 148 | | undefined; 149 | 150 | export type DeepPartial = T extends Builtin 151 | ? T 152 | : T extends Array 153 | ? Array> 154 | : T extends ReadonlyArray 155 | ? ReadonlyArray> 156 | : T extends {} 157 | ? { [K in Exclude]?: DeepPartial } 158 | : Partial; 159 | 160 | type KeysOfUnion = T extends T ? keyof T : never; 161 | export type Exact = P extends Builtin 162 | ? P 163 | : P & { [K in keyof P]: Exact } & Record< 164 | Exclude | "$type">, 165 | never 166 | >; 167 | 168 | if (_m0.util.Long !== Long) { 169 | _m0.util.Long = Long as any; 170 | _m0.configure(); 171 | } 172 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/containerregistry/index.ts: -------------------------------------------------------------------------------- 1 | export * as blob from './v1/blob' 2 | export * as image from './v1/image' 3 | export * as image_service from './v1/image_service' 4 | export * as ip_permission from './v1/ip_permission' 5 | export * as lifecycle_policy from './v1/lifecycle_policy' 6 | export * as lifecycle_policy_service from './v1/lifecycle_policy_service' 7 | export * as registry from './v1/registry' 8 | export * as registry_service from './v1/registry_service' 9 | export * as repository from './v1/repository' 10 | export * as repository_service from './v1/repository_service' 11 | export * as scan_policy from './v1/scan_policy' 12 | export * as scan_policy_service from './v1/scan_policy_service' 13 | export * as scanner from './v1/scanner' 14 | export * as scanner_service from './v1/scanner_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/containerregistry/v1/blob.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.containerregistry.v1"; 7 | 8 | /** A Blob resource. */ 9 | export interface Blob { 10 | $type: "yandex.cloud.containerregistry.v1.Blob"; 11 | /** Output only. ID of the blob. */ 12 | id: string; 13 | /** Content-addressable identifier of the blob. */ 14 | digest: string; 15 | /** Size of the blob, specified in bytes. */ 16 | size: number; 17 | /** List of blob urls. */ 18 | urls: string[]; 19 | } 20 | 21 | const baseBlob: object = { 22 | $type: "yandex.cloud.containerregistry.v1.Blob", 23 | id: "", 24 | digest: "", 25 | size: 0, 26 | urls: "", 27 | }; 28 | 29 | export const Blob = { 30 | $type: "yandex.cloud.containerregistry.v1.Blob" as const, 31 | 32 | encode(message: Blob, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { 33 | if (message.id !== "") { 34 | writer.uint32(10).string(message.id); 35 | } 36 | if (message.digest !== "") { 37 | writer.uint32(18).string(message.digest); 38 | } 39 | if (message.size !== 0) { 40 | writer.uint32(24).int64(message.size); 41 | } 42 | for (const v of message.urls) { 43 | writer.uint32(34).string(v!); 44 | } 45 | return writer; 46 | }, 47 | 48 | decode(input: _m0.Reader | Uint8Array, length?: number): Blob { 49 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 50 | let end = length === undefined ? reader.len : reader.pos + length; 51 | const message = { ...baseBlob } as Blob; 52 | message.urls = []; 53 | while (reader.pos < end) { 54 | const tag = reader.uint32(); 55 | switch (tag >>> 3) { 56 | case 1: 57 | message.id = reader.string(); 58 | break; 59 | case 2: 60 | message.digest = reader.string(); 61 | break; 62 | case 3: 63 | message.size = longToNumber(reader.int64() as Long); 64 | break; 65 | case 4: 66 | message.urls.push(reader.string()); 67 | break; 68 | default: 69 | reader.skipType(tag & 7); 70 | break; 71 | } 72 | } 73 | return message; 74 | }, 75 | 76 | fromJSON(object: any): Blob { 77 | const message = { ...baseBlob } as Blob; 78 | message.id = 79 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 80 | message.digest = 81 | object.digest !== undefined && object.digest !== null 82 | ? String(object.digest) 83 | : ""; 84 | message.size = 85 | object.size !== undefined && object.size !== null 86 | ? Number(object.size) 87 | : 0; 88 | message.urls = (object.urls ?? []).map((e: any) => String(e)); 89 | return message; 90 | }, 91 | 92 | toJSON(message: Blob): unknown { 93 | const obj: any = {}; 94 | message.id !== undefined && (obj.id = message.id); 95 | message.digest !== undefined && (obj.digest = message.digest); 96 | message.size !== undefined && (obj.size = Math.round(message.size)); 97 | if (message.urls) { 98 | obj.urls = message.urls.map((e) => e); 99 | } else { 100 | obj.urls = []; 101 | } 102 | return obj; 103 | }, 104 | 105 | fromPartial, I>>(object: I): Blob { 106 | const message = { ...baseBlob } as Blob; 107 | message.id = object.id ?? ""; 108 | message.digest = object.digest ?? ""; 109 | message.size = object.size ?? 0; 110 | message.urls = object.urls?.map((e) => e) || []; 111 | return message; 112 | }, 113 | }; 114 | 115 | messageTypeRegistry.set(Blob.$type, Blob); 116 | 117 | declare var self: any | undefined; 118 | declare var window: any | undefined; 119 | declare var global: any | undefined; 120 | var globalThis: any = (() => { 121 | if (typeof globalThis !== "undefined") return globalThis; 122 | if (typeof self !== "undefined") return self; 123 | if (typeof window !== "undefined") return window; 124 | if (typeof global !== "undefined") return global; 125 | throw "Unable to locate global object"; 126 | })(); 127 | 128 | type Builtin = 129 | | Date 130 | | Function 131 | | Uint8Array 132 | | string 133 | | number 134 | | boolean 135 | | undefined; 136 | 137 | export type DeepPartial = T extends Builtin 138 | ? T 139 | : T extends Array 140 | ? Array> 141 | : T extends ReadonlyArray 142 | ? ReadonlyArray> 143 | : T extends {} 144 | ? { [K in Exclude]?: DeepPartial } 145 | : Partial; 146 | 147 | type KeysOfUnion = T extends T ? keyof T : never; 148 | export type Exact = P extends Builtin 149 | ? P 150 | : P & { [K in keyof P]: Exact } & Record< 151 | Exclude | "$type">, 152 | never 153 | >; 154 | 155 | function longToNumber(long: Long): number { 156 | if (long.gt(Number.MAX_SAFE_INTEGER)) { 157 | throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); 158 | } 159 | return long.toNumber(); 160 | } 161 | 162 | if (_m0.util.Long !== Long) { 163 | _m0.util.Long = Long as any; 164 | _m0.configure(); 165 | } 166 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/containerregistry/v1/repository.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.containerregistry.v1"; 7 | 8 | /** A Repository resource. For more information, see [Repository](/docs/container-registry/concepts/repository). */ 9 | export interface Repository { 10 | $type: "yandex.cloud.containerregistry.v1.Repository"; 11 | /** 12 | * Name of the repository. 13 | * The name is unique within the registry. 14 | */ 15 | name: string; 16 | /** Output only. ID of the repository. */ 17 | id: string; 18 | } 19 | 20 | const baseRepository: object = { 21 | $type: "yandex.cloud.containerregistry.v1.Repository", 22 | name: "", 23 | id: "", 24 | }; 25 | 26 | export const Repository = { 27 | $type: "yandex.cloud.containerregistry.v1.Repository" as const, 28 | 29 | encode( 30 | message: Repository, 31 | writer: _m0.Writer = _m0.Writer.create() 32 | ): _m0.Writer { 33 | if (message.name !== "") { 34 | writer.uint32(10).string(message.name); 35 | } 36 | if (message.id !== "") { 37 | writer.uint32(18).string(message.id); 38 | } 39 | return writer; 40 | }, 41 | 42 | decode(input: _m0.Reader | Uint8Array, length?: number): Repository { 43 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 44 | let end = length === undefined ? reader.len : reader.pos + length; 45 | const message = { ...baseRepository } as Repository; 46 | while (reader.pos < end) { 47 | const tag = reader.uint32(); 48 | switch (tag >>> 3) { 49 | case 1: 50 | message.name = reader.string(); 51 | break; 52 | case 2: 53 | message.id = reader.string(); 54 | break; 55 | default: 56 | reader.skipType(tag & 7); 57 | break; 58 | } 59 | } 60 | return message; 61 | }, 62 | 63 | fromJSON(object: any): Repository { 64 | const message = { ...baseRepository } as Repository; 65 | message.name = 66 | object.name !== undefined && object.name !== null 67 | ? String(object.name) 68 | : ""; 69 | message.id = 70 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 71 | return message; 72 | }, 73 | 74 | toJSON(message: Repository): unknown { 75 | const obj: any = {}; 76 | message.name !== undefined && (obj.name = message.name); 77 | message.id !== undefined && (obj.id = message.id); 78 | return obj; 79 | }, 80 | 81 | fromPartial, I>>( 82 | object: I 83 | ): Repository { 84 | const message = { ...baseRepository } as Repository; 85 | message.name = object.name ?? ""; 86 | message.id = object.id ?? ""; 87 | return message; 88 | }, 89 | }; 90 | 91 | messageTypeRegistry.set(Repository.$type, Repository); 92 | 93 | type Builtin = 94 | | Date 95 | | Function 96 | | Uint8Array 97 | | string 98 | | number 99 | | boolean 100 | | undefined; 101 | 102 | export type DeepPartial = T extends Builtin 103 | ? T 104 | : T extends Array 105 | ? Array> 106 | : T extends ReadonlyArray 107 | ? ReadonlyArray> 108 | : T extends {} 109 | ? { [K in Exclude]?: DeepPartial } 110 | : Partial; 111 | 112 | type KeysOfUnion = T extends T ? keyof T : never; 113 | export type Exact = P extends Builtin 114 | ? P 115 | : P & { [K in keyof P]: Exact } & Record< 116 | Exclude | "$type">, 117 | never 118 | >; 119 | 120 | if (_m0.util.Long !== Long) { 121 | _m0.util.Long = Long as any; 122 | _m0.configure(); 123 | } 124 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/dataproc/index.ts: -------------------------------------------------------------------------------- 1 | export * as cluster from './v1/cluster' 2 | export * as cluster_service from './v1/cluster_service' 3 | export * as common from './v1/common' 4 | export * as job from './v1/job' 5 | export * as job_service from './v1/job_service' 6 | export * as resource_preset from './v1/resource_preset' 7 | export * as resource_preset_service from './v1/resource_preset_service' 8 | export * as subcluster from './v1/subcluster' 9 | export * as subcluster_service from './v1/subcluster_service' 10 | export * as manager_job from './manager/v1/job' 11 | export * as manager_job_service from './manager/v1/job_service' 12 | export * as manager_service from './manager/v1/manager_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/dataproc/v1/resource_preset.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.dataproc.v1"; 7 | 8 | /** A ResourcePreset resource for describing hardware configuration presets. */ 9 | export interface ResourcePreset { 10 | $type: "yandex.cloud.dataproc.v1.ResourcePreset"; 11 | /** ID of the ResourcePreset resource. */ 12 | id: string; 13 | /** IDs of availability zones where the resource preset is available. */ 14 | zoneIds: string[]; 15 | /** Number of CPU cores for a Data Proc host created with the preset. */ 16 | cores: number; 17 | /** RAM volume for a Data Proc host created with the preset, in bytes. */ 18 | memory: number; 19 | } 20 | 21 | const baseResourcePreset: object = { 22 | $type: "yandex.cloud.dataproc.v1.ResourcePreset", 23 | id: "", 24 | zoneIds: "", 25 | cores: 0, 26 | memory: 0, 27 | }; 28 | 29 | export const ResourcePreset = { 30 | $type: "yandex.cloud.dataproc.v1.ResourcePreset" as const, 31 | 32 | encode( 33 | message: ResourcePreset, 34 | writer: _m0.Writer = _m0.Writer.create() 35 | ): _m0.Writer { 36 | if (message.id !== "") { 37 | writer.uint32(10).string(message.id); 38 | } 39 | for (const v of message.zoneIds) { 40 | writer.uint32(18).string(v!); 41 | } 42 | if (message.cores !== 0) { 43 | writer.uint32(24).int64(message.cores); 44 | } 45 | if (message.memory !== 0) { 46 | writer.uint32(32).int64(message.memory); 47 | } 48 | return writer; 49 | }, 50 | 51 | decode(input: _m0.Reader | Uint8Array, length?: number): ResourcePreset { 52 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 53 | let end = length === undefined ? reader.len : reader.pos + length; 54 | const message = { ...baseResourcePreset } as ResourcePreset; 55 | message.zoneIds = []; 56 | while (reader.pos < end) { 57 | const tag = reader.uint32(); 58 | switch (tag >>> 3) { 59 | case 1: 60 | message.id = reader.string(); 61 | break; 62 | case 2: 63 | message.zoneIds.push(reader.string()); 64 | break; 65 | case 3: 66 | message.cores = longToNumber(reader.int64() as Long); 67 | break; 68 | case 4: 69 | message.memory = longToNumber(reader.int64() as Long); 70 | break; 71 | default: 72 | reader.skipType(tag & 7); 73 | break; 74 | } 75 | } 76 | return message; 77 | }, 78 | 79 | fromJSON(object: any): ResourcePreset { 80 | const message = { ...baseResourcePreset } as ResourcePreset; 81 | message.id = 82 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 83 | message.zoneIds = (object.zoneIds ?? []).map((e: any) => String(e)); 84 | message.cores = 85 | object.cores !== undefined && object.cores !== null 86 | ? Number(object.cores) 87 | : 0; 88 | message.memory = 89 | object.memory !== undefined && object.memory !== null 90 | ? Number(object.memory) 91 | : 0; 92 | return message; 93 | }, 94 | 95 | toJSON(message: ResourcePreset): unknown { 96 | const obj: any = {}; 97 | message.id !== undefined && (obj.id = message.id); 98 | if (message.zoneIds) { 99 | obj.zoneIds = message.zoneIds.map((e) => e); 100 | } else { 101 | obj.zoneIds = []; 102 | } 103 | message.cores !== undefined && (obj.cores = Math.round(message.cores)); 104 | message.memory !== undefined && (obj.memory = Math.round(message.memory)); 105 | return obj; 106 | }, 107 | 108 | fromPartial, I>>( 109 | object: I 110 | ): ResourcePreset { 111 | const message = { ...baseResourcePreset } as ResourcePreset; 112 | message.id = object.id ?? ""; 113 | message.zoneIds = object.zoneIds?.map((e) => e) || []; 114 | message.cores = object.cores ?? 0; 115 | message.memory = object.memory ?? 0; 116 | return message; 117 | }, 118 | }; 119 | 120 | messageTypeRegistry.set(ResourcePreset.$type, ResourcePreset); 121 | 122 | declare var self: any | undefined; 123 | declare var window: any | undefined; 124 | declare var global: any | undefined; 125 | var globalThis: any = (() => { 126 | if (typeof globalThis !== "undefined") return globalThis; 127 | if (typeof self !== "undefined") return self; 128 | if (typeof window !== "undefined") return window; 129 | if (typeof global !== "undefined") return global; 130 | throw "Unable to locate global object"; 131 | })(); 132 | 133 | type Builtin = 134 | | Date 135 | | Function 136 | | Uint8Array 137 | | string 138 | | number 139 | | boolean 140 | | undefined; 141 | 142 | export type DeepPartial = T extends Builtin 143 | ? T 144 | : T extends Array 145 | ? Array> 146 | : T extends ReadonlyArray 147 | ? ReadonlyArray> 148 | : T extends {} 149 | ? { [K in Exclude]?: DeepPartial } 150 | : Partial; 151 | 152 | type KeysOfUnion = T extends T ? keyof T : never; 153 | export type Exact = P extends Builtin 154 | ? P 155 | : P & { [K in keyof P]: Exact } & Record< 156 | Exclude | "$type">, 157 | never 158 | >; 159 | 160 | function longToNumber(long: Long): number { 161 | if (long.gt(Number.MAX_SAFE_INTEGER)) { 162 | throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); 163 | } 164 | return long.toNumber(); 165 | } 166 | 167 | if (_m0.util.Long !== Long) { 168 | _m0.util.Long = Long as any; 169 | _m0.configure(); 170 | } 171 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/datasphere/index.ts: -------------------------------------------------------------------------------- 1 | export * as app_token_service from './v1/app_token_service' 2 | export * as folder_budget_service from './v1/folder_budget_service' 3 | export * as node_execution_error_details from './v1/node_execution_error_details' 4 | export * as node_service from './v1/node_service' 5 | export * as project_data_service from './v1/project_data_service' 6 | export * as community from './v2/community' 7 | export * as community_service from './v2/community_service' 8 | export * as dataset from './v2/dataset' 9 | export * as project from './v2/project' 10 | export * as project_service from './v2/project_service' 11 | export * as secret from './v2/secret' 12 | export * as user from './v2/user' 13 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/datasphere/v1/node_execution_error_details.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.datasphere.v1"; 7 | 8 | /** User code python execution's error details */ 9 | export interface NodeExecutionErrorDetails { 10 | $type: "yandex.cloud.datasphere.v1.NodeExecutionErrorDetails"; 11 | /** Error name */ 12 | errorName: string; 13 | /** Error message */ 14 | errorMessage: string; 15 | /** Error traceback */ 16 | traceback: string[]; 17 | } 18 | 19 | const baseNodeExecutionErrorDetails: object = { 20 | $type: "yandex.cloud.datasphere.v1.NodeExecutionErrorDetails", 21 | errorName: "", 22 | errorMessage: "", 23 | traceback: "", 24 | }; 25 | 26 | export const NodeExecutionErrorDetails = { 27 | $type: "yandex.cloud.datasphere.v1.NodeExecutionErrorDetails" as const, 28 | 29 | encode( 30 | message: NodeExecutionErrorDetails, 31 | writer: _m0.Writer = _m0.Writer.create() 32 | ): _m0.Writer { 33 | if (message.errorName !== "") { 34 | writer.uint32(10).string(message.errorName); 35 | } 36 | if (message.errorMessage !== "") { 37 | writer.uint32(18).string(message.errorMessage); 38 | } 39 | for (const v of message.traceback) { 40 | writer.uint32(26).string(v!); 41 | } 42 | return writer; 43 | }, 44 | 45 | decode( 46 | input: _m0.Reader | Uint8Array, 47 | length?: number 48 | ): NodeExecutionErrorDetails { 49 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 50 | let end = length === undefined ? reader.len : reader.pos + length; 51 | const message = { 52 | ...baseNodeExecutionErrorDetails, 53 | } as NodeExecutionErrorDetails; 54 | message.traceback = []; 55 | while (reader.pos < end) { 56 | const tag = reader.uint32(); 57 | switch (tag >>> 3) { 58 | case 1: 59 | message.errorName = reader.string(); 60 | break; 61 | case 2: 62 | message.errorMessage = reader.string(); 63 | break; 64 | case 3: 65 | message.traceback.push(reader.string()); 66 | break; 67 | default: 68 | reader.skipType(tag & 7); 69 | break; 70 | } 71 | } 72 | return message; 73 | }, 74 | 75 | fromJSON(object: any): NodeExecutionErrorDetails { 76 | const message = { 77 | ...baseNodeExecutionErrorDetails, 78 | } as NodeExecutionErrorDetails; 79 | message.errorName = 80 | object.errorName !== undefined && object.errorName !== null 81 | ? String(object.errorName) 82 | : ""; 83 | message.errorMessage = 84 | object.errorMessage !== undefined && object.errorMessage !== null 85 | ? String(object.errorMessage) 86 | : ""; 87 | message.traceback = (object.traceback ?? []).map((e: any) => String(e)); 88 | return message; 89 | }, 90 | 91 | toJSON(message: NodeExecutionErrorDetails): unknown { 92 | const obj: any = {}; 93 | message.errorName !== undefined && (obj.errorName = message.errorName); 94 | message.errorMessage !== undefined && 95 | (obj.errorMessage = message.errorMessage); 96 | if (message.traceback) { 97 | obj.traceback = message.traceback.map((e) => e); 98 | } else { 99 | obj.traceback = []; 100 | } 101 | return obj; 102 | }, 103 | 104 | fromPartial, I>>( 105 | object: I 106 | ): NodeExecutionErrorDetails { 107 | const message = { 108 | ...baseNodeExecutionErrorDetails, 109 | } as NodeExecutionErrorDetails; 110 | message.errorName = object.errorName ?? ""; 111 | message.errorMessage = object.errorMessage ?? ""; 112 | message.traceback = object.traceback?.map((e) => e) || []; 113 | return message; 114 | }, 115 | }; 116 | 117 | messageTypeRegistry.set( 118 | NodeExecutionErrorDetails.$type, 119 | NodeExecutionErrorDetails 120 | ); 121 | 122 | type Builtin = 123 | | Date 124 | | Function 125 | | Uint8Array 126 | | string 127 | | number 128 | | boolean 129 | | undefined; 130 | 131 | export type DeepPartial = T extends Builtin 132 | ? T 133 | : T extends Array 134 | ? Array> 135 | : T extends ReadonlyArray 136 | ? ReadonlyArray> 137 | : T extends {} 138 | ? { [K in Exclude]?: DeepPartial } 139 | : Partial; 140 | 141 | type KeysOfUnion = T extends T ? keyof T : never; 142 | export type Exact = P extends Builtin 143 | ? P 144 | : P & { [K in keyof P]: Exact } & Record< 145 | Exclude | "$type">, 146 | never 147 | >; 148 | 149 | if (_m0.util.Long !== Long) { 150 | _m0.util.Long = Long as any; 151 | _m0.configure(); 152 | } 153 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/datasphere/v2/user.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.datasphere.v2"; 7 | 8 | export interface User { 9 | $type: "yandex.cloud.datasphere.v2.User"; 10 | /** ID of the user. */ 11 | id: string; 12 | /** Name of the user. */ 13 | name: string; 14 | /** Email of the user. */ 15 | email: string; 16 | /** URL to the user's profile picture. */ 17 | picture: string; 18 | /** An image content of the user's profile picture. */ 19 | pictureData: string; 20 | } 21 | 22 | const baseUser: object = { 23 | $type: "yandex.cloud.datasphere.v2.User", 24 | id: "", 25 | name: "", 26 | email: "", 27 | picture: "", 28 | pictureData: "", 29 | }; 30 | 31 | export const User = { 32 | $type: "yandex.cloud.datasphere.v2.User" as const, 33 | 34 | encode(message: User, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { 35 | if (message.id !== "") { 36 | writer.uint32(10).string(message.id); 37 | } 38 | if (message.name !== "") { 39 | writer.uint32(18).string(message.name); 40 | } 41 | if (message.email !== "") { 42 | writer.uint32(26).string(message.email); 43 | } 44 | if (message.picture !== "") { 45 | writer.uint32(34).string(message.picture); 46 | } 47 | if (message.pictureData !== "") { 48 | writer.uint32(42).string(message.pictureData); 49 | } 50 | return writer; 51 | }, 52 | 53 | decode(input: _m0.Reader | Uint8Array, length?: number): User { 54 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 55 | let end = length === undefined ? reader.len : reader.pos + length; 56 | const message = { ...baseUser } as User; 57 | while (reader.pos < end) { 58 | const tag = reader.uint32(); 59 | switch (tag >>> 3) { 60 | case 1: 61 | message.id = reader.string(); 62 | break; 63 | case 2: 64 | message.name = reader.string(); 65 | break; 66 | case 3: 67 | message.email = reader.string(); 68 | break; 69 | case 4: 70 | message.picture = reader.string(); 71 | break; 72 | case 5: 73 | message.pictureData = reader.string(); 74 | break; 75 | default: 76 | reader.skipType(tag & 7); 77 | break; 78 | } 79 | } 80 | return message; 81 | }, 82 | 83 | fromJSON(object: any): User { 84 | const message = { ...baseUser } as User; 85 | message.id = 86 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 87 | message.name = 88 | object.name !== undefined && object.name !== null 89 | ? String(object.name) 90 | : ""; 91 | message.email = 92 | object.email !== undefined && object.email !== null 93 | ? String(object.email) 94 | : ""; 95 | message.picture = 96 | object.picture !== undefined && object.picture !== null 97 | ? String(object.picture) 98 | : ""; 99 | message.pictureData = 100 | object.pictureData !== undefined && object.pictureData !== null 101 | ? String(object.pictureData) 102 | : ""; 103 | return message; 104 | }, 105 | 106 | toJSON(message: User): unknown { 107 | const obj: any = {}; 108 | message.id !== undefined && (obj.id = message.id); 109 | message.name !== undefined && (obj.name = message.name); 110 | message.email !== undefined && (obj.email = message.email); 111 | message.picture !== undefined && (obj.picture = message.picture); 112 | message.pictureData !== undefined && 113 | (obj.pictureData = message.pictureData); 114 | return obj; 115 | }, 116 | 117 | fromPartial, I>>(object: I): User { 118 | const message = { ...baseUser } as User; 119 | message.id = object.id ?? ""; 120 | message.name = object.name ?? ""; 121 | message.email = object.email ?? ""; 122 | message.picture = object.picture ?? ""; 123 | message.pictureData = object.pictureData ?? ""; 124 | return message; 125 | }, 126 | }; 127 | 128 | messageTypeRegistry.set(User.$type, User); 129 | 130 | type Builtin = 131 | | Date 132 | | Function 133 | | Uint8Array 134 | | string 135 | | number 136 | | boolean 137 | | undefined; 138 | 139 | export type DeepPartial = T extends Builtin 140 | ? T 141 | : T extends Array 142 | ? Array> 143 | : T extends ReadonlyArray 144 | ? ReadonlyArray> 145 | : T extends {} 146 | ? { [K in Exclude]?: DeepPartial } 147 | : Partial; 148 | 149 | type KeysOfUnion = T extends T ? keyof T : never; 150 | export type Exact = P extends Builtin 151 | ? P 152 | : P & { [K in keyof P]: Exact } & Record< 153 | Exclude | "$type">, 154 | never 155 | >; 156 | 157 | if (_m0.util.Long !== Long) { 158 | _m0.util.Long = Long as any; 159 | _m0.configure(); 160 | } 161 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/datatransfer/index.ts: -------------------------------------------------------------------------------- 1 | export * as endpoint from './v1/endpoint' 2 | export * as endpoint_service from './v1/endpoint_service' 3 | export * as transfer from './v1/transfer' 4 | export * as transfer_service from './v1/transfer_service' 5 | export * as clickhouse from './v1/endpoint/clickhouse' 6 | export * as common from './v1/endpoint/common' 7 | export * as kafka from './v1/endpoint/kafka' 8 | export * as mongo from './v1/endpoint/mongo' 9 | export * as mysql from './v1/endpoint/mysql' 10 | export * as parsers from './v1/endpoint/parsers' 11 | export * as postgres from './v1/endpoint/postgres' 12 | export * as serializers from './v1/endpoint/serializers' 13 | export * as ydb from './v1/endpoint/ydb' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/dns/index.ts: -------------------------------------------------------------------------------- 1 | export * as dns_zone from './v1/dns_zone' 2 | export * as dns_zone_service from './v1/dns_zone_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/endpoint/api_endpoint.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.endpoint"; 7 | 8 | export interface ApiEndpoint { 9 | $type: "yandex.cloud.endpoint.ApiEndpoint"; 10 | id: string; 11 | address: string; 12 | } 13 | 14 | const baseApiEndpoint: object = { 15 | $type: "yandex.cloud.endpoint.ApiEndpoint", 16 | id: "", 17 | address: "", 18 | }; 19 | 20 | export const ApiEndpoint = { 21 | $type: "yandex.cloud.endpoint.ApiEndpoint" as const, 22 | 23 | encode( 24 | message: ApiEndpoint, 25 | writer: _m0.Writer = _m0.Writer.create() 26 | ): _m0.Writer { 27 | if (message.id !== "") { 28 | writer.uint32(10).string(message.id); 29 | } 30 | if (message.address !== "") { 31 | writer.uint32(18).string(message.address); 32 | } 33 | return writer; 34 | }, 35 | 36 | decode(input: _m0.Reader | Uint8Array, length?: number): ApiEndpoint { 37 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 38 | let end = length === undefined ? reader.len : reader.pos + length; 39 | const message = { ...baseApiEndpoint } as ApiEndpoint; 40 | while (reader.pos < end) { 41 | const tag = reader.uint32(); 42 | switch (tag >>> 3) { 43 | case 1: 44 | message.id = reader.string(); 45 | break; 46 | case 2: 47 | message.address = reader.string(); 48 | break; 49 | default: 50 | reader.skipType(tag & 7); 51 | break; 52 | } 53 | } 54 | return message; 55 | }, 56 | 57 | fromJSON(object: any): ApiEndpoint { 58 | const message = { ...baseApiEndpoint } as ApiEndpoint; 59 | message.id = 60 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 61 | message.address = 62 | object.address !== undefined && object.address !== null 63 | ? String(object.address) 64 | : ""; 65 | return message; 66 | }, 67 | 68 | toJSON(message: ApiEndpoint): unknown { 69 | const obj: any = {}; 70 | message.id !== undefined && (obj.id = message.id); 71 | message.address !== undefined && (obj.address = message.address); 72 | return obj; 73 | }, 74 | 75 | fromPartial, I>>( 76 | object: I 77 | ): ApiEndpoint { 78 | const message = { ...baseApiEndpoint } as ApiEndpoint; 79 | message.id = object.id ?? ""; 80 | message.address = object.address ?? ""; 81 | return message; 82 | }, 83 | }; 84 | 85 | messageTypeRegistry.set(ApiEndpoint.$type, ApiEndpoint); 86 | 87 | type Builtin = 88 | | Date 89 | | Function 90 | | Uint8Array 91 | | string 92 | | number 93 | | boolean 94 | | undefined; 95 | 96 | export type DeepPartial = T extends Builtin 97 | ? T 98 | : T extends Array 99 | ? Array> 100 | : T extends ReadonlyArray 101 | ? ReadonlyArray> 102 | : T extends {} 103 | ? { [K in Exclude]?: DeepPartial } 104 | : Partial; 105 | 106 | type KeysOfUnion = T extends T ? keyof T : never; 107 | export type Exact = P extends Builtin 108 | ? P 109 | : P & { [K in keyof P]: Exact } & Record< 110 | Exclude | "$type">, 111 | never 112 | >; 113 | 114 | if (_m0.util.Long !== Long) { 115 | _m0.util.Long = Long as any; 116 | _m0.configure(); 117 | } 118 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/endpoint/index.ts: -------------------------------------------------------------------------------- 1 | export * as api_endpoint from './api_endpoint' 2 | export * as api_endpoint_service from './api_endpoint_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/iam/index.ts: -------------------------------------------------------------------------------- 1 | export * as api_key from './v1/api_key' 2 | export * as api_key_service from './v1/api_key_service' 3 | export * as iam_token_service from './v1/iam_token_service' 4 | export * as key from './v1/key' 5 | export * as key_service from './v1/key_service' 6 | export * as role from './v1/role' 7 | export * as role_service from './v1/role_service' 8 | export * as service_account from './v1/service_account' 9 | export * as service_account_service from './v1/service_account_service' 10 | export * as user_account from './v1/user_account' 11 | export * as user_account_service from './v1/user_account_service' 12 | export * as yandex_passport_user_account_service from './v1/yandex_passport_user_account_service' 13 | export * as access_key from './v1/awscompatibility/access_key' 14 | export * as access_key_service from './v1/awscompatibility/access_key_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/iam/v1/role.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.iam.v1"; 7 | 8 | /** A Role resource. For more information, see [Roles](/docs/iam/concepts/access-control/roles). */ 9 | export interface Role { 10 | $type: "yandex.cloud.iam.v1.Role"; 11 | /** ID of the role. */ 12 | id: string; 13 | /** Description of the role. 0-256 characters long. */ 14 | description: string; 15 | } 16 | 17 | const baseRole: object = { 18 | $type: "yandex.cloud.iam.v1.Role", 19 | id: "", 20 | description: "", 21 | }; 22 | 23 | export const Role = { 24 | $type: "yandex.cloud.iam.v1.Role" as const, 25 | 26 | encode(message: Role, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { 27 | if (message.id !== "") { 28 | writer.uint32(10).string(message.id); 29 | } 30 | if (message.description !== "") { 31 | writer.uint32(18).string(message.description); 32 | } 33 | return writer; 34 | }, 35 | 36 | decode(input: _m0.Reader | Uint8Array, length?: number): Role { 37 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 38 | let end = length === undefined ? reader.len : reader.pos + length; 39 | const message = { ...baseRole } as Role; 40 | while (reader.pos < end) { 41 | const tag = reader.uint32(); 42 | switch (tag >>> 3) { 43 | case 1: 44 | message.id = reader.string(); 45 | break; 46 | case 2: 47 | message.description = reader.string(); 48 | break; 49 | default: 50 | reader.skipType(tag & 7); 51 | break; 52 | } 53 | } 54 | return message; 55 | }, 56 | 57 | fromJSON(object: any): Role { 58 | const message = { ...baseRole } as Role; 59 | message.id = 60 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 61 | message.description = 62 | object.description !== undefined && object.description !== null 63 | ? String(object.description) 64 | : ""; 65 | return message; 66 | }, 67 | 68 | toJSON(message: Role): unknown { 69 | const obj: any = {}; 70 | message.id !== undefined && (obj.id = message.id); 71 | message.description !== undefined && 72 | (obj.description = message.description); 73 | return obj; 74 | }, 75 | 76 | fromPartial, I>>(object: I): Role { 77 | const message = { ...baseRole } as Role; 78 | message.id = object.id ?? ""; 79 | message.description = object.description ?? ""; 80 | return message; 81 | }, 82 | }; 83 | 84 | messageTypeRegistry.set(Role.$type, Role); 85 | 86 | type Builtin = 87 | | Date 88 | | Function 89 | | Uint8Array 90 | | string 91 | | number 92 | | boolean 93 | | undefined; 94 | 95 | export type DeepPartial = T extends Builtin 96 | ? T 97 | : T extends Array 98 | ? Array> 99 | : T extends ReadonlyArray 100 | ? ReadonlyArray> 101 | : T extends {} 102 | ? { [K in Exclude]?: DeepPartial } 103 | : Partial; 104 | 105 | type KeysOfUnion = T extends T ? keyof T : never; 106 | export type Exact = P extends Builtin 107 | ? P 108 | : P & { [K in keyof P]: Exact } & Record< 109 | Exclude | "$type">, 110 | never 111 | >; 112 | 113 | if (_m0.util.Long !== Long) { 114 | _m0.util.Long = Long as any; 115 | _m0.configure(); 116 | } 117 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/index.ts: -------------------------------------------------------------------------------- 1 | export * as access from './access/' 2 | export * as ai from './ai/' 3 | export * as api from './api/' 4 | export * as apploadbalancer from './apploadbalancer/' 5 | export * as backup from './backup/' 6 | export * as billing from './billing/' 7 | export * as cdn from './cdn/' 8 | export * as certificatemanager from './certificatemanager/' 9 | export * as compute from './compute/' 10 | export * as containerregistry from './containerregistry/' 11 | export * as dataproc from './dataproc/' 12 | export * as datasphere from './datasphere/' 13 | export * as datatransfer from './datatransfer/' 14 | export * as dns from './dns/' 15 | export * as endpoint from './endpoint/' 16 | export * as iam from './iam/' 17 | export * as iot from './iot/' 18 | export * as k8s from './k8s/' 19 | export * as kms from './kms/' 20 | export * as loadbalancer from './loadbalancer/' 21 | export * as loadtesting from './loadtesting/' 22 | export * as lockbox from './lockbox/' 23 | export * as logging from './logging/' 24 | export * as marketplace from './marketplace/' 25 | export * as mdb from './mdb/' 26 | export * as monitoring from './monitoring/' 27 | export * as oauth from './oauth/' 28 | export * as operation from './operation/' 29 | export * as organizationmanager from './organizationmanager/' 30 | export * as quota from './quota/' 31 | export * as reference from './reference/' 32 | export * as resourcemanager from './resourcemanager/' 33 | export * as serverless from './serverless/' 34 | export * as storage from './storage/' 35 | export * as vpc from './vpc/' 36 | export * as ydb from './ydb/' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/iot/index.ts: -------------------------------------------------------------------------------- 1 | export * as broker from './broker/v1/broker' 2 | export * as broker_broker_data_service from './broker/v1/broker_data_service' 3 | export * as broker_service from './broker/v1/broker_service' 4 | export * as devices_device from './devices/v1/device' 5 | export * as devices_device_data_service from './devices/v1/device_data_service' 6 | export * as devices_device_service from './devices/v1/device_service' 7 | export * as devices_registry from './devices/v1/registry' 8 | export * as devices_registry_data_service from './devices/v1/registry_data_service' 9 | export * as devices_registry_service from './devices/v1/registry_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/k8s/index.ts: -------------------------------------------------------------------------------- 1 | export * as cluster from './v1/cluster' 2 | export * as cluster_service from './v1/cluster_service' 3 | export * as maintenance from './v1/maintenance' 4 | export * as node from './v1/node' 5 | export * as node_group from './v1/node_group' 6 | export * as node_group_service from './v1/node_group_service' 7 | export * as version from './v1/version' 8 | export * as version_service from './v1/version_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/kms/index.ts: -------------------------------------------------------------------------------- 1 | export * as symmetric_crypto_service from './v1/symmetric_crypto_service' 2 | export * as symmetric_key from './v1/symmetric_key' 3 | export * as symmetric_key_service from './v1/symmetric_key_service' 4 | export * as asymmetric_encryption_crypto_service from './v1/asymmetricencryption/asymmetric_encryption_crypto_service' 5 | export * as asymmetric_encryption_key from './v1/asymmetricencryption/asymmetric_encryption_key' 6 | export * as asymmetric_encryption_key_service from './v1/asymmetricencryption/asymmetric_encryption_key_service' 7 | export * as asymmetric_signature_crypto_service from './v1/asymmetricsignature/asymmetric_signature_crypto_service' 8 | export * as asymmetric_signature_key from './v1/asymmetricsignature/asymmetric_signature_key' 9 | export * as asymmetric_signature_key_service from './v1/asymmetricsignature/asymmetric_signature_key_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/loadbalancer/index.ts: -------------------------------------------------------------------------------- 1 | export * as health_check from './v1/health_check' 2 | export * as network_load_balancer from './v1/network_load_balancer' 3 | export * as network_load_balancer_service from './v1/network_load_balancer_service' 4 | export * as target_group from './v1/target_group' 5 | export * as target_group_service from './v1/target_group_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/loadtesting/agent/v1/agent.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.loadtesting.agent.v1"; 7 | 8 | export interface AgentInstance { 9 | $type: "yandex.cloud.loadtesting.agent.v1.AgentInstance"; 10 | id: string; 11 | } 12 | 13 | const baseAgentInstance: object = { 14 | $type: "yandex.cloud.loadtesting.agent.v1.AgentInstance", 15 | id: "", 16 | }; 17 | 18 | export const AgentInstance = { 19 | $type: "yandex.cloud.loadtesting.agent.v1.AgentInstance" as const, 20 | 21 | encode( 22 | message: AgentInstance, 23 | writer: _m0.Writer = _m0.Writer.create() 24 | ): _m0.Writer { 25 | if (message.id !== "") { 26 | writer.uint32(10).string(message.id); 27 | } 28 | return writer; 29 | }, 30 | 31 | decode(input: _m0.Reader | Uint8Array, length?: number): AgentInstance { 32 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 33 | let end = length === undefined ? reader.len : reader.pos + length; 34 | const message = { ...baseAgentInstance } as AgentInstance; 35 | while (reader.pos < end) { 36 | const tag = reader.uint32(); 37 | switch (tag >>> 3) { 38 | case 1: 39 | message.id = reader.string(); 40 | break; 41 | default: 42 | reader.skipType(tag & 7); 43 | break; 44 | } 45 | } 46 | return message; 47 | }, 48 | 49 | fromJSON(object: any): AgentInstance { 50 | const message = { ...baseAgentInstance } as AgentInstance; 51 | message.id = 52 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 53 | return message; 54 | }, 55 | 56 | toJSON(message: AgentInstance): unknown { 57 | const obj: any = {}; 58 | message.id !== undefined && (obj.id = message.id); 59 | return obj; 60 | }, 61 | 62 | fromPartial, I>>( 63 | object: I 64 | ): AgentInstance { 65 | const message = { ...baseAgentInstance } as AgentInstance; 66 | message.id = object.id ?? ""; 67 | return message; 68 | }, 69 | }; 70 | 71 | messageTypeRegistry.set(AgentInstance.$type, AgentInstance); 72 | 73 | type Builtin = 74 | | Date 75 | | Function 76 | | Uint8Array 77 | | string 78 | | number 79 | | boolean 80 | | undefined; 81 | 82 | export type DeepPartial = T extends Builtin 83 | ? T 84 | : T extends Array 85 | ? Array> 86 | : T extends ReadonlyArray 87 | ? ReadonlyArray> 88 | : T extends {} 89 | ? { [K in Exclude]?: DeepPartial } 90 | : Partial; 91 | 92 | type KeysOfUnion = T extends T ? keyof T : never; 93 | export type Exact = P extends Builtin 94 | ? P 95 | : P & { [K in keyof P]: Exact } & Record< 96 | Exclude | "$type">, 97 | never 98 | >; 99 | 100 | if (_m0.util.Long !== Long) { 101 | _m0.util.Long = Long as any; 102 | _m0.configure(); 103 | } 104 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/loadtesting/api/v1/agent/status.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import Long from "long"; 3 | import _m0 from "protobufjs/minimal"; 4 | 5 | export const protobufPackage = "yandex.cloud.loadtesting.api.v1.agent"; 6 | 7 | export enum Status { 8 | STATUS_UNSPECIFIED = 0, 9 | PREPARING_TEST = 1, 10 | READY_FOR_TEST = 2, 11 | TESTING = 3, 12 | TANK_FAILED = 4, 13 | PROVISIONING = 5, 14 | STOPPING = 6, 15 | STOPPED = 7, 16 | STARTING = 8, 17 | RESTARTING = 9, 18 | UPDATING = 10, 19 | ERROR = 11, 20 | CRASHED = 12, 21 | DELETING = 13, 22 | INITIALIZING_CONNECTION = 15, 23 | LOST_CONNECTION_WITH_AGENT = 16, 24 | UPLOADING_ARTIFACTS = 17, 25 | UNRECOGNIZED = -1, 26 | } 27 | 28 | export function statusFromJSON(object: any): Status { 29 | switch (object) { 30 | case 0: 31 | case "STATUS_UNSPECIFIED": 32 | return Status.STATUS_UNSPECIFIED; 33 | case 1: 34 | case "PREPARING_TEST": 35 | return Status.PREPARING_TEST; 36 | case 2: 37 | case "READY_FOR_TEST": 38 | return Status.READY_FOR_TEST; 39 | case 3: 40 | case "TESTING": 41 | return Status.TESTING; 42 | case 4: 43 | case "TANK_FAILED": 44 | return Status.TANK_FAILED; 45 | case 5: 46 | case "PROVISIONING": 47 | return Status.PROVISIONING; 48 | case 6: 49 | case "STOPPING": 50 | return Status.STOPPING; 51 | case 7: 52 | case "STOPPED": 53 | return Status.STOPPED; 54 | case 8: 55 | case "STARTING": 56 | return Status.STARTING; 57 | case 9: 58 | case "RESTARTING": 59 | return Status.RESTARTING; 60 | case 10: 61 | case "UPDATING": 62 | return Status.UPDATING; 63 | case 11: 64 | case "ERROR": 65 | return Status.ERROR; 66 | case 12: 67 | case "CRASHED": 68 | return Status.CRASHED; 69 | case 13: 70 | case "DELETING": 71 | return Status.DELETING; 72 | case 15: 73 | case "INITIALIZING_CONNECTION": 74 | return Status.INITIALIZING_CONNECTION; 75 | case 16: 76 | case "LOST_CONNECTION_WITH_AGENT": 77 | return Status.LOST_CONNECTION_WITH_AGENT; 78 | case 17: 79 | case "UPLOADING_ARTIFACTS": 80 | return Status.UPLOADING_ARTIFACTS; 81 | case -1: 82 | case "UNRECOGNIZED": 83 | default: 84 | return Status.UNRECOGNIZED; 85 | } 86 | } 87 | 88 | export function statusToJSON(object: Status): string { 89 | switch (object) { 90 | case Status.STATUS_UNSPECIFIED: 91 | return "STATUS_UNSPECIFIED"; 92 | case Status.PREPARING_TEST: 93 | return "PREPARING_TEST"; 94 | case Status.READY_FOR_TEST: 95 | return "READY_FOR_TEST"; 96 | case Status.TESTING: 97 | return "TESTING"; 98 | case Status.TANK_FAILED: 99 | return "TANK_FAILED"; 100 | case Status.PROVISIONING: 101 | return "PROVISIONING"; 102 | case Status.STOPPING: 103 | return "STOPPING"; 104 | case Status.STOPPED: 105 | return "STOPPED"; 106 | case Status.STARTING: 107 | return "STARTING"; 108 | case Status.RESTARTING: 109 | return "RESTARTING"; 110 | case Status.UPDATING: 111 | return "UPDATING"; 112 | case Status.ERROR: 113 | return "ERROR"; 114 | case Status.CRASHED: 115 | return "CRASHED"; 116 | case Status.DELETING: 117 | return "DELETING"; 118 | case Status.INITIALIZING_CONNECTION: 119 | return "INITIALIZING_CONNECTION"; 120 | case Status.LOST_CONNECTION_WITH_AGENT: 121 | return "LOST_CONNECTION_WITH_AGENT"; 122 | case Status.UPLOADING_ARTIFACTS: 123 | return "UPLOADING_ARTIFACTS"; 124 | default: 125 | return "UNKNOWN"; 126 | } 127 | } 128 | 129 | if (_m0.util.Long !== Long) { 130 | _m0.util.Long = Long as any; 131 | _m0.configure(); 132 | } 133 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/loadtesting/index.ts: -------------------------------------------------------------------------------- 1 | export * as agent from './agent/v1/agent' 2 | export * as agent_agent_registration_service from './agent/v1/agent_registration_service' 3 | export * as agent_service from './agent/v1/agent_service' 4 | export * as agent_job_service from './agent/v1/job_service' 5 | export * as agent_monitoring_service from './agent/v1/monitoring_service' 6 | export * as agent_test from './agent/v1/test' 7 | export * as agent_test_service from './agent/v1/test_service' 8 | export * as agent_trail_service from './agent/v1/trail_service' 9 | export * as api_agent_service from './api/v1/agent_service' 10 | export * as api_agent from './api/v1/agent/agent' 11 | export * as api_create_compute_instance from './api/v1/agent/create_compute_instance' 12 | export * as api_status from './api/v1/agent/status' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/lockbox/index.ts: -------------------------------------------------------------------------------- 1 | export * as payload from './v1/payload' 2 | export * as payload_service from './v1/payload_service' 3 | export * as secret from './v1/secret' 4 | export * as secret_service from './v1/secret_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/logging/index.ts: -------------------------------------------------------------------------------- 1 | export * as export from './v1/export' 2 | export * as export_service from './v1/export_service' 3 | export * as log_entry from './v1/log_entry' 4 | export * as log_group from './v1/log_group' 5 | export * as log_group_service from './v1/log_group_service' 6 | export * as log_ingestion_service from './v1/log_ingestion_service' 7 | export * as log_reading_service from './v1/log_reading_service' 8 | export * as log_resource from './v1/log_resource' 9 | export * as sink from './v1/sink' 10 | export * as sink_service from './v1/sink_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/marketplace/index.ts: -------------------------------------------------------------------------------- 1 | export * as licensemanager_instance from './licensemanager/v1/instance' 2 | export * as licensemanager_instance_service from './licensemanager/v1/instance_service' 3 | export * as licensemanager_lock from './licensemanager/v1/lock' 4 | export * as licensemanager_lock_service from './licensemanager/v1/lock_service' 5 | export * as licensemanager_template from './licensemanager/v1/template' 6 | export * as metering_image_product_usage_service from './metering/v1/image_product_usage_service' 7 | export * as metering_usage_record from './metering/v1/usage_record' 8 | export * as image_product_usage_service from './v1/metering/image_product_usage_service' 9 | export * as usage_record from './v1/metering/usage_record' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/mdb/clickhouse/v1/ml_model.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.mdb.clickhouse.v1"; 7 | 8 | export enum MlModelType { 9 | ML_MODEL_TYPE_UNSPECIFIED = 0, 10 | /** ML_MODEL_TYPE_CATBOOST - CatBoost model. */ 11 | ML_MODEL_TYPE_CATBOOST = 1, 12 | UNRECOGNIZED = -1, 13 | } 14 | 15 | export function mlModelTypeFromJSON(object: any): MlModelType { 16 | switch (object) { 17 | case 0: 18 | case "ML_MODEL_TYPE_UNSPECIFIED": 19 | return MlModelType.ML_MODEL_TYPE_UNSPECIFIED; 20 | case 1: 21 | case "ML_MODEL_TYPE_CATBOOST": 22 | return MlModelType.ML_MODEL_TYPE_CATBOOST; 23 | case -1: 24 | case "UNRECOGNIZED": 25 | default: 26 | return MlModelType.UNRECOGNIZED; 27 | } 28 | } 29 | 30 | export function mlModelTypeToJSON(object: MlModelType): string { 31 | switch (object) { 32 | case MlModelType.ML_MODEL_TYPE_UNSPECIFIED: 33 | return "ML_MODEL_TYPE_UNSPECIFIED"; 34 | case MlModelType.ML_MODEL_TYPE_CATBOOST: 35 | return "ML_MODEL_TYPE_CATBOOST"; 36 | default: 37 | return "UNKNOWN"; 38 | } 39 | } 40 | 41 | export interface MlModel { 42 | $type: "yandex.cloud.mdb.clickhouse.v1.MlModel"; 43 | /** Name of the the model. */ 44 | name: string; 45 | /** ID of the ClickHouse cluster that the model belongs to. */ 46 | clusterId: string; 47 | /** Type of the model. */ 48 | type: MlModelType; 49 | /** Model file URL. You can only use models stored in Object Storage. */ 50 | uri: string; 51 | } 52 | 53 | const baseMlModel: object = { 54 | $type: "yandex.cloud.mdb.clickhouse.v1.MlModel", 55 | name: "", 56 | clusterId: "", 57 | type: 0, 58 | uri: "", 59 | }; 60 | 61 | export const MlModel = { 62 | $type: "yandex.cloud.mdb.clickhouse.v1.MlModel" as const, 63 | 64 | encode( 65 | message: MlModel, 66 | writer: _m0.Writer = _m0.Writer.create() 67 | ): _m0.Writer { 68 | if (message.name !== "") { 69 | writer.uint32(10).string(message.name); 70 | } 71 | if (message.clusterId !== "") { 72 | writer.uint32(18).string(message.clusterId); 73 | } 74 | if (message.type !== 0) { 75 | writer.uint32(24).int32(message.type); 76 | } 77 | if (message.uri !== "") { 78 | writer.uint32(34).string(message.uri); 79 | } 80 | return writer; 81 | }, 82 | 83 | decode(input: _m0.Reader | Uint8Array, length?: number): MlModel { 84 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 85 | let end = length === undefined ? reader.len : reader.pos + length; 86 | const message = { ...baseMlModel } as MlModel; 87 | while (reader.pos < end) { 88 | const tag = reader.uint32(); 89 | switch (tag >>> 3) { 90 | case 1: 91 | message.name = reader.string(); 92 | break; 93 | case 2: 94 | message.clusterId = reader.string(); 95 | break; 96 | case 3: 97 | message.type = reader.int32() as any; 98 | break; 99 | case 4: 100 | message.uri = reader.string(); 101 | break; 102 | default: 103 | reader.skipType(tag & 7); 104 | break; 105 | } 106 | } 107 | return message; 108 | }, 109 | 110 | fromJSON(object: any): MlModel { 111 | const message = { ...baseMlModel } as MlModel; 112 | message.name = 113 | object.name !== undefined && object.name !== null 114 | ? String(object.name) 115 | : ""; 116 | message.clusterId = 117 | object.clusterId !== undefined && object.clusterId !== null 118 | ? String(object.clusterId) 119 | : ""; 120 | message.type = 121 | object.type !== undefined && object.type !== null 122 | ? mlModelTypeFromJSON(object.type) 123 | : 0; 124 | message.uri = 125 | object.uri !== undefined && object.uri !== null ? String(object.uri) : ""; 126 | return message; 127 | }, 128 | 129 | toJSON(message: MlModel): unknown { 130 | const obj: any = {}; 131 | message.name !== undefined && (obj.name = message.name); 132 | message.clusterId !== undefined && (obj.clusterId = message.clusterId); 133 | message.type !== undefined && (obj.type = mlModelTypeToJSON(message.type)); 134 | message.uri !== undefined && (obj.uri = message.uri); 135 | return obj; 136 | }, 137 | 138 | fromPartial, I>>(object: I): MlModel { 139 | const message = { ...baseMlModel } as MlModel; 140 | message.name = object.name ?? ""; 141 | message.clusterId = object.clusterId ?? ""; 142 | message.type = object.type ?? 0; 143 | message.uri = object.uri ?? ""; 144 | return message; 145 | }, 146 | }; 147 | 148 | messageTypeRegistry.set(MlModel.$type, MlModel); 149 | 150 | type Builtin = 151 | | Date 152 | | Function 153 | | Uint8Array 154 | | string 155 | | number 156 | | boolean 157 | | undefined; 158 | 159 | export type DeepPartial = T extends Builtin 160 | ? T 161 | : T extends Array 162 | ? Array> 163 | : T extends ReadonlyArray 164 | ? ReadonlyArray> 165 | : T extends {} 166 | ? { [K in Exclude]?: DeepPartial } 167 | : Partial; 168 | 169 | type KeysOfUnion = T extends T ? keyof T : never; 170 | export type Exact = P extends Builtin 171 | ? P 172 | : P & { [K in keyof P]: Exact } & Record< 173 | Exclude | "$type">, 174 | never 175 | >; 176 | 177 | if (_m0.util.Long !== Long) { 178 | _m0.util.Long = Long as any; 179 | _m0.configure(); 180 | } 181 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/mdb/clickhouse/v1/version.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.mdb.clickhouse.v1"; 7 | 8 | export interface Version { 9 | $type: "yandex.cloud.mdb.clickhouse.v1.Version"; 10 | /** ID of the version. */ 11 | id: string; 12 | /** Name of the version. */ 13 | name: string; 14 | /** Whether version is deprecated. */ 15 | deprecated: boolean; 16 | /** List of versions that can be updated from current. */ 17 | updatableTo: string[]; 18 | } 19 | 20 | const baseVersion: object = { 21 | $type: "yandex.cloud.mdb.clickhouse.v1.Version", 22 | id: "", 23 | name: "", 24 | deprecated: false, 25 | updatableTo: "", 26 | }; 27 | 28 | export const Version = { 29 | $type: "yandex.cloud.mdb.clickhouse.v1.Version" as const, 30 | 31 | encode( 32 | message: Version, 33 | writer: _m0.Writer = _m0.Writer.create() 34 | ): _m0.Writer { 35 | if (message.id !== "") { 36 | writer.uint32(10).string(message.id); 37 | } 38 | if (message.name !== "") { 39 | writer.uint32(18).string(message.name); 40 | } 41 | if (message.deprecated === true) { 42 | writer.uint32(24).bool(message.deprecated); 43 | } 44 | for (const v of message.updatableTo) { 45 | writer.uint32(34).string(v!); 46 | } 47 | return writer; 48 | }, 49 | 50 | decode(input: _m0.Reader | Uint8Array, length?: number): Version { 51 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 52 | let end = length === undefined ? reader.len : reader.pos + length; 53 | const message = { ...baseVersion } as Version; 54 | message.updatableTo = []; 55 | while (reader.pos < end) { 56 | const tag = reader.uint32(); 57 | switch (tag >>> 3) { 58 | case 1: 59 | message.id = reader.string(); 60 | break; 61 | case 2: 62 | message.name = reader.string(); 63 | break; 64 | case 3: 65 | message.deprecated = reader.bool(); 66 | break; 67 | case 4: 68 | message.updatableTo.push(reader.string()); 69 | break; 70 | default: 71 | reader.skipType(tag & 7); 72 | break; 73 | } 74 | } 75 | return message; 76 | }, 77 | 78 | fromJSON(object: any): Version { 79 | const message = { ...baseVersion } as Version; 80 | message.id = 81 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 82 | message.name = 83 | object.name !== undefined && object.name !== null 84 | ? String(object.name) 85 | : ""; 86 | message.deprecated = 87 | object.deprecated !== undefined && object.deprecated !== null 88 | ? Boolean(object.deprecated) 89 | : false; 90 | message.updatableTo = (object.updatableTo ?? []).map((e: any) => String(e)); 91 | return message; 92 | }, 93 | 94 | toJSON(message: Version): unknown { 95 | const obj: any = {}; 96 | message.id !== undefined && (obj.id = message.id); 97 | message.name !== undefined && (obj.name = message.name); 98 | message.deprecated !== undefined && (obj.deprecated = message.deprecated); 99 | if (message.updatableTo) { 100 | obj.updatableTo = message.updatableTo.map((e) => e); 101 | } else { 102 | obj.updatableTo = []; 103 | } 104 | return obj; 105 | }, 106 | 107 | fromPartial, I>>(object: I): Version { 108 | const message = { ...baseVersion } as Version; 109 | message.id = object.id ?? ""; 110 | message.name = object.name ?? ""; 111 | message.deprecated = object.deprecated ?? false; 112 | message.updatableTo = object.updatableTo?.map((e) => e) || []; 113 | return message; 114 | }, 115 | }; 116 | 117 | messageTypeRegistry.set(Version.$type, Version); 118 | 119 | type Builtin = 120 | | Date 121 | | Function 122 | | Uint8Array 123 | | string 124 | | number 125 | | boolean 126 | | undefined; 127 | 128 | export type DeepPartial = T extends Builtin 129 | ? T 130 | : T extends Array 131 | ? Array> 132 | : T extends ReadonlyArray 133 | ? ReadonlyArray> 134 | : T extends {} 135 | ? { [K in Exclude]?: DeepPartial } 136 | : Partial; 137 | 138 | type KeysOfUnion = T extends T ? keyof T : never; 139 | export type Exact = P extends Builtin 140 | ? P 141 | : P & { [K in keyof P]: Exact } & Record< 142 | Exclude | "$type">, 143 | never 144 | >; 145 | 146 | if (_m0.util.Long !== Long) { 147 | _m0.util.Long = Long as any; 148 | _m0.configure(); 149 | } 150 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/mdb/kafka/v1/common.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import Long from "long"; 3 | import _m0 from "protobufjs/minimal"; 4 | 5 | export const protobufPackage = "yandex.cloud.mdb.kafka.v1"; 6 | 7 | export enum CompressionType { 8 | COMPRESSION_TYPE_UNSPECIFIED = 0, 9 | /** COMPRESSION_TYPE_UNCOMPRESSED - no codec (uncompressed). */ 10 | COMPRESSION_TYPE_UNCOMPRESSED = 1, 11 | /** COMPRESSION_TYPE_ZSTD - Zstandard codec. */ 12 | COMPRESSION_TYPE_ZSTD = 2, 13 | /** COMPRESSION_TYPE_LZ4 - LZ4 codec. */ 14 | COMPRESSION_TYPE_LZ4 = 3, 15 | /** COMPRESSION_TYPE_SNAPPY - Snappy codec. */ 16 | COMPRESSION_TYPE_SNAPPY = 4, 17 | /** COMPRESSION_TYPE_GZIP - GZip codec. */ 18 | COMPRESSION_TYPE_GZIP = 5, 19 | /** COMPRESSION_TYPE_PRODUCER - the codec to use is set by a producer (can be any of `ZSTD`, `LZ4`, `GZIP` or `SNAPPY` codecs). */ 20 | COMPRESSION_TYPE_PRODUCER = 6, 21 | UNRECOGNIZED = -1, 22 | } 23 | 24 | export function compressionTypeFromJSON(object: any): CompressionType { 25 | switch (object) { 26 | case 0: 27 | case "COMPRESSION_TYPE_UNSPECIFIED": 28 | return CompressionType.COMPRESSION_TYPE_UNSPECIFIED; 29 | case 1: 30 | case "COMPRESSION_TYPE_UNCOMPRESSED": 31 | return CompressionType.COMPRESSION_TYPE_UNCOMPRESSED; 32 | case 2: 33 | case "COMPRESSION_TYPE_ZSTD": 34 | return CompressionType.COMPRESSION_TYPE_ZSTD; 35 | case 3: 36 | case "COMPRESSION_TYPE_LZ4": 37 | return CompressionType.COMPRESSION_TYPE_LZ4; 38 | case 4: 39 | case "COMPRESSION_TYPE_SNAPPY": 40 | return CompressionType.COMPRESSION_TYPE_SNAPPY; 41 | case 5: 42 | case "COMPRESSION_TYPE_GZIP": 43 | return CompressionType.COMPRESSION_TYPE_GZIP; 44 | case 6: 45 | case "COMPRESSION_TYPE_PRODUCER": 46 | return CompressionType.COMPRESSION_TYPE_PRODUCER; 47 | case -1: 48 | case "UNRECOGNIZED": 49 | default: 50 | return CompressionType.UNRECOGNIZED; 51 | } 52 | } 53 | 54 | export function compressionTypeToJSON(object: CompressionType): string { 55 | switch (object) { 56 | case CompressionType.COMPRESSION_TYPE_UNSPECIFIED: 57 | return "COMPRESSION_TYPE_UNSPECIFIED"; 58 | case CompressionType.COMPRESSION_TYPE_UNCOMPRESSED: 59 | return "COMPRESSION_TYPE_UNCOMPRESSED"; 60 | case CompressionType.COMPRESSION_TYPE_ZSTD: 61 | return "COMPRESSION_TYPE_ZSTD"; 62 | case CompressionType.COMPRESSION_TYPE_LZ4: 63 | return "COMPRESSION_TYPE_LZ4"; 64 | case CompressionType.COMPRESSION_TYPE_SNAPPY: 65 | return "COMPRESSION_TYPE_SNAPPY"; 66 | case CompressionType.COMPRESSION_TYPE_GZIP: 67 | return "COMPRESSION_TYPE_GZIP"; 68 | case CompressionType.COMPRESSION_TYPE_PRODUCER: 69 | return "COMPRESSION_TYPE_PRODUCER"; 70 | default: 71 | return "UNKNOWN"; 72 | } 73 | } 74 | 75 | export enum SaslMechanism { 76 | SASL_MECHANISM_UNSPECIFIED = 0, 77 | SASL_MECHANISM_SCRAM_SHA_256 = 1, 78 | SASL_MECHANISM_SCRAM_SHA_512 = 2, 79 | UNRECOGNIZED = -1, 80 | } 81 | 82 | export function saslMechanismFromJSON(object: any): SaslMechanism { 83 | switch (object) { 84 | case 0: 85 | case "SASL_MECHANISM_UNSPECIFIED": 86 | return SaslMechanism.SASL_MECHANISM_UNSPECIFIED; 87 | case 1: 88 | case "SASL_MECHANISM_SCRAM_SHA_256": 89 | return SaslMechanism.SASL_MECHANISM_SCRAM_SHA_256; 90 | case 2: 91 | case "SASL_MECHANISM_SCRAM_SHA_512": 92 | return SaslMechanism.SASL_MECHANISM_SCRAM_SHA_512; 93 | case -1: 94 | case "UNRECOGNIZED": 95 | default: 96 | return SaslMechanism.UNRECOGNIZED; 97 | } 98 | } 99 | 100 | export function saslMechanismToJSON(object: SaslMechanism): string { 101 | switch (object) { 102 | case SaslMechanism.SASL_MECHANISM_UNSPECIFIED: 103 | return "SASL_MECHANISM_UNSPECIFIED"; 104 | case SaslMechanism.SASL_MECHANISM_SCRAM_SHA_256: 105 | return "SASL_MECHANISM_SCRAM_SHA_256"; 106 | case SaslMechanism.SASL_MECHANISM_SCRAM_SHA_512: 107 | return "SASL_MECHANISM_SCRAM_SHA_512"; 108 | default: 109 | return "UNKNOWN"; 110 | } 111 | } 112 | 113 | if (_m0.util.Long !== Long) { 114 | _m0.util.Long = Long as any; 115 | _m0.configure(); 116 | } 117 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/mdb/kafka/v1/resource_preset.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.mdb.kafka.v1"; 7 | 8 | /** A ResourcePreset resource for describing hardware configuration presets. */ 9 | export interface ResourcePreset { 10 | $type: "yandex.cloud.mdb.kafka.v1.ResourcePreset"; 11 | /** ID of the resource preset. */ 12 | id: string; 13 | /** IDs of availability zones where the resource preset is available. */ 14 | zoneIds: string[]; 15 | /** Number of CPU cores for a Kafka broker created with the preset. */ 16 | cores: number; 17 | /** RAM volume for a Kafka broker created with the preset, in bytes. */ 18 | memory: number; 19 | } 20 | 21 | const baseResourcePreset: object = { 22 | $type: "yandex.cloud.mdb.kafka.v1.ResourcePreset", 23 | id: "", 24 | zoneIds: "", 25 | cores: 0, 26 | memory: 0, 27 | }; 28 | 29 | export const ResourcePreset = { 30 | $type: "yandex.cloud.mdb.kafka.v1.ResourcePreset" as const, 31 | 32 | encode( 33 | message: ResourcePreset, 34 | writer: _m0.Writer = _m0.Writer.create() 35 | ): _m0.Writer { 36 | if (message.id !== "") { 37 | writer.uint32(10).string(message.id); 38 | } 39 | for (const v of message.zoneIds) { 40 | writer.uint32(18).string(v!); 41 | } 42 | if (message.cores !== 0) { 43 | writer.uint32(24).int64(message.cores); 44 | } 45 | if (message.memory !== 0) { 46 | writer.uint32(32).int64(message.memory); 47 | } 48 | return writer; 49 | }, 50 | 51 | decode(input: _m0.Reader | Uint8Array, length?: number): ResourcePreset { 52 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 53 | let end = length === undefined ? reader.len : reader.pos + length; 54 | const message = { ...baseResourcePreset } as ResourcePreset; 55 | message.zoneIds = []; 56 | while (reader.pos < end) { 57 | const tag = reader.uint32(); 58 | switch (tag >>> 3) { 59 | case 1: 60 | message.id = reader.string(); 61 | break; 62 | case 2: 63 | message.zoneIds.push(reader.string()); 64 | break; 65 | case 3: 66 | message.cores = longToNumber(reader.int64() as Long); 67 | break; 68 | case 4: 69 | message.memory = longToNumber(reader.int64() as Long); 70 | break; 71 | default: 72 | reader.skipType(tag & 7); 73 | break; 74 | } 75 | } 76 | return message; 77 | }, 78 | 79 | fromJSON(object: any): ResourcePreset { 80 | const message = { ...baseResourcePreset } as ResourcePreset; 81 | message.id = 82 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 83 | message.zoneIds = (object.zoneIds ?? []).map((e: any) => String(e)); 84 | message.cores = 85 | object.cores !== undefined && object.cores !== null 86 | ? Number(object.cores) 87 | : 0; 88 | message.memory = 89 | object.memory !== undefined && object.memory !== null 90 | ? Number(object.memory) 91 | : 0; 92 | return message; 93 | }, 94 | 95 | toJSON(message: ResourcePreset): unknown { 96 | const obj: any = {}; 97 | message.id !== undefined && (obj.id = message.id); 98 | if (message.zoneIds) { 99 | obj.zoneIds = message.zoneIds.map((e) => e); 100 | } else { 101 | obj.zoneIds = []; 102 | } 103 | message.cores !== undefined && (obj.cores = Math.round(message.cores)); 104 | message.memory !== undefined && (obj.memory = Math.round(message.memory)); 105 | return obj; 106 | }, 107 | 108 | fromPartial, I>>( 109 | object: I 110 | ): ResourcePreset { 111 | const message = { ...baseResourcePreset } as ResourcePreset; 112 | message.id = object.id ?? ""; 113 | message.zoneIds = object.zoneIds?.map((e) => e) || []; 114 | message.cores = object.cores ?? 0; 115 | message.memory = object.memory ?? 0; 116 | return message; 117 | }, 118 | }; 119 | 120 | messageTypeRegistry.set(ResourcePreset.$type, ResourcePreset); 121 | 122 | declare var self: any | undefined; 123 | declare var window: any | undefined; 124 | declare var global: any | undefined; 125 | var globalThis: any = (() => { 126 | if (typeof globalThis !== "undefined") return globalThis; 127 | if (typeof self !== "undefined") return self; 128 | if (typeof window !== "undefined") return window; 129 | if (typeof global !== "undefined") return global; 130 | throw "Unable to locate global object"; 131 | })(); 132 | 133 | type Builtin = 134 | | Date 135 | | Function 136 | | Uint8Array 137 | | string 138 | | number 139 | | boolean 140 | | undefined; 141 | 142 | export type DeepPartial = T extends Builtin 143 | ? T 144 | : T extends Array 145 | ? Array> 146 | : T extends ReadonlyArray 147 | ? ReadonlyArray> 148 | : T extends {} 149 | ? { [K in Exclude]?: DeepPartial } 150 | : Partial; 151 | 152 | type KeysOfUnion = T extends T ? keyof T : never; 153 | export type Exact = P extends Builtin 154 | ? P 155 | : P & { [K in keyof P]: Exact } & Record< 156 | Exclude | "$type">, 157 | never 158 | >; 159 | 160 | function longToNumber(long: Long): number { 161 | if (long.gt(Number.MAX_SAFE_INTEGER)) { 162 | throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); 163 | } 164 | return long.toNumber(); 165 | } 166 | 167 | if (_m0.util.Long !== Long) { 168 | _m0.util.Long = Long as any; 169 | _m0.configure(); 170 | } 171 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/mdb/redis/v1/resource_preset.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.mdb.redis.v1"; 7 | 8 | /** A resource preset that describes hardware configuration for a host. */ 9 | export interface ResourcePreset { 10 | $type: "yandex.cloud.mdb.redis.v1.ResourcePreset"; 11 | /** ID of the resource preset. */ 12 | id: string; 13 | /** IDs of availability zones where the resource preset is available. */ 14 | zoneIds: string[]; 15 | /** RAM volume for a Redis host created with the preset, in bytes. */ 16 | memory: number; 17 | /** Number of CPU cores for a Redis host created with the preset. */ 18 | cores: number; 19 | } 20 | 21 | const baseResourcePreset: object = { 22 | $type: "yandex.cloud.mdb.redis.v1.ResourcePreset", 23 | id: "", 24 | zoneIds: "", 25 | memory: 0, 26 | cores: 0, 27 | }; 28 | 29 | export const ResourcePreset = { 30 | $type: "yandex.cloud.mdb.redis.v1.ResourcePreset" as const, 31 | 32 | encode( 33 | message: ResourcePreset, 34 | writer: _m0.Writer = _m0.Writer.create() 35 | ): _m0.Writer { 36 | if (message.id !== "") { 37 | writer.uint32(10).string(message.id); 38 | } 39 | for (const v of message.zoneIds) { 40 | writer.uint32(18).string(v!); 41 | } 42 | if (message.memory !== 0) { 43 | writer.uint32(24).int64(message.memory); 44 | } 45 | if (message.cores !== 0) { 46 | writer.uint32(32).int64(message.cores); 47 | } 48 | return writer; 49 | }, 50 | 51 | decode(input: _m0.Reader | Uint8Array, length?: number): ResourcePreset { 52 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 53 | let end = length === undefined ? reader.len : reader.pos + length; 54 | const message = { ...baseResourcePreset } as ResourcePreset; 55 | message.zoneIds = []; 56 | while (reader.pos < end) { 57 | const tag = reader.uint32(); 58 | switch (tag >>> 3) { 59 | case 1: 60 | message.id = reader.string(); 61 | break; 62 | case 2: 63 | message.zoneIds.push(reader.string()); 64 | break; 65 | case 3: 66 | message.memory = longToNumber(reader.int64() as Long); 67 | break; 68 | case 4: 69 | message.cores = longToNumber(reader.int64() as Long); 70 | break; 71 | default: 72 | reader.skipType(tag & 7); 73 | break; 74 | } 75 | } 76 | return message; 77 | }, 78 | 79 | fromJSON(object: any): ResourcePreset { 80 | const message = { ...baseResourcePreset } as ResourcePreset; 81 | message.id = 82 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 83 | message.zoneIds = (object.zoneIds ?? []).map((e: any) => String(e)); 84 | message.memory = 85 | object.memory !== undefined && object.memory !== null 86 | ? Number(object.memory) 87 | : 0; 88 | message.cores = 89 | object.cores !== undefined && object.cores !== null 90 | ? Number(object.cores) 91 | : 0; 92 | return message; 93 | }, 94 | 95 | toJSON(message: ResourcePreset): unknown { 96 | const obj: any = {}; 97 | message.id !== undefined && (obj.id = message.id); 98 | if (message.zoneIds) { 99 | obj.zoneIds = message.zoneIds.map((e) => e); 100 | } else { 101 | obj.zoneIds = []; 102 | } 103 | message.memory !== undefined && (obj.memory = Math.round(message.memory)); 104 | message.cores !== undefined && (obj.cores = Math.round(message.cores)); 105 | return obj; 106 | }, 107 | 108 | fromPartial, I>>( 109 | object: I 110 | ): ResourcePreset { 111 | const message = { ...baseResourcePreset } as ResourcePreset; 112 | message.id = object.id ?? ""; 113 | message.zoneIds = object.zoneIds?.map((e) => e) || []; 114 | message.memory = object.memory ?? 0; 115 | message.cores = object.cores ?? 0; 116 | return message; 117 | }, 118 | }; 119 | 120 | messageTypeRegistry.set(ResourcePreset.$type, ResourcePreset); 121 | 122 | declare var self: any | undefined; 123 | declare var window: any | undefined; 124 | declare var global: any | undefined; 125 | var globalThis: any = (() => { 126 | if (typeof globalThis !== "undefined") return globalThis; 127 | if (typeof self !== "undefined") return self; 128 | if (typeof window !== "undefined") return window; 129 | if (typeof global !== "undefined") return global; 130 | throw "Unable to locate global object"; 131 | })(); 132 | 133 | type Builtin = 134 | | Date 135 | | Function 136 | | Uint8Array 137 | | string 138 | | number 139 | | boolean 140 | | undefined; 141 | 142 | export type DeepPartial = T extends Builtin 143 | ? T 144 | : T extends Array 145 | ? Array> 146 | : T extends ReadonlyArray 147 | ? ReadonlyArray> 148 | : T extends {} 149 | ? { [K in Exclude]?: DeepPartial } 150 | : Partial; 151 | 152 | type KeysOfUnion = T extends T ? keyof T : never; 153 | export type Exact = P extends Builtin 154 | ? P 155 | : P & { [K in keyof P]: Exact } & Record< 156 | Exclude | "$type">, 157 | never 158 | >; 159 | 160 | function longToNumber(long: Long): number { 161 | if (long.gt(Number.MAX_SAFE_INTEGER)) { 162 | throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); 163 | } 164 | return long.toNumber(); 165 | } 166 | 167 | if (_m0.util.Long !== Long) { 168 | _m0.util.Long = Long as any; 169 | _m0.configure(); 170 | } 171 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/monitoring/index.ts: -------------------------------------------------------------------------------- 1 | export * as chart_widget from './v3/chart_widget' 2 | export * as dashboard from './v3/dashboard' 3 | export * as dashboard_service from './v3/dashboard_service' 4 | export * as downsampling from './v3/downsampling' 5 | export * as parametrization from './v3/parametrization' 6 | export * as text_widget from './v3/text_widget' 7 | export * as title_widget from './v3/title_widget' 8 | export * as unit_format from './v3/unit_format' 9 | export * as widget from './v3/widget' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/monitoring/v3/text_widget.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.monitoring.v3"; 7 | 8 | /** Text widget. */ 9 | export interface TextWidget { 10 | $type: "yandex.cloud.monitoring.v3.TextWidget"; 11 | /** Text. */ 12 | text: string; 13 | } 14 | 15 | const baseTextWidget: object = { 16 | $type: "yandex.cloud.monitoring.v3.TextWidget", 17 | text: "", 18 | }; 19 | 20 | export const TextWidget = { 21 | $type: "yandex.cloud.monitoring.v3.TextWidget" as const, 22 | 23 | encode( 24 | message: TextWidget, 25 | writer: _m0.Writer = _m0.Writer.create() 26 | ): _m0.Writer { 27 | if (message.text !== "") { 28 | writer.uint32(10).string(message.text); 29 | } 30 | return writer; 31 | }, 32 | 33 | decode(input: _m0.Reader | Uint8Array, length?: number): TextWidget { 34 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 35 | let end = length === undefined ? reader.len : reader.pos + length; 36 | const message = { ...baseTextWidget } as TextWidget; 37 | while (reader.pos < end) { 38 | const tag = reader.uint32(); 39 | switch (tag >>> 3) { 40 | case 1: 41 | message.text = reader.string(); 42 | break; 43 | default: 44 | reader.skipType(tag & 7); 45 | break; 46 | } 47 | } 48 | return message; 49 | }, 50 | 51 | fromJSON(object: any): TextWidget { 52 | const message = { ...baseTextWidget } as TextWidget; 53 | message.text = 54 | object.text !== undefined && object.text !== null 55 | ? String(object.text) 56 | : ""; 57 | return message; 58 | }, 59 | 60 | toJSON(message: TextWidget): unknown { 61 | const obj: any = {}; 62 | message.text !== undefined && (obj.text = message.text); 63 | return obj; 64 | }, 65 | 66 | fromPartial, I>>( 67 | object: I 68 | ): TextWidget { 69 | const message = { ...baseTextWidget } as TextWidget; 70 | message.text = object.text ?? ""; 71 | return message; 72 | }, 73 | }; 74 | 75 | messageTypeRegistry.set(TextWidget.$type, TextWidget); 76 | 77 | type Builtin = 78 | | Date 79 | | Function 80 | | Uint8Array 81 | | string 82 | | number 83 | | boolean 84 | | undefined; 85 | 86 | export type DeepPartial = T extends Builtin 87 | ? T 88 | : T extends Array 89 | ? Array> 90 | : T extends ReadonlyArray 91 | ? ReadonlyArray> 92 | : T extends {} 93 | ? { [K in Exclude]?: DeepPartial } 94 | : Partial; 95 | 96 | type KeysOfUnion = T extends T ? keyof T : never; 97 | export type Exact = P extends Builtin 98 | ? P 99 | : P & { [K in keyof P]: Exact } & Record< 100 | Exclude | "$type">, 101 | never 102 | >; 103 | 104 | if (_m0.util.Long !== Long) { 105 | _m0.util.Long = Long as any; 106 | _m0.configure(); 107 | } 108 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/monitoring/v3/title_widget.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.monitoring.v3"; 7 | 8 | /** Title widget. */ 9 | export interface TitleWidget { 10 | $type: "yandex.cloud.monitoring.v3.TitleWidget"; 11 | /** Title text. */ 12 | text: string; 13 | /** Title size. */ 14 | size: TitleWidget_TitleSize; 15 | } 16 | 17 | /** Title size. */ 18 | export enum TitleWidget_TitleSize { 19 | TITLE_SIZE_UNSPECIFIED = 0, 20 | /** TITLE_SIZE_XS - Extra small size. */ 21 | TITLE_SIZE_XS = 1, 22 | /** TITLE_SIZE_S - Small size. */ 23 | TITLE_SIZE_S = 2, 24 | /** TITLE_SIZE_M - Middle size. */ 25 | TITLE_SIZE_M = 3, 26 | /** TITLE_SIZE_L - Large size. */ 27 | TITLE_SIZE_L = 4, 28 | UNRECOGNIZED = -1, 29 | } 30 | 31 | export function titleWidget_TitleSizeFromJSON( 32 | object: any 33 | ): TitleWidget_TitleSize { 34 | switch (object) { 35 | case 0: 36 | case "TITLE_SIZE_UNSPECIFIED": 37 | return TitleWidget_TitleSize.TITLE_SIZE_UNSPECIFIED; 38 | case 1: 39 | case "TITLE_SIZE_XS": 40 | return TitleWidget_TitleSize.TITLE_SIZE_XS; 41 | case 2: 42 | case "TITLE_SIZE_S": 43 | return TitleWidget_TitleSize.TITLE_SIZE_S; 44 | case 3: 45 | case "TITLE_SIZE_M": 46 | return TitleWidget_TitleSize.TITLE_SIZE_M; 47 | case 4: 48 | case "TITLE_SIZE_L": 49 | return TitleWidget_TitleSize.TITLE_SIZE_L; 50 | case -1: 51 | case "UNRECOGNIZED": 52 | default: 53 | return TitleWidget_TitleSize.UNRECOGNIZED; 54 | } 55 | } 56 | 57 | export function titleWidget_TitleSizeToJSON( 58 | object: TitleWidget_TitleSize 59 | ): string { 60 | switch (object) { 61 | case TitleWidget_TitleSize.TITLE_SIZE_UNSPECIFIED: 62 | return "TITLE_SIZE_UNSPECIFIED"; 63 | case TitleWidget_TitleSize.TITLE_SIZE_XS: 64 | return "TITLE_SIZE_XS"; 65 | case TitleWidget_TitleSize.TITLE_SIZE_S: 66 | return "TITLE_SIZE_S"; 67 | case TitleWidget_TitleSize.TITLE_SIZE_M: 68 | return "TITLE_SIZE_M"; 69 | case TitleWidget_TitleSize.TITLE_SIZE_L: 70 | return "TITLE_SIZE_L"; 71 | default: 72 | return "UNKNOWN"; 73 | } 74 | } 75 | 76 | const baseTitleWidget: object = { 77 | $type: "yandex.cloud.monitoring.v3.TitleWidget", 78 | text: "", 79 | size: 0, 80 | }; 81 | 82 | export const TitleWidget = { 83 | $type: "yandex.cloud.monitoring.v3.TitleWidget" as const, 84 | 85 | encode( 86 | message: TitleWidget, 87 | writer: _m0.Writer = _m0.Writer.create() 88 | ): _m0.Writer { 89 | if (message.text !== "") { 90 | writer.uint32(10).string(message.text); 91 | } 92 | if (message.size !== 0) { 93 | writer.uint32(16).int32(message.size); 94 | } 95 | return writer; 96 | }, 97 | 98 | decode(input: _m0.Reader | Uint8Array, length?: number): TitleWidget { 99 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 100 | let end = length === undefined ? reader.len : reader.pos + length; 101 | const message = { ...baseTitleWidget } as TitleWidget; 102 | while (reader.pos < end) { 103 | const tag = reader.uint32(); 104 | switch (tag >>> 3) { 105 | case 1: 106 | message.text = reader.string(); 107 | break; 108 | case 2: 109 | message.size = reader.int32() as any; 110 | break; 111 | default: 112 | reader.skipType(tag & 7); 113 | break; 114 | } 115 | } 116 | return message; 117 | }, 118 | 119 | fromJSON(object: any): TitleWidget { 120 | const message = { ...baseTitleWidget } as TitleWidget; 121 | message.text = 122 | object.text !== undefined && object.text !== null 123 | ? String(object.text) 124 | : ""; 125 | message.size = 126 | object.size !== undefined && object.size !== null 127 | ? titleWidget_TitleSizeFromJSON(object.size) 128 | : 0; 129 | return message; 130 | }, 131 | 132 | toJSON(message: TitleWidget): unknown { 133 | const obj: any = {}; 134 | message.text !== undefined && (obj.text = message.text); 135 | message.size !== undefined && 136 | (obj.size = titleWidget_TitleSizeToJSON(message.size)); 137 | return obj; 138 | }, 139 | 140 | fromPartial, I>>( 141 | object: I 142 | ): TitleWidget { 143 | const message = { ...baseTitleWidget } as TitleWidget; 144 | message.text = object.text ?? ""; 145 | message.size = object.size ?? 0; 146 | return message; 147 | }, 148 | }; 149 | 150 | messageTypeRegistry.set(TitleWidget.$type, TitleWidget); 151 | 152 | type Builtin = 153 | | Date 154 | | Function 155 | | Uint8Array 156 | | string 157 | | number 158 | | boolean 159 | | undefined; 160 | 161 | export type DeepPartial = T extends Builtin 162 | ? T 163 | : T extends Array 164 | ? Array> 165 | : T extends ReadonlyArray 166 | ? ReadonlyArray> 167 | : T extends {} 168 | ? { [K in Exclude]?: DeepPartial } 169 | : Partial; 170 | 171 | type KeysOfUnion = T extends T ? keyof T : never; 172 | export type Exact = P extends Builtin 173 | ? P 174 | : P & { [K in keyof P]: Exact } & Record< 175 | Exclude | "$type">, 176 | never 177 | >; 178 | 179 | if (_m0.util.Long !== Long) { 180 | _m0.util.Long = Long as any; 181 | _m0.configure(); 182 | } 183 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/oauth/index.ts: -------------------------------------------------------------------------------- 1 | export * as claims from './claims' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/operation/index.ts: -------------------------------------------------------------------------------- 1 | export * as operation from './operation' 2 | export * as operation_service from './operation_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/organizationmanager/index.ts: -------------------------------------------------------------------------------- 1 | export * as group from './v1/group' 2 | export * as group_mapping from './v1/group_mapping' 3 | export * as group_mapping_service from './v1/group_mapping_service' 4 | export * as group_service from './v1/group_service' 5 | export * as organization from './v1/organization' 6 | export * as organization_service from './v1/organization_service' 7 | export * as ssh_certificate_service from './v1/ssh_certificate_service' 8 | export * as user_account from './v1/user_account' 9 | export * as user_service from './v1/user_service' 10 | export * as certificate from './v1/saml/certificate' 11 | export * as certificate_service from './v1/saml/certificate_service' 12 | export * as federation from './v1/saml/federation' 13 | export * as federation_service from './v1/saml/federation_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/quota/index.ts: -------------------------------------------------------------------------------- 1 | export * as quota from './quota' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/reference/index.ts: -------------------------------------------------------------------------------- 1 | export * as reference from './reference' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/resourcemanager/index.ts: -------------------------------------------------------------------------------- 1 | export * as cloud from './v1/cloud' 2 | export * as cloud_service from './v1/cloud_service' 3 | export * as folder from './v1/folder' 4 | export * as folder_service from './v1/folder_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/serverless/index.ts: -------------------------------------------------------------------------------- 1 | export * as apigateway from './apigateway/v1/apigateway' 2 | export * as apigateway_service from './apigateway/v1/apigateway_service' 3 | export * as containers_container from './containers/v1/container' 4 | export * as containers_container_service from './containers/v1/container_service' 5 | export * as functions_function from './functions/v1/function' 6 | export * as functions_function_service from './functions/v1/function_service' 7 | export * as mdbproxy_proxy from './mdbproxy/v1/proxy' 8 | export * as mdbproxy_proxy_service from './mdbproxy/v1/proxy_service' 9 | export * as triggers_predicate from './triggers/v1/predicate' 10 | export * as triggers_trigger from './triggers/v1/trigger' 11 | export * as triggers_trigger_service from './triggers/v1/trigger_service' 12 | export * as apigateway_connection from './apigateway/websocket/v1/connection' 13 | export * as apigateway_connection_service from './apigateway/websocket/v1/connection_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/storage/index.ts: -------------------------------------------------------------------------------- 1 | export * as bucket from './v1/bucket' 2 | export * as bucket_service from './v1/bucket_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/validation.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud"; 7 | 8 | export interface MapKeySpec { 9 | $type: "yandex.cloud.MapKeySpec"; 10 | value: string; 11 | pattern: string; 12 | length: string; 13 | } 14 | 15 | const baseMapKeySpec: object = { 16 | $type: "yandex.cloud.MapKeySpec", 17 | value: "", 18 | pattern: "", 19 | length: "", 20 | }; 21 | 22 | export const MapKeySpec = { 23 | $type: "yandex.cloud.MapKeySpec" as const, 24 | 25 | encode( 26 | message: MapKeySpec, 27 | writer: _m0.Writer = _m0.Writer.create() 28 | ): _m0.Writer { 29 | if (message.value !== "") { 30 | writer.uint32(10).string(message.value); 31 | } 32 | if (message.pattern !== "") { 33 | writer.uint32(18).string(message.pattern); 34 | } 35 | if (message.length !== "") { 36 | writer.uint32(26).string(message.length); 37 | } 38 | return writer; 39 | }, 40 | 41 | decode(input: _m0.Reader | Uint8Array, length?: number): MapKeySpec { 42 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 43 | let end = length === undefined ? reader.len : reader.pos + length; 44 | const message = { ...baseMapKeySpec } as MapKeySpec; 45 | while (reader.pos < end) { 46 | const tag = reader.uint32(); 47 | switch (tag >>> 3) { 48 | case 1: 49 | message.value = reader.string(); 50 | break; 51 | case 2: 52 | message.pattern = reader.string(); 53 | break; 54 | case 3: 55 | message.length = reader.string(); 56 | break; 57 | default: 58 | reader.skipType(tag & 7); 59 | break; 60 | } 61 | } 62 | return message; 63 | }, 64 | 65 | fromJSON(object: any): MapKeySpec { 66 | const message = { ...baseMapKeySpec } as MapKeySpec; 67 | message.value = 68 | object.value !== undefined && object.value !== null 69 | ? String(object.value) 70 | : ""; 71 | message.pattern = 72 | object.pattern !== undefined && object.pattern !== null 73 | ? String(object.pattern) 74 | : ""; 75 | message.length = 76 | object.length !== undefined && object.length !== null 77 | ? String(object.length) 78 | : ""; 79 | return message; 80 | }, 81 | 82 | toJSON(message: MapKeySpec): unknown { 83 | const obj: any = {}; 84 | message.value !== undefined && (obj.value = message.value); 85 | message.pattern !== undefined && (obj.pattern = message.pattern); 86 | message.length !== undefined && (obj.length = message.length); 87 | return obj; 88 | }, 89 | 90 | fromPartial, I>>( 91 | object: I 92 | ): MapKeySpec { 93 | const message = { ...baseMapKeySpec } as MapKeySpec; 94 | message.value = object.value ?? ""; 95 | message.pattern = object.pattern ?? ""; 96 | message.length = object.length ?? ""; 97 | return message; 98 | }, 99 | }; 100 | 101 | messageTypeRegistry.set(MapKeySpec.$type, MapKeySpec); 102 | 103 | type Builtin = 104 | | Date 105 | | Function 106 | | Uint8Array 107 | | string 108 | | number 109 | | boolean 110 | | undefined; 111 | 112 | export type DeepPartial = T extends Builtin 113 | ? T 114 | : T extends Array 115 | ? Array> 116 | : T extends ReadonlyArray 117 | ? ReadonlyArray> 118 | : T extends {} 119 | ? { [K in Exclude]?: DeepPartial } 120 | : Partial; 121 | 122 | type KeysOfUnion = T extends T ? keyof T : never; 123 | export type Exact = P extends Builtin 124 | ? P 125 | : P & { [K in keyof P]: Exact } & Record< 126 | Exclude | "$type">, 127 | never 128 | >; 129 | 130 | if (_m0.util.Long !== Long) { 131 | _m0.util.Long = Long as any; 132 | _m0.configure(); 133 | } 134 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/vpc/index.ts: -------------------------------------------------------------------------------- 1 | export * as address from './v1/address' 2 | export * as address_service from './v1/address_service' 3 | export * as gateway from './v1/gateway' 4 | export * as gateway_service from './v1/gateway_service' 5 | export * as network from './v1/network' 6 | export * as network_service from './v1/network_service' 7 | export * as route_table from './v1/route_table' 8 | export * as route_table_service from './v1/route_table_service' 9 | export * as security_group from './v1/security_group' 10 | export * as security_group_service from './v1/security_group_service' 11 | export * as subnet from './v1/subnet' 12 | export * as subnet_service from './v1/subnet_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ydb/index.ts: -------------------------------------------------------------------------------- 1 | export * as backup from './v1/backup' 2 | export * as backup_service from './v1/backup_service' 3 | export * as database from './v1/database' 4 | export * as database_service from './v1/database_service' 5 | export * as location from './v1/location' 6 | export * as location_service from './v1/location_service' 7 | export * as resource_preset from './v1/resource_preset' 8 | export * as resource_preset_service from './v1/resource_preset_service' 9 | export * as storage_type from './v1/storage_type' 10 | export * as storage_type_service from './v1/storage_type_service' -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ydb/v1/location.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.ydb.v1"; 7 | 8 | export interface Location { 9 | $type: "yandex.cloud.ydb.v1.Location"; 10 | id: string; 11 | description: string; 12 | } 13 | 14 | const baseLocation: object = { 15 | $type: "yandex.cloud.ydb.v1.Location", 16 | id: "", 17 | description: "", 18 | }; 19 | 20 | export const Location = { 21 | $type: "yandex.cloud.ydb.v1.Location" as const, 22 | 23 | encode( 24 | message: Location, 25 | writer: _m0.Writer = _m0.Writer.create() 26 | ): _m0.Writer { 27 | if (message.id !== "") { 28 | writer.uint32(10).string(message.id); 29 | } 30 | if (message.description !== "") { 31 | writer.uint32(18).string(message.description); 32 | } 33 | return writer; 34 | }, 35 | 36 | decode(input: _m0.Reader | Uint8Array, length?: number): Location { 37 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 38 | let end = length === undefined ? reader.len : reader.pos + length; 39 | const message = { ...baseLocation } as Location; 40 | while (reader.pos < end) { 41 | const tag = reader.uint32(); 42 | switch (tag >>> 3) { 43 | case 1: 44 | message.id = reader.string(); 45 | break; 46 | case 2: 47 | message.description = reader.string(); 48 | break; 49 | default: 50 | reader.skipType(tag & 7); 51 | break; 52 | } 53 | } 54 | return message; 55 | }, 56 | 57 | fromJSON(object: any): Location { 58 | const message = { ...baseLocation } as Location; 59 | message.id = 60 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 61 | message.description = 62 | object.description !== undefined && object.description !== null 63 | ? String(object.description) 64 | : ""; 65 | return message; 66 | }, 67 | 68 | toJSON(message: Location): unknown { 69 | const obj: any = {}; 70 | message.id !== undefined && (obj.id = message.id); 71 | message.description !== undefined && 72 | (obj.description = message.description); 73 | return obj; 74 | }, 75 | 76 | fromPartial, I>>(object: I): Location { 77 | const message = { ...baseLocation } as Location; 78 | message.id = object.id ?? ""; 79 | message.description = object.description ?? ""; 80 | return message; 81 | }, 82 | }; 83 | 84 | messageTypeRegistry.set(Location.$type, Location); 85 | 86 | type Builtin = 87 | | Date 88 | | Function 89 | | Uint8Array 90 | | string 91 | | number 92 | | boolean 93 | | undefined; 94 | 95 | export type DeepPartial = T extends Builtin 96 | ? T 97 | : T extends Array 98 | ? Array> 99 | : T extends ReadonlyArray 100 | ? ReadonlyArray> 101 | : T extends {} 102 | ? { [K in Exclude]?: DeepPartial } 103 | : Partial; 104 | 105 | type KeysOfUnion = T extends T ? keyof T : never; 106 | export type Exact = P extends Builtin 107 | ? P 108 | : P & { [K in keyof P]: Exact } & Record< 109 | Exclude | "$type">, 110 | never 111 | >; 112 | 113 | if (_m0.util.Long !== Long) { 114 | _m0.util.Long = Long as any; 115 | _m0.configure(); 116 | } 117 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ydb/v1/resource_preset.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.ydb.v1"; 7 | 8 | export interface ResourcePreset { 9 | $type: "yandex.cloud.ydb.v1.ResourcePreset"; 10 | id: string; 11 | cores: number; 12 | memory: number; 13 | } 14 | 15 | const baseResourcePreset: object = { 16 | $type: "yandex.cloud.ydb.v1.ResourcePreset", 17 | id: "", 18 | cores: 0, 19 | memory: 0, 20 | }; 21 | 22 | export const ResourcePreset = { 23 | $type: "yandex.cloud.ydb.v1.ResourcePreset" as const, 24 | 25 | encode( 26 | message: ResourcePreset, 27 | writer: _m0.Writer = _m0.Writer.create() 28 | ): _m0.Writer { 29 | if (message.id !== "") { 30 | writer.uint32(10).string(message.id); 31 | } 32 | if (message.cores !== 0) { 33 | writer.uint32(16).int64(message.cores); 34 | } 35 | if (message.memory !== 0) { 36 | writer.uint32(24).int64(message.memory); 37 | } 38 | return writer; 39 | }, 40 | 41 | decode(input: _m0.Reader | Uint8Array, length?: number): ResourcePreset { 42 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 43 | let end = length === undefined ? reader.len : reader.pos + length; 44 | const message = { ...baseResourcePreset } as ResourcePreset; 45 | while (reader.pos < end) { 46 | const tag = reader.uint32(); 47 | switch (tag >>> 3) { 48 | case 1: 49 | message.id = reader.string(); 50 | break; 51 | case 2: 52 | message.cores = longToNumber(reader.int64() as Long); 53 | break; 54 | case 3: 55 | message.memory = longToNumber(reader.int64() as Long); 56 | break; 57 | default: 58 | reader.skipType(tag & 7); 59 | break; 60 | } 61 | } 62 | return message; 63 | }, 64 | 65 | fromJSON(object: any): ResourcePreset { 66 | const message = { ...baseResourcePreset } as ResourcePreset; 67 | message.id = 68 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 69 | message.cores = 70 | object.cores !== undefined && object.cores !== null 71 | ? Number(object.cores) 72 | : 0; 73 | message.memory = 74 | object.memory !== undefined && object.memory !== null 75 | ? Number(object.memory) 76 | : 0; 77 | return message; 78 | }, 79 | 80 | toJSON(message: ResourcePreset): unknown { 81 | const obj: any = {}; 82 | message.id !== undefined && (obj.id = message.id); 83 | message.cores !== undefined && (obj.cores = Math.round(message.cores)); 84 | message.memory !== undefined && (obj.memory = Math.round(message.memory)); 85 | return obj; 86 | }, 87 | 88 | fromPartial, I>>( 89 | object: I 90 | ): ResourcePreset { 91 | const message = { ...baseResourcePreset } as ResourcePreset; 92 | message.id = object.id ?? ""; 93 | message.cores = object.cores ?? 0; 94 | message.memory = object.memory ?? 0; 95 | return message; 96 | }, 97 | }; 98 | 99 | messageTypeRegistry.set(ResourcePreset.$type, ResourcePreset); 100 | 101 | declare var self: any | undefined; 102 | declare var window: any | undefined; 103 | declare var global: any | undefined; 104 | var globalThis: any = (() => { 105 | if (typeof globalThis !== "undefined") return globalThis; 106 | if (typeof self !== "undefined") return self; 107 | if (typeof window !== "undefined") return window; 108 | if (typeof global !== "undefined") return global; 109 | throw "Unable to locate global object"; 110 | })(); 111 | 112 | type Builtin = 113 | | Date 114 | | Function 115 | | Uint8Array 116 | | string 117 | | number 118 | | boolean 119 | | undefined; 120 | 121 | export type DeepPartial = T extends Builtin 122 | ? T 123 | : T extends Array 124 | ? Array> 125 | : T extends ReadonlyArray 126 | ? ReadonlyArray> 127 | : T extends {} 128 | ? { [K in Exclude]?: DeepPartial } 129 | : Partial; 130 | 131 | type KeysOfUnion = T extends T ? keyof T : never; 132 | export type Exact = P extends Builtin 133 | ? P 134 | : P & { [K in keyof P]: Exact } & Record< 135 | Exclude | "$type">, 136 | never 137 | >; 138 | 139 | function longToNumber(long: Long): number { 140 | if (long.gt(Number.MAX_SAFE_INTEGER)) { 141 | throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); 142 | } 143 | return long.toNumber(); 144 | } 145 | 146 | if (_m0.util.Long !== Long) { 147 | _m0.util.Long = Long as any; 148 | _m0.configure(); 149 | } 150 | -------------------------------------------------------------------------------- /src/generated/yandex/cloud/ydb/v1/storage_type.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import { messageTypeRegistry } from "../../../../typeRegistry"; 3 | import Long from "long"; 4 | import _m0 from "protobufjs/minimal"; 5 | 6 | export const protobufPackage = "yandex.cloud.ydb.v1"; 7 | 8 | export interface StorageType { 9 | $type: "yandex.cloud.ydb.v1.StorageType"; 10 | id: string; 11 | deviceType: string; 12 | redundancyType: string; 13 | } 14 | 15 | const baseStorageType: object = { 16 | $type: "yandex.cloud.ydb.v1.StorageType", 17 | id: "", 18 | deviceType: "", 19 | redundancyType: "", 20 | }; 21 | 22 | export const StorageType = { 23 | $type: "yandex.cloud.ydb.v1.StorageType" as const, 24 | 25 | encode( 26 | message: StorageType, 27 | writer: _m0.Writer = _m0.Writer.create() 28 | ): _m0.Writer { 29 | if (message.id !== "") { 30 | writer.uint32(10).string(message.id); 31 | } 32 | if (message.deviceType !== "") { 33 | writer.uint32(18).string(message.deviceType); 34 | } 35 | if (message.redundancyType !== "") { 36 | writer.uint32(26).string(message.redundancyType); 37 | } 38 | return writer; 39 | }, 40 | 41 | decode(input: _m0.Reader | Uint8Array, length?: number): StorageType { 42 | const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); 43 | let end = length === undefined ? reader.len : reader.pos + length; 44 | const message = { ...baseStorageType } as StorageType; 45 | while (reader.pos < end) { 46 | const tag = reader.uint32(); 47 | switch (tag >>> 3) { 48 | case 1: 49 | message.id = reader.string(); 50 | break; 51 | case 2: 52 | message.deviceType = reader.string(); 53 | break; 54 | case 3: 55 | message.redundancyType = reader.string(); 56 | break; 57 | default: 58 | reader.skipType(tag & 7); 59 | break; 60 | } 61 | } 62 | return message; 63 | }, 64 | 65 | fromJSON(object: any): StorageType { 66 | const message = { ...baseStorageType } as StorageType; 67 | message.id = 68 | object.id !== undefined && object.id !== null ? String(object.id) : ""; 69 | message.deviceType = 70 | object.deviceType !== undefined && object.deviceType !== null 71 | ? String(object.deviceType) 72 | : ""; 73 | message.redundancyType = 74 | object.redundancyType !== undefined && object.redundancyType !== null 75 | ? String(object.redundancyType) 76 | : ""; 77 | return message; 78 | }, 79 | 80 | toJSON(message: StorageType): unknown { 81 | const obj: any = {}; 82 | message.id !== undefined && (obj.id = message.id); 83 | message.deviceType !== undefined && (obj.deviceType = message.deviceType); 84 | message.redundancyType !== undefined && 85 | (obj.redundancyType = message.redundancyType); 86 | return obj; 87 | }, 88 | 89 | fromPartial, I>>( 90 | object: I 91 | ): StorageType { 92 | const message = { ...baseStorageType } as StorageType; 93 | message.id = object.id ?? ""; 94 | message.deviceType = object.deviceType ?? ""; 95 | message.redundancyType = object.redundancyType ?? ""; 96 | return message; 97 | }, 98 | }; 99 | 100 | messageTypeRegistry.set(StorageType.$type, StorageType); 101 | 102 | type Builtin = 103 | | Date 104 | | Function 105 | | Uint8Array 106 | | string 107 | | number 108 | | boolean 109 | | undefined; 110 | 111 | export type DeepPartial = T extends Builtin 112 | ? T 113 | : T extends Array 114 | ? Array> 115 | : T extends ReadonlyArray 116 | ? ReadonlyArray> 117 | : T extends {} 118 | ? { [K in Exclude]?: DeepPartial } 119 | : Partial; 120 | 121 | type KeysOfUnion = T extends T ? keyof T : never; 122 | export type Exact = P extends Builtin 123 | ? P 124 | : P & { [K in keyof P]: Exact } & Record< 125 | Exclude | "$type">, 126 | never 127 | >; 128 | 129 | if (_m0.util.Long !== Long) { 130 | _m0.util.Long = Long as any; 131 | _m0.configure(); 132 | } 133 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * as serviceClients from './generated/yandex/cloud/service_clients'; 2 | export * as cloudApi from './generated/yandex/cloud'; 3 | export * from './session'; 4 | export * from './utils/operation'; 5 | export * from './utils/decode-message'; 6 | export * as errors from './errors'; 7 | export { WrappedServiceClientType } from './types'; 8 | -------------------------------------------------------------------------------- /src/middleware/error-metadata.ts: -------------------------------------------------------------------------------- 1 | import { CallOptions, ClientMiddleware, Metadata } from 'nice-grpc'; 2 | import { rethrowAbortError } from 'abort-controller-x'; 3 | import { ApiError } from '../errors'; 4 | 5 | export const errorMetadataMiddleware: ClientMiddleware = async function* errorMetadataMiddleware( 6 | call, 7 | options, 8 | ) { 9 | let md: Metadata | undefined; 10 | const { onHeader } = options; 11 | const callOptions: CallOptions = { 12 | ...options, 13 | onHeader: (header: Metadata) => { 14 | md = header; 15 | if (onHeader !== undefined) { 16 | onHeader(header); 17 | } 18 | }, 19 | }; 20 | 21 | try { 22 | return yield* call.next(call.request, callOptions); 23 | } catch (error: unknown) { 24 | rethrowAbortError(error); 25 | if (error instanceof Error && md !== undefined) { 26 | throw new ApiError(error, md); 27 | } 28 | 29 | throw error; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/middleware/retry.ts: -------------------------------------------------------------------------------- 1 | import { 2 | delay, 3 | rethrowAbortError, 4 | } from 'abort-controller-x'; 5 | import { 6 | ClientError, 7 | ClientMiddleware, 8 | Status, 9 | } from 'nice-grpc'; 10 | import { AbortController } from 'node-abort-controller'; 11 | 12 | /** 13 | * These options are added to `CallOptions` by 14 | * `nice-grpc-client-middleware-retry`. 15 | */ 16 | export type RetryOptions = { 17 | /** 18 | * Boolean indicating whether retries are enabled. 19 | * 20 | * If the method is marked as idempotent in Protobuf, i.e. has 21 | * 22 | * option idempotency_level = IDEMPOTENT; 23 | * 24 | * then the default is `true`. Otherwise, the default is `false`. 25 | * 26 | * Method options currently work only when compiling with `ts-proto`. 27 | */ 28 | retry?: boolean; 29 | /** 30 | * Base delay between retry attempts in milliseconds. 31 | * 32 | * Defaults to 1000. 33 | * 34 | * Example: if `retryBaseDelayMs` is 100, then retries will be attempted in 35 | * 100ms, 200ms, 400ms etc. (not counting jitter). 36 | */ 37 | retryBaseDelayMs?: number; 38 | /** 39 | * Maximum delay between attempts in milliseconds. 40 | * 41 | * Defaults to 15 seconds. 42 | * 43 | * Example: if `retryBaseDelayMs` is 1000 and `retryMaxDelayMs` is 3000, then 44 | * retries will be attempted in 1000ms, 2000ms, 3000ms, 3000ms etc (not 45 | * counting jitter). 46 | */ 47 | retryMaxDelayMs?: number; 48 | /** 49 | * Maximum for the total number of attempts. `Infinity` is supported. 50 | * 51 | * Defaults to 1, i.e. a single retry will be attempted. 52 | */ 53 | retryMaxAttempts?: number; 54 | /** 55 | * Array of retryable status codes. 56 | * 57 | * Default is `[UNKNOWN, RESOURCE_EXHAUSTED, INTERNAL, UNAVAILABLE]`. 58 | */ 59 | retryableStatuses?: Status[]; 60 | /** 61 | * Called after receiving error with retryable status code before setting 62 | * backoff delay timer. 63 | * 64 | * If the error code is not retryable, or the maximum attempts exceeded, this 65 | * function will not be called and the error will be thrown from the client 66 | * method. 67 | */ 68 | onRetryableError?(error: ClientError, attempt: number, delayMs: number): void; 69 | }; 70 | 71 | const defaultRetryableStatuses: Status[] = [ 72 | Status.UNKNOWN, 73 | Status.RESOURCE_EXHAUSTED, 74 | Status.INTERNAL, 75 | Status.UNAVAILABLE, 76 | ]; 77 | 78 | /** 79 | * Client middleware that adds automatic retries to unary calls. 80 | */ 81 | export const retryMiddleware: ClientMiddleware = async function* retryMiddleware(call, options) { 82 | const { idempotencyLevel } = call.method.options ?? {}; 83 | const isIdempotent = idempotencyLevel === 'IDEMPOTENT' 84 | || idempotencyLevel === 'NO_SIDE_EFFECTS'; 85 | 86 | const { 87 | retry = isIdempotent, 88 | retryBaseDelayMs = 1000, 89 | retryMaxDelayMs = 15_000, 90 | retryMaxAttempts = 1, 91 | onRetryableError, 92 | retryableStatuses = defaultRetryableStatuses, 93 | ...restOptions 94 | } = options; 95 | 96 | if (call.requestStream || call.responseStream || !retry) { 97 | return yield* call.next(call.request, restOptions); 98 | } 99 | 100 | const signal = options.signal ?? new AbortController().signal; 101 | 102 | for (let attempt = 0; ; attempt++) { 103 | try { 104 | return yield* call.next(call.request, restOptions); 105 | } catch (error: unknown) { 106 | rethrowAbortError(error); 107 | 108 | if ( 109 | attempt >= retryMaxAttempts 110 | || !(error instanceof ClientError) 111 | || !retryableStatuses.includes(error.code) 112 | ) { 113 | throw error; 114 | } 115 | 116 | // https://aws.amazon.com/ru/blogs/architecture/exponential-backoff-and-jitter/ 117 | const backoff = Math.min( 118 | retryMaxDelayMs, 119 | 2 ** attempt * retryBaseDelayMs, 120 | ); 121 | const delayMs = Math.round((backoff * (1 + Math.random())) / 2); 122 | 123 | onRetryableError?.(error, attempt, delayMs); 124 | 125 | // eslint-disable-next-line no-await-in-loop 126 | await delay(signal, delayMs); 127 | } 128 | } 129 | }; 130 | -------------------------------------------------------------------------------- /src/service-endpoints.test.ts: -------------------------------------------------------------------------------- 1 | import { getServiceClientEndpoint } from './service-endpoints'; 2 | import { serviceClients } from '.'; 3 | import { GeneratedServiceClientCtor } from './types'; 4 | 5 | // eslint-disable-next-line @typescript-eslint/ban-types 6 | type MockServiceClientCtor = GeneratedServiceClientCtor<{}>; 7 | 8 | describe('service endpoints', () => { 9 | it('each service in generated service_clients module should have endpoint declared in service-endpoints', () => { 10 | for (const [, ServiceClient] of Object.entries(serviceClients)) { 11 | // eslint-disable-next-line @typescript-eslint/no-loop-func 12 | expect(() => { 13 | const endpoint = getServiceClientEndpoint(ServiceClient as MockServiceClientCtor); 14 | 15 | expect(endpoint).toBeTruthy(); 16 | }).not.toThrow(); 17 | } 18 | }); 19 | 20 | it('should throw exception if endpoint was not found', () => { 21 | const serviceName = 'myCustomService'; 22 | 23 | expect(() => { 24 | getServiceClientEndpoint({ serviceName } as unknown as MockServiceClientCtor); 25 | }).toThrow(`Endpoint for service ${serviceName} is no defined`); 26 | }); 27 | 28 | it('should throw exception if client class has no serviceName option', () => { 29 | expect(() => { 30 | getServiceClientEndpoint({} as unknown as MockServiceClientCtor); 31 | }).toThrow('Unable to retrieve serviceName of provided service client class'); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /src/session.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ChannelCredentials, credentials, Metadata, ServiceDefinition, 3 | } from '@grpc/grpc-js'; 4 | import { createChannel } from 'nice-grpc'; 5 | import { Required } from 'utility-types'; 6 | import { 7 | ChannelSslOptions, 8 | GeneratedServiceClientCtor, 9 | IamTokenCredentialsConfig, 10 | OAuthCredentialsConfig, 11 | ServiceAccountCredentialsConfig, 12 | SessionConfig, 13 | WrappedServiceClientType, 14 | } from './types'; 15 | import { IamTokenService } from './token-service/iam-token-service'; 16 | import { MetadataTokenService } from './token-service/metadata-token-service'; 17 | import { clientFactory } from './utils/client-factory'; 18 | import { cloudApi, serviceClients } from '.'; 19 | import { getServiceClientEndpoint } from './service-endpoints'; 20 | 21 | const isOAuth = (config: SessionConfig): config is OAuthCredentialsConfig => 'oauthToken' in config; 22 | 23 | const isIamToken = (config: SessionConfig): config is IamTokenCredentialsConfig => 'iamToken' in config; 24 | 25 | const isServiceAccount = (config: SessionConfig): config is ServiceAccountCredentialsConfig => 'serviceAccountJson' in config; 26 | 27 | const createIamToken = async (iamEndpoint: string, req: Partial) => { 28 | const channel = createChannel(iamEndpoint, credentials.createSsl()); 29 | const client = clientFactory.create(serviceClients.IamTokenServiceClient.service, channel); 30 | const resp = await client.create(cloudApi.iam.iam_token_service.CreateIamTokenRequest.fromPartial(req)); 31 | 32 | return resp.iamToken; 33 | }; 34 | 35 | const newTokenCreator = (config: SessionConfig): () => Promise => { 36 | if (isOAuth(config)) { 37 | return () => { 38 | const iamEndpoint = getServiceClientEndpoint(serviceClients.IamTokenServiceClient); 39 | 40 | return createIamToken(iamEndpoint, { 41 | yandexPassportOauthToken: config.oauthToken, 42 | }); 43 | }; 44 | } 45 | if (isIamToken(config)) { 46 | const { iamToken } = config; 47 | 48 | return async () => iamToken; 49 | } 50 | 51 | const tokenService = isServiceAccount(config) ? new IamTokenService(config.serviceAccountJson) : new MetadataTokenService(); 52 | 53 | return async () => tokenService.getToken(); 54 | }; 55 | 56 | const newChannelCredentials = ( 57 | tokenCreator: TokenCreator, 58 | sslOptions?: ChannelSslOptions, 59 | headers?: Record, 60 | ) => credentials.combineChannelCredentials( 61 | credentials.createSsl(sslOptions?.rootCerts, sslOptions?.privateKey, sslOptions?.certChain), 62 | credentials.createFromMetadataGenerator( 63 | ( 64 | params: { service_url: string }, 65 | callback: (error: any, result?: any) => void, 66 | ) => { 67 | tokenCreator() 68 | .then((token) => { 69 | const md = new Metadata(); 70 | 71 | md.set('authorization', `Bearer ${token}`); 72 | if (headers) { 73 | for (const [key, value] of Object.entries(headers)) { 74 | const lowerCaseKey = key.toLowerCase(); 75 | 76 | if (lowerCaseKey !== 'authorization') { 77 | md.set(lowerCaseKey, value); 78 | } 79 | } 80 | } 81 | 82 | return callback(null, md); 83 | }) 84 | .catch((error) => callback(error)); 85 | }, 86 | ), 87 | ); 88 | 89 | type TokenCreator = () => Promise; 90 | 91 | export class Session { 92 | private readonly config: Required; 93 | private readonly channelCredentials: ChannelCredentials; 94 | private readonly tokenCreator: TokenCreator; 95 | 96 | private static readonly DEFAULT_CONFIG = { 97 | pollInterval: 1000, 98 | }; 99 | 100 | constructor(config?: SessionConfig) { 101 | this.config = { 102 | ...Session.DEFAULT_CONFIG, 103 | ...config, 104 | }; 105 | this.tokenCreator = newTokenCreator(this.config); 106 | this.channelCredentials = newChannelCredentials(this.tokenCreator, this.config.ssl, this.config.headers); 107 | } 108 | 109 | get pollInterval(): number { 110 | return this.config.pollInterval; 111 | } 112 | 113 | client(clientClass: GeneratedServiceClientCtor, customEndpoint?: string): WrappedServiceClientType { 114 | const endpoint = customEndpoint || getServiceClientEndpoint(clientClass); 115 | const channel = createChannel(endpoint, this.channelCredentials); 116 | 117 | return clientFactory.create(clientClass.service, channel); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/token-service/iam-token-service.ts: -------------------------------------------------------------------------------- 1 | import { credentials } from '@grpc/grpc-js'; 2 | import * as jwt from 'jsonwebtoken'; 3 | import { DateTime } from 'luxon'; 4 | import { createChannel } from 'nice-grpc'; 5 | import { cloudApi, serviceClients } from '..'; 6 | import { getServiceClientEndpoint } from '../service-endpoints'; 7 | import { IIAmCredentials, ISslCredentials, TokenService } from '../types'; 8 | import { clientFactory } from '../utils/client-factory'; 9 | 10 | const { IamTokenServiceClient } = serviceClients; 11 | 12 | export class IamTokenService implements TokenService { 13 | public readonly sslCredentials?: ISslCredentials; 14 | 15 | private readonly iamCredentials: IIAmCredentials; 16 | private jwtExpirationTimeout = 3600 * 1000; 17 | private tokenExpirationTimeout = 120 * 1000; 18 | private tokenRequestTimeout = 10 * 1000; 19 | private token = ''; 20 | private tokenTimestamp: DateTime | null; 21 | 22 | constructor(iamCredentials: IIAmCredentials, sslCredentials?: ISslCredentials) { 23 | this.iamCredentials = iamCredentials; 24 | this.tokenTimestamp = null; 25 | 26 | this.sslCredentials = sslCredentials; 27 | } 28 | 29 | private get expired() { 30 | return ( 31 | !this.tokenTimestamp 32 | || DateTime.utc().diff(this.tokenTimestamp).valueOf() > this.tokenExpirationTimeout 33 | ); 34 | } 35 | 36 | public async getToken(): Promise { 37 | if (this.expired) { 38 | await this.initialize(); 39 | } 40 | 41 | return this.token; 42 | } 43 | 44 | private client() { 45 | const endpoint = getServiceClientEndpoint(IamTokenServiceClient); 46 | const channel = createChannel(endpoint, credentials.createSsl()); 47 | 48 | return clientFactory.create(IamTokenServiceClient.service, channel); 49 | } 50 | 51 | private getJwtRequest() { 52 | const now = DateTime.utc(); 53 | const expires = now.plus({ milliseconds: this.jwtExpirationTimeout }); 54 | const payload = { 55 | iss: this.iamCredentials.serviceAccountId, 56 | aud: 'https://iam.api.cloud.yandex.net/iam/v1/tokens', 57 | iat: Math.round(now.toSeconds()), 58 | exp: Math.round(expires.toSeconds()), 59 | }; 60 | const options: jwt.SignOptions = { 61 | algorithm: 'PS256', 62 | keyid: this.iamCredentials.accessKeyId, 63 | }; 64 | 65 | return jwt.sign(payload, this.iamCredentials.privateKey, options); 66 | } 67 | 68 | private async initialize() { 69 | const resp = await this.requestToken(); 70 | 71 | if (resp) { 72 | this.token = resp.iamToken; 73 | this.tokenTimestamp = DateTime.utc(); 74 | } else { 75 | throw new Error('Received empty token from IAM!'); 76 | } 77 | } 78 | 79 | private async requestToken(): Promise { 80 | const deadline = DateTime.now().plus({ millisecond: this.tokenRequestTimeout }).toJSDate(); 81 | 82 | return this.client().create( 83 | cloudApi.iam.iam_token_service.CreateIamTokenRequest.fromPartial({ 84 | jwt: this.getJwtRequest(), 85 | }), 86 | { deadline }, 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/token-service/metadata-token-service.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosRequestConfig } from 'axios'; 2 | 3 | import { TokenService } from '../types'; 4 | 5 | type Options = AxiosRequestConfig; 6 | 7 | const DEFAULT_URL = 'http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token'; 8 | const DEFAULT_OPTIONS: Options = { 9 | headers: { 10 | 'Metadata-Flavor': 'Google', 11 | }, 12 | }; 13 | 14 | export class MetadataTokenService implements TokenService { 15 | private readonly url: string; 16 | private readonly opts: Options; 17 | private token?: string; 18 | 19 | constructor(url: string = DEFAULT_URL, options: Options = DEFAULT_OPTIONS) { 20 | this.url = url; 21 | this.opts = options; 22 | } 23 | 24 | async getToken(): Promise { 25 | if (!this.token) { 26 | await this.initialize(); 27 | 28 | if (!this.token) { 29 | throw new Error('Token is empty after MetadataTokenService.initialize'); 30 | } 31 | 32 | return this.token; 33 | } 34 | 35 | return this.token; 36 | } 37 | 38 | private async fetchToken(): Promise { 39 | const res = await axios.get<{ access_token: string }>(this.url, this.opts); 40 | 41 | if (res.status !== 200) { 42 | throw new Error(`failed to fetch token from metadata service: ${res.status} ${res.statusText}`); 43 | } 44 | 45 | return res.data.access_token; 46 | } 47 | 48 | private async initialize() { 49 | if (this.token) { 50 | return; 51 | } 52 | 53 | let lastError = null; 54 | 55 | for (let i = 0; i < 5; i++) { 56 | try { 57 | // eslint-disable-next-line no-await-in-loop 58 | this.token = await this.fetchToken(); 59 | break; 60 | } catch (error) { 61 | lastError = error; 62 | } 63 | } 64 | if (!this.token) { 65 | throw new Error( 66 | // eslint-disable-next-line @typescript-eslint/restrict-template-expressions 67 | `failed to fetch token from metadata service: ${lastError}`, 68 | ); 69 | } 70 | setTimeout(async () => { 71 | try { 72 | this.token = await this.fetchToken(); 73 | } catch { 74 | // TBD 75 | } 76 | }, 30_000); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ChannelCredentials, 3 | ChannelOptions, 4 | Client, 5 | ServiceDefinition, 6 | } from '@grpc/grpc-js'; 7 | import { RawClient } from 'nice-grpc'; 8 | import { DeadlineOptions } from 'nice-grpc-client-middleware-deadline'; 9 | import { NormalizedServiceDefinition } from 'nice-grpc/lib/service-definitions'; 10 | import { RetryOptions } from './middleware/retry'; 11 | 12 | export interface TokenService { 13 | getToken: () => Promise; 14 | } 15 | 16 | export interface GeneratedServiceClientCtor { 17 | service: T 18 | 19 | new( 20 | address: string, 21 | credentials: ChannelCredentials, 22 | options?: Partial, 23 | ): Client; 24 | } 25 | 26 | export interface IIAmCredentials { 27 | serviceAccountId: string; 28 | accessKeyId: string; 29 | privateKey: Buffer | string; 30 | } 31 | 32 | export interface ISslCredentials { 33 | rootCertificates?: Buffer; 34 | clientPrivateKey?: Buffer; 35 | clientCertChain?: Buffer; 36 | } 37 | 38 | export interface ChannelSslOptions { 39 | rootCerts?: Buffer, 40 | privateKey?: Buffer, 41 | certChain?: Buffer, 42 | } 43 | 44 | export interface GenericCredentialsConfig { 45 | pollInterval?: number; 46 | ssl?: ChannelSslOptions 47 | headers?: Record; 48 | } 49 | 50 | export interface OAuthCredentialsConfig extends GenericCredentialsConfig { 51 | oauthToken: string; 52 | } 53 | 54 | export interface IamTokenCredentialsConfig extends GenericCredentialsConfig { 55 | iamToken: string; 56 | } 57 | 58 | export interface ServiceAccountCredentialsConfig extends GenericCredentialsConfig { 59 | serviceAccountJson: IIAmCredentials; 60 | } 61 | 62 | export type SessionConfig = 63 | | OAuthCredentialsConfig 64 | | IamTokenCredentialsConfig 65 | | ServiceAccountCredentialsConfig 66 | | GenericCredentialsConfig; 67 | 68 | // eslint-disable-next-line max-len 69 | export type WrappedServiceClientType = RawClient, DeadlineOptions & RetryOptions>; 70 | -------------------------------------------------------------------------------- /src/utils/client-factory.ts: -------------------------------------------------------------------------------- 1 | import { createClientFactory } from 'nice-grpc'; 2 | import { deadlineMiddleware } from 'nice-grpc-client-middleware-deadline'; 3 | import { retryMiddleware } from '../middleware/retry'; 4 | import { errorMetadataMiddleware } from '../middleware/error-metadata'; 5 | 6 | export const clientFactory = createClientFactory() 7 | .use(errorMetadataMiddleware) 8 | .use(retryMiddleware) 9 | .use(deadlineMiddleware); 10 | -------------------------------------------------------------------------------- /src/utils/decode-message.ts: -------------------------------------------------------------------------------- 1 | import { Any } from '../generated/google/protobuf/any'; 2 | 3 | import { MessageType, messageTypeRegistry, UnknownMessage } from '../generated/typeRegistry'; 4 | 5 | type OptionalMessage = MessageType | undefined; 6 | 7 | export const decodeMessage = (data: Any): T => { 8 | const fqn = data.typeUrl.slice(Math.max(0, data.typeUrl.lastIndexOf('/') + 1)); 9 | const cls: OptionalMessage | undefined = messageTypeRegistry.get(fqn) as unknown as OptionalMessage; 10 | 11 | if (!cls) { 12 | throw new Error(`Message contains unknown type ${fqn}`); 13 | } 14 | 15 | return cls.decode(data.value); 16 | }; 17 | -------------------------------------------------------------------------------- /src/utils/logger.ts: -------------------------------------------------------------------------------- 1 | import log4js from 'log4js'; 2 | 3 | export const logger = log4js.getLogger(); 4 | 5 | logger.level = process.env.LOG_LEVEL || 'warn'; 6 | -------------------------------------------------------------------------------- /src/utils/operation/index.ts: -------------------------------------------------------------------------------- 1 | export * from './wait-for'; 2 | export * from './time-spent'; 3 | -------------------------------------------------------------------------------- /src/utils/operation/time-spent.ts: -------------------------------------------------------------------------------- 1 | import { Operation } from '../../generated/yandex/cloud/operation/operation'; 2 | 3 | export const timeSpentOperation = (op: Operation): number => Date.now() - (op.createdAt?.getTime() ?? 0); 4 | -------------------------------------------------------------------------------- /src/utils/operation/wait-for.ts: -------------------------------------------------------------------------------- 1 | import { 2 | cloudApi, 3 | serviceClients, 4 | } from '../..'; 5 | import { Operation } from '../../generated/yandex/cloud/operation/operation'; 6 | import { Session } from '../../session'; 7 | 8 | const { operation: { operation_service: { GetOperationRequest } } } = cloudApi; 9 | 10 | const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes 11 | 12 | export const waitForOperation = ( 13 | op: Operation, 14 | session: Session, 15 | timeoutMs: number = DEFAULT_TIMEOUT_MS, 16 | operationServiceEndpoint?: string, 17 | ): Promise => { 18 | const client = session.client(serviceClients.OperationServiceClient, operationServiceEndpoint); 19 | const maxChecksCount = Math.ceil(timeoutMs / session.pollInterval); 20 | 21 | let checksCount = 0; 22 | 23 | return new Promise((resolve, reject) => { 24 | const checkOperation = async () => { 25 | const operation = await client.get( 26 | GetOperationRequest.fromPartial({ 27 | operationId: op.id, 28 | }), 29 | { 30 | retry: true, 31 | retryMaxAttempts: 3, 32 | }, 33 | ); 34 | 35 | checksCount++; 36 | 37 | if (operation.error) { 38 | reject(operation); 39 | } else if (operation.done) { 40 | resolve(operation); 41 | } else if (checksCount > maxChecksCount) { 42 | reject(new Error('Timeout reached')); 43 | } else { 44 | setTimeout(checkOperation, session.pollInterval); 45 | } 46 | }; 47 | 48 | checkOperation(); 49 | }); 50 | }; 51 | -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "./src", 5 | "./config", 6 | "./scripts", 7 | "./examples" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "allowJs": true, 6 | "declaration": true, 7 | "outDir": "./dist", 8 | "esModuleInterop": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "strict": true, 11 | "skipLibCheck": true, 12 | "resolveJsonModule": true, 13 | "lib": ["es6"] 14 | }, 15 | "include": [ 16 | "./src" 17 | ] 18 | } 19 | --------------------------------------------------------------------------------