예제 #1
0
# Copyright 2019 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.

import synthtool as s
import synthtool.gcp as gcp
import logging

logging.basicConfig(level=logging.DEBUG)
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library(source_location='build/src')
s.copy(templates, excludes=['.jsdoc.js'])

# Create .config directory under $HOME to get around permissions issues
# with resumable upload.
s.replace(
    ".circleci/config.yml",
    "command: npm run system-test",
    "command: mkdir $HOME/.config && npm run system-test")
예제 #2
0
import synthtool as s
import synthtool.gcp as gcp
import logging

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()

v1_library = gapic.php_library(
    service='kms',
    version='v1',
    config_path='artman_cloudkms.yaml',
    artman_output_name='google-cloud-kms-v1')

s.copy(v1_library / f'src/')
s.copy(v1_library / f'proto/src/GPBMetadata/Google/Cloud/Kms', f'metadata')
s.copy(v1_library / f'proto/src/Google/Cloud/Kms', f'src')
s.copy(v1_library / f'tests')

# fix copyright year
s.replace(
    'src/V1/**/*Client.php',
    r'Copyright \d{4}',
    r'Copyright 2018')
s.replace(
    'tests/**/V1/*Test.php',
    r'Copyright \d{4}',
    r'Copyright 2018')

# Use new namespace in the doc sample. See
예제 #3
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re
from textwrap import dedent

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'language', 'v1',
    artman_output_name='google-cloud-ruby/google-cloud-language'
)
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'lib/google/cloud/language/v1')
s.copy(v1_library / 'lib/google/cloud/language/v1.rb')
s.copy(v1_library / 'lib/google/cloud/language/v1')
s.copy(v1_library / 'lib/google/cloud/language.rb')
s.copy(v1_library / 'test/google/cloud/language/v1')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-language.gemspec', merge=ruby.merge_gemspec)

v1beta2_library = gapic.ruby_library(
    'language', 'v1beta2',
    artman_output_name='google-cloud-ruby/google-cloud-language'
)
예제 #4
0
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
excludes = ["README.rst", "setup.py", "nox*.py", "docs/index.rst"]

# ----------------------------------------------------------------------------
# Generate tasks GAPIC layer
# ----------------------------------------------------------------------------
for version in ["v2beta2", "v2beta3", "v2"]:
    library = gapic.py_library(
        "tasks",
        version,
        config_path=f"artman_cloudtasks_{version}.yaml",
        include_protos=True,
    )

    s.copy(library, excludes=excludes)

    s.replace(
        f"google/cloud/tasks_{version}/gapic/cloud_tasks_client.py",
        "(Google IAM .*?_) ",
        "\g<1>_ ",
    )

    # Issues with Anonymous ('__') links. Change to named.
    s.replace(f"google/cloud/tasks_{version}/proto/*.py", ">`__", ">`_")

