use of com.google.monitoring.v3.FolderName in project gapic-generator-java by googleapis.
the class SyncCreateExclusionFoldernameLogexclusion method syncCreateExclusionFoldernameLogexclusion.
public static void syncCreateExclusionFoldernameLogexclusion() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
FolderName parent = FolderName.of("[FOLDER]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
LogExclusion response = configClient.createExclusion(parent, exclusion);
}
}
use of com.google.monitoring.v3.FolderName in project gapic-generator-java by googleapis.
the class ConfigClientTest method listSinksTest2.
@Test
public void listSinksTest2() throws Exception {
LogSink responsesElement = LogSink.newBuilder().build();
ListSinksResponse expectedResponse = ListSinksResponse.newBuilder().setNextPageToken("").addAllSinks(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
FolderName parent = FolderName.of("[FOLDER]");
ListSinksPagedResponse pagedListResponse = client.listSinks(parent);
List<LogSink> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getSinksList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListSinksRequest actualRequest = ((ListSinksRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations