From 28f3572addb0f563a2a42a76977b4e083191613f Mon Sep 17 00:00:00 2001 From: Noah Dietz Date: Thu, 8 Dec 2022 11:51:49 -0800 Subject: [PATCH] feat(all): enable REGAPIC and REST numeric enums (#6999) --- internal/gapicgen/generator/config.go | 169 +++++++++++++------------- internal/gapicgen/generator/gapics.go | 5 +- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index bffa336270d..6f675568590 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -54,7 +54,7 @@ type MicrogenConfig struct { DisableMetadata bool // Transports is a list of Transports to generate a client for. Acceptable - // values are 'grpc' and 'rest' + // values are 'grpc' and 'rest'. Default is ["grpc", "rest"]. Transports []string // stubsDir indicates that the protobuf/gRPC stubs should be generated @@ -63,11 +63,11 @@ type MicrogenConfig struct { // same Pkg value. stubsDir string - // NumericEnumsEnabled indicates, for REST GAPICs, if requests should be - // generated to send the $alt=json;enum-encoding=int system parameter with - // every API call. This should only be enabled for services that are - // up-to-date enough to support such a system parameter. - NumericEnumsEnabled bool + // NumericEnumsDisabled indicates, for REST GAPICs, if requests should *not* + // be generated to send the $alt=json;enum-encoding=int system parameter + // with every API call. This should only be disabled for services that are + // *not* up-to-date enough to support such a system parameter. + NumericEnumsDisabled bool } // genprotoImportPath returns the genproto import path for a given config. @@ -151,7 +151,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/language/apiv1beta2", GRPCServiceConfigPath: "language_grpc_service_config.json", ApiServiceConfigPath: "language_v1beta2.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -168,7 +167,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/memcache/apiv1beta2", GRPCServiceConfigPath: "memcache_grpc_service_config.json", ApiServiceConfigPath: "memcache_v1beta2.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -177,7 +175,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/phishingprotection/apiv1beta1", GRPCServiceConfigPath: "phishingprotection_grpc_service_config.json", ApiServiceConfigPath: "phishingprotection_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -202,7 +199,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/scheduler/apiv1beta1", GRPCServiceConfigPath: "cloudscheduler_grpc_service_config.json", ApiServiceConfigPath: "cloudscheduler_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -219,7 +215,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/speech/apiv1p1beta1", GRPCServiceConfigPath: "speech_grpc_service_config.json", ApiServiceConfigPath: "speech_v1p1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -228,7 +223,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/bigquery/connection/apiv1beta1", GRPCServiceConfigPath: "bigqueryconnection_grpc_service_config.json", ApiServiceConfigPath: "bigqueryconnection_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -245,7 +239,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/bigquery/dataexchange/apiv1beta1", GRPCServiceConfigPath: "analyticshub_v1beta1_grpc_service_config.json", ApiServiceConfigPath: "analyticshub_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, + NumericEnumsDisabled: true, ReleaseLevel: "beta", }, { @@ -262,6 +256,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/bigquery/migration/apiv2alpha", GRPCServiceConfigPath: "bigquerymigration_grpc_service_config.json", ApiServiceConfigPath: "bigquerymigration_v2alpha.yaml", + NumericEnumsDisabled: true, ReleaseLevel: "alpha", }, { @@ -271,6 +266,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "bigquerymigration_grpc_service_config.json", ApiServiceConfigPath: "bigquerymigration_v2.yaml", ReleaseLevel: "beta", + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/bigquery/reservation/v1", @@ -286,8 +283,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/bigquery/storage/apiv1beta1", GRPCServiceConfigPath: "bigquerystorage_grpc_service_config.json", ApiServiceConfigPath: "bigquerystorage_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/bigquery/storage/v1beta2", @@ -295,8 +292,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/bigquery/storage/apiv1beta2", GRPCServiceConfigPath: "bigquerystorage_grpc_service_config.json", ApiServiceConfigPath: "bigquerystorage_v1beta2.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/bigquery/storage/v1", @@ -305,6 +302,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "bigquerystorage_grpc_service_config.json", ApiServiceConfigPath: "bigquerystorage_v1.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/iot/v1", @@ -320,7 +319,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/recommender/apiv1beta1", GRPCServiceConfigPath: "recommender_grpc_service_config.json", ApiServiceConfigPath: "recommender_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -337,7 +335,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/cloudtasks/apiv2beta2", GRPCServiceConfigPath: "cloudtasks_grpc_service_config.json", ApiServiceConfigPath: "cloudtasks_v2beta2.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -346,7 +343,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/cloudtasks/apiv2beta3", GRPCServiceConfigPath: "cloudtasks_grpc_service_config.json", ApiServiceConfigPath: "cloudtasks_v2beta3.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -379,7 +375,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/webrisk/apiv1beta1", GRPCServiceConfigPath: "webrisk_grpc_service_config.json", ApiServiceConfigPath: "webrisk_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -404,7 +399,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/osconfig/apiv1alpha", GRPCServiceConfigPath: "osconfig_grpc_service_config.json", ApiServiceConfigPath: "osconfig_v1alpha.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -413,7 +407,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/osconfig/apiv1beta", GRPCServiceConfigPath: "osconfig_grpc_service_config.json", ApiServiceConfigPath: "osconfig_v1beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -423,6 +416,9 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "agentendpoint_grpc_service_config.json", ApiServiceConfigPath: "osconfig_v1.yaml", ReleaseLevel: "ga", + // Do not generate REST until numeric enums are supported. + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/osconfig/agentendpoint/v1beta", @@ -430,7 +426,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/osconfig/agentendpoint/apiv1beta", GRPCServiceConfigPath: "agentendpoint_grpc_service_config.json", ApiServiceConfigPath: "osconfig_v1beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -440,6 +435,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "datacatalog_grpc_service_config.json", ApiServiceConfigPath: "datacatalog_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/datacatalog/v1beta1", @@ -447,7 +444,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/datacatalog/apiv1beta1", GRPCServiceConfigPath: "datacatalog_grpc_service_config.json", ApiServiceConfigPath: "datacatalog_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -480,7 +476,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/oslogin/apiv1beta", GRPCServiceConfigPath: "oslogin_grpc_service_config.json", ApiServiceConfigPath: "oslogin_v1beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -490,6 +485,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "recaptchaenterprise_grpc_service_config.json", ApiServiceConfigPath: "recaptchaenterprise_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/recaptchaenterprise/v1beta1", @@ -497,7 +493,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/recaptchaenterprise/v2/apiv1beta1", GRPCServiceConfigPath: "recaptchaenterprise_grpc_service_config.json", ApiServiceConfigPath: "recaptchaenterprise_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -514,7 +509,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/redis/apiv1beta1", GRPCServiceConfigPath: "redis_grpc_service_config.json", ApiServiceConfigPath: "redis_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -531,7 +525,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/errorreporting/apiv1beta1", GRPCServiceConfigPath: "errorreporting_grpc_service_config.json", ApiServiceConfigPath: "clouderrorreporting_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -596,8 +589,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/securitycenter/settings/apiv1beta1", GRPCServiceConfigPath: "securitycenter_settings_grpc_service_config.json", ApiServiceConfigPath: "securitycenter_settings.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/securitycenter/v1", @@ -613,7 +606,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/securitycenter/apiv1beta1", GRPCServiceConfigPath: "securitycenter_grpc_service_config.json", ApiServiceConfigPath: "securitycenter_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -622,7 +614,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/securitycenter/apiv1p1beta1", GRPCServiceConfigPath: "securitycenter_grpc_service_config.json", ApiServiceConfigPath: "securitycenter_v1p1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -655,7 +646,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/dialogflow/cx/apiv3beta1", GRPCServiceConfigPath: "dialogflow_grpc_service_config.json", ApiServiceConfigPath: "dialogflow_v3beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -689,7 +679,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "longrunning_grpc_service_config.json", ApiServiceConfigPath: "longrunning.yaml", ReleaseLevel: "alpha", - Transports: []string{"grpc", "rest"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/devtools/containeranalysis/v1beta1", @@ -697,7 +687,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/containeranalysis/apiv1beta1", GRPCServiceConfigPath: "containeranalysis_grpc_service_config.json", ApiServiceConfigPath: "containeranalysis_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -708,7 +697,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/containeranalysis/apiv1beta1", GRPCServiceConfigPath: "../containeranalysis_grpc_service_config.json", ApiServiceConfigPath: "../containeranalysis_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -725,7 +713,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/videointelligence/apiv1beta2", GRPCServiceConfigPath: "videointelligence_grpc_service_config.json", ApiServiceConfigPath: "../videointelligence_v1beta2.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -734,7 +721,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/asset/apiv1p2beta1", GRPCServiceConfigPath: "cloudasset_grpc_service_config.json", ApiServiceConfigPath: "cloudasset_v1p2beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -743,7 +729,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/asset/apiv1p5beta1", GRPCServiceConfigPath: "cloudasset_grpc_service_config.json", ApiServiceConfigPath: "cloudasset_v1p5beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -753,6 +738,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "monitoring_grpc_service_config.json", ApiServiceConfigPath: "monitoring.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/vision/v1p1beta1", @@ -760,7 +747,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/vision/v2/apiv1p1beta1", GRPCServiceConfigPath: "vision_grpc_service_config.json", ApiServiceConfigPath: "vision_v1p1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -770,6 +756,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "logging_grpc_service_config.json", ApiServiceConfigPath: "logging_v2.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/talent/v4", @@ -785,7 +773,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/talent/apiv4beta1", GRPCServiceConfigPath: "talent_grpc_service_config.json", ApiServiceConfigPath: "jobs_v4beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -803,6 +790,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "pubsublite_grpc_service_config.json", ApiServiceConfigPath: "pubsublite_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/automl/v1", @@ -818,7 +807,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/automl/apiv1beta1", GRPCServiceConfigPath: "automl_grpc_service_config.json", ApiServiceConfigPath: "automl_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -828,6 +816,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "container_grpc_service_config.json", ApiServiceConfigPath: "container_v1.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/servicedirectory/v1", @@ -843,7 +833,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/servicedirectory/apiv1beta1", GRPCServiceConfigPath: "servicedirectory_grpc_service_config.json", ApiServiceConfigPath: "servicedirectory_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -860,7 +849,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/gaming/apiv1beta", GRPCServiceConfigPath: "gaming_grpc_service_config.json", ApiServiceConfigPath: "gameservices_v1beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -894,6 +882,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "networkconnectivity_v1_grpc_service_config.json", ApiServiceConfigPath: "networkconnectivity_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/networkconnectivity/v1alpha1", @@ -901,7 +890,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/networkconnectivity/apiv1alpha1", GRPCServiceConfigPath: "networkconnectivity_grpc_service_config.json", ApiServiceConfigPath: "networkconnectivity_v1alpha1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -910,7 +898,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/notebooks/apiv1beta1", GRPCServiceConfigPath: "notebooks_grpc_service_config.json", ApiServiceConfigPath: "notebooks_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -920,6 +907,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "billingbudgets_grpc_service_config.json", ApiServiceConfigPath: "billingbudgets.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/billing/budgets/v1beta1", @@ -927,7 +916,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/billing/budgets/apiv1beta1", GRPCServiceConfigPath: "billingbudgets_grpc_service_config.json", ApiServiceConfigPath: "billingbudgets.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -944,7 +932,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/workflows/apiv1beta", GRPCServiceConfigPath: "workflows_grpc_service_config.json", ApiServiceConfigPath: "workflows_v1beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -954,6 +941,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "executions_grpc_service_config.json", ApiServiceConfigPath: "workflowexecutions_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/workflows/executions/v1beta", @@ -961,8 +950,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/workflows/executions/apiv1beta", GRPCServiceConfigPath: "executions_grpc_service_config.json", ApiServiceConfigPath: "workflowexecutions_v1beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/security/privateca/v1beta1", @@ -970,7 +959,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/security/privateca/apiv1beta1", GRPCServiceConfigPath: "privateca_grpc_service_config.json", ApiServiceConfigPath: "privateca_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -987,7 +975,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/assuredworkloads/apiv1beta1", GRPCServiceConfigPath: "assuredworkloads_grpc_service_config.json", ApiServiceConfigPath: "assuredworkloads_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1013,6 +1000,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "managedidentities_grpc_service_config.json", ApiServiceConfigPath: "managedidentities_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/devtools/artifactregistry/v1beta2", @@ -1020,7 +1009,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/artifactregistry/apiv1beta2", GRPCServiceConfigPath: "artifactregistry_grpc_service_config.json", ApiServiceConfigPath: "artifactregistry_v1beta2.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "ga", }, { @@ -1030,6 +1018,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "retail_grpc_service_config.json", ApiServiceConfigPath: "retail_v2.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/appengine/v1", @@ -1044,7 +1033,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/binaryauthorization/apiv1beta1", GRPCServiceConfigPath: "binaryauthorization_grpc_service_config.json", ApiServiceConfigPath: "binaryauthorization_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1077,7 +1065,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/datalabeling/apiv1beta1", GRPCServiceConfigPath: "datalabeling_grpc_service_config.json", ApiServiceConfigPath: "datalabeling_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1086,8 +1073,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/dataqna/apiv1alpha", GRPCServiceConfigPath: "dataqna_grpc_service_config.json", ApiServiceConfigPath: "dataqna_v1alpha.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/documentai/v1", @@ -1103,7 +1090,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/documentai/apiv1beta3", GRPCServiceConfigPath: "documentai_v1beta3_grpc_service_config.json", ApiServiceConfigPath: "documentai_v1beta3.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1120,7 +1106,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/domains/apiv1beta1", GRPCServiceConfigPath: "domains_grpc_service_config.json", ApiServiceConfigPath: "domains_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1129,7 +1114,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/mediatranslation/apiv1beta1", GRPCServiceConfigPath: "mediatranslation_grpc_service_config.json", ApiServiceConfigPath: "mediatranslation_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1153,7 +1137,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/recommendationengine/apiv1beta1", GRPCServiceConfigPath: "recommendationengine_grpc_service_config.json", ApiServiceConfigPath: "recommendationengine_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1162,7 +1145,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/gkehub/apiv1beta1", GRPCServiceConfigPath: "membership_grpc_service_config.json", ApiServiceConfigPath: "gkehub_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1187,7 +1169,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/metastore/apiv1alpha", GRPCServiceConfigPath: "metastore_grpc_service_config.json", ApiServiceConfigPath: "metastore_v1alpha.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -1196,7 +1177,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/metastore/apiv1beta", GRPCServiceConfigPath: "metastore_grpc_service_config.json", ApiServiceConfigPath: "metastore_v1beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1214,6 +1194,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "library_grpc_service_config.json", ApiServiceConfigPath: "datamigration_v1.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/essentialcontacts/v1", @@ -1253,7 +1235,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/privatecatalog/apiv1beta1", GRPCServiceConfigPath: "cloudprivatecatalog_grpc_service_config.json", ApiServiceConfigPath: "cloudprivatecatalog_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1263,6 +1244,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "tpu_grpc_service_config.json", ApiServiceConfigPath: "tpu_v1.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/apigeeconnect/v1", @@ -1271,6 +1254,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "connection_grpc_service_config.json", ApiServiceConfigPath: "apigeeconnect_v1.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/lifesciences/v2beta", @@ -1278,7 +1263,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/lifesciences/apiv2beta", GRPCServiceConfigPath: "lifesciences_grpc_service_config.json", ApiServiceConfigPath: "lifesciences_v2beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1288,6 +1272,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "aiplatform_grpc_service_config.json", ApiServiceConfigPath: "aiplatform_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/aiplatform/v1beta1", @@ -1295,8 +1281,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/aiplatform/apiv1beta1", GRPCServiceConfigPath: "aiplatform_grpc_service_config.json", ApiServiceConfigPath: "aiplatform_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/gkeconnect/gateway/v1beta1", @@ -1304,8 +1290,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/gkeconnect/gateway/apiv1beta1", GRPCServiceConfigPath: "connectgw_grpc_service_config.json", ApiServiceConfigPath: "connectgateway_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/datastream/v1alpha1", @@ -1313,7 +1299,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/datastream/apiv1alpha1", GRPCServiceConfigPath: "datastream_grpc_service_config.json", ApiServiceConfigPath: "datastream_v1alpha1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -1322,7 +1307,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/dataflow/apiv1beta3", GRPCServiceConfigPath: "dataflow_grpc_service_config.json", ApiServiceConfigPath: "dataflow_v1beta3.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1371,7 +1355,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/networksecurity/apiv1beta1", GRPCServiceConfigPath: "networksecurity_v1beta1_grpc_service_config.json", ApiServiceConfigPath: "networksecurity_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1381,6 +1364,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "metricsscopes_grpc_service_config.json", ApiServiceConfigPath: "monitoring.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/identity/accesscontextmanager/v1", @@ -1462,6 +1447,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "dataplex_grpc_service_config.json", ApiServiceConfigPath: "dataplex_v1.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/video/stitcher/v1", @@ -1470,6 +1457,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "videostitcher_grpc_service_config.json", ApiServiceConfigPath: "videostitcher_v1.yaml", ReleaseLevel: "ga", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/certificatemanager/v1", @@ -1527,6 +1516,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "notebooks_grpc_service_config.json", ApiServiceConfigPath: "notebooks_v1.yaml", ReleaseLevel: "ga", + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/workflows/v1", @@ -1551,6 +1541,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/gkemulticloud/apiv1", GRPCServiceConfigPath: "gkemulticloud_grpc_service_config.json", ApiServiceConfigPath: "gkemulticloud_v1.yaml", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, // GA after 2022/08/10 ReleaseLevel: "beta", }, @@ -1560,7 +1552,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/retail/apiv2alpha", GRPCServiceConfigPath: "retail_grpc_service_config.json", ApiServiceConfigPath: "retail_v2alpha.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -1569,7 +1560,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/retail/apiv2beta", GRPCServiceConfigPath: "retail_grpc_service_config.json", ApiServiceConfigPath: "retail_v2beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1596,7 +1586,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/videointelligence/apiv1p3beta1", GRPCServiceConfigPath: "videointelligence_grpc_service_config.json", ApiServiceConfigPath: "videointelligence_v1p3beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1605,7 +1594,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/functions/apiv2beta", GRPCServiceConfigPath: "functions_grpc_service_config.json", ApiServiceConfigPath: "cloudfunctions_v2beta.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1614,7 +1602,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/dataform/apiv1alpha2", GRPCServiceConfigPath: "dataform_grpc_service_config.json", ApiServiceConfigPath: "dataform_v1alpha2.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -1633,7 +1620,9 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "beyondcorp-appconnections_grpc_service_config.json", ApiServiceConfigPath: "beyondcorp_v1.yaml", // GA after 2022/08/12 - ReleaseLevel: "beta", + ReleaseLevel: "beta", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/beyondcorp/appconnectors/v1", @@ -1642,7 +1631,9 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "beyondcorp-appconnectors_grpc_service_config.json", ApiServiceConfigPath: "beyondcorp_v1.yaml", // GA after 2022/08/12 - ReleaseLevel: "beta", + ReleaseLevel: "beta", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/beyondcorp/appgateways/v1", @@ -1651,7 +1642,9 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "beyondcorp-appgateways_grpc_service_config.json", ApiServiceConfigPath: "beyondcorp_v1.yaml", // GA after 2022/08/12 - ReleaseLevel: "beta", + ReleaseLevel: "beta", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/beyondcorp/clientconnectorservices/v1", @@ -1660,7 +1653,9 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "beyondcorp-clientconnectorservices_grpc_service_config.json", ApiServiceConfigPath: "beyondcorp_v1.yaml", // GA after 2022/08/12 - ReleaseLevel: "beta", + ReleaseLevel: "beta", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/cloud/beyondcorp/clientgateways/v1", @@ -1669,7 +1664,9 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "beyondcorp-clientgateways_grpc_service_config.json", ApiServiceConfigPath: "beyondcorp_v1.yaml", // GA after 2022/08/12 - ReleaseLevel: "beta", + ReleaseLevel: "beta", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/devtools/artifactregistry/v1", @@ -1687,7 +1684,9 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ GRPCServiceConfigPath: "apigeeregistry_grpc_service_config.json", ApiServiceConfigPath: "apigeeregistry_v1.yaml", // GA after 2022/09/02 - ReleaseLevel: "beta", + ReleaseLevel: "beta", + NumericEnumsDisabled: true, + Transports: []string{"grpc"}, }, { InputDirectoryPath: "google/api/apikeys/v2", @@ -1704,7 +1703,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/dialogflow/apiv2beta1", GRPCServiceConfigPath: "dialogflow_grpc_service_config.json", ApiServiceConfigPath: "dialogflow_v2beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1713,7 +1711,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/iam/apiv1", ApiServiceConfigPath: "iam_meta_api.yaml", // GA after 2022/12/21 - ReleaseLevel: "beta", + ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/iam/v2", @@ -1730,7 +1729,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/security/publicca/apiv1beta1", GRPCServiceConfigPath: "publicca_v1beta1_grpc_service_config.json", ApiServiceConfigPath: "publicca_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1748,8 +1746,8 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/bigquery/datapolicies/apiv1beta1", GRPCServiceConfigPath: "datapolicies_v1beta1_grpc_service_config.json", ApiServiceConfigPath: "bigquerydatapolicy_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", + NumericEnumsDisabled: true, }, { InputDirectoryPath: "google/cloud/bigquery/analyticshub/v1", @@ -1757,7 +1755,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/bigquery/analyticshub/apiv1", GRPCServiceConfigPath: "analyticshub_v1_grpc_service_config.json", ApiServiceConfigPath: "analyticshub_v1.yaml", - Transports: []string{"grpc", "rest"}, + NumericEnumsDisabled: true, // GA after 2022/10/20 ReleaseLevel: "beta", }, @@ -1776,7 +1774,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/dataform/apiv1beta1", GRPCServiceConfigPath: "dataform_grpc_service_config.json", ApiServiceConfigPath: "dataform_v1beta1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "beta", }, { @@ -1814,7 +1811,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/analytics/admin/apiv1alpha", GRPCServiceConfigPath: "admin_grpc_service_config.json", ApiServiceConfigPath: "analyticsadmin_v1alpha.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -1823,7 +1819,6 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ImportPath: "cloud.google.com/go/area120/tables/apiv1alpha1", GRPCServiceConfigPath: "tables_grpc_service_config.json", ApiServiceConfigPath: "area120tables_v1alpha1.yaml", - Transports: []string{"grpc", "rest"}, ReleaseLevel: "alpha", }, { @@ -1843,5 +1838,7 @@ var MicrogenGapicConfigs = []*MicrogenConfig{ ApiServiceConfigPath: "storage_v2.yaml", ReleaseLevel: "alpha", stubsDir: "stubs", + Transports: []string{"grpc"}, + NumericEnumsDisabled: true, }, } diff --git a/internal/gapicgen/generator/gapics.go b/internal/gapicgen/generator/gapics.go index 6287e2c4a1f..550843088eb 100644 --- a/internal/gapicgen/generator/gapics.go +++ b/internal/gapicgen/generator/gapics.go @@ -309,10 +309,13 @@ func (g *GapicGenerator) microgen(conf *MicrogenConfig) error { if !conf.DisableMetadata { args = append(args, "--go_gapic_opt", "metadata") } + if len(conf.Transports) == 0 { + conf.Transports = []string{"grpc", "rest"} + } if len(conf.Transports) > 0 { args = append(args, "--go_gapic_opt", fmt.Sprintf("transport=%s", strings.Join(conf.Transports, "+"))) } - if conf.NumericEnumsEnabled { + if !conf.NumericEnumsDisabled { args = append(args, "--go_gapic_opt", "rest-numeric-enums") } // This is a bummer way of toggling diregapic generation, but it compute is the only one for the near term.