use of com.google.cloud.securitycenter.v1.SecurityCenterClient.ListBigQueryExportsPagedResponse in project java-securitycenter by googleapis.
the class SecurityCenterClientTest method listBigQueryExportsTest4.
@Test
public void listBigQueryExportsTest4() throws Exception {
BigQueryExport responsesElement = BigQueryExport.newBuilder().build();
ListBigQueryExportsResponse expectedResponse = ListBigQueryExportsResponse.newBuilder().setNextPageToken("").addAllBigQueryExports(Arrays.asList(responsesElement)).build();
mockSecurityCenter.addResponse(expectedResponse);
String parent = "parent-995424086";
ListBigQueryExportsPagedResponse pagedListResponse = client.listBigQueryExports(parent);
List<BigQueryExport> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getBigQueryExportsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSecurityCenter.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListBigQueryExportsRequest actualRequest = ((ListBigQueryExportsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.securitycenter.v1.SecurityCenterClient.ListBigQueryExportsPagedResponse in project java-securitycenter by googleapis.
the class SecurityCenterClientTest method listBigQueryExportsTest3.
@Test
public void listBigQueryExportsTest3() throws Exception {
BigQueryExport responsesElement = BigQueryExport.newBuilder().build();
ListBigQueryExportsResponse expectedResponse = ListBigQueryExportsResponse.newBuilder().setNextPageToken("").addAllBigQueryExports(Arrays.asList(responsesElement)).build();
mockSecurityCenter.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListBigQueryExportsPagedResponse pagedListResponse = client.listBigQueryExports(parent);
List<BigQueryExport> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getBigQueryExportsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSecurityCenter.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListBigQueryExportsRequest actualRequest = ((ListBigQueryExportsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.securitycenter.v1.SecurityCenterClient.ListBigQueryExportsPagedResponse in project java-securitycenter by googleapis.
the class SecurityCenterClientTest method listBigQueryExportsTest2.
@Test
public void listBigQueryExportsTest2() throws Exception {
BigQueryExport responsesElement = BigQueryExport.newBuilder().build();
ListBigQueryExportsResponse expectedResponse = ListBigQueryExportsResponse.newBuilder().setNextPageToken("").addAllBigQueryExports(Arrays.asList(responsesElement)).build();
mockSecurityCenter.addResponse(expectedResponse);
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListBigQueryExportsPagedResponse pagedListResponse = client.listBigQueryExports(parent);
List<BigQueryExport> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getBigQueryExportsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSecurityCenter.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListBigQueryExportsRequest actualRequest = ((ListBigQueryExportsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.securitycenter.v1.SecurityCenterClient.ListBigQueryExportsPagedResponse in project java-securitycenter by googleapis.
the class ListBigQueryExports method listBigQueryExports.
// List BigQuery exports in the given parent.
public static void listBigQueryExports(String parent) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (SecurityCenterClient client = SecurityCenterClient.create()) {
ListBigQueryExportsRequest request = ListBigQueryExportsRequest.newBuilder().setParent(parent).build();
ListBigQueryExportsPagedResponse response = client.listBigQueryExports(request);
System.out.println("Listing BigQuery exports:");
for (BigQueryExport bigQueryExport : response.iterateAll()) {
System.out.println(bigQueryExport.getName());
}
}
}
use of com.google.cloud.securitycenter.v1.SecurityCenterClient.ListBigQueryExportsPagedResponse in project java-securitycenter by googleapis.
the class SecurityCenterClientTest method listBigQueryExportsTest.
@Test
public void listBigQueryExportsTest() throws Exception {
BigQueryExport responsesElement = BigQueryExport.newBuilder().build();
ListBigQueryExportsResponse expectedResponse = ListBigQueryExportsResponse.newBuilder().setNextPageToken("").addAllBigQueryExports(Arrays.asList(responsesElement)).build();
mockSecurityCenter.addResponse(expectedResponse);
FolderName parent = FolderName.of("[FOLDER]");
ListBigQueryExportsPagedResponse pagedListResponse = client.listBigQueryExports(parent);
List<BigQueryExport> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getBigQueryExportsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSecurityCenter.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListBigQueryExportsRequest actualRequest = ((ListBigQueryExportsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations