use of com.google.logging.v2.SinkNameOneof in project google-cloud-java by GoogleCloudPlatform.
the class ConfigClientTest method getSinkTest.
@Test
@SuppressWarnings("all")
public void getSinkTest() {
String name = "name3373707";
ResourceName destination = ProjectName.create("[PROJECT]");
String filter = "filter-1274492040";
String writerIdentity = "writerIdentity775638794";
LogSink expectedResponse = LogSink.newBuilder().setName(name).setDestinationWithResourceName(destination).setFilter(filter).setWriterIdentity(writerIdentity).build();
mockConfigServiceV2.addResponse(expectedResponse);
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.create("[PROJECT]", "[SINK]"));
LogSink actualResponse = client.getSink(sinkName);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetSinkRequest actualRequest = (GetSinkRequest) actualRequests.get(0);
Assert.assertEquals(sinkName, actualRequest.getSinkNameAsSinkNameOneof());
}
use of com.google.logging.v2.SinkNameOneof in project google-cloud-java by GoogleCloudPlatform.
the class ConfigClient method deleteSink.
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also
* deleted.
*
* <p>Sample code:
*
* <pre><code>
* try (ConfigClient configClient = ConfigClient.create()) {
* SinkNameOneof sinkName = SinkNameOneof.from(SinkName.create("[PROJECT]", "[SINK]"));
* configClient.deleteSink(sinkName);
* }
* </code></pre>
*
* @param sinkName Required. The full resource name of the sink to delete, including the parent
* resource and the sink identifier:
* <p>"projects/[PROJECT_ID]/sinks/[SINK_ID]"
* "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
* "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
* "folders/[FOLDER_ID]/sinks/[SINK_ID]"
* <p>Example: `"projects/my-project-id/sinks/my-sink-id"`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteSink(SinkNameOneof sinkName) {
DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkNameWithSinkNameOneof(sinkName).build();
deleteSink(request);
}
Aggregations