-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: add transport
option to generation_config.yaml
#3052
Changes from 5 commits
42648dc
6e2686c
faf5830
be42912
1700842
3bc9425
f7ef615
715667a
53681e9
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,16 @@ | ||
{ | ||
"api_shortname": "secretmanager", | ||
"name_pretty": "Secret Management", | ||
"product_documentation": "https://cloud.google.com/solutions/secrets-management/", | ||
"api_description": "allows you to encrypt, store, manage, and audit infrastructure and application-level secrets.", | ||
"client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-secretmanager/latest/overview", | ||
"release_level": "preview", | ||
"transport": "http", | ||
"language": "java", | ||
"repo": "googleapis/google-cloud-java", | ||
"repo_short": "java-secretmanager", | ||
"distribution_name": "com.google.cloud:google-cloud-secretmanager", | ||
"api_id": "secretmanager.googleapis.com", | ||
"library_type": "GAPIC_AUTO", | ||
"requires_billing": true | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,6 +18,7 @@ | |||||||||||||||||
import shutil | ||||||||||||||||||
from pathlib import Path | ||||||||||||||||||
from library_generation.model.generation_config import GenerationConfig | ||||||||||||||||||
from library_generation.model.gapic_inputs import GapicInputs | ||||||||||||||||||
from library_generation.model.library_config import LibraryConfig | ||||||||||||||||||
from typing import List | ||||||||||||||||||
from library_generation.model.repo_config import RepoConfig | ||||||||||||||||||
|
@@ -186,7 +187,7 @@ def generate_postprocessing_prerequisite_files( | |||||||||||||||||
config: GenerationConfig, | ||||||||||||||||||
library: LibraryConfig, | ||||||||||||||||||
proto_path: str, | ||||||||||||||||||
transport: str, | ||||||||||||||||||
gapic_inputs: GapicInputs, | ||||||||||||||||||
library_path: str, | ||||||||||||||||||
language: str = "java", | ||||||||||||||||||
) -> None: | ||||||||||||||||||
|
@@ -198,11 +199,14 @@ def generate_postprocessing_prerequisite_files( | |||||||||||||||||
:param library: the library configuration | ||||||||||||||||||
:param proto_path: the path from the root of googleapis to the location of the service | ||||||||||||||||||
protos. If the path contains a version, it will be removed | ||||||||||||||||||
:param transport: transport supported by the library | ||||||||||||||||||
:param gapic_inputs: gapic_inputs obtained from the library's BUILD.bazel | ||||||||||||||||||
:param library_path: the path to which the generated file goes | ||||||||||||||||||
:param language: programming language of the library | ||||||||||||||||||
:return: None | ||||||||||||||||||
""" | ||||||||||||||||||
transport = ( | ||||||||||||||||||
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. Can we move this logic to 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. I initially did it that way, but then I found that it would be better for testing if we leave the This test helper passes a hard-coded value: sdk-platform-java/library_generation/test/utilities_unit_tests.py Lines 279 to 286 in e46648f
And we don't have unit tests for 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. Resolution from discussion with @blakeli0: let's move the logic to the model class 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. Done |
||||||||||||||||||
gapic_inputs.transport if library.transport is None else library.transport | ||||||||||||||||||
) | ||||||||||||||||||
library_name = library.get_library_name() | ||||||||||||||||||
artifact_id = library.get_artifact_id() | ||||||||||||||||||
if config.contains_common_protos(): | ||||||||||||||||||
|
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.
from @blakeli0: let's encapsulate this logic in a function of
model.LibraryConfig
so it's easier to test and we avoid passinggapic_inputs
down the call