diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java index b3f40443..218debdc 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java @@ -16,7 +16,6 @@ package com.google.cloud.websecurityscanner.v1; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; @@ -946,12 +945,7 @@ public static ApiFuture createAsync( ListScanConfigsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListScanConfigsPagedResponse apply(ListScanConfigsPage input) { - return new ListScanConfigsPagedResponse(input); - } - }, + input -> new ListScanConfigsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1028,12 +1022,7 @@ public static ApiFuture createAsync( ListScanRunsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListScanRunsPagedResponse apply(ListScanRunsPage input) { - return new ListScanRunsPagedResponse(input); - } - }, + input -> new ListScanRunsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1108,12 +1097,7 @@ public static ApiFuture createAsync( ListCrawledUrlsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListCrawledUrlsPagedResponse apply(ListCrawledUrlsPage input) { - return new ListCrawledUrlsPagedResponse(input); - } - }, + input -> new ListCrawledUrlsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1190,12 +1174,7 @@ public static ApiFuture createAsync( ListFindingsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListFindingsPagedResponse apply(ListFindingsPage input) { - return new ListFindingsPagedResponse(input); - } - }, + input -> new ListFindingsPagedResponse(input), MoreExecutors.directExecutor()); } diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerSettings.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerSettings.java index eb6e02f5..52066014 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerSettings.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerSettings.java @@ -232,14 +232,13 @@ public WebSecurityScannerStubSettings.Builder getStubSettingsBuilder() { return ((WebSecurityScannerStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/GrpcWebSecurityScannerStub.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/GrpcWebSecurityScannerStub.java index ad85c445..82c75ce0 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/GrpcWebSecurityScannerStub.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/GrpcWebSecurityScannerStub.java @@ -26,7 +26,6 @@ import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.websecurityscanner.v1.CreateScanConfigRequest; import com.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest; @@ -55,7 +54,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -274,39 +272,30 @@ protected GrpcWebSecurityScannerStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings deleteScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings getScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -314,79 +303,60 @@ public Map extract(GetScanConfigRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listScanConfigsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListScanConfigsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings updateScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "scan_config.name", String.valueOf(request.getScanConfig().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("scan_config.name", String.valueOf(request.getScanConfig().getName())); + return params.build(); }) .build(); GrpcCallSettings startScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(startScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(StartScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings getScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listScanRunsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listScanRunsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListScanRunsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings stopScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(stopScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(StopScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -394,39 +364,30 @@ public Map extract(StopScanRunRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listCrawledUrlsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListCrawledUrlsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getFindingTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getFindingMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetFindingRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listFindingsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listFindingsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListFindingsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings @@ -434,13 +395,10 @@ public Map extract(ListFindingsRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listFindingTypeStatsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListFindingTypeStatsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); @@ -596,7 +554,13 @@ public UnaryCallable listFinding @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/WebSecurityScannerStubSettings.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/WebSecurityScannerStubSettings.java index 4ab6fe0b..145c7555 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/WebSecurityScannerStubSettings.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/stub/WebSecurityScannerStubSettings.java @@ -745,14 +745,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java index 3622d72f..3aa26f8b 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java @@ -16,7 +16,6 @@ package com.google.cloud.websecurityscanner.v1alpha; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; @@ -1604,12 +1603,7 @@ public static ApiFuture createAsync( ListScanConfigsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListScanConfigsPagedResponse apply(ListScanConfigsPage input) { - return new ListScanConfigsPagedResponse(input); - } - }, + input -> new ListScanConfigsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1686,12 +1680,7 @@ public static ApiFuture createAsync( ListScanRunsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListScanRunsPagedResponse apply(ListScanRunsPage input) { - return new ListScanRunsPagedResponse(input); - } - }, + input -> new ListScanRunsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1766,12 +1755,7 @@ public static ApiFuture createAsync( ListCrawledUrlsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListCrawledUrlsPagedResponse apply(ListCrawledUrlsPage input) { - return new ListCrawledUrlsPagedResponse(input); - } - }, + input -> new ListCrawledUrlsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1848,12 +1832,7 @@ public static ApiFuture createAsync( ListFindingsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListFindingsPagedResponse apply(ListFindingsPage input) { - return new ListFindingsPagedResponse(input); - } - }, + input -> new ListFindingsPagedResponse(input), MoreExecutors.directExecutor()); } diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerSettings.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerSettings.java index b8f64482..b4134c14 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerSettings.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerSettings.java @@ -233,14 +233,13 @@ public WebSecurityScannerStubSettings.Builder getStubSettingsBuilder() { return ((WebSecurityScannerStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java index 6e5ddfd2..332a5e47 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java @@ -27,7 +27,6 @@ import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest; import com.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest; @@ -56,7 +55,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -280,39 +278,30 @@ protected GrpcWebSecurityScannerStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings deleteScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings getScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -320,79 +309,60 @@ public Map extract(GetScanConfigRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listScanConfigsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListScanConfigsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings updateScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "scan_config.name", String.valueOf(request.getScanConfig().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("scan_config.name", String.valueOf(request.getScanConfig().getName())); + return params.build(); }) .build(); GrpcCallSettings startScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(startScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(StartScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings getScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listScanRunsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listScanRunsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListScanRunsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings stopScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(stopScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(StopScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -400,39 +370,30 @@ public Map extract(StopScanRunRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listCrawledUrlsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListCrawledUrlsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getFindingTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getFindingMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetFindingRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listFindingsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listFindingsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListFindingsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings @@ -440,13 +401,10 @@ public Map extract(ListFindingsRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listFindingTypeStatsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListFindingTypeStatsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); @@ -602,7 +560,13 @@ public UnaryCallable listFinding @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/WebSecurityScannerStubSettings.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/WebSecurityScannerStubSettings.java index 9437e1ed..1d4cee56 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/WebSecurityScannerStubSettings.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/WebSecurityScannerStubSettings.java @@ -746,14 +746,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java index 549c8c09..185cbc0e 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java @@ -16,7 +16,6 @@ package com.google.cloud.websecurityscanner.v1beta; -import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; @@ -1604,12 +1603,7 @@ public static ApiFuture createAsync( ListScanConfigsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListScanConfigsPagedResponse apply(ListScanConfigsPage input) { - return new ListScanConfigsPagedResponse(input); - } - }, + input -> new ListScanConfigsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1686,12 +1680,7 @@ public static ApiFuture createAsync( ListScanRunsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListScanRunsPagedResponse apply(ListScanRunsPage input) { - return new ListScanRunsPagedResponse(input); - } - }, + input -> new ListScanRunsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1766,12 +1755,7 @@ public static ApiFuture createAsync( ListCrawledUrlsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListCrawledUrlsPagedResponse apply(ListCrawledUrlsPage input) { - return new ListCrawledUrlsPagedResponse(input); - } - }, + input -> new ListCrawledUrlsPagedResponse(input), MoreExecutors.directExecutor()); } @@ -1848,12 +1832,7 @@ public static ApiFuture createAsync( ListFindingsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, - new ApiFunction() { - @Override - public ListFindingsPagedResponse apply(ListFindingsPage input) { - return new ListFindingsPagedResponse(input); - } - }, + input -> new ListFindingsPagedResponse(input), MoreExecutors.directExecutor()); } diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerSettings.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerSettings.java index 616f3ca9..5a18b680 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerSettings.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerSettings.java @@ -233,14 +233,13 @@ public WebSecurityScannerStubSettings.Builder getStubSettingsBuilder() { return ((WebSecurityScannerStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/GrpcWebSecurityScannerStub.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/GrpcWebSecurityScannerStub.java index aacd632c..d044bedb 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/GrpcWebSecurityScannerStub.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/GrpcWebSecurityScannerStub.java @@ -27,7 +27,6 @@ import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest; import com.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest; @@ -56,7 +55,6 @@ import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; -import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; @@ -278,39 +276,30 @@ protected GrpcWebSecurityScannerStub( GrpcCallSettings.newBuilder() .setMethodDescriptor(createScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(CreateScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings deleteScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(DeleteScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings getScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -318,79 +307,60 @@ public Map extract(GetScanConfigRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listScanConfigsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListScanConfigsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings updateScanConfigTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateScanConfigMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(UpdateScanConfigRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "scan_config.name", String.valueOf(request.getScanConfig().getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("scan_config.name", String.valueOf(request.getScanConfig().getName())); + return params.build(); }) .build(); GrpcCallSettings startScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(startScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(StartScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings getScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listScanRunsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listScanRunsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListScanRunsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings stopScanRunTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(stopScanRunMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(StopScanRunRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings @@ -398,39 +368,30 @@ public Map extract(StopScanRunRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listCrawledUrlsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListCrawledUrlsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings getFindingTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getFindingMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetFindingRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); }) .build(); GrpcCallSettings listFindingsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listFindingsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListFindingsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); GrpcCallSettings @@ -438,13 +399,10 @@ public Map extract(ListFindingsRequest request) { GrpcCallSettings.newBuilder() .setMethodDescriptor(listFindingTypeStatsMethodDescriptor) .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListFindingTypeStatsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); }) .build(); @@ -600,7 +558,13 @@ public UnaryCallable listFinding @Override public final void close() { - shutdown(); + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } } @Override diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/WebSecurityScannerStubSettings.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/WebSecurityScannerStubSettings.java index 05542cc1..7caf02c4 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/WebSecurityScannerStubSettings.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/stub/WebSecurityScannerStubSettings.java @@ -746,14 +746,13 @@ private static Builder initDefaults(Builder builder) { return builder; } - // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * *

Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { + ApiFunction, Void> settingsUpdater) { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } diff --git a/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClientTest.java b/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClientTest.java index 9174aa28..4c7fdd5b 100644 --- a/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClientTest.java +++ b/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClientTest.java @@ -588,8 +588,7 @@ public void listCrawledUrlsExceptionTest() throws Exception { public void getFindingTest() throws Exception { Finding expectedResponse = Finding.newBuilder() - .setName( - FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]").toString()) + .setName("name3373707") .setFindingType("findingType1116910179") .setHttpMethod("httpMethod751124361") .setFuzzedUrl("fuzzedUrl-1730986655") diff --git a/pom.xml b/pom.xml index bd0d9106..b9cea869 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 0.13.1 + 1.0.0 @@ -97,7 +97,7 @@ com.google.cloud google-cloud-shared-dependencies - 1.4.0 + 2.0.0 pom import diff --git a/proto-google-cloud-websecurityscanner-v1/clirr-ignored-differences.xml b/proto-google-cloud-websecurityscanner-v1/clirr-ignored-differences.xml new file mode 100644 index 00000000..88b790e3 --- /dev/null +++ b/proto-google-cloud-websecurityscanner-v1/clirr-ignored-differences.xml @@ -0,0 +1,12 @@ + + + + + 8001 + com/google/cloud/websecurityscanner/v1/FindingName + + + 8001 + com/google/cloud/websecurityscanner/v1/FindingName$Builder + + diff --git a/proto-google-cloud-websecurityscanner-v1/pom.xml b/proto-google-cloud-websecurityscanner-v1/pom.xml index 95eead69..498fb1c1 100644 --- a/proto-google-cloud-websecurityscanner-v1/pom.xml +++ b/proto-google-cloud-websecurityscanner-v1/pom.xml @@ -21,14 +21,6 @@ com.google.api.grpc proto-google-common-protos - - com.google.api - api-common - - - com.google.guava - guava - diff --git a/proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingName.java b/proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingName.java deleted file mode 100644 index 2ddb7272..00000000 --- a/proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingName.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright 2021 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 - * - * https://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. - */ - -package com.google.cloud.websecurityscanner.v1; - -import com.google.api.pathtemplate.PathTemplate; -import com.google.api.resourcenames.ResourceName; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -@Generated("by gapic-generator-java") -public class FindingName implements ResourceName { - private static final PathTemplate PROJECT_SCAN_CONFIG_SCAN_RUN_FINDING = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}"); - private volatile Map fieldValuesMap; - private final String project; - private final String scanConfig; - private final String scanRun; - private final String finding; - - @Deprecated - protected FindingName() { - project = null; - scanConfig = null; - scanRun = null; - finding = null; - } - - private FindingName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - scanConfig = Preconditions.checkNotNull(builder.getScanConfig()); - scanRun = Preconditions.checkNotNull(builder.getScanRun()); - finding = Preconditions.checkNotNull(builder.getFinding()); - } - - public String getProject() { - return project; - } - - public String getScanConfig() { - return scanConfig; - } - - public String getScanRun() { - return scanRun; - } - - public String getFinding() { - return finding; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static FindingName of(String project, String scanConfig, String scanRun, String finding) { - return newBuilder() - .setProject(project) - .setScanConfig(scanConfig) - .setScanRun(scanRun) - .setFinding(finding) - .build(); - } - - public static String format(String project, String scanConfig, String scanRun, String finding) { - return newBuilder() - .setProject(project) - .setScanConfig(scanConfig) - .setScanRun(scanRun) - .setFinding(finding) - .build() - .toString(); - } - - public static FindingName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_SCAN_CONFIG_SCAN_RUN_FINDING.validatedMatch( - formattedString, "FindingName.parse: formattedString not in valid format"); - return of( - matchMap.get("project"), - matchMap.get("scan_config"), - matchMap.get("scan_run"), - matchMap.get("finding")); - } - - public static List parseList(List formattedStrings) { - List list = new ArrayList<>(formattedStrings.size()); - for (String formattedString : formattedStrings) { - list.add(parse(formattedString)); - } - return list; - } - - public static List toStringList(List values) { - List list = new ArrayList<>(values.size()); - for (FindingName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_SCAN_CONFIG_SCAN_RUN_FINDING.matches(formattedString); - } - - @Override - public Map getFieldValuesMap() { - if (fieldValuesMap == null) { - synchronized (this) { - if (fieldValuesMap == null) { - ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - if (project != null) { - fieldMapBuilder.put("project", project); - } - if (scanConfig != null) { - fieldMapBuilder.put("scan_config", scanConfig); - } - if (scanRun != null) { - fieldMapBuilder.put("scan_run", scanRun); - } - if (finding != null) { - fieldMapBuilder.put("finding", finding); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_SCAN_CONFIG_SCAN_RUN_FINDING.instantiate( - "project", project, "scan_config", scanConfig, "scan_run", scanRun, "finding", finding); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - FindingName that = ((FindingName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.scanConfig, that.scanConfig) - && Objects.equals(this.scanRun, that.scanRun) - && Objects.equals(this.finding, that.finding); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= Objects.hashCode(project); - h *= 1000003; - h ^= Objects.hashCode(scanConfig); - h *= 1000003; - h ^= Objects.hashCode(scanRun); - h *= 1000003; - h ^= Objects.hashCode(finding); - return h; - } - - /** - * Builder for - * projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}. - */ - public static class Builder { - private String project; - private String scanConfig; - private String scanRun; - private String finding; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getScanConfig() { - return scanConfig; - } - - public String getScanRun() { - return scanRun; - } - - public String getFinding() { - return finding; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setScanConfig(String scanConfig) { - this.scanConfig = scanConfig; - return this; - } - - public Builder setScanRun(String scanRun) { - this.scanRun = scanRun; - return this; - } - - public Builder setFinding(String finding) { - this.finding = finding; - return this; - } - - private Builder(FindingName findingName) { - this.project = findingName.project; - this.scanConfig = findingName.scanConfig; - this.scanRun = findingName.scanRun; - this.finding = findingName.finding; - } - - public FindingName build() { - return new FindingName(this); - } - } -} diff --git a/synth.metadata b/synth.metadata index f41ffe6a..3a1061b8 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,31 +4,31 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-websecurityscanner.git", - "sha": "d0bf774e9277f253d48ad0f0490c1548bf312518" + "sha": "1b20d866b4276627eeb8a3ea63ae7f8d19a73e8a" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "551681f25e36b11829e87e580281350461f4f3f5", - "internalRef": "379784268" + "sha": "d9eaf41de44d953458b18712a3f240bb4c564e48", + "internalRef": "388535346" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "551681f25e36b11829e87e580281350461f4f3f5", - "internalRef": "379784268" + "sha": "d9eaf41de44d953458b18712a3f240bb4c564e48", + "internalRef": "388535346" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "551681f25e36b11829e87e580281350461f4f3f5", - "internalRef": "379784268" + "sha": "d9eaf41de44d953458b18712a3f240bb4c564e48", + "internalRef": "388535346" } }, { @@ -184,7 +184,6 @@ "proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/DeleteScanConfigRequestOrBuilder.java", "proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/Finding.java", "proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingAddonProto.java", - "proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingName.java", "proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingOrBuilder.java", "proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingProto.java", "proto-google-cloud-websecurityscanner-v1/src/main/java/com/google/cloud/websecurityscanner/v1/FindingTypeStats.java",