Skip to content

Commit

Permalink
change snippet response and mock static
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelMurata committed Jun 6, 2024
1 parent 6ac5a92 commit 433599c
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void main(String[] args) throws IOException {

// Create export configuration to export findings from a project to a BigQuery dataset.
// Optionally specify filter to export certain findings only.
public static void createBigQueryExport(String organizationId, String location,
public static BigQueryExport createBigQueryExport(String organizationId, String location,
String projectId, String filter, String bigQueryDatasetId, String bigQueryExportId)
throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
Expand Down Expand Up @@ -84,6 +84,7 @@ public static void createBigQueryExport(String organizationId, String location,
BigQueryExport response = client.createBigQueryExport(bigQueryExportRequest);

System.out.printf("BigQuery export request created successfully: %s\n", response.getName());
return response;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void main(String[] args) throws IOException {
}

// Retrieve an existing BigQuery export.
public static void getBigQueryExport(String organizationId, String location,
public static BigQueryExport getBigQueryExport(String organizationId, String location,
String bigQueryExportId) throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests.
Expand All @@ -57,6 +57,7 @@ public static void getBigQueryExport(String organizationId, String location,

BigQueryExport response = client.getBigQueryExport(bigQueryExportRequest);
System.out.printf("Retrieved the BigQuery export: %s", response.getName());
return response;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public static void main(String[] args) throws IOException {
}

// List BigQuery exports in the given parent.
public static void listBigQueryExports(String organizationId, String location)
throws IOException {
public static ListBigQueryExportsPagedResponse listBigQueryExports(String organizationId,
String location) throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests.
try (SecurityCenterClient client = SecurityCenterClient.create()) {
Expand All @@ -57,6 +57,7 @@ public static void listBigQueryExports(String organizationId, String location)
for (BigQueryExport bigQueryExport : response.iterateAll()) {
System.out.println(bigQueryExport.getName());
}
return response;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ public static void main(String[] args) throws IOException {
}

// Updates an existing BigQuery export.
public static void updateBigQueryExport(String organizationId, String location, String filter,
String bigQueryExportId)
throws IOException {
public static BigQueryExport updateBigQueryExport(String organizationId, String location,
String filter, String bigQueryExportId) throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests.
try (SecurityCenterClient client = SecurityCenterClient.create()) {
Expand Down Expand Up @@ -83,11 +82,8 @@ public static void updateBigQueryExport(String organizationId, String location,
.build();

BigQueryExport response = client.updateBigQueryExport(request);
if (!response.getFilter().equalsIgnoreCase(filter)) {
System.out.println("Failed to update BigQueryExport!");
return;
}
System.out.println("BigQueryExport updated successfully!");
return response;
}
}
}
Expand Down
Loading

0 comments on commit 433599c

Please sign in to comment.