Search in sources :

Example 1 with DeleteGroupRequest

use of com.google.monitoring.v3.DeleteGroupRequest in project google-cloud-java by GoogleCloudPlatform.

the class GroupServiceClient method deleteGroup.

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
   * Deletes an existing group.
   *
   * <p>Sample code:
   *
   * <pre><code>
   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
   *   GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
   *   groupServiceClient.deleteGroup(name);
   * }
   * </code></pre>
   *
   * @param name The group to delete. The format is
   *     `"projects/{project_id_or_number}/groups/{group_id}"`.
   * @throws com.google.api.gax.grpc.ApiException if the remote call fails
   */
public final void deleteGroup(GroupName name) {
    DeleteGroupRequest request = DeleteGroupRequest.newBuilder().setNameWithGroupName(name).build();
    deleteGroup(request);
}
Also used : DeleteGroupRequest(com.google.monitoring.v3.DeleteGroupRequest)

Example 2 with DeleteGroupRequest

use of com.google.monitoring.v3.DeleteGroupRequest in project google-cloud-java by GoogleCloudPlatform.

the class GroupServiceClientTest method deleteGroupTest.

@Test
@SuppressWarnings("all")
public void deleteGroupTest() {
    Empty expectedResponse = Empty.newBuilder().build();
    mockGroupService.addResponse(expectedResponse);
    GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
    client.deleteGroup(name);
    List<GeneratedMessageV3> actualRequests = mockGroupService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteGroupRequest actualRequest = (DeleteGroupRequest) actualRequests.get(0);
    Assert.assertEquals(name, actualRequest.getNameAsGroupName());
}
Also used : GroupName(com.google.monitoring.v3.GroupName) Empty(com.google.protobuf.Empty) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) DeleteGroupRequest(com.google.monitoring.v3.DeleteGroupRequest) Test(org.junit.Test)

Aggregations

DeleteGroupRequest (com.google.monitoring.v3.DeleteGroupRequest)2 GroupName (com.google.monitoring.v3.GroupName)1 Empty (com.google.protobuf.Empty)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 Test (org.junit.Test)1