Search in sources :

Example 11 with DeleteExclusionRequest

use of com.google.logging.v2.DeleteExclusionRequest in project gapic-generator-java by googleapis.

the class ConfigClient method deleteExclusion.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes an exclusion.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * // This snippet has been automatically generated for illustrative purposes only.
 * // It may require modifications to work in your environment.
 * try (ConfigClient configClient = ConfigClient.create()) {
 *   String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
 *   configClient.deleteExclusion(name);
 * }
 * }</pre>
 *
 * @param name Required. The resource name of an existing exclusion to delete:
 *     <p>"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
 *     "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
 *     "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
 *     "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
 *     <p>Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteExclusion(String name) {
    DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(name).build();
    deleteExclusion(request);
}
Also used : DeleteExclusionRequest(com.google.logging.v2.DeleteExclusionRequest)

Example 12 with DeleteExclusionRequest

use of com.google.logging.v2.DeleteExclusionRequest in project gapic-generator-java by googleapis.

the class ConfigClient method deleteExclusion.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes an exclusion.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * // This snippet has been automatically generated for illustrative purposes only.
 * // It may require modifications to work in your environment.
 * try (ConfigClient configClient = ConfigClient.create()) {
 *   LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
 *   configClient.deleteExclusion(name);
 * }
 * }</pre>
 *
 * @param name Required. The resource name of an existing exclusion to delete:
 *     <p>"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
 *     "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
 *     "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
 *     "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
 *     <p>Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteExclusion(LogExclusionName name) {
    DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteExclusion(request);
}
Also used : DeleteExclusionRequest(com.google.logging.v2.DeleteExclusionRequest)

Example 13 with DeleteExclusionRequest

use of com.google.logging.v2.DeleteExclusionRequest in project gapic-generator-java by googleapis.

the class ConfigClientTest method deleteExclusionTest.

@Test
public void deleteExclusionTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockConfigServiceV2.addResponse(expectedResponse);
    LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
    client.deleteExclusion(name);
    List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteExclusionRequest actualRequest = ((DeleteExclusionRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteExclusionRequest(com.google.logging.v2.DeleteExclusionRequest) LogExclusionName(com.google.logging.v2.LogExclusionName) Test(org.junit.Test)

Example 14 with DeleteExclusionRequest

use of com.google.logging.v2.DeleteExclusionRequest in project gapic-generator-java by googleapis.

the class ConfigClientTest method deleteExclusionTest2.

@Test
public void deleteExclusionTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockConfigServiceV2.addResponse(expectedResponse);
    String name = "name3373707";
    client.deleteExclusion(name);
    List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteExclusionRequest actualRequest = ((DeleteExclusionRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteExclusionRequest(com.google.logging.v2.DeleteExclusionRequest) Test(org.junit.Test)

Aggregations

DeleteExclusionRequest (com.google.logging.v2.DeleteExclusionRequest)14 Empty (com.google.protobuf.Empty)9 Test (org.junit.Test)8 AbstractMessage (com.google.protobuf.AbstractMessage)4 ConfigClient (com.google.cloud.logging.v2.ConfigClient)2 LogExclusionName (com.google.logging.v2.LogExclusionName)2