Skip to content

Commit

Permalink
chore: ignore v1
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanVor committed Oct 11, 2024
1 parent d562dda commit 89a35de
Show file tree
Hide file tree
Showing 46 changed files with 967 additions and 957 deletions.
4 changes: 4 additions & 0 deletions scripts/exceptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const exportAliasExceptions: Record<string, string | undefined> = {
'v1/metering/usage_record': 'v1_metering_usage_record',
'v1/metering/image_product_usage_service': 'v1_metering_image_product_usage_service',
};
26 changes: 16 additions & 10 deletions scripts/generate-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as _ from 'lodash';
import { logger } from '../src/utils/logger';
import { servicesConfig } from './services';

import { exportAliasExceptions } from './exceptions';

const GENERATED_CODE_DIR = path.resolve('./src/generated');
const GENERATED_PROJECTS_DIR = path.join(GENERATED_CODE_DIR, 'yandex', 'cloud');
const PROTO_DIR = path.resolve('./cloudapi');
Expand Down Expand Up @@ -56,6 +58,12 @@ interface ProjectMeta {

const projectsMeta: Record<string, ProjectMeta> = {};

const getExportAlias = (relativePath: string) => exportAliasExceptions[relativePath]
|| relativePath
.split(path.sep)
.filter((str) => str !== 'v1')
.join('_');

for (const projectDir of projectsDirs) {
logger.debug(`Processing project directory ${projectDir}`);

Expand All @@ -82,22 +90,18 @@ for (const projectDir of projectsDirs) {
.relative(projectDir, modulePath)
.replace('.ts', '');

const relativePathSegments = relativePath.split(path.sep);
const moduleName = path.basename(modulePath);
const exportAlias = getExportAlias(relativePath);

const moduleAlias = relativePathSegments.join('_');
if (relativePath.endsWith('_service')) {
const name = path.basename(modulePath);

const { ext } = path.parse(modulePath);
const moduleWithoutExt = relativePath.replace(ext, '');

if (moduleWithoutExt.endsWith('_service')) {
projectsMeta[indexModulePath].services.push({
name: moduleName,
exportAlias: moduleAlias,
name,
exportAlias,
});
}

return `export * as ${moduleAlias} from './${moduleWithoutExt}'`;
return `export * as ${exportAlias} from './${relativePath}'`;
});

const indexModuleContent = exportStatements.join('\n');
Expand Down Expand Up @@ -162,6 +166,8 @@ for (const [indexModulePath, projectMeta] of Object.entries(projectsMeta)) {
logger.debug(`Writing result to ${rootIndexModulePath} module`);
logger.debug(`Writing result to ${serviceClientsModulePath} module`);

logger.debug('\n\n\n');

for (const serviceName of Object.keys(servicesConfig)) {
const obj = servicesConfig[serviceName];
const keys = Object.keys(obj);
Expand Down
360 changes: 180 additions & 180 deletions scripts/services.ts

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions src/generated/yandex/cloud/ai/index.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
export * as common_common from './common/common'
export * as assistants_v1_assistant from './assistants/v1/assistant'
export * as assistants_v1_assistant_service from './assistants/v1/assistant_service'
export * as assistants_v1_common from './assistants/v1/common'
export * as files_v1_file from './files/v1/file'
export * as files_v1_file_service from './files/v1/file_service'
export * as foundation_models_v1_text_common from './foundation_models/v1/text_common'
export * as ocr_v1_ocr from './ocr/v1/ocr'
export * as ocr_v1_ocr_service from './ocr/v1/ocr_service'
export * as assistants_assistant from './assistants/v1/assistant'
export * as assistants_assistant_service from './assistants/v1/assistant_service'
export * as assistants_common from './assistants/v1/common'
export * as files_file from './files/v1/file'
export * as files_file_service from './files/v1/file_service'
export * as foundation_models_text_common from './foundation_models/v1/text_common'
export * as ocr_ocr from './ocr/v1/ocr'
export * as ocr_ocr_service from './ocr/v1/ocr_service'
export * as stt_v2_stt_service from './stt/v2/stt_service'
export * as stt_v3_stt from './stt/v3/stt'
export * as stt_v3_stt_service from './stt/v3/stt_service'
export * as translate_v2_translation from './translate/v2/translation'
export * as translate_v2_translation_service from './translate/v2/translation_service'
export * as tts_v3_tts from './tts/v3/tts'
export * as tts_v3_tts_service from './tts/v3/tts_service'
export * as vision_v1_classification from './vision/v1/classification'
export * as vision_v1_face_detection from './vision/v1/face_detection'
export * as vision_v1_image_copy_search from './vision/v1/image_copy_search'
export * as vision_v1_primitives from './vision/v1/primitives'
export * as vision_v1_text_detection from './vision/v1/text_detection'
export * as vision_v1_vision_service from './vision/v1/vision_service'
export * as vision_classification from './vision/v1/classification'
export * as vision_face_detection from './vision/v1/face_detection'
export * as vision_image_copy_search from './vision/v1/image_copy_search'
export * as vision_primitives from './vision/v1/primitives'
export * as vision_text_detection from './vision/v1/text_detection'
export * as vision_vision_service from './vision/v1/vision_service'
export * as vision_v2_image from './vision/v2/image'
export * as vision_v2_image_classifier from './vision/v2/image_classifier'
export * as vision_v2_image_classifier_service from './vision/v2/image_classifier_service'
export * as assistants_v1_runs_run from './assistants/v1/runs/run'
export * as assistants_v1_runs_run_service from './assistants/v1/runs/run_service'
export * as assistants_v1_searchindex_common from './assistants/v1/searchindex/common'
export * as assistants_v1_searchindex_search_index from './assistants/v1/searchindex/search_index'
export * as assistants_v1_searchindex_search_index_file from './assistants/v1/searchindex/search_index_file'
export * as assistants_v1_searchindex_search_index_file_service from './assistants/v1/searchindex/search_index_file_service'
export * as assistants_v1_searchindex_search_index_service from './assistants/v1/searchindex/search_index_service'
export * as assistants_v1_threads_message from './assistants/v1/threads/message'
export * as assistants_v1_threads_message_service from './assistants/v1/threads/message_service'
export * as assistants_v1_threads_thread from './assistants/v1/threads/thread'
export * as assistants_v1_threads_thread_service from './assistants/v1/threads/thread_service'
export * as assistants_v1_users_user from './assistants/v1/users/user'
export * as assistants_v1_users_user_service from './assistants/v1/users/user_service'
export * as foundation_models_v1_embedding_embedding_service from './foundation_models/v1/embedding/embedding_service'
export * as foundation_models_v1_image_generation_image_generation from './foundation_models/v1/image_generation/image_generation'
export * as foundation_models_v1_image_generation_image_generation_service from './foundation_models/v1/image_generation/image_generation_service'
export * as foundation_models_v1_text_classification_text_classification from './foundation_models/v1/text_classification/text_classification'
export * as foundation_models_v1_text_classification_text_classification_service from './foundation_models/v1/text_classification/text_classification_service'
export * as foundation_models_v1_text_generation_text_generation_service from './foundation_models/v1/text_generation/text_generation_service'
export * as assistants_runs_run from './assistants/v1/runs/run'
export * as assistants_runs_run_service from './assistants/v1/runs/run_service'
export * as assistants_searchindex_common from './assistants/v1/searchindex/common'
export * as assistants_searchindex_search_index from './assistants/v1/searchindex/search_index'
export * as assistants_searchindex_search_index_file from './assistants/v1/searchindex/search_index_file'
export * as assistants_searchindex_search_index_file_service from './assistants/v1/searchindex/search_index_file_service'
export * as assistants_searchindex_search_index_service from './assistants/v1/searchindex/search_index_service'
export * as assistants_threads_message from './assistants/v1/threads/message'
export * as assistants_threads_message_service from './assistants/v1/threads/message_service'
export * as assistants_threads_thread from './assistants/v1/threads/thread'
export * as assistants_threads_thread_service from './assistants/v1/threads/thread_service'
export * as assistants_users_user from './assistants/v1/users/user'
export * as assistants_users_user_service from './assistants/v1/users/user_service'
export * as foundation_models_embedding_embedding_service from './foundation_models/v1/embedding/embedding_service'
export * as foundation_models_image_generation_image_generation from './foundation_models/v1/image_generation/image_generation'
export * as foundation_models_image_generation_image_generation_service from './foundation_models/v1/image_generation/image_generation_service'
export * as foundation_models_text_classification_text_classification from './foundation_models/v1/text_classification/text_classification'
export * as foundation_models_text_classification_text_classification_service from './foundation_models/v1/text_classification/text_classification_service'
export * as foundation_models_text_generation_text_generation_service from './foundation_models/v1/text_generation/text_generation_service'
6 changes: 3 additions & 3 deletions src/generated/yandex/cloud/airflow/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * as v1_cluster from './v1/cluster'
export * as v1_cluster_service from './v1/cluster_service'
export * as v1_common from './v1/common'
export * as cluster from './v1/cluster'
export * as cluster_service from './v1/cluster_service'
export * as common from './v1/common'
26 changes: 13 additions & 13 deletions src/generated/yandex/cloud/apploadbalancer/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export * as v1_backend_group from './v1/backend_group'
export * as v1_backend_group_service from './v1/backend_group_service'
export * as v1_http_router from './v1/http_router'
export * as v1_http_router_service from './v1/http_router_service'
export * as v1_load_balancer from './v1/load_balancer'
export * as v1_load_balancer_service from './v1/load_balancer_service'
export * as v1_logging from './v1/logging'
export * as v1_payload from './v1/payload'
export * as v1_target_group from './v1/target_group'
export * as v1_target_group_service from './v1/target_group_service'
export * as v1_tls from './v1/tls'
export * as v1_virtual_host from './v1/virtual_host'
export * as v1_virtual_host_service from './v1/virtual_host_service'
export * as backend_group from './v1/backend_group'
export * as backend_group_service from './v1/backend_group_service'
export * as http_router from './v1/http_router'
export * as http_router_service from './v1/http_router_service'
export * as load_balancer from './v1/load_balancer'
export * as load_balancer_service from './v1/load_balancer_service'
export * as logging from './v1/logging'
export * as payload from './v1/payload'
export * as target_group from './v1/target_group'
export * as target_group_service from './v1/target_group_service'
export * as tls from './v1/tls'
export * as virtual_host from './v1/virtual_host'
export * as virtual_host_service from './v1/virtual_host_service'
4 changes: 2 additions & 2 deletions src/generated/yandex/cloud/audittrails/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * as v1_trail from './v1/trail'
export * as v1_trail_service from './v1/trail_service'
export * as trail from './v1/trail'
export * as trail_service from './v1/trail_service'
14 changes: 7 additions & 7 deletions src/generated/yandex/cloud/backup/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * as v1_backup from './v1/backup'
export * as v1_backup_service from './v1/backup_service'
export * as v1_policy from './v1/policy'
export * as v1_policy_service from './v1/policy_service'
export * as v1_provider_service from './v1/provider_service'
export * as v1_resource from './v1/resource'
export * as v1_resource_service from './v1/resource_service'
export * as backup from './v1/backup'
export * as backup_service from './v1/backup_service'
export * as policy from './v1/policy'
export * as policy_service from './v1/policy_service'
export * as provider_service from './v1/provider_service'
export * as resource from './v1/resource'
export * as resource_service from './v1/resource_service'
22 changes: 11 additions & 11 deletions src/generated/yandex/cloud/billing/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export * as v1_billable_object from './v1/billable_object'
export * as v1_billing_account from './v1/billing_account'
export * as v1_billing_account_service from './v1/billing_account_service'
export * as v1_budget from './v1/budget'
export * as v1_budget_service from './v1/budget_service'
export * as v1_customer from './v1/customer'
export * as v1_customer_service from './v1/customer_service'
export * as v1_service from './v1/service'
export * as v1_service_service from './v1/service_service'
export * as v1_sku from './v1/sku'
export * as v1_sku_service from './v1/sku_service'
export * as billable_object from './v1/billable_object'
export * as billing_account from './v1/billing_account'
export * as billing_account_service from './v1/billing_account_service'
export * as budget from './v1/budget'
export * as budget_service from './v1/budget_service'
export * as customer from './v1/customer'
export * as customer_service from './v1/customer_service'
export * as service from './v1/service'
export * as service_service from './v1/service_service'
export * as sku from './v1/sku'
export * as sku_service from './v1/sku_service'
24 changes: 12 additions & 12 deletions src/generated/yandex/cloud/cdn/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export * as v1_cache_service from './v1/cache_service'
export * as v1_origin from './v1/origin'
export * as v1_origin_group from './v1/origin_group'
export * as v1_origin_group_service from './v1/origin_group_service'
export * as v1_origin_service from './v1/origin_service'
export * as v1_provider_service from './v1/provider_service'
export * as v1_raw_logs from './v1/raw_logs'
export * as v1_raw_logs_service from './v1/raw_logs_service'
export * as v1_resource from './v1/resource'
export * as v1_resource_service from './v1/resource_service'
export * as v1_rule from './v1/rule'
export * as v1_rule_service from './v1/rule_service'
export * as cache_service from './v1/cache_service'
export * as origin from './v1/origin'
export * as origin_group from './v1/origin_group'
export * as origin_group_service from './v1/origin_group_service'
export * as origin_service from './v1/origin_service'
export * as provider_service from './v1/provider_service'
export * as raw_logs from './v1/raw_logs'
export * as raw_logs_service from './v1/raw_logs_service'
export * as resource from './v1/resource'
export * as resource_service from './v1/resource_service'
export * as rule from './v1/rule'
export * as rule_service from './v1/rule_service'
6 changes: 3 additions & 3 deletions src/generated/yandex/cloud/certificatemanager/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * as v1_certificate from './v1/certificate'
export * as v1_certificate_content_service from './v1/certificate_content_service'
export * as v1_certificate_service from './v1/certificate_service'
export * as certificate from './v1/certificate'
export * as certificate_content_service from './v1/certificate_content_service'
export * as certificate_service from './v1/certificate_service'
28 changes: 14 additions & 14 deletions src/generated/yandex/cloud/cic/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export * as v1_partner from './v1/partner'
export * as v1_partner_service from './v1/partner_service'
export * as v1_peering from './v1/peering'
export * as v1_point_of_presence from './v1/point_of_presence'
export * as v1_point_of_presence_service from './v1/point_of_presence_service'
export * as v1_private_connection from './v1/private_connection'
export * as v1_private_connection_service from './v1/private_connection_service'
export * as v1_public_connection from './v1/public_connection'
export * as v1_public_connection_service from './v1/public_connection_service'
export * as v1_trunk_connection from './v1/trunk_connection'
export * as v1_trunk_connection_service from './v1/trunk_connection_service'
export * as v1_common_lag_allocation_settings from './v1/common/lag_allocation_settings'
export * as v1_common_lag_info from './v1/common/lag_info'
export * as v1_common_transceiver_type from './v1/common/transceiver_type'
export * as partner from './v1/partner'
export * as partner_service from './v1/partner_service'
export * as peering from './v1/peering'
export * as point_of_presence from './v1/point_of_presence'
export * as point_of_presence_service from './v1/point_of_presence_service'
export * as private_connection from './v1/private_connection'
export * as private_connection_service from './v1/private_connection_service'
export * as public_connection from './v1/public_connection'
export * as public_connection_service from './v1/public_connection_service'
export * as trunk_connection from './v1/trunk_connection'
export * as trunk_connection_service from './v1/trunk_connection_service'
export * as common_lag_allocation_settings from './v1/common/lag_allocation_settings'
export * as common_lag_info from './v1/common/lag_info'
export * as common_transceiver_type from './v1/common/transceiver_type'
4 changes: 2 additions & 2 deletions src/generated/yandex/cloud/cloudapps/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * as workload_v1_cloud_application from './workload/v1/cloud_application'
export * as workload_v1_cloud_application_service from './workload/v1/cloud_application_service'
export * as workload_cloud_application from './workload/v1/cloud_application'
export * as workload_cloud_application_service from './workload/v1/cloud_application_service'
4 changes: 2 additions & 2 deletions src/generated/yandex/cloud/cloudrouter/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * as v1_routing_instance from './v1/routing_instance'
export * as v1_routing_instance_service from './v1/routing_instance_service'
export * as routing_instance from './v1/routing_instance'
export * as routing_instance_service from './v1/routing_instance_service'
Loading

0 comments on commit 89a35de

Please sign in to comment.