forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsynth.py
More file actions
83 lines (67 loc) · 2.85 KB
/
synth.py
File metadata and controls
83 lines (67 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 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 re
import synthtool as s
from synthtool import gcp
gapic = gcp.GAPICGenerator()
versions = ['v1beta2', 'v1']
for version in versions:
library = gapic.py_library('dataproc', version)
s.move(
library,
excludes=[
'docs/index.rst', 'nox.py', 'README.rst', 'setup.py'])
s.replace(
f'google/cloud/dataproc_{version}/gapic/cluster_controller_client.py',
'metadata_type=operations_pb2.ClusterOperationMetadata,',
'metadata_type=proto_operations_pb2.ClusterOperationMetadata,')
s.replace(
f'google/cloud/dataproc_{version}/gapic/cluster_controller_client.py',
'\s+<strong>Note:</strong>.*\n(.*\n)+?.*types.FieldMask.',
f'''
.. note::
Currently, only the following fields can be updated:
* ``labels``: Update labels
* ``config.worker_config.num_instances``: Resize primary
worker group
* ``config.secondary_worker_config.num_instances``: Resize
secondary worker group
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.dataproc_{version}.types.FieldMask`'''
)
s.replace(
'google/cloud/dataproc_v1beta2/proto/clusters_pb2.py',
'# Generated by the protocol buffer compiler. DO NOT EDIT!',
'# -*- coding: utf-8 -*-\n'
'# Generated by the protocol buffer compiler. DO NOT EDIT!')
s.replace(
'google/cloud/dataproc_v1beta2/proto/workflow_templates_pb2.py',
', and must\n\s+conform to the following PCRE regular expression:'
'(.*\n)+?.*No more than 32',
'. Label values must be between\n'
' 1 and 63 characters long. No more than 32'
)
s.replace(
'google/cloud/dataproc_v1beta2/proto/workflow_templates_pb2.py',
', and must conform to\n'
'\s+the following regular expression:(.*\n)+?.* No more than',
'. Label values must be between\n'
' 1 and 63 characters long. No more than'
)
s.replace(
f'google/cloud/dataproc_v1/gapic/cluster_controller_client.py',
'}\n(\s+Similarly, to change the number of preemptible workers in a cluster to 5,)',
'}\n\n\g<1>'
)