# Wrapped link fails due to space in link (v2beta2)
s.replace(
    "google/cloud/tasks_v2beta2/proto/queue_pb2.py",
    "(in queue.yaml/xml) <\n\s+",
    "\g<1>\n          <",
예제 #5
0
"""This script is used to synthesize generated parts of this library."""

import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java

gapic = gcp.GAPICGenerator()

library = gapic.java_library(
    service='spanner',
    version='v1',
    config_path='/google/spanner/artman_spanner.yaml',
    artman_output_name='')

s.copy(library / 'gapic-google-cloud-spanner-v1/src', 'src')
s.copy(library / 'grpc-google-cloud-spanner-v1/src', '../../google-api-grpc/grpc-google-cloud-spanner-v1/src')
s.copy(library / 'proto-google-cloud-spanner-v1/src', '../../google-api-grpc/proto-google-cloud-spanner-v1/src')

library = gapic.java_library(
    service='spanner',
    version='v1',
    config_path='/google/spanner/admin/database/artman_spanner_admin_database.yaml',
    artman_output_name='')

s.copy(library / 'gapic-google-cloud-spanner-admin-database-v1/src', 'src')
s.copy(library / 'grpc-google-cloud-spanner-admin-database-v1/src', '../../google-api-grpc/grpc-google-cloud-spanner-admin-database-v1/src')
s.copy(library / 'proto-google-cloud-spanner-admin-database-v1/src', '../../google-api-grpc/proto-google-cloud-spanner-admin-database-v1/src')

library = gapic.java_library(
    service='spanner',
예제 #6
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re


logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v2beta2_library = gapic.ruby_library(
    'tasks', 'v2beta2', artman_output_name='google-cloud-ruby/google-cloud-tasks',
    config_path='artman_cloudtasks_v2beta2.yaml'
)
s.copy(v2beta2_library / 'lib/google/cloud/tasks/v2beta2')
s.copy(v2beta2_library / 'lib/google/cloud/tasks/v2beta2.rb')
s.copy(v2beta2_library / 'test/google/cloud/tasks/v2beta2')

v2beta3_library = gapic.ruby_library(
    'tasks', 'v2beta3', artman_output_name='google-cloud-ruby/google-cloud-tasks',
    config_path='artman_cloudtasks_v2beta3.yaml'
)
s.copy(v2beta3_library / 'lib/google/cloud/tasks.rb')
s.copy(v2beta3_library / 'lib/google/cloud/tasks/v2beta3')
s.copy(v2beta3_library / 'lib/google/cloud/tasks/v2beta3.rb')
s.copy(v2beta3_library / 'test/google/cloud/tasks/v2beta3')
s.copy(v2beta3_library / 'README.md')
s.copy(v2beta3_library / 'LICENSE')
s.copy(v2beta3_library / '.gitignore')
s.copy(v2beta3_library / '.yardopts')
예제 #7
0
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._generate_code(
    'asset', 'v1beta1', 'php',
    config_path='artman_cloudasset_v1beta1.yaml',
    artman_output_name='google-cloud-asset-v1beta1')

templates = common_templates.php_library()

s.copy(v1beta1_library / f'src/')
s.copy(v1beta1_library / f'proto/src/GPBMetadata/Google/Cloud/Asset', f'metadata')
s.copy(v1beta1_library / f'proto/src/Google/Cloud/Asset', f'src')
s.copy(v1beta1_library / f'tests')

s.copy(templates)

# fix year
s.replace(
    'src/V1beta1/*Client.php',
    r'Copyright \d{4}',
    r'Copyright 2018')
s.replace(
    '**/Gapic/*GapicClient.php',
    r'Copyright \d{4}',
    r'Copyright 2018')
예제 #8
0
logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICMicrogenerator()
common_templates = gcp.CommonTemplates()

# tasks has two product names, and a poorly named artman yaml
version = 'v1'
library = gapic.typescript_library(
    'pubsub',
    version,
    generator_args={
        'grpc-service-config':
        f'google/pubsub/{version}/pubsub_grpc_service_config.json',
        'package-name': '@google-cloud/pubsub',
        'main-service': 'pubsub',
        'bundle-config': f'google/pubsub/{version}/pubsub_gapic.yaml',
        'template': 'typescript_gapic',
        'iam-service': 'true'
    },
    proto_path=f'/google/pubsub/{version}',
    extra_proto_files=['google/cloud/common_resources.proto'])

# skip index, protos, package.json, and README.md
s.copy(library, excludes=['package.json', 'README.md', 'src/index.ts'])

templates = common_templates.node_library(source_location='build/src')
s.copy(templates)

node.postprocess_gapic_library()
예제 #9
0
# 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 synthtool.languages.java as java

gapic = gcp.GAPICGenerator()

data_library = gapic.java_library(
    service='bigtable',
    version='v2',
    config_path='/google/bigtable/artman_bigtable.yaml',
    artman_output_name='')

s.copy(data_library / 'gapic-google-cloud-bigtable-v2/src', 'src')
s.copy(data_library / 'grpc-google-cloud-bigtable-v2/src',
       '../../google-api-grpc/grpc-google-cloud-bigtable-v2/src')
s.copy(data_library / 'proto-google-cloud-bigtable-v2/src',
       '../../google-api-grpc/proto-google-cloud-bigtable-v2/src')

java.format_code('../../google-api-grpc/grpc-google-cloud-bigtable-v2/src')
java.format_code('../../google-api-grpc/proto-google-cloud-bigtable-v2/src')

admin_library = gapic.java_library(
    service='bigtable-admin',
    version='v2',
    config_path='/google/bigtable/admin/artman_bigtableadmin.yaml',
    artman_output_name='')

s.copy(admin_library / 'gapic-google-cloud-bigtable-admin-v2/src', 'src')
예제 #10
0
# 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 synthtool.languages.node as node
import subprocess
import logging

logging.basicConfig(level=logging.DEBUG)

# run the gapic generator
gapic = gcp.GAPICBazel()
versions = ["v1"]
name = 'appengine'
for version in versions:
  library = gapic.node_library(
  name, 
  version,
  bazel_target=f"//google/appengine/{version}:appengine-{version}-nodejs")
  s.copy(library, excludes=["package.json"])

# Copy common templates
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library(
    source_location='build/src', versions=["v1"], default_version="v1")
s.copy(templates, excludes=[])

node.postprocess_gapic_library()
예제 #11
0
service = 'phishingprotection'
config_pattern = '/google/cloud/phishingprotection/artman_phishingprotection_{version}.yaml'

for version in versions:
    library = gapic.java_library(
        service=service,
        version=version,
        config_path=config_pattern.format(version=version),
        artman_output_name='')

    package_name = f'com.google.cloud.{service}.{version}'
    java.fix_proto_headers(library / f'proto-google-cloud-{service}-{version}')
    java.fix_grpc_headers(library / f'grpc-google-cloud-{service}-{version}',
                          package_name)

    s.copy(library / f'gapic-google-cloud-{service}-{version}/src',
           f'google-cloud-{service}/src')
    s.copy(library / f'grpc-google-cloud-{service}-{version}/src',
           f'grpc-google-cloud-{service}-{version}/src')
    s.copy(library / f'proto-google-cloud-{service}-{version}/src',
           f'proto-google-cloud-{service}-{version}/src')

    java.format_code(f'google-cloud-{service}/src')
    java.format_code(f'grpc-google-cloud-{service}-{version}/src')
    java.format_code(f'proto-google-cloud-{service}-{version}/src')

common_templates = gcp.CommonTemplates()
templates = common_templates.java_library()
s.copy(templates, excludes=[
    'README.md',
])
예제 #12
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re
from subprocess import call

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'asset', 'v1', artman_output_name='google-cloud-ruby/google-cloud-asset',
    config_path='artman_cloudasset_v1.yaml'
)
s.copy(v1_library / 'lib/google/cloud/asset/v1.rb')
s.copy(v1_library / 'lib/google/cloud/asset/v1')
s.copy(v1_library / 'test/google/cloud/asset/v1')
s.copy(v1_library / 'lib/google/cloud/asset.rb')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-asset.gemspec', merge=ruby.merge_gemspec)

v1beta1_library = gapic.ruby_library(
    'asset', 'v1beta1', artman_output_name='google-cloud-ruby/google-cloud-asset',
    config_path='artman_cloudasset_v1beta1.yaml'
)
s.copy(v1beta1_library / 'lib/google/cloud/asset/v1beta1.rb')
s.copy(v1beta1_library / 'lib/google/cloud/asset/v1beta1')
예제 #13
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
from subprocess import call

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1alpha2 = gapic.ruby_library(
    'irm', 'v1alpha2',
    artman_output_name='google-cloud-ruby/google-cloud-irm',
    config_path='artman_irm_v1alpha2.yaml'
)
s.copy(v1alpha2 / 'lib')
s.copy(v1alpha2 / 'test')
s.copy(v1alpha2 / 'README.md')
s.copy(v1alpha2 / 'LICENSE')
s.copy(v1alpha2 / '.gitignore')
s.copy(v1alpha2 / '.yardopts')
s.copy(v1alpha2 / 'google-cloud-irm.gemspec', merge=ruby.merge_gemspec)

# Copy common templates
templates = gcp.CommonTemplates().ruby_library()
s.copy(templates)

# Update gemspec to reflect Ruby 2.4
ruby.update_gemspec('google-cloud-irm.gemspec')

# Update README to reflect Ruby 2.4
예제 #14
0
import logging
import re
from textwrap import dedent
from subprocess import call

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v4beta1 = gapic.ruby_library(
    'talent', 'v4beta1',
    artman_output_name='google-cloud-ruby/google-cloud-jobs',
    private=True,
    config_path='artman_jobs_v4beta1.yaml'
)
s.copy(v4beta1 / 'acceptance')
s.copy(v4beta1 / 'lib')
s.copy(v4beta1 / 'test')
s.copy(v4beta1 / 'README.md')
s.copy(v4beta1 / 'LICENSE')
s.copy(v4beta1 / '.gitignore')
s.copy(v4beta1 / '.yardopts')
s.copy(v4beta1 / 'google-cloud-talent.gemspec', merge=ruby.merge_gemspec)

# https://github.com/googleapis/gapic-generator/issues/2243
s.replace(
    'lib/google/cloud/talent/*/*_client.rb',
    '(\n\\s+class \\w+Client\n)(\\s+)(attr_reader :\\w+_stub)',
    '\\1\\2# @private\n\\2\\3')

# https://github.com/googleapis/gapic-generator/issues/2279
예제 #15
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re
from textwrap import dedent

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'speech', 'v1',
    artman_output_name='google-cloud-ruby/google-cloud-speech'
)
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'lib/google/cloud/speech/v1.rb')
s.copy(v1_library / 'lib/google/cloud/speech/v1')
s.copy(v1_library / 'test/google/cloud/speech/v1')
s.copy(v1_library / 'lib/google/cloud/speech.rb')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-speech.gemspec', merge=ruby.merge_gemspec)

