-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add synthtool scripts #3765
Merged
Merged
Add synthtool scripts #3765
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
3d1aa2e
Add assets synth script
chingor13 f446ec8
Add automl synth script
chingor13 6397513
Add BigQueryDataTransfer synth
chingor13 b646ed9
Add BigTable synth
chingor13 d8a56fa
Add BigTableAdmin synth
chingor13 d413248
Add container synth
chingor13 7668b6c
Add containeranalysis synth
chingor13 5fd519d
Add dataproc synth
chingor13 a1042dc
Add datastore synth
chingor13 9cf131b
Add dialogflow synth
chingor13 3e50d8d
Add dlp synth
chingor13 19b667d
Add errorreporting synth
chingor13 676cca0
Add firestore synth
chingor13 e80364c
Add iot synth
chingor13 5e1f5df
Add kms synth
chingor13 f329a72
Add language synth
chingor13 ec9135d
Add logging synth
chingor13 a2a3d58
Add monitoring synth
chingor13 df96632
Add oslogin synth
chingor13 eb4f8d0
Add pubsub synth
chingor13 e78d817
Add redis synth
chingor13 34d3cb4
Add spanner synth
chingor13 390325c
Add speech synth
chingor13 1d23189
Add tasks synth
chingor13 885a315
Add texttospeech synth
chingor13 323efa6
Add trace synth
chingor13 e4afbb8
Add videointelligence synth
chingor13 ba35839
Add vision synth
chingor13 a479fe6
Add websecurityscanner synth
chingor13 9739afd
Add compute synth
chingor13 40c41d1
Remove unnecessary import
chingor13 98c03ca
Remove compute synth and remove excess logging statements
chingor13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
# tasks has two product names, and a poorly named artman yaml | ||
v1beta1_library = gapic.java_library( | ||
service='asset', | ||
version='v1beta1', | ||
config_path='artman_cloudasset_v1beta1.yaml', | ||
artman_output_name='') | ||
|
||
s.copy(v1beta1_library / 'gapic-google-cloud-asset-v1beta1/src', 'src') | ||
s.copy(v1beta1_library / 'grpc-google-cloud-asset-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-asset-v1beta1/src') | ||
s.copy(v1beta1_library / 'proto-google-cloud-asset-v1beta1/src', '../../google-api-grpc/proto-google-cloud-asset-v1beta1/src') | ||
|
||
# s.copy(templates) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
library = gapic.java_library( | ||
service='automl', | ||
version='v1beta1', | ||
config_path='artman_automl_v1beta1.yaml', | ||
artman_output_name='') | ||
|
||
s.copy(library / 'gapic-google-cloud-automl-v1beta1/src', 'src') | ||
s.copy(library / 'grpc-google-cloud-automl-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-automl-v1beta1/src') | ||
s.copy(library / 'proto-google-cloud-automl-v1beta1/src', '../../google-api-grpc/proto-google-cloud-automl-v1beta1/src') | ||
|
35 changes: 35 additions & 0 deletions
35
google-cloud-clients/google-cloud-bigquerydatatransfer/synth.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
library = gapic.java_library( | ||
service='bigquerydatatransfer', | ||
version='v1', | ||
config_path='/google/cloud/bigquery/datatransfer/artman_bigquerydatatransfer.yaml', | ||
artman_output_name='google-cloud-bigquerydatatransfer-v1') | ||
|
||
s.copy(library / 'gapic-google-cloud-bigquerydatatransfer-v1/src', 'src') | ||
s.copy(library / 'grpc-google-cloud-bigquerydatatransfer-v1/src', '../../google-api-grpc/grpc-google-cloud-bigquerydatatransfer-v1/src') | ||
s.copy(library / 'proto-google-cloud-bigquerydatatransfer-v1/src', '../../google-api-grpc/proto-google-cloud-bigquerydatatransfer-v1/src') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
library = gapic.java_library( | ||
service='bigtable-admin', | ||
version='v2', | ||
config_path='/google/bigtable/admin/artman_bigtableadmin.yaml', | ||
artman_output_name='') | ||
|
||
s.copy(library / 'gapic-google-cloud-bigtable-admin-v2/src', 'src') | ||
s.copy(library / 'grpc-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-admin-v2/src') | ||
s.copy(library / 'proto-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-admin-v2/src') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
library = gapic.java_library( | ||
service='bigtable', | ||
version='v2', | ||
config_path='/google/bigtable/artman_bigtable.yaml', | ||
artman_output_name='') | ||
|
||
s.copy(library / 'gapic-google-cloud-bigtable-v2/src', 'src') | ||
s.copy(library / 'grpc-google-cloud-bigtable-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-v2/src') | ||
s.copy(library / 'proto-google-cloud-bigtable-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-v2/src') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import os | ||
import synthtool as s | ||
import logging | ||
|
||
from synthtool import log | ||
from synthtool import _tracked_paths | ||
from synthtool import shell | ||
from synthtool.sources import git | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
discovery_url = "https://github.com/googleapis/discovery-artifact-manager.git" | ||
|
||
log.debug(f"Cloning {discovery_url}.") | ||
discovery = git.clone(discovery_url, depth=1) | ||
|
||
def generate(config, root_dir): | ||
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong. |
||
image = "googleapis/artman:latest" | ||
log.debug("Pulling artman image.") | ||
shell.run(["docker", "pull", image]) | ||
|
||
output_dir = root_dir / "artman-genfiles" | ||
|
||
docker_cmd = [ | ||
"docker", | ||
"run", | ||
"--rm", | ||
"-i", | ||
"-e", | ||
f"HOST_USER_ID={os.getuid()}", | ||
"-e", | ||
f"HOST_GROUP_ID={os.getgid()}", | ||
"-e", | ||
"RUNNING_IN_ARTMAN_DOCKER=True", | ||
"-v", | ||
f"{root_dir}:{root_dir}", | ||
"-v", | ||
f"{output_dir}:{output_dir}", | ||
"-w", | ||
root_dir, | ||
image, | ||
"/bin/bash", | ||
"-c", | ||
] | ||
|
||
config_yaml = root_dir / config | ||
artman_command = " ".join( | ||
map(str, ["artman", "--local", "--config", config_yaml, "generate", "java_discogapic"]) | ||
) | ||
|
||
cmd = docker_cmd + [artman_command] | ||
|
||
shell.run(cmd, cwd=root_dir) | ||
|
||
genfiles = output_dir / "java" | ||
|
||
if not genfiles.exists(): | ||
raise FileNotFoundError( | ||
f"Unable to find generated output of artman: {genfiles}." | ||
) | ||
|
||
log.success(f"Generated code into {genfiles}.") | ||
|
||
_tracked_paths.add(genfiles) | ||
return genfiles | ||
|
||
library = generate('gapic/google/compute/artman_compute.yaml', discovery) | ||
|
||
s.copy(library / 'gapic-google-cloud-compute-v1/src', 'src') | ||
#s.copy(library / 'grpc-google-cloud-compute-v1/src', '../../google-api-grpc/grpc-google-cloud-compute-v1/src') | ||
#s.copy(library / 'proto-google-cloud-compute-v1/src', '../../google-api-grpc/proto-google-cloud-compute-v1/src') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
library = gapic.java_library( | ||
service='container', | ||
version='v1', | ||
config_path='/google/container/artman_container.yaml', | ||
artman_output_name='') | ||
|
||
s.copy(library / 'gapic-google-cloud-container-v1/src', 'src') | ||
s.copy(library / 'grpc-google-cloud-container-v1/src', '../../google-api-grpc/grpc-google-cloud-container-v1/src') | ||
s.copy(library / 'proto-google-cloud-container-v1/src', '../../google-api-grpc/proto-google-cloud-container-v1/src') | ||
|
35 changes: 35 additions & 0 deletions
35
google-cloud-clients/google-cloud-containeranalysis/synth.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
library = gapic.java_library( | ||
service='container', | ||
version='v1beta1', | ||
config_path='/google/devtools/containeranalysis/artman_containeranalysis_v1beta1.yaml', | ||
artman_output_name='') | ||
|
||
s.copy(library / 'gapic-google-cloud-containeranalysis-v1beta1/src', 'src') | ||
s.copy(library / 'grpc-google-cloud-containeranalysis-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-containeranalysis-v1beta1/src') | ||
s.copy(library / 'proto-google-cloud-containeranalysis-v1beta1/src', '../../google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2018 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. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
import logging | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
gapic = gcp.GAPICGenerator() | ||
common_templates = gcp.CommonTemplates() | ||
|
||
for version in ["v1", "v1beta2"]: | ||
library = gapic.java_library( | ||
service='dataproc', | ||
version=version, | ||
config_path=f'/google/cloud/dataproc/artman_dataproc_{version}.yaml', | ||
artman_output_name='') | ||
|
||
s.copy(library / f'gapic-google-cloud-dataproc-{version}/src', 'src') | ||
s.copy(library / f'grpc-google-cloud-dataproc-{version}/src', f'../../google-api-grpc/grpc-google-cloud-dataproc-{version}/src') | ||
s.copy(library / f'proto-google-cloud-dataproc-{version}/src', f'../../google-api-grpc/proto-google-cloud-dataproc-{version}/src') | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.