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();
}
}
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);
}
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()));
}
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);
}
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);
}
Aggregations