1*55e87721SMatt Gilbride# Copyright 2021 Google LLC 2*55e87721SMatt Gilbride# 3*55e87721SMatt Gilbride# Licensed under the Apache License, Version 2.0 (the "License"); 4*55e87721SMatt Gilbride# you may not use this file except in compliance with the License. 5*55e87721SMatt Gilbride# You may obtain a copy of the License at 6*55e87721SMatt Gilbride# 7*55e87721SMatt Gilbride# https://www.apache.org/licenses/LICENSE-2.0 8*55e87721SMatt Gilbride# 9*55e87721SMatt Gilbride# Unless required by applicable law or agreed to in writing, software 10*55e87721SMatt Gilbride# distributed under the License is distributed on an "AS IS" BASIS, 11*55e87721SMatt Gilbride# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*55e87721SMatt Gilbride# See the License for the specific language governing permissions and 13*55e87721SMatt Gilbride# limitations under the License. 14*55e87721SMatt Gilbride 15*55e87721SMatt Gilbrideimport os 16*55e87721SMatt Gilbrideimport synthtool as s 17*55e87721SMatt Gilbridefrom synthtool.languages import java 18*55e87721SMatt Gilbride 19*55e87721SMatt Gilbride 20*55e87721SMatt Gilbridefor library in s.get_staging_dirs(): 21*55e87721SMatt Gilbride # put any special-case replacements here 22*55e87721SMatt Gilbride ERROR_GROUP_OVERLOAD = """ 23*55e87721SMatt Gilbride // Inserted by synthtool to preserve backwards-compatibility 24*55e87721SMatt Gilbride /** 25*55e87721SMatt Gilbride * Get the specified group. 26*55e87721SMatt Gilbride * 27*55e87721SMatt Gilbride * <p>Sample code: 28*55e87721SMatt Gilbride * 29*55e87721SMatt Gilbride * <pre><code> 30*55e87721SMatt Gilbride * try (ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.create()) { 31*55e87721SMatt Gilbride * GroupName groupName = GroupName.of("[PROJECT]", "[GROUP]"); 32*55e87721SMatt Gilbride * ErrorGroup response = errorGroupServiceClient.getGroup(groupName); 33*55e87721SMatt Gilbride * } 34*55e87721SMatt Gilbride * </code></pre> 35*55e87721SMatt Gilbride * 36*55e87721SMatt Gilbride * @param groupName Required. The group resource name. Written as 37*55e87721SMatt Gilbride * <code>projects/<var>projectID</var>/groups/<var>group_name</var></code>. 38*55e87721SMatt Gilbride * Call <a href="/error-reporting/reference/rest/v1beta1/projects.groupStats/list"> 39*55e87721SMatt Gilbride * <code>groupStats.list</code></a> to return a list of groups belonging to 40*55e87721SMatt Gilbride * this project. 41*55e87721SMatt Gilbride * <p>Example: <code>projects/my-project-123/groups/my-group</code> 42*55e87721SMatt Gilbride * @throws com.google.api.gax.rpc.ApiException if the remote call fails 43*55e87721SMatt Gilbride * @deprecated Use ErrorGroupServiceClient#getGroup(ErrorGroupName) 44*55e87721SMatt Gilbride */ 45*55e87721SMatt Gilbride @Deprecated 46*55e87721SMatt Gilbride public final ErrorGroup getGroup(GroupName groupName) { 47*55e87721SMatt Gilbride 48*55e87721SMatt Gilbride GetGroupRequest request = 49*55e87721SMatt Gilbride GetGroupRequest.newBuilder() 50*55e87721SMatt Gilbride .setGroupName(groupName == null ? null : groupName.toString()) 51*55e87721SMatt Gilbride .build(); 52*55e87721SMatt Gilbride return getGroup(request); 53*55e87721SMatt Gilbride } 54*55e87721SMatt Gilbride """ 55*55e87721SMatt Gilbride 56*55e87721SMatt Gilbride ERROR_GROUP_OVERLOAD_PREVIOUS_METHOD = r'(\s+public ErrorGroupServiceStub getStub\(\) {\n\s+return stub;\n\s+})' 57*55e87721SMatt Gilbride 58*55e87721SMatt Gilbride version = library.parts[len(library.parts) - 1] 59*55e87721SMatt Gilbride service = 'errorreporting' 60*55e87721SMatt Gilbride 61*55e87721SMatt Gilbride #java.fix_proto_headers('owl-bot-staging/v2beta1/proto-google-cloud-error-reporting-v1beta1') 62*55e87721SMatt Gilbride #java.fix_grpc_headers('owl-bot-staging/v2beta1/grpc-google-cloud-error-reporting-v1beta1', "") 63*55e87721SMatt Gilbride 64*55e87721SMatt Gilbride s.replace( 65*55e87721SMatt Gilbride 'owl-bot-staging/v1beta1/google-cloud-errorreporting/src/**/ErrorGroupServiceClient.java', 66*55e87721SMatt Gilbride ERROR_GROUP_OVERLOAD_PREVIOUS_METHOD, 67*55e87721SMatt Gilbride "\g<1>\n\n" + ERROR_GROUP_OVERLOAD 68*55e87721SMatt Gilbride ) 69*55e87721SMatt Gilbride s.replace( 70*55e87721SMatt Gilbride 'owl-bot-staging/v1beta1/google-cloud-errorreporting/src/**/ErrorGroupServiceClient.java', 71*55e87721SMatt Gilbride "import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupName;", 72*55e87721SMatt Gilbride "import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupName;\nimport com.google.devtools.clouderrorreporting.v1beta1.GroupName;" 73*55e87721SMatt Gilbride ) 74*55e87721SMatt Gilbride 75*55e87721SMatt Gilbride s.move(library) 76*55e87721SMatt Gilbride 77*55e87721SMatt Gilbrides.remove_staging_dirs() 78*55e87721SMatt Gilbridejava.common_templates(monorepo=True, excludes=[ 79*55e87721SMatt Gilbride ".github/*", 80*55e87721SMatt Gilbride ".kokoro/*", 81*55e87721SMatt Gilbride "samples/*", 82*55e87721SMatt Gilbride "CODE_OF_CONDUCT.md", 83*55e87721SMatt Gilbride "CONTRIBUTING.md", 84*55e87721SMatt Gilbride "LICENSE", 85*55e87721SMatt Gilbride "SECURITY.md", 86*55e87721SMatt Gilbride "java.header", 87*55e87721SMatt Gilbride "license-checks.xml", 88*55e87721SMatt Gilbride "renovate.json", 89*55e87721SMatt Gilbride ".gitignore" 90*55e87721SMatt Gilbride]) 91