-
Notifications
You must be signed in to change notification settings - Fork 75
feat(librariangen): add protoc package #3935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
42b04c9
e7c57b5
353e7a0
7093602
ec1e063
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,100 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Copyright 2025 Google LLC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package protoc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "os" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "path/filepath" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "strings" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ConfigProvider is an interface that describes the configuration needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // by the Build function. This allows the protoc package to be decoupled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // from the source of the configuration (e.g., Bazel files, JSON, etc.). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type ConfigProvider interface { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ServiceYAML() string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GapicYAML() string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GRPCServiceConfig() string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Transport() string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HasRESTNumericEnums() bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HasGAPIC() bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Build constructs the full protoc command arguments for a given API. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func Build(apiServiceDir string, config ConfigProvider, sourceDir, outputDir string) ([]string, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Gather all .proto files in the API's source directory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| entries, err := os.ReadDir(apiServiceDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil, fmt.Errorf("librariangen: failed to read API source directory %s: %w", apiServiceDir, err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var protoFiles []string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for _, entry := range entries { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if !entry.IsDir() && filepath.Ext(entry.Name()) == ".proto" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protoFiles = append(protoFiles, filepath.Join(apiServiceDir, entry.Name())) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(protoFiles) == 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil, fmt.Errorf("librariangen: no .proto files found in %s", apiServiceDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Construct the protoc command arguments. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var gapicOpts []string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if config.HasGAPIC() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if config.ServiceYAML() != "" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gapicOpts = append(gapicOpts, fmt.Sprintf("api-service-config=%s", filepath.Join(apiServiceDir, config.ServiceYAML()))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if config.GapicYAML() != "" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gapicOpts = append(gapicOpts, fmt.Sprintf("gapic-config=%s", filepath.Join(apiServiceDir, config.GapicYAML()))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if config.GRPCServiceConfig() != "" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gapicOpts = append(gapicOpts, fmt.Sprintf("grpc-service-config=%s", filepath.Join(apiServiceDir, config.GRPCServiceConfig()))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if config.Transport() != "" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gapicOpts = append(gapicOpts, fmt.Sprintf("transport=%s", config.Transport())) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if config.HasRESTNumericEnums() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gapicOpts = append(gapicOpts, "rest-numeric-enums") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+58
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block has some repetition when constructing
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args := []string{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "protoc", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--experimental_allow_proto3_optional", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args = append(args, fmt.Sprintf("--java_out=%s", outputDir)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if config.HasGAPIC() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args = append(args, fmt.Sprintf("--java_gapic_out=metadata:%s", filepath.Join(outputDir, "java_gapic.zip"))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(gapicOpts) > 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args = append(args, "--java_gapic_opt="+strings.Join(gapicOpts, ",")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args = append(args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // The -I flag specifies the import path for protoc. All protos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // and their dependencies must be findable from this path. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // The /source mount contains the complete googleapis repository. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "-I="+sourceDir, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args = append(args, protoFiles...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return args, nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| // Copyright 2025 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package protoc | ||
|
|
||
| import ( | ||
| "path/filepath" | ||
| "strings" | ||
| "testing" | ||
|
|
||
| "github.com/google/go-cmp/cmp" | ||
| ) | ||
|
|
||
| // mockConfigProvider is a mock implementation of the ConfigProvider interface for testing. | ||
| type mockConfigProvider struct { | ||
| serviceYAML string | ||
| gapicYAML string | ||
| grpcServiceConfig string | ||
| transport string | ||
| restNumericEnums bool | ||
| hasGAPIC bool | ||
| } | ||
|
|
||
| func (m *mockConfigProvider) ServiceYAML() string { return m.serviceYAML } | ||
| func (m *mockConfigProvider) GapicYAML() string { return m.gapicYAML } | ||
| func (m *mockConfigProvider) GRPCServiceConfig() string { return m.grpcServiceConfig } | ||
| func (m *mockConfigProvider) Transport() string { return m.transport } | ||
| func (m *mockConfigProvider) HasRESTNumericEnums() bool { return m.restNumericEnums } | ||
| func (m *mockConfigProvider) HasGAPIC() bool { return m.hasGAPIC } | ||
|
|
||
| func TestBuild(t *testing.T) { | ||
| // The testdata directory is a curated version of a valid protoc | ||
| // import path that contains all the necessary proto definitions. | ||
| sourceDir, err := filepath.Abs("../testdata/generate/source") | ||
| if err != nil { | ||
| t.Fatalf("failed to get absolute path for sourceDir: %v", err) | ||
| } | ||
| tests := []struct { | ||
| name string | ||
| apiPath string | ||
| reqID string | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| config mockConfigProvider | ||
| want []string | ||
| }{ | ||
| { | ||
| name: "java_grpc_library rule", | ||
| apiPath: "google/cloud/workflows/v1", | ||
| reqID: "workflows", | ||
| config: mockConfigProvider{ | ||
| transport: "grpc", | ||
| grpcServiceConfig: "workflows_grpc_service_config.json", | ||
| gapicYAML: "workflows_gapic.yaml", | ||
| serviceYAML: "workflows_v1.yaml", | ||
| restNumericEnums: true, | ||
| hasGAPIC: true, | ||
| }, | ||
| want: []string{ | ||
| "protoc", | ||
| "--experimental_allow_proto3_optional", | ||
| "--java_out=/output", | ||
| "--java_gapic_out=metadata:/output/java_gapic.zip", | ||
| "--java_gapic_opt=" + strings.Join([]string{ | ||
| "api-service-config=" + filepath.Join(sourceDir, "google/cloud/workflows/v1/workflows_v1.yaml"), | ||
| "gapic-config=" + filepath.Join(sourceDir, "google/cloud/workflows/v1/workflows_gapic.yaml"), | ||
| "grpc-service-config=" + filepath.Join(sourceDir, "google/cloud/workflows/v1/workflows_grpc_service_config.json"), | ||
| "transport=grpc", | ||
| "rest-numeric-enums", | ||
| }, ","), | ||
| "-I=" + sourceDir, | ||
| filepath.Join(sourceDir, "google/cloud/workflows/v1/workflows.proto"), | ||
| }, | ||
| }, | ||
| { | ||
| name: "java_proto_library rule with legacy gRPC", | ||
| apiPath: "google/cloud/secretmanager/v1beta2", | ||
| reqID: "secretmanager", | ||
| config: mockConfigProvider{ | ||
| transport: "grpc", | ||
| grpcServiceConfig: "secretmanager_grpc_service_config.json", | ||
| serviceYAML: "secretmanager_v1beta2.yaml", | ||
| restNumericEnums: true, | ||
| hasGAPIC: true, | ||
| }, | ||
| want: []string{ | ||
| "protoc", | ||
| "--experimental_allow_proto3_optional", | ||
| "--java_out=/output", | ||
| "--java_gapic_out=metadata:/output/java_gapic.zip", | ||
| "--java_gapic_opt=" + strings.Join([]string{ | ||
| "api-service-config=" + filepath.Join(sourceDir, "google/cloud/secretmanager/v1beta2/secretmanager_v1beta2.yaml"), | ||
| "grpc-service-config=" + filepath.Join(sourceDir, "google/cloud/secretmanager/v1beta2/secretmanager_grpc_service_config.json"), | ||
| "transport=grpc", | ||
| "rest-numeric-enums", | ||
| }, ","), | ||
| "-I=" + sourceDir, | ||
| filepath.Join(sourceDir, "google/cloud/secretmanager/v1beta2/secretmanager.proto"), | ||
| }, | ||
| }, | ||
| { | ||
| // Note: we don't have a separate test directory with a proto-only library; | ||
| // the config is used to say "don't generate GAPIC". | ||
| name: "proto-only", | ||
| apiPath: "google/cloud/secretmanager/v1beta2", | ||
| reqID: "secretmanager", | ||
| config: mockConfigProvider{ | ||
| hasGAPIC: false, | ||
| }, | ||
| want: []string{ | ||
| "protoc", | ||
| "--experimental_allow_proto3_optional", | ||
| "--java_out=/output", | ||
| "-I=" + sourceDir, | ||
| filepath.Join(sourceDir, "google/cloud/secretmanager/v1beta2/secretmanager.proto"), | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| got, err := Build(filepath.Join(sourceDir, tt.apiPath), &tt.config, sourceDir, "/output") | ||
| if err != nil { | ||
| t.Fatalf("Build() failed: %v", err) | ||
| } | ||
|
|
||
| if diff := cmp.Diff(tt.want, got); diff != "" { | ||
| t.Errorf("Build() mismatch (-want +got):\n%s", diff) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright 2025 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| syntax = "proto3"; | ||
|
|
||
| package google.api; | ||
|
|
||
| import "google/protobuf/descriptor.proto"; | ||
|
|
||
| option java_multiple_files = true; | ||
| option java_outer_classname = "AnnotationsProto"; | ||
| option java_package = "com.google.api"; | ||
|
|
||
| extend google.protobuf.MethodOptions { | ||
| HttpRule http = 72295728; | ||
| } | ||
|
|
||
| message HttpRule { | ||
| string selector = 1; | ||
| oneof pattern { | ||
| string get = 2; | ||
| string put = 3; | ||
| string post = 4; | ||
| string delete = 5; | ||
| string patch = 6; | ||
| CustomHttpPattern custom = 8; | ||
| } | ||
| string body = 7; | ||
| repeated HttpRule additional_bindings = 11; | ||
| } | ||
|
|
||
| message CustomHttpPattern { | ||
| string kind = 1; | ||
| string path = 2; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| java_proto_library( | ||
| name = "secretmanager_java_proto", | ||
| deps = [":secretmanager_proto"], | ||
| ) | ||
|
|
||
| java_grpc_library( | ||
| name = "secretmanager_java_grpc", | ||
| srcs = [":secretmanager_proto"], | ||
| deps = [":secretmanager_java_proto"], | ||
| ) | ||
|
|
||
| java_gapic_library( | ||
| name = "secretmanager_java_gapic", | ||
| srcs = [":secretmanager_proto_with_info"], | ||
| gapic_yaml = None, | ||
| grpc_service_config = "secretmanager_grpc_service_config.json", | ||
| rest_numeric_enums = True, | ||
| service_yaml = "secretmanager_v1beta2.yaml", | ||
| test_deps = [ | ||
| "//google/cloud/location:location_java_grpc", | ||
| "//google/iam/v1:iam_java_grpc", | ||
| ":secretmanager_java_grpc", | ||
| ], | ||
| transport = "grpc+rest", | ||
| deps = [ | ||
| ":secretmanager_java_proto", | ||
| "//google/api:api_java_proto", | ||
| "//google/cloud/location:location_java_proto", | ||
| "//google/iam/v1:iam_java_proto", | ||
| ], | ||
| ) | ||
|
|
||
| java_gapic_test( | ||
| name = "secretmanager_java_gapic_test_suite", | ||
| test_classes = [ | ||
| "com.google.cloud.secretmanager.v1beta2.SecretManagerServiceClientHttpJsonTest", | ||
| "com.google.cloud.secretmanager.v1beta2.SecretManagerServiceClientTest", | ||
| ], | ||
| runtime_deps = [":secretmanager_java_gapic_test"], | ||
| ) | ||
|
|
||
| # Open Source Packages | ||
| java_gapic_assembly_gradle_pkg( | ||
| name = "google-cloud-secretmanager-v1beta2-java", | ||
| transport = "grpc+rest", | ||
| deps = [ | ||
| ":secretmanager_java_gapic", | ||
| ":secretmanager_java_grpc", | ||
| ":secretmanager_java_proto", | ||
| ":secretmanager_proto", | ||
| ], | ||
| include_samples = True, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Copyright 2025 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| syntax = "proto3"; | ||
|
|
||
| package google.cloud.secretmanager.v1beta2; | ||
|
|
||
| import "google/api/annotations.proto"; | ||
|
|
||
| option java_multiple_files = true; | ||
| option java_outer_classname = "ServiceProto"; | ||
| option java_package = "com.google.cloud.secretmanager.v1beta2"; | ||
|
|
||
| // A Secret is a secret value. | ||
| message Secret { | ||
| string name = 1; | ||
| } | ||
|
|
||
| // Request for the `ListSecrets` method. | ||
| message ListSecretsRequest { | ||
| string parent = 1; | ||
| } | ||
|
|
||
| // Response for the `ListSecrets` method. | ||
| message ListSecretsResponse { | ||
| repeated Secret Secrets = 1; | ||
| } | ||
|
|
||
| // Service for managing secrets. | ||
| service Secrets { | ||
| // Lists Secrets in a given project and location. | ||
| rpc ListSecrets(ListSecretsRequest) returns (ListSecretsResponse) { | ||
| option (google.api.http) = { | ||
| get: "/v1/{parent=projects/*/locations/*}/Secrets" | ||
| }; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this rewriting part of generate_library.sh in go? If yes, there are some special cases need to be handled. cc: @JoeWang1127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just scaffolding for now. Yes, we'll be rewriting the needed logic in Go.