Skip to content
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 32 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
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 Oct 3, 2018
f446ec8
Add automl synth script
chingor13 Oct 3, 2018
6397513
Add BigQueryDataTransfer synth
chingor13 Oct 3, 2018
b646ed9
Add BigTable synth
chingor13 Oct 3, 2018
d8a56fa
Add BigTableAdmin synth
chingor13 Oct 3, 2018
d413248
Add container synth
chingor13 Oct 3, 2018
7668b6c
Add containeranalysis synth
chingor13 Oct 3, 2018
5fd519d
Add dataproc synth
chingor13 Oct 3, 2018
a1042dc
Add datastore synth
chingor13 Oct 3, 2018
9cf131b
Add dialogflow synth
chingor13 Oct 3, 2018
3e50d8d
Add dlp synth
chingor13 Oct 3, 2018
19b667d
Add errorreporting synth
chingor13 Oct 3, 2018
676cca0
Add firestore synth
chingor13 Oct 3, 2018
e80364c
Add iot synth
chingor13 Oct 3, 2018
5e1f5df
Add kms synth
chingor13 Oct 3, 2018
f329a72
Add language synth
chingor13 Oct 3, 2018
ec9135d
Add logging synth
chingor13 Oct 3, 2018
a2a3d58
Add monitoring synth
chingor13 Oct 3, 2018
df96632
Add oslogin synth
chingor13 Oct 3, 2018
eb4f8d0
Add pubsub synth
chingor13 Oct 3, 2018
e78d817
Add redis synth
chingor13 Oct 3, 2018
34d3cb4
Add spanner synth
chingor13 Oct 3, 2018
390325c
Add speech synth
chingor13 Oct 3, 2018
1d23189
Add tasks synth
chingor13 Oct 3, 2018
885a315
Add texttospeech synth
chingor13 Oct 3, 2018
323efa6
Add trace synth
chingor13 Oct 3, 2018
e4afbb8
Add videointelligence synth
chingor13 Oct 3, 2018
ba35839
Add vision synth
chingor13 Oct 3, 2018
a479fe6
Add websecurityscanner synth
chingor13 Oct 3, 2018
9739afd
Add compute synth
chingor13 Oct 3, 2018
40c41d1
Remove unnecessary import
chingor13 Oct 4, 2018
98c03ca
Remove compute synth and remove excess logging statements
chingor13 Oct 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions google-cloud-clients/google-cloud-asset/synth.py
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)

This comment was marked as spam.


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)
35 changes: 35 additions & 0 deletions google-cloud-clients/google-cloud-automl/synth.py
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 google-cloud-clients/google-cloud-bigquerydatatransfer/synth.py
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')

35 changes: 35 additions & 0 deletions google-cloud-clients/google-cloud-bigtable-admin/synth.py
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')

35 changes: 35 additions & 0 deletions google-cloud-clients/google-cloud-bigtable/synth.py
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')

88 changes: 88 additions & 0 deletions google-cloud-clients/google-cloud-compute/synth.py
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.

This comment was marked as spam.

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')

35 changes: 35 additions & 0 deletions google-cloud-clients/google-cloud-container/synth.py
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 google-cloud-clients/google-cloud-containeranalysis/synth.py
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')

36 changes: 36 additions & 0 deletions google-cloud-clients/google-cloud-dataproc/synth.py
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')

Loading