use of com.google.logging.v2.CmekSettings in project java-logging by googleapis.
the class ConfigClientTest method getCmekSettingsTest.
@Test
public void getCmekSettingsTest() throws Exception {
CmekSettings expectedResponse = CmekSettings.newBuilder().setName(CmekSettingsName.ofProjectCmekSettingsName("[PROJECT]").toString()).setKmsKeyName("kmsKeyName412586233").setServiceAccountId("serviceAccountId1964232947").build();
mockConfigServiceV2.addResponse(expectedResponse);
GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder().setName(CmekSettingsName.ofProjectCmekSettingsName("[PROJECT]").toString()).build();
CmekSettings actualResponse = client.getCmekSettings(request);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetCmekSettingsRequest actualRequest = ((GetCmekSettingsRequest) actualRequests.get(0));
Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.logging.v2.CmekSettings in project gapic-generator-java by googleapis.
the class SyncGetCmekSettings method syncGetCmekSettings.
public static void syncGetCmekSettings() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder().setName(CmekSettingsName.ofProjectName("[PROJECT]").toString()).build();
CmekSettings response = configClient.getCmekSettings(request);
}
}
use of com.google.logging.v2.CmekSettings in project gapic-generator-java by googleapis.
the class ConfigClientTest method updateCmekSettingsTest.
@Test
public void updateCmekSettingsTest() throws Exception {
CmekSettings expectedResponse = CmekSettings.newBuilder().setName(CmekSettingsName.ofProjectName("[PROJECT]").toString()).setKmsKeyName("kmsKeyName412586233").setServiceAccountId("serviceAccountId1964232947").build();
mockConfigServiceV2.addResponse(expectedResponse);
UpdateCmekSettingsRequest request = UpdateCmekSettingsRequest.newBuilder().setName("name3373707").setCmekSettings(CmekSettings.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).build();
CmekSettings actualResponse = client.updateCmekSettings(request);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateCmekSettingsRequest actualRequest = ((UpdateCmekSettingsRequest) actualRequests.get(0));
Assert.assertEquals(request.getName(), actualRequest.getName());
Assert.assertEquals(request.getCmekSettings(), actualRequest.getCmekSettings());
Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations