Search in sources :

Example 1 with DeleteSchemaRequest

use of com.google.pubsub.v1.DeleteSchemaRequest in project gapic-generator-java by googleapis.

the class AsyncDeleteSchema method asyncDeleteSchema.

public static void asyncDeleteSchema() throws Exception {
    // It may require modifications to work in your environment.
    try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
        DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder().setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()).build();
        ApiFuture<Empty> future = schemaServiceClient.deleteSchemaCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : Empty(com.google.protobuf.Empty) DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest) SchemaServiceClient(com.google.cloud.pubsub.v1.SchemaServiceClient)

Example 2 with DeleteSchemaRequest

use of com.google.pubsub.v1.DeleteSchemaRequest in project gapic-generator-java by googleapis.

the class SchemaServiceClient method deleteSchema.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a schema.
 *
 * <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 (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
 *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
 *   schemaServiceClient.deleteSchema(name);
 * }
 * }</pre>
 *
 * @param name Required. Name of the schema to delete. Format is
 *     `projects/{project}/schemas/{schema}`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteSchema(String name) {
    DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder().setName(name).build();
    deleteSchema(request);
}
Also used : DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest)

Example 3 with DeleteSchemaRequest

use of com.google.pubsub.v1.DeleteSchemaRequest in project java-pubsub by googleapis.

the class SchemaServiceClientTest method deleteSchemaTest2.

@Test
public void deleteSchemaTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockSchemaService.addResponse(expectedResponse);
    String name = "name3373707";
    client.deleteSchema(name);
    List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteSchemaRequest actualRequest = ((DeleteSchemaRequest) 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) DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 4 with DeleteSchemaRequest

use of com.google.pubsub.v1.DeleteSchemaRequest in project java-pubsub by googleapis.

the class SchemaServiceClient method deleteSchema.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a schema.
 *
 * <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 (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
 *   SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]");
 *   schemaServiceClient.deleteSchema(name);
 * }
 * }</pre>
 *
 * @param name Required. Name of the schema to delete. Format is
 *     `projects/{project}/schemas/{schema}`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteSchema(SchemaName name) {
    DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteSchema(request);
}
Also used : DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest)

Example 5 with DeleteSchemaRequest

use of com.google.pubsub.v1.DeleteSchemaRequest in project java-pubsub by googleapis.

the class SchemaServiceClient method deleteSchema.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a schema.
 *
 * <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 (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
 *   String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString();
 *   schemaServiceClient.deleteSchema(name);
 * }
 * }</pre>
 *
 * @param name Required. Name of the schema to delete. Format is
 *     `projects/{project}/schemas/{schema}`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteSchema(String name) {
    DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder().setName(name).build();
    deleteSchema(request);
}
Also used : DeleteSchemaRequest(com.google.pubsub.v1.DeleteSchemaRequest)

Aggregations

DeleteSchemaRequest (com.google.pubsub.v1.DeleteSchemaRequest)10 Empty (com.google.protobuf.Empty)5 AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 SchemaServiceClient (com.google.cloud.pubsub.v1.SchemaServiceClient)2 ByteString (com.google.protobuf.ByteString)2 SchemaName (com.google.pubsub.v1.SchemaName)2