v1p1beta1_library = gapic.ruby_library(
    'speech', 'v1p1beta1',
    artman_output_name='google-cloud-ruby/google-cloud-speech'
)
s.copy(v1p1beta1_library / 'acceptance')
예제 #16
0
"""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()

v1_library = gapic.ruby_library(
    'datastore',
    'v1',
    config_path='/google/datastore/artman_datastore.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-datastore')
s.copy(v1_library / 'lib/google/cloud/datastore/v1')
s.copy(v1_library / 'lib/google/datastore/v1')

# Omitting lib/google/cloud/datastore/v1.rb for now because we are not exposing
# the low-level API.

# https://github.com/googleapis/gapic-generator/issues/2124
s.replace('lib/google/cloud/datastore/v1/credentials.rb',
          'SCOPE = \[[^\]]+\]\.freeze',
          'SCOPE = ["https://www.googleapis.com/auth/datastore"].freeze')

# https://github.com/googleapis/gapic-generator/issues/2243
s.replace('lib/google/cloud/datastore/v1/*_client.rb',
          '(\n\\s+class \\w+Client\n)(\\s+)(attr_reader :\\w+_stub)',
          '\\1\\2# @private\n\\2\\3')
예제 #17
0
import synthtool as s
import synthtool.gcp as gcp
import logging

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()

v3_library = gapic.py_library(
    'monitoring', 'v3',
    config_path='/google/monitoring/artman_monitoring.yaml',
    artman_output_name='monitoring-v3')

# don't copy setup.py, README.rst, docs/index.rst
s.copy(v3_library, excludes=['setup.py', 'README.rst', 'docs/index.rst'])

# Correct calls to routing_header
# https://github.com/googleapis/gapic-generator/issues/2016
s.replace(
    "google/cloud/*/gapic/*_client.py",
    "routing_header\(",
    "routing_header.to_grpc_metadata(")

# metadata in tests in none but should be empty list.
# https://github.com/googleapis/gapic-generator/issues/2014
s.replace(
    "google/cloud/*/gapic/*_client.py",
    'def .*\(([^\)]+)\n.*metadata=None\):\n\s+"""(.*\n)*?\s+"""\n',
    '\g<0>'
    '        if metadata is None:\n'
예제 #18
0
import synthtool as s
import synthtool.gcp as gcp
import logging
import subprocess
import os

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()
v2_library = gapic.node_library(
    'bigtable', 'v2', config_path='/google/bigtable/artman_bigtable.yaml')

s.copy(
    v2_library,
    excludes=['package.json', 'README.md', 'src/index.js', 'src/v2/index.js'])

v2_library = gapic.node_library(
    "bigtable_admin",
    "v2",
    config_path="/google/bigtable/admin/artman_bigtableadmin.yaml",
    artman_output_name="bigtable-admin-v2")

s.copy(
    v2_library,
    excludes=['package.json', 'README.md', 'src/index.js', 'src/v2/index.js'])

# Update path discovery due to build/ dir and TypeScript conversion.
s.replace("src/v2/bigtable_client.js", "../../package.json",
          "../../../package.json")
s.replace("src/v2/bigtable_instance_admin_client.js", "../../package.json",
          "../../../package.json")
예제 #19
0
import synthtool.languages.ruby as ruby
import logging
import os
import re
from subprocess import call


logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1beta1_library = gapic.ruby_library(
    'recaptchaenterprise', 'v1beta1', artman_output_name='google-cloud-ruby/google-cloud-recaptchaenterprise',
    config_path='artman_recaptchaenterprise_v1beta1.yaml'
)
s.copy(v1beta1_library / 'lib')
s.copy(v1beta1_library / 'test')
s.copy(v1beta1_library / 'README.md')
s.copy(v1beta1_library / 'LICENSE')
s.copy(v1beta1_library / '.gitignore')
s.copy(v1beta1_library / '.yardopts')
s.copy(v1beta1_library / 'google-cloud-recaptcha_enterprise.gemspec', merge=ruby.merge_gemspec)

# Copy common templates
templates = gcp.CommonTemplates().ruby_library()
s.copy(templates)

# https://github.com/googleapis/gapic-generator/issues/2180
s.replace(
    'google-cloud-recaptcha_enterprise.gemspec',
    '\n  gem\\.add_dependency "google-gax", "~> ([\\d\\.]+)"\n\n',
예제 #20
0
# 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.

import synthtool as s
import synthtool.gcp as gcp
import subprocess
import logging

logging.basicConfig(level=logging.DEBUG)
AUTOSYNTH_MULTIPLE_COMMITS = True
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates,
       excludes=[
           ".github/CONTRIBUTING.md", "README.md", ".eslintignore",
           ".prettierignore", ".github/release-please.yml",
           '.kokoro/publish.sh', '.kokoro/release/publish.cfg'
       ])
subprocess.run(['npm', 'install'])
subprocess.run(['npm', 'run', 'update-disclaimers'])
subprocess.run(['npm', 'run', 'submit-prs'])
예제 #21
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
from os.path import join

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1beta1 = gapic.ruby_library(
    'webrisk', 'v1beta1', artman_output_name='google-cloud-ruby/google-cloud-webrisk'
)

s.copy(v1beta1 / 'lib')
s.copy(v1beta1 / 'acceptance')
s.copy(v1beta1 / 'test')
s.copy(v1beta1 / 'README.md')
s.copy(v1beta1 / 'LICENSE')
s.copy(v1beta1 / '.gitignore')
s.copy(v1beta1 / '.yardopts')
s.copy(v1beta1 / 'google-cloud-webrisk.gemspec', merge=ruby.merge_gemspec)

# Copy common templates
templates = gcp.CommonTemplates().ruby_library()
s.copy(templates)

# https://github.com/googleapis/gapic-generator/issues/2243
s.replace(
    f'lib/google/cloud/webrisk/v1beta1/*_client.rb',
예제 #22
0
        'google/firestore/v1beta1/firestore_grpc_service_config.json'
    })
v1_library = gapic_micro.typescript_library(
    "firestore",
    "v1",
    proto_path="/google/firestore/v1",
    generator_args={
        'grpc-service-config':
        'google/firestore/v1/firestore_grpc_service_config.json'
    })

# skip index, protos, package.json, and README.md
s.copy(v1_admin_library,
       "dev",
       excludes=[
           "package.json", "README.md", "src/index.ts", "src/v1/index.ts",
           "tsconfig.json", "tslint.json", "linkinator.config.json",
           "webpack.config.js"
       ])
s.copy(v1beta1_library,
       "dev",
       excludes=[
           "package.json", "README.md", "src/index.ts", "src/v1beta1/index.ts",
           "tsconfig.json", "tslint.json", "linkinator.config.json",
           "webpack.config.js"
       ])
s.copy(v1_library,
       "dev",
       excludes=[
           "package.json", "README.md", "src/index.ts", "src/v1/index.ts",
           "tsconfig.json", "tslint.json", "linkinator.config.json",
예제 #23
0
import synthtool as s
import synthtool.gcp as gcp
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1beta1_library = gapic.ruby_library(
    'errorreporting', 'v1beta1',
    config_path='/google/devtools/clouderrorreporting/artman_errorreporting.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-error_reporting'
)
s.copy(v1beta1_library / 'lib/google/cloud/error_reporting/v1beta1')
s.copy(v1beta1_library / 'lib/google/devtools/clouderrorreporting/v1beta1')

# Omitting lib/google/cloud/error_reporting/v1beta1.rb for now because we are
# not exposing the low-level API.

# https://github.com/googleapis/gapic-generator/issues/2242
def escape_braces(match):
    expr = re.compile('^([^`]*(`[^`]*`[^`]*)*)([^`#\\$\\\\])\\{([\\w,]+)\\}')
    content = match.group(0)
    while True:
        content, count = expr.subn('\\1\\3\\\\\\\\{\\4}', content)
        if count == 0:
            return content
s.replace(
    'lib/google/cloud/error_reporting/v1beta1/**/*.rb',
예제 #24
0
gapic = gcp.GAPICBazel()

library = gapic.java_library(
    service='spanner',
    version='v1',
    proto_path=f'google/spanner/v1',
    bazel_target=f'//google/spanner/v1:google-cloud-spanner-v1-java',
)

library = library / f"google-cloud-spanner-v1-java"

java.fix_proto_headers(library / 'proto-google-cloud-spanner-v1-java')
java.fix_grpc_headers(library / 'grpc-google-cloud-spanner-v1-java',
                      'com.google.spanner.v1')
s.copy(library / 'gapic-google-cloud-spanner-v1-java/src',
       'google-cloud-spanner/src')
s.copy(library / 'grpc-google-cloud-spanner-v1-java/src',
       'grpc-google-cloud-spanner-v1/src')
s.copy(library / 'proto-google-cloud-spanner-v1-java/src',
       'proto-google-cloud-spanner-v1/src')

library = gapic.java_library(
    service='admin-database',
    version='v1',
    proto_path=f'google/spanner/admin/database/v1',
    bazel_target=
    f'//google/spanner/admin/database/v1:google-cloud-admin-database-v1-java',
)

library = library / f"google-cloud-admin-database-v1-java"
예제 #25
0
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re
from subprocess import call


logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'kms', 'v1', artman_output_name='google-cloud-ruby/google-cloud-kms',
    config_path='artman_cloudkms.yaml'
)
s.copy(v1_library / 'lib')
s.copy(v1_library / 'test')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-kms.gemspec', merge=ruby.merge_gemspec)

# PERMANENT: API name for cloudkms
s.replace(
    [
      'README.md',
      'lib/google/cloud/kms.rb',
      'lib/google/cloud/kms/v1.rb'
    ],
    '/kms\\.googleapis\\.com', '/cloudkms.googleapis.com')
예제 #26
0
logging.basicConfig(level=logging.DEBUG)

AUTOSYNTH_MULTIPLE_COMMITS = True

gapic = gcp.GAPICMicrogenerator()
versions = ['v1', 'v1beta2']
# tasks has two product names, and a poorly named artman yaml
for version in versions:
    library = gapic.typescript_library(
        'language',
        generator_args={
            "grpc-service-config":
            f"google/cloud/language/{version}/language_grpc_service_config.json",
            "package-name": f"@google-cloud/language"
        },
        proto_path=f'/google/cloud/language/{version}',
        version=version)

    # skip index, protos, package.json, and README.md
    s.copy(library, excludes=['package.json', 'README.md'])

# Update common templates
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library(source_location='build/src',
                                          versions=versions,
                                          default_version='v1')
s.copy(templates)

node.postprocess_gapic_library()
예제 #27
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'dataproc', 'v1', config_path='/google/cloud/dataproc/artman_dataproc_v1.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-dataproc'
)
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'lib')
s.copy(v1_library / 'test')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-dataproc.gemspec', merge=ruby.merge_gemspec)

v1beta2 = gapic.ruby_library(
    'dataproc', 'v1beta2', config_path='/google/cloud/dataproc/artman_dataproc_v1beta2.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-dataproc'
)
s.copy(v1beta2 / 'lib/google/cloud/dataproc/v1beta2')
s.copy(v1beta2 / 'lib/google/cloud/dataproc/v1beta2.rb')
s.copy(v1beta2 / 'acceptance/google/cloud/dataproc/v1beta2')
예제 #28
0
    config_path='/google/firestore/admin/artman_firestore_v1.yaml',
    package='com.google.firestore.admin.v1',
    include_gapic=True
)

firestore_v1 = generate_client(
    service='firestore',
    version='v1',
    config_path='/google/firestore/artman_firestore_v1.yaml',
    package='com.google.firestore.v1',
    include_gapic=True
)

firestore_v1beta1 = generate_client(
    service='firestore',
    version='v1beta1',
    config_path='/google/firestore/artman_firestore.yaml',
    package='com.google.firestore.v1beta1',
    include_gapic=False
)

common_templates = gcp.CommonTemplates()
templates = common_templates.java_library()
s.copy(templates, excludes=[
    '.gitignore',
    'README.md',
    # firestore uses a different project for its integration tests
    # due to the default project running datastore
    '.kokoro/presubmit/integration.cfg'
])
예제 #29
0
"""This script is used to synthesize generated parts of this library."""

import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java

gapic = gcp.GAPICGenerator()

data_library = gapic.java_library(
    service='bigtable',
    version='v2',
    config_path='/google/bigtable/artman_bigtable.yaml',
    artman_output_name='')


s.copy(data_library / 'gapic-google-cloud-bigtable-v2/src', 'src')
s.copy(data_library / 'grpc-google-cloud-bigtable-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-v2/src')
s.copy(data_library / 'proto-google-cloud-bigtable-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-v2/src')

java.format_code('../../google-api-grpc/grpc-google-cloud-bigtable-v2/src')
java.format_code('../../google-api-grpc/proto-google-cloud-bigtable-v2/src')


admin_library = gapic.java_library(
    service='bigtable-admin',
    version='v2',
    config_path='/google/bigtable/admin/artman_bigtableadmin.yaml',
    artman_output_name='')


s.copy(admin_library / 'gapic-google-cloud-bigtable-admin-v2/src', 'src')
예제 #30
0
# 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 subprocess

gapic = gcp.GAPICGenerator()

versions = ['v1', 'v1p1beta1', 'v1p2beta1']

for version in versions:
    library = gapic.node_library('vision', version)

    s.copy(library / 'protos')
    s.copy(library / 'src' / version)
    s.copy(library / 'samples')
    s.copy(library / 'system-test')
    s.copy(library / 'test')
'''
Node.js specific cleanup
'''
# Repo Cleanup/Setup
subprocess.run(['npm', 'install'])

# Generates scaffolding, enters contributors names
subprocess.run(['npm', 'run', 'generate-scaffolding'])

# prettify and lint
subprocess.run(['npm', 'run', 'prettier'])
예제 #31
0
import synthtool as s
import synthtool.gcp as gcp
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'trace', 'v1',
    config_path='/google/devtools/cloudtrace/artman_cloudtrace_v1.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-trace'
)
s.copy(v1_library / 'lib/google/cloud/trace/v1')
s.copy(v1_library / 'lib/google/devtools/cloudtrace/v1')

v2_library = gapic.ruby_library(
    'trace', 'v2',
    config_path='/google/devtools/cloudtrace/artman_cloudtrace_v2.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-trace'
)
s.copy(v2_library / 'lib/google/cloud/trace/v2')
s.copy(v2_library / 'lib/google/devtools/cloudtrace/v2')

# Omitting lib/google/cloud/trace/v{1,2}.rb for now because we are not exposing
# the low-level API.

# https://github.com/googleapis/gapic-generator/issues/2124
s.replace(
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.node as node
import logging
logging.basicConfig(level=logging.DEBUG)

AUTOSYNTH_MULTIPLE_COMMITS = True

common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates, excludes=["LICENSE", "README.md"])
node.install()
node.fix()
예제 #33
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re


logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'redis', 'v1',
    artman_output_name='google-cloud-ruby/google-cloud-redis'
)
s.copy(v1_library / 'lib/google/cloud/redis.rb')
s.copy(v1_library / 'lib/google/cloud/redis/v1')
s.copy(v1_library / 'lib/google/cloud/redis/v1.rb')
s.copy(v1_library / 'test/google/cloud/redis/v1')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-redis.gemspec', merge=ruby.merge_gemspec)

v1beta1_library = gapic.ruby_library(
    'redis', 'v1beta1',
    artman_output_name='google-cloud-ruby/google-cloud-redis'
)
s.copy(v1beta1_library / 'lib/google/cloud/redis/v1beta1')
s.copy(v1beta1_library / 'lib/google/cloud/redis/v1beta1.rb')
예제 #34
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v2_library = gapic.ruby_library(
    'dlp',
    'v2',
    config_path='/google/privacy/dlp/artman_dlp_v2.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-dlp')
s.copy(v2_library / 'lib')
s.copy(v2_library / 'test')
s.copy(v2_library / 'README.md')
s.copy(v2_library / 'LICENSE')
s.copy(v2_library / '.gitignore')
s.copy(v2_library / '.yardopts')
s.copy(v2_library / 'google-cloud-dlp.gemspec', merge=ruby.merge_gemspec)


# https://github.com/googleapis/gapic-generator/issues/2242
def escape_braces(match):
    expr = re.compile('^([^`]*(`[^`]*`[^`]*)*)([^`#\\$\\\\])\\{([\\w,]+)\\}')
    content = match.group(0)
    while True:
        content, count = expr.subn('\\1\\3\\\\\\\\{\\4}', content)
        if count == 0:
예제 #35
0
"""This script is used to synthesize generated parts of this library."""

import synthtool as s
import synthtool.gcp as gcp
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v2_library = gapic.ruby_library(
    'bigtable', 'v2', config_path='/google/bigtable/artman_bigtable.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-bigtable'
)
s.copy(v2_library / 'lib/google/cloud/bigtable/v2')
s.copy(v2_library / 'lib/google/cloud/bigtable/v2.rb')
s.copy(v2_library / 'lib/google/bigtable/v2')
s.copy(v2_library / 'test/google/cloud/bigtable/v2')

v2_admin_library = gapic.ruby_library(
    'bigtableadmin', 'v2',
    config_path='/google/bigtable/admin/artman_bigtableadmin.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-bigtable_admin'
)
s.copy(v2_admin_library / 'lib/google/cloud/bigtable/admin/v2')
s.copy(v2_admin_library / 'lib/google/cloud/bigtable/admin/v2.rb')
s.copy(v2_admin_library / 'lib/google/cloud/bigtable/admin.rb')
s.copy(v2_admin_library / 'lib/google/bigtable/admin/v2')
s.copy(v2_admin_library / 'test/google/cloud/bigtable/admin/v2')
예제 #36
0
import logging
import os
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'containeranalysis',
    'v1',
    artman_output_name='google-cloud-ruby/google-cloud-containeranalysis',
    config_path=
    '/google/devtools/containeranalysis/artman_containeranalysis_v1.yaml')

s.copy(v1_library / 'lib')
s.copy(v1_library / 'test')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-container_analysis.gemspec',
       merge=ruby.merge_gemspec)

# Copy common templates
templates = gcp.CommonTemplates().ruby_library()
s.copy(templates)

# Update gemspec to reflect Ruby 2.4
ruby.update_gemspec('google-cloud-container_analysis.gemspec')

# Hack grpc service class name and location
예제 #37
0
# 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.

import synthtool as s
import synthtool.gcp as gcp
import logging

logging.basicConfig(level=logging.DEBUG)
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates, excludes=["LICENSE"])
예제 #38
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 synthtool.languages.java as java

gapic = gcp.GAPICGenerator()

service = 'texttospeech'
versions = ['v1', 'v1beta1']

for version in versions:
    java.gapic_library(
        service=service,
        version=version,
        config_pattern=
        '/google/cloud/texttospeech/artman_texttospeech_{version}.yaml',
        package_pattern='com.google.cloud.{service}.{version}',
        gapic=gapic,
    )

common_templates = gcp.CommonTemplates()
templates = common_templates.java_library()
s.copy(templates, excludes=[
    'README.md',
])
예제 #39
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re


logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'videointelligence', 'v1',
    artman_output_name='google-cloud-ruby/google-cloud-video_intelligence'
)
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'lib/google/cloud/video_intelligence/v1')
s.copy(v1_library / 'lib/google/cloud/video_intelligence/v1.rb')
s.copy(v1_library / 'lib/google/cloud/videointelligence/v1')
s.copy(v1_library / 'lib/google/cloud/video_intelligence.rb')
s.copy(v1_library / 'test/google/cloud/video_intelligence/v1')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-video_intelligence.gemspec', merge=ruby.merge_gemspec)

v1beta1_library = gapic.ruby_library(
    'videointelligence', 'v1beta1',
    artman_output_name='google-cloud-ruby/google-cloud-video_intelligence'
)
예제 #40
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
from synthtool import gcp

common = gcp.CommonTemplates()
# ----------------------------------------------------------------------------
# Generate webrisk GAPIC layer
# ----------------------------------------------------------------------------
for library in s.get_staging_dirs("v1"):
    s.copy(library,
           excludes=["docs/index.rst", "nox.py", "README.rst", "setup.py"])
s.remove_staging_dirs()

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(
    samples=False,  # set to True only if there are samples
    microgenerator=True,
    cov_level=99,
)
s.move(templated_files,
       excludes=[".coveragerc"])  # microgenerator has a good .coveragerc file

s.shell.run(["nox", "-s", "blacken"], hide_output=False)
예제 #41
0
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
from subprocess import call

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1alpha2 = gapic.ruby_library(
    'irm', 'v1alpha2',
    artman_output_name='google-cloud-ruby/google-cloud-irm',
    private=True,
    config_path='artman_irm_v1alpha2.yaml'
)
s.copy(v1alpha2 / 'acceptance')
s.copy(v1alpha2 / 'lib')
s.copy(v1alpha2 / 'test')
s.copy(v1alpha2 / 'README.md')
s.copy(v1alpha2 / 'LICENSE')
s.copy(v1alpha2 / '.gitignore')
s.copy(v1alpha2 / '.yardopts')
s.copy(v1alpha2 / 'google-cloud-irm.gemspec', merge=ruby.merge_gemspec)

# https://github.com/googleapis/gapic-generator/issues/2243
s.replace(
    'lib/google/cloud/irm/*/*_client.rb',
    '(\n\\s+class \\w+Client\n)(\\s+)(attr_reader :\\w+_stub)',
    '\\1\\2# @private\n\\2\\3')

# https://github.com/googleapis/gapic-generator/issues/2279
예제 #42
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java

gapic = gcp.GAPICGenerator()

service = 'dataproc'
versions = ['v1', 'v1beta2']
config_pattern = '/google/cloud/dataproc/artman_dataproc_{version}.yaml'

for version in versions:
    library = gapic.java_library(
        service=service,
        version=version,
        config_path=config_pattern.format(version=version),
        artman_output_name='')

    s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src')
    s.copy(library / f'grpc-google-cloud-{service}-{version}/src',
           f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
    s.copy(
        library / f'proto-google-cloud-{service}-{version}/src',
        f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')

    java.format_code('./src')
    java.format_code(
        f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
    java.format_code(
        f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')
# 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.

import synthtool as s
import synthtool.gcp as gcp
import logging

logging.basicConfig(level=logging.DEBUG)

common_templates = gcp.CommonTemplates()

templates = common_templates.node_library()
s.copy(templates)
예제 #44
0
import synthtool as s
import synthtool.gcp as gcp
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'firestore',
    'v1',
    config_path='/google/firestore/artman_firestore_v1.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-firestore')
s.copy(v1_library / 'lib/google/cloud/firestore/v1')
s.copy(v1_library / 'lib/google/cloud/firestore/v1.rb')
s.copy(v1_library / 'lib/google/firestore/v1')
s.copy(v1_library / 'test/google/cloud/firestore/v1')

v1beta1_library = gapic.ruby_library(
    'firestore',
    'v1beta1',
    config_path='/google/firestore/artman_firestore.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-firestore')
s.copy(v1beta1_library / 'lib/google/cloud/firestore/v1beta1')
s.copy(v1beta1_library / 'lib/google/cloud/firestore/v1beta1.rb')
s.copy(v1beta1_library / 'lib/google/firestore/v1beta1')
s.copy(v1beta1_library / 'test/google/cloud/firestore/v1beta1')

admin_v1_library = gapic.ruby_library(
예제 #45
0
import synthtool as s
import synthtool.gcp as gcp
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v2_library = gapic.ruby_library(
    'debugger', 'v2',
    config_path='/google/devtools/artman_clouddebugger.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-debugger'
)
s.copy(v2_library / 'lib/google/cloud/debugger/v2')
s.copy(v2_library / 'lib/google/cloud/debugger/v2.rb')
s.copy(v2_library / 'lib/google/devtools')
s.copy(v2_library / 'test/google/cloud/debugger/v2')

# PERMANENT: Handwritten layer owns Debugger.new so low-level clients need to
# use Debugger::V2.new instead of Debugger.new(version: :v2). Update the
# examples and tests.
s.replace(
    [
      'lib/google/cloud/debugger/v2/controller2_client.rb',
      'lib/google/cloud/debugger/v2/debugger2_client.rb',
      'test/google/cloud/debugger/v2/controller2_client_test.rb',
      'test/google/cloud/debugger/v2/debugger2_client_test.rb'
    ],
    'require "google/cloud/debugger"',
예제 #46
0
import synthtool as s
import synthtool.gcp as gcp
import logging
import os

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'pubsub',
    'v1',
    config_path='/google/pubsub/artman_pubsub.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-pubsub')
s.copy(v1_library / 'lib/google/cloud/pubsub/v1')
s.copy(v1_library / 'lib/google/pubsub/v1')

# Omitting lib/google/cloud/pusbusb/v1.rb for now because we are not exposing
# the low-level API.

# PERMANENT: We don't want the generated overview.rb file because we have our
# own toplevel docs for the handwritten layer.
os.remove('lib/google/cloud/pubsub/v1/doc/overview.rb')

# https://github.com/googleapis/gapic-generator/issues/2124
s.replace('lib/google/cloud/pubsub/v1/credentials.rb',
          'SCOPE = \[[^\]]+\]\.freeze',
          'SCOPE = ["https://www.googleapis.com/auth/pubsub"].freeze')

# https://github.com/googleapis/gapic-generator/issues/2182
예제 #47
0
"""This script is used to synthesize generated parts of this library."""

import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java

gapic = gcp.GAPICGenerator()

library = gapic.java_library(
    service='dialogflow',
    version='v2',
    config_path=f'/google/cloud/dialogflow/artman_dialogflow_v2.yaml',
    artman_output_name='')

s.copy(library / f'gapic-google-cloud-dialogflow-v2/src', 'src')
s.copy(library / f'grpc-google-cloud-dialogflow-v2/src', f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2/src')
s.copy(library / f'proto-google-cloud-dialogflow-v2/src', f'../../google-api-grpc/proto-google-cloud-dialogflow-v2/src')

# v2beta1 has a weird config name
library = gapic.java_library(
    service='dialogflow',
    version='v2beta1',
    config_path=f'/google/cloud/dialogflow/artman_dialogflow_v2beta1_java.yaml',
    artman_output_name='')

s.copy(library / f'gapic-google-cloud-dialogflow-v2beta1/src', 'src')
s.copy(library / f'grpc-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src')
s.copy(library / f'proto-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/proto-google-cloud-dialogflow-v2beta1/src')

java.format_code('./src')
예제 #48
0
# 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.

import synthtool as s
import synthtool.gcp as gcp
import logging
import subprocess

logging.basicConfig(level=logging.DEBUG)
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates)
예제 #49
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'bigquery/datatransfer', 'v1',
    artman_output_name='google-cloud-ruby/google-cloud-bigquerydatatransfer',
    config_path='artman_bigquerydatatransfer.yaml'
)
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'lib')
s.copy(v1_library / 'test')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-bigquery-data_transfer.gemspec', merge=ruby.merge_gemspec)

# Copy common templates
templates = gcp.CommonTemplates().ruby_library()
s.copy(templates)

# PERMANENT: Use custom credentials env variable names
s.replace(
    'lib/google/cloud/bigquery/data_transfer/v1/credentials.rb',
예제 #50
0
common_templates = gcp.CommonTemplates()

versions = ["v1", "v1beta2", "v1p1beta1", "v1p2beta1", "v1p3beta1"]

for version in versions:
    library = gapic.node_library(
        "video-intelligence",
        version,
        config_path="/google/cloud/videointelligence/"
        f"artman_videointelligence_{version}.yaml",
    )

    # skip index, protos, package.json, and README.md
    s.copy(library,
           excludes=[
               "package.json", "README.md", "src/index.js",
               "smoke-test/video_intelligence_service_smoke_test.js"
           ])

#
# Generator emitted unused helper mockSimpleGrpcMethod, add a temporary
# s.replace to remove that function.
# ref: https://github.com/googleapis/gapic-generator/issues/2120
#
s.replace("test/gapic-*.js", "function mockSimpleGrpcMethod.*\n(.*\n)*?}\n",
          "")

templates = common_templates.node_library()
s.copy(templates)

# Node.js specific cleanup
예제 #51
0
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
from textwrap import dedent
from os.path import join
from subprocess import call

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'vision', 'v1', artman_output_name='google-cloud-ruby/google-cloud-vision'
)

s.copy(v1_library / 'lib')
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'test')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-vision.gemspec', merge=ruby.merge_gemspec)

v1p3beta1 = gapic.ruby_library(
    'vision', 'v1p3beta1',
    artman_output_name='google-cloud-ruby/google-cloud-vision'
)
s.copy(v1p3beta1 / 'lib/google/cloud/vision/v1p3beta1')
s.copy(v1p3beta1 / 'lib/google/cloud/vision/v1p3beta1.rb')
s.copy(v1p3beta1 / 'acceptance/google/cloud/vision/v1p3beta1')
예제 #52
0
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
excludes = [
    "README.rst", "setup.py", "nox*.py", "docs/conf.py", "docs/index.rst"
]

# ----------------------------------------------------------------------------
# Generate tasks GAPIC layer
# ----------------------------------------------------------------------------
for version in ["v2beta2", "v2beta3"]:
    library = gapic.py_library("tasks",
                               version,
                               config_path=f"artman_cloudtasks_{version}.yaml")

    s.copy(library, excludes=excludes)

    # Fix unindentation of bullet list second line
    s.replace(
        f"google/cloud/tasks_{version}/gapic/cloud_tasks_client.py",
        "(        \* .*\n        )([^\s*])",
        "\g<1>  \g<2>",
    )

    s.replace(
        f"google/cloud/tasks_{version}/gapic/cloud_tasks_client.py",
        "(Google IAM .*?_) ",
        "\g<1>_ ",
    )

    # Issues with Anonymous ('__') links. Change to named.
예제 #53
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re
from subprocess import call

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'asset', 'v1', artman_output_name='google-cloud-ruby/google-cloud-asset',
    config_path='artman_cloudasset_v1.yaml'
)
s.copy(v1_library / 'lib/google/cloud/asset/v1.rb')
s.copy(v1_library / 'lib/google/cloud/asset/v1')
s.copy(v1_library / 'test/google/cloud/asset/v1')
s.copy(v1_library / 'lib/google/cloud/asset.rb')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-asset.gemspec', merge=ruby.merge_gemspec)

v1beta1_library = gapic.ruby_library(
    'asset', 'v1beta1', artman_output_name='google-cloud-ruby/google-cloud-asset',
    config_path='artman_cloudasset_v1beta1.yaml'
)
s.copy(v1beta1_library / 'lib/google/cloud/asset/v1beta1.rb')
s.copy(v1beta1_library / 'lib/google/cloud/asset/v1beta1')
예제 #54
0
# 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 synthtool.languages.ruby as ruby
import logging

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICMicrogenerator()
library = gapic.ruby_library(
    "tasks",
    "v2beta3",
    extra_proto_files=["google/cloud/common_resources.proto"],
    generator_args={
        "ruby-cloud-gem-name":
        "google-cloud-tasks-v2beta3",
        "ruby-cloud-title":
        "Cloud Tasks V2beta3",
        "ruby-cloud-description":
        "Cloud Tasks is a fully managed service that allows you to manage the execution, dispatch and delivery of a large number of distributed tasks. You can asynchronously perform work outside of a user request. Your tasks can be executed on App Engine or any arbitrary HTTP endpoint.",
        "ruby-cloud-env-prefix":
        "TASKS",
        "ruby-cloud-grpc-service-config":
        "google/cloud/tasks/v2beta3/cloudtasks_grpc_service_config.json",
    })

s.copy(library, merge=ruby.global_merge)
예제 #55
0
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re


logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'oslogin', 'v1',
    config_path='/google/cloud/oslogin/artman_oslogin_v1.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-os_login'
)
s.copy(v1_library / 'lib/google/cloud/os_login.rb')
s.copy(v1_library / 'lib/google/cloud/os_login/v1')
s.copy(v1_library / 'lib/google/cloud/os_login/v1.rb')
s.copy(v1_library / 'lib/google/cloud/oslogin/v1')
s.copy(v1_library / 'lib/google/cloud/oslogin/common')
s.copy(v1_library / 'test/google/cloud/os_login/v1')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-os_login.gemspec', merge=ruby.merge_gemspec)

# Copy common templates
templates = gcp.CommonTemplates().ruby_library()
s.copy(templates)
예제 #56
0
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re

logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v1_library = gapic.ruby_library(
    'videointelligence',
    'v1',
    artman_output_name='google-cloud-ruby/google-cloud-video_intelligence')
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'lib/google/cloud/video_intelligence/v1')
s.copy(v1_library / 'lib/google/cloud/video_intelligence/v1.rb')
s.copy(v1_library / 'lib/google/cloud/videointelligence/v1')
s.copy(v1_library / 'lib/google/cloud/video_intelligence.rb')
s.copy(v1_library / 'test/google/cloud/video_intelligence/v1')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-video_intelligence.gemspec',
       merge=ruby.merge_gemspec)

v1p1beta1_library = gapic.ruby_library(
    'videointelligence',
    'v1p1beta1',
예제 #57
0
import re

import synthtool as s
from synthtool import gcp

gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
versions = ["v1beta1"]

# ----------------------------------------------------------------------------
# Generate webrisk GAPIC layer
# ----------------------------------------------------------------------------
for version in versions:
    library = gapic.py_library("webrisk", version, include_protos=True)
    s.copy(library, excludes=["docs/index.rst", "nox.py", "README.rst", "setup.py"])


# Fix docstring issue for classes with no summary line
s.replace(
    "google/cloud/**/proto/webrisk_pb2.py",
    '''__doc__ = """Attributes:''',
    '''__doc__ = """
    Attributes:''',
)


# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(unit_cov_level=97, cov_level=100)
예제 #58
0
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re


logging.basicConfig(level=logging.DEBUG)

gapic = gcp.GAPICGenerator()

v3_library = gapic.ruby_library(
    'monitoring', 'v3',
    config_path='/google/monitoring/artman_monitoring.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-monitoring'
)
s.copy(v3_library / 'acceptance')
s.copy(v3_library / 'lib')
s.copy(v3_library / 'test')
s.copy(v3_library / 'README.md')
s.copy(v3_library / 'LICENSE')
s.copy(v3_library / '.gitignore')
s.copy(v3_library / '.yardopts')
s.copy(v3_library / 'google-cloud-monitoring.gemspec', merge=ruby.merge_gemspec)

# Copy common templates
templates = gcp.CommonTemplates().ruby_library()
s.copy(templates)

# PERMANENT: Use a compatible version of googleapis-common-protos-types
s.replace(
    'google-cloud-monitoring.gemspec',
예제 #59
0
# 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 synthtool.languages.java as java

gapic = gcp.GAPICGenerator()
common_templates = gcp.CommonTemplates()

versions = ['{{version}}']
service = '{{service}}'

for version in versions:
    library = gapic.java_library(
        service=service,
        version=version,
        config_path=f'{{config_path}}',
        artman_output_name='')

    s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src')
    s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
    s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')

    java.format_code('./src')
    java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
    java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')
예제 #60
0
# 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()

v2_library = gapic.ruby_library(
    'dlp',
    'v2',
    config_path='/google/privacy/dlp/artman_dlp_v2.yaml',
    artman_output_name='google-cloud-ruby/google-cloud-dlp')

s.copy(v2_library / 'lib/google/cloud/dlp')
s.copy(v2_library / 'lib/google/cloud/privacy')
s.copy(v2_library / 'test')