Search in sources :

Example 6 with DeleteExclusionRequest

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

the class LoggingImplTest method testDeleteExclusion.

@Test
public void testDeleteExclusion() {
    DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(EXCLUSION_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(Empty.getDefaultInstance());
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertTrue(logging.deleteExclusion(EXCLUSION_NAME));
}
Also used : Empty(com.google.protobuf.Empty) DeleteExclusionRequest(com.google.logging.v2.DeleteExclusionRequest) Test(org.junit.Test)

Example 7 with DeleteExclusionRequest

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

the class ConfigClient method deleteExclusion.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes an exclusion in the _Default sink.
 *
 * <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>For example:
 *     <p>`"projects/my-project/exclusions/my-exclusion"`
 * @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 8 with DeleteExclusionRequest

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

the class LoggingImplTest method testDeleteExclusionAsync.

@Test
public void testDeleteExclusionAsync() throws ExecutionException, InterruptedException {
    DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(EXCLUSION_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(Empty.getDefaultInstance());
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertTrue(logging.deleteExclusionAsync(EXCLUSION_NAME).get());
}
Also used : Empty(com.google.protobuf.Empty) DeleteExclusionRequest(com.google.logging.v2.DeleteExclusionRequest) Test(org.junit.Test)

Example 9 with DeleteExclusionRequest

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

the class ConfigClient method deleteExclusion.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes an exclusion in the _Default sink.
 *
 * <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>For example:
 *     <p>`"projects/my-project/exclusions/my-exclusion"`
 * @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 10 with DeleteExclusionRequest

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

the class AsyncDeleteExclusion method asyncDeleteExclusion.

public static void asyncDeleteExclusion() throws Exception {
    // It may require modifications to work in your environment.
    try (ConfigClient configClient = ConfigClient.create()) {
        DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).build();
        ApiFuture<Empty> future = configClient.deleteExclusionCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : ConfigClient(com.google.cloud.logging.v2.ConfigClient) Empty(com.google.protobuf.Empty) DeleteExclusionRequest(com.google.logging.v2.DeleteExclusionRequest)

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