diff --git a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java b/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java index 170be6b2fc8c..124f0c7b8347 100644 --- a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java +++ b/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java @@ -25,7 +25,6 @@ import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; -import com.google.api.pathtemplate.PathTemplate; import com.google.cloud.websecurityscanner.v1alpha.stub.WebSecurityScannerStub; import com.google.cloud.websecurityscanner.v1alpha.stub.WebSecurityScannerStubSettings; import com.google.common.util.concurrent.MoreExecutors; @@ -48,9 +47,9 @@ *
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ScanConfig scanConfig = ScanConfig.newBuilder().build();
- * ScanConfig response = webSecurityScannerClient.createScanConfig(formattedParent, scanConfig);
+ * ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
* }
*
*
@@ -112,116 +111,6 @@ public class WebSecurityScannerClient implements BackgroundResource {
private final WebSecurityScannerSettings settings;
private final WebSecurityScannerStub stub;
- private static final PathTemplate PROJECT_PATH_TEMPLATE =
- PathTemplate.createWithoutUrlEncoding("projects/{project}");
-
- private static final PathTemplate SCAN_CONFIG_PATH_TEMPLATE =
- PathTemplate.createWithoutUrlEncoding("projects/{project}/scanConfigs/{scan_config}");
-
- private static final PathTemplate SCAN_RUN_PATH_TEMPLATE =
- PathTemplate.createWithoutUrlEncoding(
- "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}");
-
- private static final PathTemplate FINDING_PATH_TEMPLATE =
- PathTemplate.createWithoutUrlEncoding(
- "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}");
-
- /** Formats a string containing the fully-qualified path to represent a project resource. */
- public static final String formatProjectName(String project) {
- return PROJECT_PATH_TEMPLATE.instantiate("project", project);
- }
-
- /** Formats a string containing the fully-qualified path to represent a scan_config resource. */
- public static final String formatScanConfigName(String project, String scanConfig) {
- return SCAN_CONFIG_PATH_TEMPLATE.instantiate(
- "project", project,
- "scan_config", scanConfig);
- }
-
- /** Formats a string containing the fully-qualified path to represent a scan_run resource. */
- public static final String formatScanRunName(String project, String scanConfig, String scanRun) {
- return SCAN_RUN_PATH_TEMPLATE.instantiate(
- "project", project,
- "scan_config", scanConfig,
- "scan_run", scanRun);
- }
-
- /** Formats a string containing the fully-qualified path to represent a finding resource. */
- public static final String formatFindingName(
- String project, String scanConfig, String scanRun, String finding) {
- return FINDING_PATH_TEMPLATE.instantiate(
- "project", project,
- "scan_config", scanConfig,
- "scan_run", scanRun,
- "finding", finding);
- }
-
- /** Parses the project from the given fully-qualified path which represents a project resource. */
- public static final String parseProjectFromProjectName(String projectName) {
- return PROJECT_PATH_TEMPLATE.parse(projectName).get("project");
- }
-
- /**
- * Parses the project from the given fully-qualified path which represents a scan_config resource.
- */
- public static final String parseProjectFromScanConfigName(String scanConfigName) {
- return SCAN_CONFIG_PATH_TEMPLATE.parse(scanConfigName).get("project");
- }
-
- /**
- * Parses the scan_config from the given fully-qualified path which represents a scan_config
- * resource.
- */
- public static final String parseScanConfigFromScanConfigName(String scanConfigName) {
- return SCAN_CONFIG_PATH_TEMPLATE.parse(scanConfigName).get("scan_config");
- }
-
- /**
- * Parses the project from the given fully-qualified path which represents a scan_run resource.
- */
- public static final String parseProjectFromScanRunName(String scanRunName) {
- return SCAN_RUN_PATH_TEMPLATE.parse(scanRunName).get("project");
- }
-
- /**
- * Parses the scan_config from the given fully-qualified path which represents a scan_run
- * resource.
- */
- public static final String parseScanConfigFromScanRunName(String scanRunName) {
- return SCAN_RUN_PATH_TEMPLATE.parse(scanRunName).get("scan_config");
- }
-
- /**
- * Parses the scan_run from the given fully-qualified path which represents a scan_run resource.
- */
- public static final String parseScanRunFromScanRunName(String scanRunName) {
- return SCAN_RUN_PATH_TEMPLATE.parse(scanRunName).get("scan_run");
- }
-
- /** Parses the project from the given fully-qualified path which represents a finding resource. */
- public static final String parseProjectFromFindingName(String findingName) {
- return FINDING_PATH_TEMPLATE.parse(findingName).get("project");
- }
-
- /**
- * Parses the scan_config from the given fully-qualified path which represents a finding resource.
- */
- public static final String parseScanConfigFromFindingName(String findingName) {
- return FINDING_PATH_TEMPLATE.parse(findingName).get("scan_config");
- }
-
- /**
- * Parses the scan_run from the given fully-qualified path which represents a finding resource.
- */
- public static final String parseScanRunFromFindingName(String findingName) {
- return FINDING_PATH_TEMPLATE.parse(findingName).get("scan_run");
- }
-
- /** Parses the finding from the given fully-qualified path which represents a finding resource. */
- public static final String parseFindingFromFindingName(String findingName) {
- return FINDING_PATH_TEMPLATE.parse(findingName).get("finding");
- }
-
/** Constructs an instance of WebSecurityScannerClient with default settings. */
public static final WebSecurityScannerClient create() throws IOException {
return create(WebSecurityScannerSettings.newBuilder().build());
@@ -278,9 +167,38 @@ public WebSecurityScannerStub getStub() {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * ScanConfig scanConfig = ScanConfig.newBuilder().build();
+ * ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+ * }
+ *
+ *
+ * @param parent Required. The parent resource name where the scan is created, which should be a
+ * project resource name in the format 'projects/{projectId}'.
+ * @param scanConfig Required. The ScanConfig to be created.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ScanConfig createScanConfig(ProjectName parent, ScanConfig scanConfig) {
+
+ CreateScanConfigRequest request =
+ CreateScanConfigRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setScanConfig(scanConfig)
+ .build();
+ return createScanConfig(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Creates a new ScanConfig.
+ *
+ * Sample code: + * + *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ScanConfig scanConfig = ScanConfig.newBuilder().build();
- * ScanConfig response = webSecurityScannerClient.createScanConfig(formattedParent, scanConfig);
+ * ScanConfig response = webSecurityScannerClient.createScanConfig(parent.toString(), scanConfig);
* }
*
*
@@ -290,7 +208,7 @@ public WebSecurityScannerStub getStub() {
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ScanConfig createScanConfig(String parent, ScanConfig scanConfig) {
- PROJECT_PATH_TEMPLATE.validate(parent, "createScanConfig");
+
CreateScanConfigRequest request =
CreateScanConfigRequest.newBuilder().setParent(parent).setScanConfig(scanConfig).build();
return createScanConfig(request);
@@ -304,10 +222,10 @@ public final ScanConfig createScanConfig(String parent, ScanConfig scanConfig) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ScanConfig scanConfig = ScanConfig.newBuilder().build();
* CreateScanConfigRequest request = CreateScanConfigRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .setScanConfig(scanConfig)
* .build();
* ScanConfig response = webSecurityScannerClient.createScanConfig(request);
@@ -329,10 +247,10 @@ public final ScanConfig createScanConfig(CreateScanConfigRequest request) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ScanConfig scanConfig = ScanConfig.newBuilder().build();
* CreateScanConfigRequest request = CreateScanConfigRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .setScanConfig(scanConfig)
* .build();
* ApiFuture<ScanConfig> future = webSecurityScannerClient.createScanConfigCallable().futureCall(request);
@@ -353,8 +271,32 @@ public final UnaryCallable createScanConfig
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
- * webSecurityScannerClient.deleteScanConfig(formattedName);
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * webSecurityScannerClient.deleteScanConfig(name);
+ * }
+ *
+ *
+ * @param name Required. The resource name of the ScanConfig to be deleted. The name follows the
+ * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteScanConfig(ScanConfigName name) {
+
+ DeleteScanConfigRequest request =
+ DeleteScanConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deleteScanConfig(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes an existing ScanConfig and its child resources.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * webSecurityScannerClient.deleteScanConfig(name.toString());
* }
*
*
@@ -363,7 +305,7 @@ public final UnaryCallable createScanConfig
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteScanConfig(String name) {
- SCAN_CONFIG_PATH_TEMPLATE.validate(name, "deleteScanConfig");
+
DeleteScanConfigRequest request = DeleteScanConfigRequest.newBuilder().setName(name).build();
deleteScanConfig(request);
}
@@ -376,9 +318,9 @@ public final void deleteScanConfig(String name) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* DeleteScanConfigRequest request = DeleteScanConfigRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* webSecurityScannerClient.deleteScanConfig(request);
* }
@@ -399,9 +341,9 @@ public final void deleteScanConfig(DeleteScanConfigRequest request) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* DeleteScanConfigRequest request = DeleteScanConfigRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ApiFuture<Void> future = webSecurityScannerClient.deleteScanConfigCallable().futureCall(request);
* // Do something
@@ -421,8 +363,32 @@ public final UnaryCallable deleteScanConfigCalla
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
- * ScanConfig response = webSecurityScannerClient.getScanConfig(formattedName);
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfig response = webSecurityScannerClient.getScanConfig(name);
+ * }
+ *
+ *
+ * @param name Required. The resource name of the ScanConfig to be returned. The name follows the
+ * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ScanConfig getScanConfig(ScanConfigName name) {
+
+ GetScanConfigRequest request =
+ GetScanConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getScanConfig(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a ScanConfig.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfig response = webSecurityScannerClient.getScanConfig(name.toString());
* }
*
*
@@ -431,7 +397,7 @@ public final UnaryCallable deleteScanConfigCalla
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ScanConfig getScanConfig(String name) {
- SCAN_CONFIG_PATH_TEMPLATE.validate(name, "getScanConfig");
+
GetScanConfigRequest request = GetScanConfigRequest.newBuilder().setName(name).build();
return getScanConfig(request);
}
@@ -444,9 +410,9 @@ public final ScanConfig getScanConfig(String name) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* GetScanConfigRequest request = GetScanConfigRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ScanConfig response = webSecurityScannerClient.getScanConfig(request);
* }
@@ -467,9 +433,9 @@ public final ScanConfig getScanConfig(GetScanConfigRequest request) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* GetScanConfigRequest request = GetScanConfigRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ApiFuture<ScanConfig> future = webSecurityScannerClient.getScanConfigCallable().futureCall(request);
* // Do something
@@ -489,8 +455,35 @@ public final UnaryCallable getScanConfigCallab
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
- * for (ScanConfig element : webSecurityScannerClient.listScanConfigs(formattedParent).iterateAll()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The parent resource name, which should be a project resource name in
+ * the format 'projects/{projectId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListScanConfigsPagedResponse listScanConfigs(ProjectName parent) {
+ ListScanConfigsRequest request =
+ ListScanConfigsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listScanConfigs(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists ScanConfigs under a given project.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ProjectName parent = ProjectName.of("[PROJECT]");
+ * for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent.toString()).iterateAll()) {
* // doThingsWith(element);
* }
* }
@@ -501,7 +494,6 @@ public final UnaryCallable getScanConfigCallab
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListScanConfigsPagedResponse listScanConfigs(String parent) {
- PROJECT_PATH_TEMPLATE.validate(parent, "listScanConfigs");
ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder().setParent(parent).build();
return listScanConfigs(request);
}
@@ -514,9 +506,9 @@ public final ListScanConfigsPagedResponse listScanConfigs(String parent) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* for (ScanConfig element : webSecurityScannerClient.listScanConfigs(request).iterateAll()) {
* // doThingsWith(element);
@@ -539,9 +531,9 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* ApiFuture<ListScanConfigsPagedResponse> future = webSecurityScannerClient.listScanConfigsPagedCallable().futureCall(request);
* // Do something
@@ -564,9 +556,9 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* while (true) {
* ListScanConfigsResponse response = webSecurityScannerClient.listScanConfigsCallable().call(request);
@@ -677,8 +669,32 @@ public final UnaryCallable updateScanConfig
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
- * ScanRun response = webSecurityScannerClient.startScanRun(formattedName);
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanRun response = webSecurityScannerClient.startScanRun(name);
+ * }
+ *
+ *
+ * @param name Required. The resource name of the ScanConfig to be used. The name follows the
+ * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ScanRun startScanRun(ScanConfigName name) {
+
+ StartScanRunRequest request =
+ StartScanRunRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return startScanRun(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Start a ScanRun according to the given ScanConfig.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanRun response = webSecurityScannerClient.startScanRun(name.toString());
* }
*
*
@@ -687,7 +703,7 @@ public final UnaryCallable updateScanConfig
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ScanRun startScanRun(String name) {
- SCAN_CONFIG_PATH_TEMPLATE.validate(name, "startScanRun");
+
StartScanRunRequest request = StartScanRunRequest.newBuilder().setName(name).build();
return startScanRun(request);
}
@@ -700,9 +716,9 @@ public final ScanRun startScanRun(String name) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* StartScanRunRequest request = StartScanRunRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ScanRun response = webSecurityScannerClient.startScanRun(request);
* }
@@ -723,9 +739,9 @@ public final ScanRun startScanRun(StartScanRunRequest request) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* StartScanRunRequest request = StartScanRunRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ApiFuture<ScanRun> future = webSecurityScannerClient.startScanRunCallable().futureCall(request);
* // Do something
@@ -745,8 +761,32 @@ public final UnaryCallable startScanRunCallable()
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- * ScanRun response = webSecurityScannerClient.getScanRun(formattedName);
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRun response = webSecurityScannerClient.getScanRun(name);
+ * }
+ *
+ *
+ * @param name Required. The resource name of the ScanRun to be returned. The name follows the
+ * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ScanRun getScanRun(ScanRunName name) {
+
+ GetScanRunRequest request =
+ GetScanRunRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getScanRun(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a ScanRun.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRun response = webSecurityScannerClient.getScanRun(name.toString());
* }
*
*
@@ -755,7 +795,7 @@ public final UnaryCallable startScanRunCallable()
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ScanRun getScanRun(String name) {
- SCAN_RUN_PATH_TEMPLATE.validate(name, "getScanRun");
+
GetScanRunRequest request = GetScanRunRequest.newBuilder().setName(name).build();
return getScanRun(request);
}
@@ -768,9 +808,9 @@ public final ScanRun getScanRun(String name) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* GetScanRunRequest request = GetScanRunRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ScanRun response = webSecurityScannerClient.getScanRun(request);
* }
@@ -791,9 +831,9 @@ public final ScanRun getScanRun(GetScanRunRequest request) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* GetScanRunRequest request = GetScanRunRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ApiFuture<ScanRun> future = webSecurityScannerClient.getScanRunCallable().futureCall(request);
* // Do something
@@ -813,8 +853,35 @@ public final UnaryCallable getScanRunCallable() {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
- * for (ScanRun element : webSecurityScannerClient.listScanRuns(formattedParent).iterateAll()) {
+ * ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * for (ScanRun element : webSecurityScannerClient.listScanRuns(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The parent resource name, which should be a scan resource name in the
+ * format 'projects/{projectId}/scanConfigs/{scanConfigId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListScanRunsPagedResponse listScanRuns(ScanConfigName parent) {
+ ListScanRunsRequest request =
+ ListScanRunsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listScanRuns(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+ * for (ScanRun element : webSecurityScannerClient.listScanRuns(parent.toString()).iterateAll()) {
* // doThingsWith(element);
* }
* }
@@ -825,7 +892,6 @@ public final UnaryCallable getScanRunCallable() {
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListScanRunsPagedResponse listScanRuns(String parent) {
- SCAN_CONFIG_PATH_TEMPLATE.validate(parent, "listScanRuns");
ListScanRunsRequest request = ListScanRunsRequest.newBuilder().setParent(parent).build();
return listScanRuns(request);
}
@@ -838,9 +904,9 @@ public final ListScanRunsPagedResponse listScanRuns(String parent) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* ListScanRunsRequest request = ListScanRunsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* for (ScanRun element : webSecurityScannerClient.listScanRuns(request).iterateAll()) {
* // doThingsWith(element);
@@ -863,9 +929,9 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request)
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* ListScanRunsRequest request = ListScanRunsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* ApiFuture<ListScanRunsPagedResponse> future = webSecurityScannerClient.listScanRunsPagedCallable().futureCall(request);
* // Do something
@@ -888,9 +954,9 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request)
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ * ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
* ListScanRunsRequest request = ListScanRunsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* while (true) {
* ListScanRunsResponse response = webSecurityScannerClient.listScanRunsCallable().call(request);
@@ -919,8 +985,32 @@ public final UnaryCallable listScanRu
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- * ScanRun response = webSecurityScannerClient.stopScanRun(formattedName);
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRun response = webSecurityScannerClient.stopScanRun(name);
+ * }
+ *
+ *
+ * @param name Required. The resource name of the ScanRun to be stopped. The name follows the
+ * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ScanRun stopScanRun(ScanRunName name) {
+
+ StopScanRunRequest request =
+ StopScanRunRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return stopScanRun(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Stops a ScanRun. The stopped ScanRun is returned.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRun response = webSecurityScannerClient.stopScanRun(name.toString());
* }
*
*
@@ -929,7 +1019,7 @@ public final UnaryCallable listScanRu
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ScanRun stopScanRun(String name) {
- SCAN_RUN_PATH_TEMPLATE.validate(name, "stopScanRun");
+
StopScanRunRequest request = StopScanRunRequest.newBuilder().setName(name).build();
return stopScanRun(request);
}
@@ -942,9 +1032,9 @@ public final ScanRun stopScanRun(String name) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* StopScanRunRequest request = StopScanRunRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ScanRun response = webSecurityScannerClient.stopScanRun(request);
* }
@@ -965,9 +1055,9 @@ public final ScanRun stopScanRun(StopScanRunRequest request) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* StopScanRunRequest request = StopScanRunRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ApiFuture<ScanRun> future = webSecurityScannerClient.stopScanRunCallable().futureCall(request);
* // Do something
@@ -987,8 +1077,35 @@ public final UnaryCallable stopScanRunCallable() {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- * for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(formattedParent).iterateAll()) {
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The parent resource name, which should be a scan run resource name in
+ * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListCrawledUrlsPagedResponse listCrawledUrls(ScanRunName parent) {
+ ListCrawledUrlsRequest request =
+ ListCrawledUrlsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listCrawledUrls(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * List CrawledUrls under a given ScanRun.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent.toString()).iterateAll()) {
* // doThingsWith(element);
* }
* }
@@ -999,7 +1116,6 @@ public final UnaryCallable stopScanRunCallable() {
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListCrawledUrlsPagedResponse listCrawledUrls(String parent) {
- SCAN_RUN_PATH_TEMPLATE.validate(parent, "listCrawledUrls");
ListCrawledUrlsRequest request = ListCrawledUrlsRequest.newBuilder().setParent(parent).build();
return listCrawledUrls(request);
}
@@ -1012,9 +1128,9 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(String parent) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* ListCrawledUrlsRequest request = ListCrawledUrlsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(request).iterateAll()) {
* // doThingsWith(element);
@@ -1037,9 +1153,9 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* ListCrawledUrlsRequest request = ListCrawledUrlsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* ApiFuture<ListCrawledUrlsPagedResponse> future = webSecurityScannerClient.listCrawledUrlsPagedCallable().futureCall(request);
* // Do something
@@ -1062,9 +1178,9 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* ListCrawledUrlsRequest request = ListCrawledUrlsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* while (true) {
* ListCrawledUrlsResponse response = webSecurityScannerClient.listCrawledUrlsCallable().call(request);
@@ -1094,8 +1210,33 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatFindingName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
- * Finding response = webSecurityScannerClient.getFinding(formattedName);
+ * FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+ * Finding response = webSecurityScannerClient.getFinding(name);
+ * }
+ *
+ *
+ * @param name Required. The resource name of the Finding to be returned. The name follows the
+ * format of
+ * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Finding getFinding(FindingName name) {
+
+ GetFindingRequest request =
+ GetFindingRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getFinding(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets a Finding.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+ * Finding response = webSecurityScannerClient.getFinding(name.toString());
* }
*
*
@@ -1105,7 +1246,7 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Finding getFinding(String name) {
- FINDING_PATH_TEMPLATE.validate(name, "getFinding");
+
GetFindingRequest request = GetFindingRequest.newBuilder().setName(name).build();
return getFinding(request);
}
@@ -1118,9 +1259,9 @@ public final Finding getFinding(String name) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatFindingName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+ * FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
* GetFindingRequest request = GetFindingRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* Finding response = webSecurityScannerClient.getFinding(request);
* }
@@ -1141,9 +1282,9 @@ public final Finding getFinding(GetFindingRequest request) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedName = WebSecurityScannerClient.formatFindingName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+ * FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
* GetFindingRequest request = GetFindingRequest.newBuilder()
- * .setName(formattedName)
+ * .setName(name.toString())
* .build();
* ApiFuture<Finding> future = webSecurityScannerClient.getFindingCallable().futureCall(request);
* // Do something
@@ -1163,9 +1304,40 @@ public final UnaryCallable getFindingCallable() {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* String filter = "";
- * for (Finding element : webSecurityScannerClient.listFindings(formattedParent, filter).iterateAll()) {
+ * for (Finding element : webSecurityScannerClient.listFindings(parent, filter).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The parent resource name, which should be a scan run resource name in
+ * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
+ * @param filter The filter expression. The expression must be in the format: <field>
+ * <operator> <value>. Supported field: 'finding_type'. Supported operator: '='.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListFindingsPagedResponse listFindings(ScanRunName parent, String filter) {
+ ListFindingsRequest request =
+ ListFindingsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setFilter(filter)
+ .build();
+ return listFindings(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * List Findings under a given ScanRun.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * String filter = "";
+ * for (Finding element : webSecurityScannerClient.listFindings(parent.toString(), filter).iterateAll()) {
* // doThingsWith(element);
* }
* }
@@ -1178,7 +1350,6 @@ public final UnaryCallable getFindingCallable() {
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListFindingsPagedResponse listFindings(String parent, String filter) {
- SCAN_RUN_PATH_TEMPLATE.validate(parent, "listFindings");
ListFindingsRequest request =
ListFindingsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listFindings(request);
@@ -1192,10 +1363,10 @@ public final ListFindingsPagedResponse listFindings(String parent, String filter
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* String filter = "";
* ListFindingsRequest request = ListFindingsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .setFilter(filter)
* .build();
* for (Finding element : webSecurityScannerClient.listFindings(request).iterateAll()) {
@@ -1219,10 +1390,10 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request)
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* String filter = "";
* ListFindingsRequest request = ListFindingsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .setFilter(filter)
* .build();
* ApiFuture<ListFindingsPagedResponse> future = webSecurityScannerClient.listFindingsPagedCallable().futureCall(request);
@@ -1246,10 +1417,10 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request)
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* String filter = "";
* ListFindingsRequest request = ListFindingsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .setFilter(filter)
* .build();
* while (true) {
@@ -1279,8 +1450,34 @@ public final UnaryCallable listFindin
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- * ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(formattedParent);
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent);
+ * }
+ *
+ *
+ * @param parent Required. The parent resource name, which should be a scan run resource name in
+ * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListFindingTypeStatsResponse listFindingTypeStats(ScanRunName parent) {
+
+ ListFindingTypeStatsRequest request =
+ ListFindingTypeStatsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listFindingTypeStats(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * List all FindingTypeStats under a given ScanRun.
+ *
+ * Sample code:
+ *
+ *
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent.toString());
* }
*
*
@@ -1289,7 +1486,7 @@ public final UnaryCallable listFindin
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListFindingTypeStatsResponse listFindingTypeStats(String parent) {
- SCAN_RUN_PATH_TEMPLATE.validate(parent, "listFindingTypeStats");
+
ListFindingTypeStatsRequest request =
ListFindingTypeStatsRequest.newBuilder().setParent(parent).build();
return listFindingTypeStats(request);
@@ -1303,9 +1500,9 @@ public final ListFindingTypeStatsResponse listFindingTypeStats(String parent) {
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* ListFindingTypeStatsRequest request = ListFindingTypeStatsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(request);
* }
@@ -1327,9 +1524,9 @@ public final ListFindingTypeStatsResponse listFindingTypeStats(
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ * ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
* ListFindingTypeStatsRequest request = ListFindingTypeStatsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent.toString())
* .build();
* ApiFuture<ListFindingTypeStatsResponse> future = webSecurityScannerClient.listFindingTypeStatsCallable().futureCall(request);
* // Do something
diff --git a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java b/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java
index 9498bdc4a92c..6b4520274868 100644
--- a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java
+++ b/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java
@@ -30,9 +30,9 @@
*
*
* try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
- * String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ * ProjectName parent = ProjectName.of("[PROJECT]");
* ScanConfig scanConfig = ScanConfig.newBuilder().build();
- * ScanConfig response = webSecurityScannerClient.createScanConfig(formattedParent, scanConfig);
+ * ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
* }
*
*
diff --git a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java b/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java
index addad8e01f29..007a66e79bb6 100644
--- a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java
+++ b/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/stub/GrpcWebSecurityScannerStub.java
@@ -26,6 +26,7 @@
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;
@@ -48,10 +49,12 @@
import com.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest;
import com.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest;
import com.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest;
+import com.google.common.collect.ImmutableMap;
import com.google.protobuf.Empty;
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;
@@ -262,57 +265,175 @@ protected GrpcWebSecurityScannerStub(
GrpcCallSettings createScanConfigTransportSettings =
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();
+ }
+ })
.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();
+ }
+ })
.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();
+ }
+ })
.build();
GrpcCallSettings
listScanConfigsTransportSettings =
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();
+ }
+ })
.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();
+ }
+ })
.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();
+ }
+ })
.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();
+ }
+ })
.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();
+ }
+ })
.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();
+ }
+ })
.build();
GrpcCallSettings
listCrawledUrlsTransportSettings =
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();
+ }
+ })
.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();
+ }
+ })
.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();
+ }
+ })
.build();
GrpcCallSettings
listFindingTypeStatsTransportSettings =
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();
+ }
+ })
.build();
this.createScanConfigCallable =
diff --git a/google-cloud-clients/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClientTest.java b/google-cloud-clients/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClientTest.java
index 1adb90f7652a..345beb67ae39 100644
--- a/google-cloud-clients/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClientTest.java
+++ b/google-cloud-clients/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClientTest.java
@@ -91,17 +91,17 @@ public void createScanConfigTest() {
ScanConfig.newBuilder().setName(name).setDisplayName(displayName).setMaxQps(maxQps).build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ ProjectName parent = ProjectName.of("[PROJECT]");
ScanConfig scanConfig = ScanConfig.newBuilder().build();
- ScanConfig actualResponse = client.createScanConfig(formattedParent, scanConfig);
+ ScanConfig actualResponse = client.createScanConfig(parent, scanConfig);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateScanConfigRequest actualRequest = (CreateScanConfigRequest) actualRequests.get(0);
- Assert.assertEquals(formattedParent, actualRequest.getParent());
+ Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent()));
Assert.assertEquals(scanConfig, actualRequest.getScanConfig());
Assert.assertTrue(
channelProvider.isHeaderSent(
@@ -116,10 +116,10 @@ public void createScanConfigExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ ProjectName parent = ProjectName.of("[PROJECT]");
ScanConfig scanConfig = ScanConfig.newBuilder().build();
- client.createScanConfig(formattedParent, scanConfig);
+ client.createScanConfig(parent, scanConfig);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -132,16 +132,15 @@ public void deleteScanConfigTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedName =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- client.deleteScanConfig(formattedName);
+ client.deleteScanConfig(name);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteScanConfigRequest actualRequest = (DeleteScanConfigRequest) actualRequests.get(0);
- Assert.assertEquals(formattedName, actualRequest.getName());
+ Assert.assertEquals(name, ScanConfigName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -155,10 +154,9 @@ public void deleteScanConfigExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedName =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- client.deleteScanConfig(formattedName);
+ client.deleteScanConfig(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -179,17 +177,16 @@ public void getScanConfigTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedName =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- ScanConfig actualResponse = client.getScanConfig(formattedName);
+ ScanConfig actualResponse = client.getScanConfig(name);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetScanConfigRequest actualRequest = (GetScanConfigRequest) actualRequests.get(0);
- Assert.assertEquals(formattedName, actualRequest.getName());
+ Assert.assertEquals(name, ScanConfigName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -203,10 +200,9 @@ public void getScanConfigExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedName =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- client.getScanConfig(formattedName);
+ client.getScanConfig(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -226,9 +222,9 @@ public void listScanConfigsTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ ProjectName parent = ProjectName.of("[PROJECT]");
- ListScanConfigsPagedResponse pagedListResponse = client.listScanConfigs(formattedParent);
+ ListScanConfigsPagedResponse pagedListResponse = client.listScanConfigs(parent);
List resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
@@ -238,7 +234,7 @@ public void listScanConfigsTest() {
Assert.assertEquals(1, actualRequests.size());
ListScanConfigsRequest actualRequest = (ListScanConfigsRequest) actualRequests.get(0);
- Assert.assertEquals(formattedParent, actualRequest.getParent());
+ Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -252,9 +248,9 @@ public void listScanConfigsExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedParent = WebSecurityScannerClient.formatProjectName("[PROJECT]");
+ ProjectName parent = ProjectName.of("[PROJECT]");
- client.listScanConfigs(formattedParent);
+ client.listScanConfigs(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -324,17 +320,16 @@ public void startScanRunTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedName =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- ScanRun actualResponse = client.startScanRun(formattedName);
+ ScanRun actualResponse = client.startScanRun(name);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
StartScanRunRequest actualRequest = (StartScanRunRequest) actualRequests.get(0);
- Assert.assertEquals(formattedName, actualRequest.getName());
+ Assert.assertEquals(name, ScanConfigName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -348,10 +343,9 @@ public void startScanRunExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedName =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- client.startScanRun(formattedName);
+ client.startScanRun(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -376,17 +370,16 @@ public void getScanRunTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedName =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- ScanRun actualResponse = client.getScanRun(formattedName);
+ ScanRun actualResponse = client.getScanRun(name);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetScanRunRequest actualRequest = (GetScanRunRequest) actualRequests.get(0);
- Assert.assertEquals(formattedName, actualRequest.getName());
+ Assert.assertEquals(name, ScanRunName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -400,10 +393,9 @@ public void getScanRunExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedName =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- client.getScanRun(formattedName);
+ client.getScanRun(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -423,10 +415,9 @@ public void listScanRunsTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedParent =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- ListScanRunsPagedResponse pagedListResponse = client.listScanRuns(formattedParent);
+ ListScanRunsPagedResponse pagedListResponse = client.listScanRuns(parent);
List resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
@@ -436,7 +427,7 @@ public void listScanRunsTest() {
Assert.assertEquals(1, actualRequests.size());
ListScanRunsRequest actualRequest = (ListScanRunsRequest) actualRequests.get(0);
- Assert.assertEquals(formattedParent, actualRequest.getParent());
+ Assert.assertEquals(parent, ScanConfigName.parse(actualRequest.getParent()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -450,10 +441,9 @@ public void listScanRunsExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedParent =
- WebSecurityScannerClient.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+ ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
- client.listScanRuns(formattedParent);
+ client.listScanRuns(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -478,17 +468,16 @@ public void stopScanRunTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedName =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- ScanRun actualResponse = client.stopScanRun(formattedName);
+ ScanRun actualResponse = client.stopScanRun(name);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
StopScanRunRequest actualRequest = (StopScanRunRequest) actualRequests.get(0);
- Assert.assertEquals(formattedName, actualRequest.getName());
+ Assert.assertEquals(name, ScanRunName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -502,10 +491,9 @@ public void stopScanRunExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedName =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- client.stopScanRun(formattedName);
+ client.stopScanRun(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -525,10 +513,9 @@ public void listCrawledUrlsTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedParent =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- ListCrawledUrlsPagedResponse pagedListResponse = client.listCrawledUrls(formattedParent);
+ ListCrawledUrlsPagedResponse pagedListResponse = client.listCrawledUrls(parent);
List resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
@@ -538,7 +525,7 @@ public void listCrawledUrlsTest() {
Assert.assertEquals(1, actualRequests.size());
ListCrawledUrlsRequest actualRequest = (ListCrawledUrlsRequest) actualRequests.get(0);
- Assert.assertEquals(formattedParent, actualRequest.getParent());
+ Assert.assertEquals(parent, ScanRunName.parse(actualRequest.getParent()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -552,10 +539,9 @@ public void listCrawledUrlsExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedParent =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- client.listCrawledUrls(formattedParent);
+ client.listCrawledUrls(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -588,18 +574,16 @@ public void getFindingTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedName =
- WebSecurityScannerClient.formatFindingName(
- "[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+ FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
- Finding actualResponse = client.getFinding(formattedName);
+ Finding actualResponse = client.getFinding(name);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetFindingRequest actualRequest = (GetFindingRequest) actualRequests.get(0);
- Assert.assertEquals(formattedName, actualRequest.getName());
+ Assert.assertEquals(name, FindingName.parse(actualRequest.getName()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -613,11 +597,9 @@ public void getFindingExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedName =
- WebSecurityScannerClient.formatFindingName(
- "[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+ FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
- client.getFinding(formattedName);
+ client.getFinding(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -637,11 +619,10 @@ public void listFindingsTest() {
.build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedParent =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
String filter = "filter-1274492040";
- ListFindingsPagedResponse pagedListResponse = client.listFindings(formattedParent, filter);
+ ListFindingsPagedResponse pagedListResponse = client.listFindings(parent, filter);
List resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
@@ -651,7 +632,7 @@ public void listFindingsTest() {
Assert.assertEquals(1, actualRequests.size());
ListFindingsRequest actualRequest = (ListFindingsRequest) actualRequests.get(0);
- Assert.assertEquals(formattedParent, actualRequest.getParent());
+ Assert.assertEquals(parent, ScanRunName.parse(actualRequest.getParent()));
Assert.assertEquals(filter, actualRequest.getFilter());
Assert.assertTrue(
channelProvider.isHeaderSent(
@@ -666,11 +647,10 @@ public void listFindingsExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedParent =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
String filter = "filter-1274492040";
- client.listFindings(formattedParent, filter);
+ client.listFindings(parent, filter);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -684,17 +664,16 @@ public void listFindingTypeStatsTest() {
ListFindingTypeStatsResponse.newBuilder().build();
mockWebSecurityScanner.addResponse(expectedResponse);
- String formattedParent =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- ListFindingTypeStatsResponse actualResponse = client.listFindingTypeStats(formattedParent);
+ ListFindingTypeStatsResponse actualResponse = client.listFindingTypeStats(parent);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockWebSecurityScanner.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListFindingTypeStatsRequest actualRequest = (ListFindingTypeStatsRequest) actualRequests.get(0);
- Assert.assertEquals(formattedParent, actualRequest.getParent());
+ Assert.assertEquals(parent, ScanRunName.parse(actualRequest.getParent()));
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -708,10 +687,9 @@ public void listFindingTypeStatsExceptionTest() throws Exception {
mockWebSecurityScanner.addException(exception);
try {
- String formattedParent =
- WebSecurityScannerClient.formatScanRunName("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+ ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
- client.listFindingTypeStats(formattedParent);
+ client.listFindingTypeStats(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
diff --git a/google-cloud-clients/google-cloud-websecurityscanner/synth.metadata b/google-cloud-clients/google-cloud-websecurityscanner/synth.metadata
index a73ecb01f2e6..bdc960127683 100644
--- a/google-cloud-clients/google-cloud-websecurityscanner/synth.metadata
+++ b/google-cloud-clients/google-cloud-websecurityscanner/synth.metadata
@@ -1,19 +1,19 @@
{
- "updateTime": "2019-03-06T08:59:50.869051Z",
+ "updateTime": "2019-03-28T08:04:38.021018Z",
"sources": [
{
"generator": {
"name": "artman",
- "version": "0.16.15",
- "dockerImage": "googleapis/artman@sha256:9caadfa59d48224cba5f3217eb9d61a155b78ccf31e628abef385bc5b7ed3bd2"
+ "version": "0.16.20",
+ "dockerImage": "googleapis/artman@sha256:e3c054a2fb85a12481c722af616c7fb6f1d02d862248385eecbec3e4240ebd1e"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "856117505ff9075b3e9c0b5674113667b6cf9e00",
- "internalRef": "236931378"
+ "sha": "6a84b3267b0a95e922608b9891219075047eee29",
+ "internalRef": "240640999"
}
}
],