diff --git a/google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/AdminServiceClientTest.java b/google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/AdminServiceClientTest.java index 79d744c2a..a42b24cf2 100644 --- a/google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/AdminServiceClientTest.java +++ b/google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/AdminServiceClientTest.java @@ -36,6 +36,7 @@ import com.google.cloud.pubsublite.proto.DeleteReservationRequest; import com.google.cloud.pubsublite.proto.DeleteSubscriptionRequest; import com.google.cloud.pubsublite.proto.DeleteTopicRequest; +import com.google.cloud.pubsublite.proto.ExportConfig; import com.google.cloud.pubsublite.proto.GetReservationRequest; import com.google.cloud.pubsublite.proto.GetSubscriptionRequest; import com.google.cloud.pubsublite.proto.GetTopicPartitionsRequest; @@ -666,6 +667,7 @@ public void createSubscriptionTest() throws Exception { .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setDeliveryConfig(Subscription.DeliveryConfig.newBuilder().build()) + .setExportConfig(ExportConfig.newBuilder().build()) .build(); mockAdminService.addResponse(expectedResponse); @@ -712,6 +714,7 @@ public void createSubscriptionTest2() throws Exception { .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setDeliveryConfig(Subscription.DeliveryConfig.newBuilder().build()) + .setExportConfig(ExportConfig.newBuilder().build()) .build(); mockAdminService.addResponse(expectedResponse); @@ -758,6 +761,7 @@ public void getSubscriptionTest() throws Exception { .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setDeliveryConfig(Subscription.DeliveryConfig.newBuilder().build()) + .setExportConfig(ExportConfig.newBuilder().build()) .build(); mockAdminService.addResponse(expectedResponse); @@ -798,6 +802,7 @@ public void getSubscriptionTest2() throws Exception { .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setDeliveryConfig(Subscription.DeliveryConfig.newBuilder().build()) + .setExportConfig(ExportConfig.newBuilder().build()) .build(); mockAdminService.addResponse(expectedResponse); @@ -926,6 +931,7 @@ public void updateSubscriptionTest() throws Exception { .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) .setDeliveryConfig(Subscription.DeliveryConfig.newBuilder().build()) + .setExportConfig(ExportConfig.newBuilder().build()) .build(); mockAdminService.addResponse(expectedResponse); diff --git a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/CommonProto.java b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/CommonProto.java index 9b6c8faa6..96efdb803 100644 --- a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/CommonProto.java +++ b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/CommonProto.java @@ -79,6 +79,18 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_pubsublite_v1_Subscription_DeliveryConfig_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_pubsublite_v1_Subscription_DeliveryConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_pubsublite_v1_ExportConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_pubsublite_v1_TimeTarget_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -93,76 +105,93 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\'google/cloud/pubsublite/v1/common.prot" - + "o\022\032google.cloud.pubsublite.v1\032\031google/ap" - + "i/resource.proto\032\036google/protobuf/durati" - + "on.proto\032\037google/protobuf/timestamp.prot" - + "o\"!\n\017AttributeValues\022\016\n\006values\030\001 \003(\014\"\211\002\n" - + "\rPubSubMessage\022\013\n\003key\030\001 \001(\014\022\014\n\004data\030\002 \001(" - + "\014\022M\n\nattributes\030\003 \003(\01329.google.cloud.pub" - + "sublite.v1.PubSubMessage.AttributesEntry" - + "\022.\n\nevent_time\030\004 \001(\0132\032.google.protobuf.T" - + "imestamp\032^\n\017AttributesEntry\022\013\n\003key\030\001 \001(\t" - + "\022:\n\005value\030\002 \001(\0132+.google.cloud.pubsublit" - + "e.v1.AttributeValues:\0028\001\"\030\n\006Cursor\022\016\n\006of" - + "fset\030\001 \001(\003\"\310\001\n\020SequencedMessage\0222\n\006curso" - + "r\030\001 \001(\0132\".google.cloud.pubsublite.v1.Cur" - + "sor\0220\n\014publish_time\030\002 \001(\0132\032.google.proto" - + "buf.Timestamp\022:\n\007message\030\003 \001(\0132).google." - + "cloud.pubsublite.v1.PubSubMessage\022\022\n\nsiz" - + "e_bytes\030\004 \001(\003\"\250\001\n\013Reservation\022\014\n\004name\030\001 " - + "\001(\t\022\033\n\023throughput_capacity\030\002 \001(\003:n\352Ak\n%p" - + "ubsublite.googleapis.com/Reservation\022Bpr" - + "ojects/{project}/locations/{location}/re" - + "servations/{reservation}\"\367\005\n\005Topic\022\014\n\004na" - + "me\030\001 \001(\t\022K\n\020partition_config\030\002 \001(\01321.goo" - + "gle.cloud.pubsublite.v1.Topic.PartitionC" - + "onfig\022K\n\020retention_config\030\003 \001(\01321.google" - + ".cloud.pubsublite.v1.Topic.RetentionConf" - + "ig\022O\n\022reservation_config\030\004 \001(\01323.google." - + "cloud.pubsublite.v1.Topic.ReservationCon" - + "fig\032\332\001\n\017PartitionConfig\022\r\n\005count\030\001 \001(\003\022\023" - + "\n\005scale\030\002 \001(\005B\002\030\001H\000\022N\n\010capacity\030\003 \001(\0132:." - + "google.cloud.pubsublite.v1.Topic.Partiti" - + "onConfig.CapacityH\000\032F\n\010Capacity\022\033\n\023publi" - + "sh_mib_per_sec\030\001 \001(\005\022\035\n\025subscribe_mib_pe" - + "r_sec\030\002 \001(\005B\013\n\tdimension\032Y\n\017RetentionCon" - + "fig\022\033\n\023per_partition_bytes\030\001 \001(\003\022)\n\006peri" - + "od\030\002 \001(\0132\031.google.protobuf.Duration\032_\n\021R" - + "eservationConfig\022J\n\026throughput_reservati" - + "on\030\001 \001(\tB*\372A\'\n%pubsublite.googleapis.com" - + "/Reservation:\\\352AY\n\037pubsublite.googleapis" - + ".com/Topic\0226projects/{project}/locations" - + "/{location}/topics/{topic}\"\204\004\n\014Subscript" - + "ion\022\014\n\004name\030\001 \001(\t\0223\n\005topic\030\002 \001(\tB$\372A!\n\037p" - + "ubsublite.googleapis.com/Topic\022P\n\017delive" - + "ry_config\030\003 \001(\01327.google.cloud.pubsublit" - + "e.v1.Subscription.DeliveryConfig\032\353\001\n\016Del" - + "iveryConfig\022i\n\024delivery_requirement\030\003 \001(" - + "\0162K.google.cloud.pubsublite.v1.Subscript" - + "ion.DeliveryConfig.DeliveryRequirement\"n" - + "\n\023DeliveryRequirement\022$\n DELIVERY_REQUIR" - + "EMENT_UNSPECIFIED\020\000\022\027\n\023DELIVER_IMMEDIATE" - + "LY\020\001\022\030\n\024DELIVER_AFTER_STORED\020\002:q\352An\n&pub" - + "sublite.googleapis.com/Subscription\022Dpro" - + "jects/{project}/locations/{location}/sub" - + "scriptions/{subscription}\"z\n\nTimeTarget\022" - + "2\n\014publish_time\030\001 \001(\0132\032.google.protobuf." - + "TimestampH\000\0220\n\nevent_time\030\002 \001(\0132\032.google" - + ".protobuf.TimestampH\000B\006\n\004timeB\325\001\n!com.go" - + "ogle.cloud.pubsublite.protoB\013CommonProto" - + "P\001ZDgoogle.golang.org/genproto/googleapi" - + "s/cloud/pubsublite/v1;pubsublite\370\001\001\252\002\032Go" - + "ogle.Cloud.PubSubLite.V1\312\002\032Google\\Cloud\\" - + "PubSubLite\\V1\352\002\035Google::Cloud::PubSubLit" - + "e::V1b\006proto3" + + "o\022\032google.cloud.pubsublite.v1\032\037google/ap" + + "i/field_behavior.proto\032\031google/api/resou" + + "rce.proto\032\036google/protobuf/duration.prot" + + "o\032\037google/protobuf/timestamp.proto\032\027goog" + + "le/rpc/status.proto\"!\n\017AttributeValues\022\016" + + "\n\006values\030\001 \003(\014\"\211\002\n\rPubSubMessage\022\013\n\003key\030" + + "\001 \001(\014\022\014\n\004data\030\002 \001(\014\022M\n\nattributes\030\003 \003(\0132" + + "9.google.cloud.pubsublite.v1.PubSubMessa" + + "ge.AttributesEntry\022.\n\nevent_time\030\004 \001(\0132\032" + + ".google.protobuf.Timestamp\032^\n\017Attributes" + + "Entry\022\013\n\003key\030\001 \001(\t\022:\n\005value\030\002 \001(\0132+.goog" + + "le.cloud.pubsublite.v1.AttributeValues:\002" + + "8\001\"\030\n\006Cursor\022\016\n\006offset\030\001 \001(\003\"\310\001\n\020Sequenc" + + "edMessage\0222\n\006cursor\030\001 \001(\0132\".google.cloud" + + ".pubsublite.v1.Cursor\0220\n\014publish_time\030\002 " + + "\001(\0132\032.google.protobuf.Timestamp\022:\n\007messa" + + "ge\030\003 \001(\0132).google.cloud.pubsublite.v1.Pu" + + "bSubMessage\022\022\n\nsize_bytes\030\004 \001(\003\"\250\001\n\013Rese" + + "rvation\022\014\n\004name\030\001 \001(\t\022\033\n\023throughput_capa" + + "city\030\002 \001(\003:n\352Ak\n%pubsublite.googleapis.c" + + "om/Reservation\022Bprojects/{project}/locat" + + "ions/{location}/reservations/{reservatio" + + "n}\"\367\005\n\005Topic\022\014\n\004name\030\001 \001(\t\022K\n\020partition_" + + "config\030\002 \001(\01321.google.cloud.pubsublite.v" + + "1.Topic.PartitionConfig\022K\n\020retention_con" + + "fig\030\003 \001(\01321.google.cloud.pubsublite.v1.T" + + "opic.RetentionConfig\022O\n\022reservation_conf" + + "ig\030\004 \001(\01323.google.cloud.pubsublite.v1.To" + + "pic.ReservationConfig\032\332\001\n\017PartitionConfi" + + "g\022\r\n\005count\030\001 \001(\003\022\023\n\005scale\030\002 \001(\005B\002\030\001H\000\022N\n" + + "\010capacity\030\003 \001(\0132:.google.cloud.pubsublit" + + "e.v1.Topic.PartitionConfig.CapacityH\000\032F\n" + + "\010Capacity\022\033\n\023publish_mib_per_sec\030\001 \001(\005\022\035" + + "\n\025subscribe_mib_per_sec\030\002 \001(\005B\013\n\tdimensi" + + "on\032Y\n\017RetentionConfig\022\033\n\023per_partition_b" + + "ytes\030\001 \001(\003\022)\n\006period\030\002 \001(\0132\031.google.prot" + + "obuf.Duration\032_\n\021ReservationConfig\022J\n\026th" + + "roughput_reservation\030\001 \001(\tB*\372A\'\n%pubsubl" + + "ite.googleapis.com/Reservation:\\\352AY\n\037pub" + + "sublite.googleapis.com/Topic\0226projects/{" + + "project}/locations/{location}/topics/{to" + + "pic}\"\305\004\n\014Subscription\022\014\n\004name\030\001 \001(\t\0223\n\005t" + + "opic\030\002 \001(\tB$\372A!\n\037pubsublite.googleapis.c" + + "om/Topic\022P\n\017delivery_config\030\003 \001(\01327.goog" + + "le.cloud.pubsublite.v1.Subscription.Deli" + + "veryConfig\022?\n\rexport_config\030\004 \001(\0132(.goog" + + "le.cloud.pubsublite.v1.ExportConfig\032\353\001\n\016" + + "DeliveryConfig\022i\n\024delivery_requirement\030\003" + + " \001(\0162K.google.cloud.pubsublite.v1.Subscr" + + "iption.DeliveryConfig.DeliveryRequiremen" + + "t\"n\n\023DeliveryRequirement\022$\n DELIVERY_REQ" + + "UIREMENT_UNSPECIFIED\020\000\022\027\n\023DELIVER_IMMEDI" + + "ATELY\020\001\022\030\n\024DELIVER_AFTER_STORED\020\002:q\352An\n&" + + "pubsublite.googleapis.com/Subscription\022D" + + "projects/{project}/locations/{location}/" + + "subscriptions/{subscription}\"\352\003\n\014ExportC" + + "onfig\022E\n\rdesired_state\030\001 \001(\0162..google.cl" + + "oud.pubsublite.v1.ExportConfig.State\022O\n\010" + + "statuses\030\004 \003(\01328.google.cloud.pubsublite" + + ".v1.ExportConfig.PartitionStatusB\003\340A\003\022B\n" + + "\021dead_letter_topic\030\005 \001(\tB\'\340A\001\372A!\n\037pubsub" + + "lite.googleapis.com/Topic\022N\n\rpubsub_conf" + + "ig\030\003 \001(\01325.google.cloud.pubsublite.v1.Ex" + + "portConfig.PubSubConfigH\000\032H\n\017PartitionSt" + + "atus\022\021\n\tpartition\030\001 \001(\003\022\"\n\006status\030\002 \001(\0132" + + "\022.google.rpc.Status\032\035\n\014PubSubConfig\022\r\n\005t" + + "opic\030\001 \001(\t\"6\n\005State\022\025\n\021STATE_UNSPECIFIED" + + "\020\000\022\n\n\006ACTIVE\020\001\022\n\n\006PAUSED\020\002B\r\n\013destinatio" + + "n\"z\n\nTimeTarget\0222\n\014publish_time\030\001 \001(\0132\032." + + "google.protobuf.TimestampH\000\0220\n\nevent_tim" + + "e\030\002 \001(\0132\032.google.protobuf.TimestampH\000B\006\n" + + "\004timeB\325\001\n!com.google.cloud.pubsublite.pr" + + "otoB\013CommonProtoP\001ZDgoogle.golang.org/ge" + + "nproto/googleapis/cloud/pubsublite/v1;pu" + + "bsublite\370\001\001\252\002\032Google.Cloud.PubSubLite.V1" + + "\312\002\032Google\\Cloud\\PubSubLite\\V1\352\002\035Google::" + + "Cloud::PubSubLite::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), + com.google.rpc.StatusProto.getDescriptor(), }); internal_static_google_cloud_pubsublite_v1_AttributeValues_descriptor = getDescriptor().getMessageTypes().get(0); @@ -260,7 +289,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_pubsublite_v1_Subscription_descriptor, new java.lang.String[] { - "Name", "Topic", "DeliveryConfig", + "Name", "Topic", "DeliveryConfig", "ExportConfig", }); internal_static_google_cloud_pubsublite_v1_Subscription_DeliveryConfig_descriptor = internal_static_google_cloud_pubsublite_v1_Subscription_descriptor.getNestedTypes().get(0); @@ -270,8 +299,32 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "DeliveryRequirement", }); - internal_static_google_cloud_pubsublite_v1_TimeTarget_descriptor = + internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor = getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_pubsublite_v1_ExportConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor, + new java.lang.String[] { + "DesiredState", "Statuses", "DeadLetterTopic", "PubsubConfig", "Destination", + }); + internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_descriptor = + internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_descriptor, + new java.lang.String[] { + "Partition", "Status", + }); + internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_descriptor = + internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_descriptor, + new java.lang.String[] { + "Topic", + }); + internal_static_google_cloud_pubsublite_v1_TimeTarget_descriptor = + getDescriptor().getMessageTypes().get(8); internal_static_google_cloud_pubsublite_v1_TimeTarget_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_pubsublite_v1_TimeTarget_descriptor, @@ -280,13 +333,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); registry.add(com.google.api.ResourceProto.resource); registry.add(com.google.api.ResourceProto.resourceReference); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); + com.google.rpc.StatusProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/ExportConfig.java b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/ExportConfig.java new file mode 100644 index 000000000..c05ebc950 --- /dev/null +++ b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/ExportConfig.java @@ -0,0 +1,3604 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/pubsublite/v1/common.proto + +package com.google.cloud.pubsublite.proto; + +/** + * + * + *
+ * Configuration for a Pub/Sub Lite subscription that writes messages to a
+ * destination. User subscriber clients must not connect to this subscription.
+ * 
+ * + * Protobuf type {@code google.cloud.pubsublite.v1.ExportConfig} + */ +public final class ExportConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.pubsublite.v1.ExportConfig) + ExportConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExportConfig.newBuilder() to construct. + private ExportConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExportConfig() { + desiredState_ = 0; + statuses_ = java.util.Collections.emptyList(); + deadLetterTopic_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExportConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ExportConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + + desiredState_ = rawValue; + break; + } + case 26: + { + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder subBuilder = null; + if (destinationCase_ == 3) { + subBuilder = + ((com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_) + .toBuilder(); + } + destination_ = + input.readMessage( + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_); + destination_ = subBuilder.buildPartial(); + } + destinationCase_ = 3; + break; + } + case 34: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + statuses_ = + new java.util.ArrayList< + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus>(); + mutable_bitField0_ |= 0x00000001; + } + statuses_.add( + input.readMessage( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.parser(), + extensionRegistry)); + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + deadLetterTopic_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + statuses_ = java.util.Collections.unmodifiableList(statuses_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.pubsublite.proto.ExportConfig.class, + com.google.cloud.pubsublite.proto.ExportConfig.Builder.class); + } + + /** + * + * + *
+   * An export state.
+   * 
+ * + * Protobuf enum {@code google.cloud.pubsublite.v1.ExportConfig.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * Messages are being exported.
+     * 
+ * + * ACTIVE = 1; + */ + ACTIVE(1), + /** + * + * + *
+     * Exporting messages is suspended.
+     * 
+ * + * PAUSED = 2; + */ + PAUSED(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Messages are being exported.
+     * 
+ * + * ACTIVE = 1; + */ + public static final int ACTIVE_VALUE = 1; + /** + * + * + *
+     * Exporting messages is suspended.
+     * 
+ * + * PAUSED = 2; + */ + public static final int PAUSED_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return ACTIVE; + case 2: + return PAUSED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.pubsublite.proto.ExportConfig.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.pubsublite.v1.ExportConfig.State) + } + + public interface PartitionStatusOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.ExportConfig.PartitionStatus) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The partition number.
+     * 
+ * + * int64 partition = 1; + * + * @return The partition. + */ + long getPartition(); + + /** + * + * + *
+     * If the export for a partition is healthy and the desired state is
+     * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+     * the export is `PAUSED`, the status code will be `CANCELLED`.
+     * If the export has been suspended due to an error, the status will be
+     * populated with an error code and details. The service will automatically
+     * retry after a period of time, and will update the status code to `OK` if
+     * export subsequently succeeds.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + * + * + *
+     * If the export for a partition is healthy and the desired state is
+     * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+     * the export is `PAUSED`, the status code will be `CANCELLED`.
+     * If the export has been suspended due to an error, the status will be
+     * populated with an error code and details. The service will automatically
+     * retry after a period of time, and will update the status code to `OK` if
+     * export subsequently succeeds.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return The status. + */ + com.google.rpc.Status getStatus(); + /** + * + * + *
+     * If the export for a partition is healthy and the desired state is
+     * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+     * the export is `PAUSED`, the status code will be `CANCELLED`.
+     * If the export has been suspended due to an error, the status will be
+     * populated with an error code and details. The service will automatically
+     * retry after a period of time, and will update the status code to `OK` if
+     * export subsequently succeeds.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + } + /** + * + * + *
+   * The export status of a partition.
+   * 
+ * + * Protobuf type {@code google.cloud.pubsublite.v1.ExportConfig.PartitionStatus} + */ + public static final class PartitionStatus extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.pubsublite.v1.ExportConfig.PartitionStatus) + PartitionStatusOrBuilder { + private static final long serialVersionUID = 0L; + // Use PartitionStatus.newBuilder() to construct. + private PartitionStatus(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PartitionStatus() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PartitionStatus(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PartitionStatus( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + partition_ = input.readInt64(); + break; + } + case 18: + { + com.google.rpc.Status.Builder subBuilder = null; + if (status_ != null) { + subBuilder = status_.toBuilder(); + } + status_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(status_); + status_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.class, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder.class); + } + + public static final int PARTITION_FIELD_NUMBER = 1; + private long partition_; + /** + * + * + *
+     * The partition number.
+     * 
+ * + * int64 partition = 1; + * + * @return The partition. + */ + @java.lang.Override + public long getPartition() { + return partition_; + } + + public static final int STATUS_FIELD_NUMBER = 2; + private com.google.rpc.Status status_; + /** + * + * + *
+     * If the export for a partition is healthy and the desired state is
+     * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+     * the export is `PAUSED`, the status code will be `CANCELLED`.
+     * If the export has been suspended due to an error, the status will be
+     * populated with an error code and details. The service will automatically
+     * retry after a period of time, and will update the status code to `OK` if
+     * export subsequently succeeds.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return status_ != null; + } + /** + * + * + *
+     * If the export for a partition is healthy and the desired state is
+     * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+     * the export is `PAUSED`, the status code will be `CANCELLED`.
+     * If the export has been suspended due to an error, the status will be
+     * populated with an error code and details. The service will automatically
+     * retry after a period of time, and will update the status code to `OK` if
+     * export subsequently succeeds.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return The status. + */ + @java.lang.Override + public com.google.rpc.Status getStatus() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + /** + * + * + *
+     * If the export for a partition is healthy and the desired state is
+     * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+     * the export is `PAUSED`, the status code will be `CANCELLED`.
+     * If the export has been suspended due to an error, the status will be
+     * populated with an error code and details. The service will automatically
+     * retry after a period of time, and will update the status code to `OK` if
+     * export subsequently succeeds.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + return getStatus(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (partition_ != 0L) { + output.writeInt64(1, partition_); + } + if (status_ != null) { + output.writeMessage(2, getStatus()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (partition_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, partition_); + } + if (status_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStatus()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus)) { + return super.equals(obj); + } + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus other = + (com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus) obj; + + if (getPartition() != other.getPartition()) return false; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus().equals(other.getStatus())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARTITION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getPartition()); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * The export status of a partition.
+     * 
+ * + * Protobuf type {@code google.cloud.pubsublite.v1.ExportConfig.PartitionStatus} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.pubsublite.v1.ExportConfig.PartitionStatus) + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.class, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder.class); + } + + // Construct using com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + partition_ = 0L; + + if (statusBuilder_ == null) { + status_ = null; + } else { + status_ = null; + statusBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PartitionStatus_descriptor; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus + getDefaultInstanceForType() { + return com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus build() { + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus buildPartial() { + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus result = + new com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus(this); + result.partition_ = partition_; + if (statusBuilder_ == null) { + result.status_ = status_; + } else { + result.status_ = statusBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus) { + return mergeFrom((com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus other) { + if (other + == com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.getDefaultInstance()) + return this; + if (other.getPartition() != 0L) { + setPartition(other.getPartition()); + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long partition_; + /** + * + * + *
+       * The partition number.
+       * 
+ * + * int64 partition = 1; + * + * @return The partition. + */ + @java.lang.Override + public long getPartition() { + return partition_; + } + /** + * + * + *
+       * The partition number.
+       * 
+ * + * int64 partition = 1; + * + * @param value The partition to set. + * @return This builder for chaining. + */ + public Builder setPartition(long value) { + + partition_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The partition number.
+       * 
+ * + * int64 partition = 1; + * + * @return This builder for chaining. + */ + public Builder clearPartition() { + + partition_ = 0L; + onChanged(); + return this; + } + + private com.google.rpc.Status status_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + statusBuilder_; + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + * + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return statusBuilder_ != null || status_ != null; + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + * + * @return The status. + */ + public com.google.rpc.Status getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder setStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + onChanged(); + } else { + statusBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder setStatus(com.google.rpc.Status.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + onChanged(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder mergeStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (status_ != null) { + status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial(); + } else { + status_ = value; + } + onChanged(); + } else { + statusBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder clearStatus() { + if (statusBuilder_ == null) { + status_ = null; + onChanged(); + } else { + status_ = null; + statusBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.Status.Builder getStatusBuilder() { + + onChanged(); + return getStatusFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + } + /** + * + * + *
+       * If the export for a partition is healthy and the desired state is
+       * `ACTIVE`, the status code will be `OK` (zero). If the desired state of
+       * the export is `PAUSED`, the status code will be `CANCELLED`.
+       * If the export has been suspended due to an error, the status will be
+       * populated with an error code and details. The service will automatically
+       * retry after a period of time, and will update the status code to `OK` if
+       * export subsequently succeeds.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>(getStatus(), getParentForChildren(), isClean()); + status_ = null; + } + return statusBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.pubsublite.v1.ExportConfig.PartitionStatus) + } + + // @@protoc_insertion_point(class_scope:google.cloud.pubsublite.v1.ExportConfig.PartitionStatus) + private static final com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus(); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PartitionStatus parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PartitionStatus(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface PubSubConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.ExportConfig.PubSubConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The name of the Pub/Sub topic.
+     * Structured like: projects/{project_number}/topics/{topic_id}.
+     * The topic may be changed.
+     * 
+ * + * string topic = 1; + * + * @return The topic. + */ + java.lang.String getTopic(); + /** + * + * + *
+     * The name of the Pub/Sub topic.
+     * Structured like: projects/{project_number}/topics/{topic_id}.
+     * The topic may be changed.
+     * 
+ * + * string topic = 1; + * + * @return The bytes for topic. + */ + com.google.protobuf.ByteString getTopicBytes(); + } + /** + * + * + *
+   * Configuration for exporting to a Pub/Sub topic.
+   * 
+ * + * Protobuf type {@code google.cloud.pubsublite.v1.ExportConfig.PubSubConfig} + */ + public static final class PubSubConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.pubsublite.v1.ExportConfig.PubSubConfig) + PubSubConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use PubSubConfig.newBuilder() to construct. + private PubSubConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PubSubConfig() { + topic_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PubSubConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PubSubConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + topic_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.class, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder.class); + } + + public static final int TOPIC_FIELD_NUMBER = 1; + private volatile java.lang.Object topic_; + /** + * + * + *
+     * The name of the Pub/Sub topic.
+     * Structured like: projects/{project_number}/topics/{topic_id}.
+     * The topic may be changed.
+     * 
+ * + * string topic = 1; + * + * @return The topic. + */ + @java.lang.Override + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } + } + /** + * + * + *
+     * The name of the Pub/Sub topic.
+     * Structured like: projects/{project_number}/topics/{topic_id}.
+     * The topic may be changed.
+     * 
+ * + * string topic = 1; + * + * @return The bytes for topic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(topic_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, topic_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(topic_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, topic_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig)) { + return super.equals(obj); + } + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig other = + (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) obj; + + if (!getTopic().equals(other.getTopic())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getTopic().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Configuration for exporting to a Pub/Sub topic.
+     * 
+ * + * Protobuf type {@code google.cloud.pubsublite.v1.ExportConfig.PubSubConfig} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.pubsublite.v1.ExportConfig.PubSubConfig) + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.class, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder.class); + } + + // Construct using com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + topic_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_PubSubConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig + getDefaultInstanceForType() { + return com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig build() { + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig buildPartial() { + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig result = + new com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig(this); + result.topic_ = topic_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) { + return mergeFrom((com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig other) { + if (other + == com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance()) + return this; + if (!other.getTopic().isEmpty()) { + topic_ = other.topic_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object topic_ = ""; + /** + * + * + *
+       * The name of the Pub/Sub topic.
+       * Structured like: projects/{project_number}/topics/{topic_id}.
+       * The topic may be changed.
+       * 
+ * + * string topic = 1; + * + * @return The topic. + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The name of the Pub/Sub topic.
+       * Structured like: projects/{project_number}/topics/{topic_id}.
+       * The topic may be changed.
+       * 
+ * + * string topic = 1; + * + * @return The bytes for topic. + */ + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The name of the Pub/Sub topic.
+       * Structured like: projects/{project_number}/topics/{topic_id}.
+       * The topic may be changed.
+       * 
+ * + * string topic = 1; + * + * @param value The topic to set. + * @return This builder for chaining. + */ + public Builder setTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + topic_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The name of the Pub/Sub topic.
+       * Structured like: projects/{project_number}/topics/{topic_id}.
+       * The topic may be changed.
+       * 
+ * + * string topic = 1; + * + * @return This builder for chaining. + */ + public Builder clearTopic() { + + topic_ = getDefaultInstance().getTopic(); + onChanged(); + return this; + } + /** + * + * + *
+       * The name of the Pub/Sub topic.
+       * Structured like: projects/{project_number}/topics/{topic_id}.
+       * The topic may be changed.
+       * 
+ * + * string topic = 1; + * + * @param value The bytes for topic to set. + * @return This builder for chaining. + */ + public Builder setTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + topic_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.pubsublite.v1.ExportConfig.PubSubConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.pubsublite.v1.ExportConfig.PubSubConfig) + private static final com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig(); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PubSubConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PubSubConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int destinationCase_ = 0; + private java.lang.Object destination_; + + public enum DestinationCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PUBSUB_CONFIG(3), + DESTINATION_NOT_SET(0); + private final int value; + + private DestinationCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DestinationCase valueOf(int value) { + return forNumber(value); + } + + public static DestinationCase forNumber(int value) { + switch (value) { + case 3: + return PUBSUB_CONFIG; + case 0: + return DESTINATION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public DestinationCase getDestinationCase() { + return DestinationCase.forNumber(destinationCase_); + } + + public static final int DESIRED_STATE_FIELD_NUMBER = 1; + private int desiredState_; + /** + * + * + *
+   * The desired state of this export.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @return The enum numeric value on the wire for desiredState. + */ + @java.lang.Override + public int getDesiredStateValue() { + return desiredState_; + } + /** + * + * + *
+   * The desired state of this export.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @return The desiredState. + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.State getDesiredState() { + @SuppressWarnings("deprecation") + com.google.cloud.pubsublite.proto.ExportConfig.State result = + com.google.cloud.pubsublite.proto.ExportConfig.State.valueOf(desiredState_); + return result == null + ? com.google.cloud.pubsublite.proto.ExportConfig.State.UNRECOGNIZED + : result; + } + + public static final int STATUSES_FIELD_NUMBER = 4; + private java.util.List statuses_; + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getStatusesList() { + return statuses_; + } + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List< + ? extends com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder> + getStatusesOrBuilderList() { + return statuses_; + } + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public int getStatusesCount() { + return statuses_.size(); + } + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus getStatuses(int index) { + return statuses_.get(index); + } + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder + getStatusesOrBuilder(int index) { + return statuses_.get(index); + } + + public static final int DEAD_LETTER_TOPIC_FIELD_NUMBER = 5; + private volatile java.lang.Object deadLetterTopic_; + /** + * + * + *
+   * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+   * be exported to the destination. For example, the message can not be
+   * published to the Pub/Sub service because it does not satisfy the
+   * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+   * Structured like:
+   * projects/{project_number}/locations/{location}/topics/{topic_id}.
+   * Must be within the same project and location as the subscription. The topic
+   * may be changed or removed.
+   * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The deadLetterTopic. + */ + @java.lang.Override + public java.lang.String getDeadLetterTopic() { + java.lang.Object ref = deadLetterTopic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + deadLetterTopic_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+   * be exported to the destination. For example, the message can not be
+   * published to the Pub/Sub service because it does not satisfy the
+   * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+   * Structured like:
+   * projects/{project_number}/locations/{location}/topics/{topic_id}.
+   * Must be within the same project and location as the subscription. The topic
+   * may be changed or removed.
+   * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for deadLetterTopic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDeadLetterTopicBytes() { + java.lang.Object ref = deadLetterTopic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + deadLetterTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PUBSUB_CONFIG_FIELD_NUMBER = 3; + /** + * + * + *
+   * Messages are automatically written from the Pub/Sub Lite topic associated
+   * with this subscription to a Pub/Sub topic.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + * + * @return Whether the pubsubConfig field is set. + */ + @java.lang.Override + public boolean hasPubsubConfig() { + return destinationCase_ == 3; + } + /** + * + * + *
+   * Messages are automatically written from the Pub/Sub Lite topic associated
+   * with this subscription to a Pub/Sub topic.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + * + * @return The pubsubConfig. + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig getPubsubConfig() { + if (destinationCase_ == 3) { + return (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_; + } + return com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance(); + } + /** + * + * + *
+   * Messages are automatically written from the Pub/Sub Lite topic associated
+   * with this subscription to a Pub/Sub topic.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfigOrBuilder + getPubsubConfigOrBuilder() { + if (destinationCase_ == 3) { + return (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_; + } + return com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (desiredState_ + != com.google.cloud.pubsublite.proto.ExportConfig.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, desiredState_); + } + if (destinationCase_ == 3) { + output.writeMessage( + 3, (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_); + } + for (int i = 0; i < statuses_.size(); i++) { + output.writeMessage(4, statuses_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deadLetterTopic_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, deadLetterTopic_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (desiredState_ + != com.google.cloud.pubsublite.proto.ExportConfig.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, desiredState_); + } + if (destinationCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_); + } + for (int i = 0; i < statuses_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, statuses_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deadLetterTopic_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, deadLetterTopic_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.pubsublite.proto.ExportConfig)) { + return super.equals(obj); + } + com.google.cloud.pubsublite.proto.ExportConfig other = + (com.google.cloud.pubsublite.proto.ExportConfig) obj; + + if (desiredState_ != other.desiredState_) return false; + if (!getStatusesList().equals(other.getStatusesList())) return false; + if (!getDeadLetterTopic().equals(other.getDeadLetterTopic())) return false; + if (!getDestinationCase().equals(other.getDestinationCase())) return false; + switch (destinationCase_) { + case 3: + if (!getPubsubConfig().equals(other.getPubsubConfig())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESIRED_STATE_FIELD_NUMBER; + hash = (53 * hash) + desiredState_; + if (getStatusesCount() > 0) { + hash = (37 * hash) + STATUSES_FIELD_NUMBER; + hash = (53 * hash) + getStatusesList().hashCode(); + } + hash = (37 * hash) + DEAD_LETTER_TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getDeadLetterTopic().hashCode(); + switch (destinationCase_) { + case 3: + hash = (37 * hash) + PUBSUB_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getPubsubConfig().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.pubsublite.proto.ExportConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configuration for a Pub/Sub Lite subscription that writes messages to a
+   * destination. User subscriber clients must not connect to this subscription.
+   * 
+ * + * Protobuf type {@code google.cloud.pubsublite.v1.ExportConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.pubsublite.v1.ExportConfig) + com.google.cloud.pubsublite.proto.ExportConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.pubsublite.proto.ExportConfig.class, + com.google.cloud.pubsublite.proto.ExportConfig.Builder.class); + } + + // Construct using com.google.cloud.pubsublite.proto.ExportConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getStatusesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + desiredState_ = 0; + + if (statusesBuilder_ == null) { + statuses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + statusesBuilder_.clear(); + } + deadLetterTopic_ = ""; + + destinationCase_ = 0; + destination_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.pubsublite.proto.CommonProto + .internal_static_google_cloud_pubsublite_v1_ExportConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig getDefaultInstanceForType() { + return com.google.cloud.pubsublite.proto.ExportConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig build() { + com.google.cloud.pubsublite.proto.ExportConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig buildPartial() { + com.google.cloud.pubsublite.proto.ExportConfig result = + new com.google.cloud.pubsublite.proto.ExportConfig(this); + int from_bitField0_ = bitField0_; + result.desiredState_ = desiredState_; + if (statusesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + statuses_ = java.util.Collections.unmodifiableList(statuses_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.statuses_ = statuses_; + } else { + result.statuses_ = statusesBuilder_.build(); + } + result.deadLetterTopic_ = deadLetterTopic_; + if (destinationCase_ == 3) { + if (pubsubConfigBuilder_ == null) { + result.destination_ = destination_; + } else { + result.destination_ = pubsubConfigBuilder_.build(); + } + } + result.destinationCase_ = destinationCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.pubsublite.proto.ExportConfig) { + return mergeFrom((com.google.cloud.pubsublite.proto.ExportConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.pubsublite.proto.ExportConfig other) { + if (other == com.google.cloud.pubsublite.proto.ExportConfig.getDefaultInstance()) return this; + if (other.desiredState_ != 0) { + setDesiredStateValue(other.getDesiredStateValue()); + } + if (statusesBuilder_ == null) { + if (!other.statuses_.isEmpty()) { + if (statuses_.isEmpty()) { + statuses_ = other.statuses_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureStatusesIsMutable(); + statuses_.addAll(other.statuses_); + } + onChanged(); + } + } else { + if (!other.statuses_.isEmpty()) { + if (statusesBuilder_.isEmpty()) { + statusesBuilder_.dispose(); + statusesBuilder_ = null; + statuses_ = other.statuses_; + bitField0_ = (bitField0_ & ~0x00000001); + statusesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getStatusesFieldBuilder() + : null; + } else { + statusesBuilder_.addAllMessages(other.statuses_); + } + } + } + if (!other.getDeadLetterTopic().isEmpty()) { + deadLetterTopic_ = other.deadLetterTopic_; + onChanged(); + } + switch (other.getDestinationCase()) { + case PUBSUB_CONFIG: + { + mergePubsubConfig(other.getPubsubConfig()); + break; + } + case DESTINATION_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.pubsublite.proto.ExportConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.pubsublite.proto.ExportConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int destinationCase_ = 0; + private java.lang.Object destination_; + + public DestinationCase getDestinationCase() { + return DestinationCase.forNumber(destinationCase_); + } + + public Builder clearDestination() { + destinationCase_ = 0; + destination_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private int desiredState_ = 0; + /** + * + * + *
+     * The desired state of this export.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @return The enum numeric value on the wire for desiredState. + */ + @java.lang.Override + public int getDesiredStateValue() { + return desiredState_; + } + /** + * + * + *
+     * The desired state of this export.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @param value The enum numeric value on the wire for desiredState to set. + * @return This builder for chaining. + */ + public Builder setDesiredStateValue(int value) { + + desiredState_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The desired state of this export.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @return The desiredState. + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.State getDesiredState() { + @SuppressWarnings("deprecation") + com.google.cloud.pubsublite.proto.ExportConfig.State result = + com.google.cloud.pubsublite.proto.ExportConfig.State.valueOf(desiredState_); + return result == null + ? com.google.cloud.pubsublite.proto.ExportConfig.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The desired state of this export.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @param value The desiredState to set. + * @return This builder for chaining. + */ + public Builder setDesiredState(com.google.cloud.pubsublite.proto.ExportConfig.State value) { + if (value == null) { + throw new NullPointerException(); + } + + desiredState_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The desired state of this export.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @return This builder for chaining. + */ + public Builder clearDesiredState() { + + desiredState_ = 0; + onChanged(); + return this; + } + + private java.util.List + statuses_ = java.util.Collections.emptyList(); + + private void ensureStatusesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + statuses_ = + new java.util.ArrayList( + statuses_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder> + statusesBuilder_; + + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getStatusesList() { + if (statusesBuilder_ == null) { + return java.util.Collections.unmodifiableList(statuses_); + } else { + return statusesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public int getStatusesCount() { + if (statusesBuilder_ == null) { + return statuses_.size(); + } else { + return statusesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus getStatuses(int index) { + if (statusesBuilder_ == null) { + return statuses_.get(index); + } else { + return statusesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStatuses( + int index, com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus value) { + if (statusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStatusesIsMutable(); + statuses_.set(index, value); + onChanged(); + } else { + statusesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStatuses( + int index, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder builderForValue) { + if (statusesBuilder_ == null) { + ensureStatusesIsMutable(); + statuses_.set(index, builderForValue.build()); + onChanged(); + } else { + statusesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addStatuses( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus value) { + if (statusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStatusesIsMutable(); + statuses_.add(value); + onChanged(); + } else { + statusesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addStatuses( + int index, com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus value) { + if (statusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStatusesIsMutable(); + statuses_.add(index, value); + onChanged(); + } else { + statusesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addStatuses( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder builderForValue) { + if (statusesBuilder_ == null) { + ensureStatusesIsMutable(); + statuses_.add(builderForValue.build()); + onChanged(); + } else { + statusesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addStatuses( + int index, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder builderForValue) { + if (statusesBuilder_ == null) { + ensureStatusesIsMutable(); + statuses_.add(index, builderForValue.build()); + onChanged(); + } else { + statusesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addAllStatuses( + java.lang.Iterable + values) { + if (statusesBuilder_ == null) { + ensureStatusesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, statuses_); + onChanged(); + } else { + statusesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearStatuses() { + if (statusesBuilder_ == null) { + statuses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + statusesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeStatuses(int index) { + if (statusesBuilder_ == null) { + ensureStatusesIsMutable(); + statuses_.remove(index); + onChanged(); + } else { + statusesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder + getStatusesBuilder(int index) { + return getStatusesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder + getStatusesOrBuilder(int index) { + if (statusesBuilder_ == null) { + return statuses_.get(index); + } else { + return statusesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List< + ? extends com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder> + getStatusesOrBuilderList() { + if (statusesBuilder_ != null) { + return statusesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(statuses_); + } + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder + addStatusesBuilder() { + return getStatusesFieldBuilder() + .addBuilder( + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder + addStatusesBuilder(int index) { + return getStatusesFieldBuilder() + .addBuilder( + index, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The export statuses of each partition. This field is output only.
+     * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getStatusesBuilderList() { + return getStatusesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder> + getStatusesFieldBuilder() { + if (statusesBuilder_ == null) { + statusesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus.Builder, + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder>( + statuses_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + statuses_ = null; + } + return statusesBuilder_; + } + + private java.lang.Object deadLetterTopic_ = ""; + /** + * + * + *
+     * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+     * be exported to the destination. For example, the message can not be
+     * published to the Pub/Sub service because it does not satisfy the
+     * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+     * Structured like:
+     * projects/{project_number}/locations/{location}/topics/{topic_id}.
+     * Must be within the same project and location as the subscription. The topic
+     * may be changed or removed.
+     * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The deadLetterTopic. + */ + public java.lang.String getDeadLetterTopic() { + java.lang.Object ref = deadLetterTopic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + deadLetterTopic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+     * be exported to the destination. For example, the message can not be
+     * published to the Pub/Sub service because it does not satisfy the
+     * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+     * Structured like:
+     * projects/{project_number}/locations/{location}/topics/{topic_id}.
+     * Must be within the same project and location as the subscription. The topic
+     * may be changed or removed.
+     * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for deadLetterTopic. + */ + public com.google.protobuf.ByteString getDeadLetterTopicBytes() { + java.lang.Object ref = deadLetterTopic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + deadLetterTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+     * be exported to the destination. For example, the message can not be
+     * published to the Pub/Sub service because it does not satisfy the
+     * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+     * Structured like:
+     * projects/{project_number}/locations/{location}/topics/{topic_id}.
+     * Must be within the same project and location as the subscription. The topic
+     * may be changed or removed.
+     * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The deadLetterTopic to set. + * @return This builder for chaining. + */ + public Builder setDeadLetterTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + deadLetterTopic_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+     * be exported to the destination. For example, the message can not be
+     * published to the Pub/Sub service because it does not satisfy the
+     * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+     * Structured like:
+     * projects/{project_number}/locations/{location}/topics/{topic_id}.
+     * Must be within the same project and location as the subscription. The topic
+     * may be changed or removed.
+     * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearDeadLetterTopic() { + + deadLetterTopic_ = getDefaultInstance().getDeadLetterTopic(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+     * be exported to the destination. For example, the message can not be
+     * published to the Pub/Sub service because it does not satisfy the
+     * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+     * Structured like:
+     * projects/{project_number}/locations/{location}/topics/{topic_id}.
+     * Must be within the same project and location as the subscription. The topic
+     * may be changed or removed.
+     * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for deadLetterTopic to set. + * @return This builder for chaining. + */ + public Builder setDeadLetterTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + deadLetterTopic_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfigOrBuilder> + pubsubConfigBuilder_; + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + * + * @return Whether the pubsubConfig field is set. + */ + @java.lang.Override + public boolean hasPubsubConfig() { + return destinationCase_ == 3; + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + * + * @return The pubsubConfig. + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig getPubsubConfig() { + if (pubsubConfigBuilder_ == null) { + if (destinationCase_ == 3) { + return (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_; + } + return com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance(); + } else { + if (destinationCase_ == 3) { + return pubsubConfigBuilder_.getMessage(); + } + return com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + public Builder setPubsubConfig( + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig value) { + if (pubsubConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + destination_ = value; + onChanged(); + } else { + pubsubConfigBuilder_.setMessage(value); + } + destinationCase_ = 3; + return this; + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + public Builder setPubsubConfig( + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder builderForValue) { + if (pubsubConfigBuilder_ == null) { + destination_ = builderForValue.build(); + onChanged(); + } else { + pubsubConfigBuilder_.setMessage(builderForValue.build()); + } + destinationCase_ = 3; + return this; + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + public Builder mergePubsubConfig( + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig value) { + if (pubsubConfigBuilder_ == null) { + if (destinationCase_ == 3 + && destination_ + != com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig + .getDefaultInstance()) { + destination_ = + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.newBuilder( + (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_) + .mergeFrom(value) + .buildPartial(); + } else { + destination_ = value; + } + onChanged(); + } else { + if (destinationCase_ == 3) { + pubsubConfigBuilder_.mergeFrom(value); + } else { + pubsubConfigBuilder_.setMessage(value); + } + } + destinationCase_ = 3; + return this; + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + public Builder clearPubsubConfig() { + if (pubsubConfigBuilder_ == null) { + if (destinationCase_ == 3) { + destinationCase_ = 0; + destination_ = null; + onChanged(); + } + } else { + if (destinationCase_ == 3) { + destinationCase_ = 0; + destination_ = null; + } + pubsubConfigBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder + getPubsubConfigBuilder() { + return getPubsubConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfigOrBuilder + getPubsubConfigOrBuilder() { + if ((destinationCase_ == 3) && (pubsubConfigBuilder_ != null)) { + return pubsubConfigBuilder_.getMessageOrBuilder(); + } else { + if (destinationCase_ == 3) { + return (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_; + } + return com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance(); + } + } + /** + * + * + *
+     * Messages are automatically written from the Pub/Sub Lite topic associated
+     * with this subscription to a Pub/Sub topic.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfigOrBuilder> + getPubsubConfigFieldBuilder() { + if (pubsubConfigBuilder_ == null) { + if (!(destinationCase_ == 3)) { + destination_ = + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.getDefaultInstance(); + } + pubsubConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig.Builder, + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfigOrBuilder>( + (com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig) destination_, + getParentForChildren(), + isClean()); + destination_ = null; + } + destinationCase_ = 3; + onChanged(); + ; + return pubsubConfigBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.pubsublite.v1.ExportConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.pubsublite.v1.ExportConfig) + private static final com.google.cloud.pubsublite.proto.ExportConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.pubsublite.proto.ExportConfig(); + } + + public static com.google.cloud.pubsublite.proto.ExportConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExportConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExportConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/ExportConfigOrBuilder.java b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/ExportConfigOrBuilder.java new file mode 100644 index 000000000..312f09ddf --- /dev/null +++ b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/ExportConfigOrBuilder.java @@ -0,0 +1,196 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/pubsublite/v1/common.proto + +package com.google.cloud.pubsublite.proto; + +public interface ExportConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.ExportConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The desired state of this export.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @return The enum numeric value on the wire for desiredState. + */ + int getDesiredStateValue(); + /** + * + * + *
+   * The desired state of this export.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.State desired_state = 1; + * + * @return The desiredState. + */ + com.google.cloud.pubsublite.proto.ExportConfig.State getDesiredState(); + + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getStatusesList(); + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatus getStatuses(int index); + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getStatusesCount(); + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List + getStatusesOrBuilderList(); + /** + * + * + *
+   * Output only. The export statuses of each partition. This field is output only.
+   * 
+ * + * + * repeated .google.cloud.pubsublite.v1.ExportConfig.PartitionStatus statuses = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.pubsublite.proto.ExportConfig.PartitionStatusOrBuilder getStatusesOrBuilder( + int index); + + /** + * + * + *
+   * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+   * be exported to the destination. For example, the message can not be
+   * published to the Pub/Sub service because it does not satisfy the
+   * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+   * Structured like:
+   * projects/{project_number}/locations/{location}/topics/{topic_id}.
+   * Must be within the same project and location as the subscription. The topic
+   * may be changed or removed.
+   * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The deadLetterTopic. + */ + java.lang.String getDeadLetterTopic(); + /** + * + * + *
+   * Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
+   * be exported to the destination. For example, the message can not be
+   * published to the Pub/Sub service because it does not satisfy the
+   * constraints documented at https://cloud.google.com/pubsub/docs/publisher.
+   * Structured like:
+   * projects/{project_number}/locations/{location}/topics/{topic_id}.
+   * Must be within the same project and location as the subscription. The topic
+   * may be changed or removed.
+   * 
+ * + * + * string dead_letter_topic = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for deadLetterTopic. + */ + com.google.protobuf.ByteString getDeadLetterTopicBytes(); + + /** + * + * + *
+   * Messages are automatically written from the Pub/Sub Lite topic associated
+   * with this subscription to a Pub/Sub topic.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + * + * @return Whether the pubsubConfig field is set. + */ + boolean hasPubsubConfig(); + /** + * + * + *
+   * Messages are automatically written from the Pub/Sub Lite topic associated
+   * with this subscription to a Pub/Sub topic.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + * + * @return The pubsubConfig. + */ + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfig getPubsubConfig(); + /** + * + * + *
+   * Messages are automatically written from the Pub/Sub Lite topic associated
+   * with this subscription to a Pub/Sub topic.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig.PubSubConfig pubsub_config = 3; + */ + com.google.cloud.pubsublite.proto.ExportConfig.PubSubConfigOrBuilder getPubsubConfigOrBuilder(); + + public com.google.cloud.pubsublite.proto.ExportConfig.DestinationCase getDestinationCase(); +} diff --git a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Subscription.java b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Subscription.java index adc0a9d5e..f524845ba 100644 --- a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Subscription.java +++ b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Subscription.java @@ -101,6 +101,22 @@ private Subscription( deliveryConfig_ = subBuilder.buildPartial(); } + break; + } + case 34: + { + com.google.cloud.pubsublite.proto.ExportConfig.Builder subBuilder = null; + if (exportConfig_ != null) { + subBuilder = exportConfig_.toBuilder(); + } + exportConfig_ = + input.readMessage( + com.google.cloud.pubsublite.proto.ExportConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(exportConfig_); + exportConfig_ = subBuilder.buildPartial(); + } + break; } default: @@ -1134,6 +1150,57 @@ public com.google.cloud.pubsublite.proto.Subscription.DeliveryConfig getDelivery return getDeliveryConfig(); } + public static final int EXPORT_CONFIG_FIELD_NUMBER = 4; + private com.google.cloud.pubsublite.proto.ExportConfig exportConfig_; + /** + * + * + *
+   * If present, messages are automatically written from the Pub/Sub Lite topic
+   * associated with this subscription to a destination.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + * + * @return Whether the exportConfig field is set. + */ + @java.lang.Override + public boolean hasExportConfig() { + return exportConfig_ != null; + } + /** + * + * + *
+   * If present, messages are automatically written from the Pub/Sub Lite topic
+   * associated with this subscription to a destination.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + * + * @return The exportConfig. + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfig getExportConfig() { + return exportConfig_ == null + ? com.google.cloud.pubsublite.proto.ExportConfig.getDefaultInstance() + : exportConfig_; + } + /** + * + * + *
+   * If present, messages are automatically written from the Pub/Sub Lite topic
+   * associated with this subscription to a destination.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + @java.lang.Override + public com.google.cloud.pubsublite.proto.ExportConfigOrBuilder getExportConfigOrBuilder() { + return getExportConfig(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -1157,6 +1224,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (deliveryConfig_ != null) { output.writeMessage(3, getDeliveryConfig()); } + if (exportConfig_ != null) { + output.writeMessage(4, getExportConfig()); + } unknownFields.writeTo(output); } @@ -1175,6 +1245,9 @@ public int getSerializedSize() { if (deliveryConfig_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getDeliveryConfig()); } + if (exportConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getExportConfig()); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1197,6 +1270,10 @@ public boolean equals(final java.lang.Object obj) { if (hasDeliveryConfig()) { if (!getDeliveryConfig().equals(other.getDeliveryConfig())) return false; } + if (hasExportConfig() != other.hasExportConfig()) return false; + if (hasExportConfig()) { + if (!getExportConfig().equals(other.getExportConfig())) return false; + } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1216,6 +1293,10 @@ public int hashCode() { hash = (37 * hash) + DELIVERY_CONFIG_FIELD_NUMBER; hash = (53 * hash) + getDeliveryConfig().hashCode(); } + if (hasExportConfig()) { + hash = (37 * hash) + EXPORT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getExportConfig().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1371,6 +1452,12 @@ public Builder clear() { deliveryConfig_ = null; deliveryConfigBuilder_ = null; } + if (exportConfigBuilder_ == null) { + exportConfig_ = null; + } else { + exportConfig_ = null; + exportConfigBuilder_ = null; + } return this; } @@ -1405,6 +1492,11 @@ public com.google.cloud.pubsublite.proto.Subscription buildPartial() { } else { result.deliveryConfig_ = deliveryConfigBuilder_.build(); } + if (exportConfigBuilder_ == null) { + result.exportConfig_ = exportConfig_; + } else { + result.exportConfig_ = exportConfigBuilder_.build(); + } onBuilt(); return result; } @@ -1465,6 +1557,9 @@ public Builder mergeFrom(com.google.cloud.pubsublite.proto.Subscription other) { if (other.hasDeliveryConfig()) { mergeDeliveryConfig(other.getDeliveryConfig()); } + if (other.hasExportConfig()) { + mergeExportConfig(other.getExportConfig()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -1917,6 +2012,201 @@ public Builder clearDeliveryConfig() { return deliveryConfigBuilder_; } + private com.google.cloud.pubsublite.proto.ExportConfig exportConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig, + com.google.cloud.pubsublite.proto.ExportConfig.Builder, + com.google.cloud.pubsublite.proto.ExportConfigOrBuilder> + exportConfigBuilder_; + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + * + * @return Whether the exportConfig field is set. + */ + public boolean hasExportConfig() { + return exportConfigBuilder_ != null || exportConfig_ != null; + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + * + * @return The exportConfig. + */ + public com.google.cloud.pubsublite.proto.ExportConfig getExportConfig() { + if (exportConfigBuilder_ == null) { + return exportConfig_ == null + ? com.google.cloud.pubsublite.proto.ExportConfig.getDefaultInstance() + : exportConfig_; + } else { + return exportConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + public Builder setExportConfig(com.google.cloud.pubsublite.proto.ExportConfig value) { + if (exportConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + exportConfig_ = value; + onChanged(); + } else { + exportConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + public Builder setExportConfig( + com.google.cloud.pubsublite.proto.ExportConfig.Builder builderForValue) { + if (exportConfigBuilder_ == null) { + exportConfig_ = builderForValue.build(); + onChanged(); + } else { + exportConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + public Builder mergeExportConfig(com.google.cloud.pubsublite.proto.ExportConfig value) { + if (exportConfigBuilder_ == null) { + if (exportConfig_ != null) { + exportConfig_ = + com.google.cloud.pubsublite.proto.ExportConfig.newBuilder(exportConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + exportConfig_ = value; + } + onChanged(); + } else { + exportConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + public Builder clearExportConfig() { + if (exportConfigBuilder_ == null) { + exportConfig_ = null; + onChanged(); + } else { + exportConfig_ = null; + exportConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + public com.google.cloud.pubsublite.proto.ExportConfig.Builder getExportConfigBuilder() { + + onChanged(); + return getExportConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + public com.google.cloud.pubsublite.proto.ExportConfigOrBuilder getExportConfigOrBuilder() { + if (exportConfigBuilder_ != null) { + return exportConfigBuilder_.getMessageOrBuilder(); + } else { + return exportConfig_ == null + ? com.google.cloud.pubsublite.proto.ExportConfig.getDefaultInstance() + : exportConfig_; + } + } + /** + * + * + *
+     * If present, messages are automatically written from the Pub/Sub Lite topic
+     * associated with this subscription to a destination.
+     * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig, + com.google.cloud.pubsublite.proto.ExportConfig.Builder, + com.google.cloud.pubsublite.proto.ExportConfigOrBuilder> + getExportConfigFieldBuilder() { + if (exportConfigBuilder_ == null) { + exportConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.pubsublite.proto.ExportConfig, + com.google.cloud.pubsublite.proto.ExportConfig.Builder, + com.google.cloud.pubsublite.proto.ExportConfigOrBuilder>( + getExportConfig(), getParentForChildren(), isClean()); + exportConfig_ = null; + } + return exportConfigBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/SubscriptionOrBuilder.java b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/SubscriptionOrBuilder.java index 6eb6724c5..aa2408cff 100644 --- a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/SubscriptionOrBuilder.java +++ b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/SubscriptionOrBuilder.java @@ -116,4 +116,42 @@ public interface SubscriptionOrBuilder */ com.google.cloud.pubsublite.proto.Subscription.DeliveryConfigOrBuilder getDeliveryConfigOrBuilder(); + + /** + * + * + *
+   * If present, messages are automatically written from the Pub/Sub Lite topic
+   * associated with this subscription to a destination.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + * + * @return Whether the exportConfig field is set. + */ + boolean hasExportConfig(); + /** + * + * + *
+   * If present, messages are automatically written from the Pub/Sub Lite topic
+   * associated with this subscription to a destination.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + * + * @return The exportConfig. + */ + com.google.cloud.pubsublite.proto.ExportConfig getExportConfig(); + /** + * + * + *
+   * If present, messages are automatically written from the Pub/Sub Lite topic
+   * associated with this subscription to a destination.
+   * 
+ * + * .google.cloud.pubsublite.v1.ExportConfig export_config = 4; + */ + com.google.cloud.pubsublite.proto.ExportConfigOrBuilder getExportConfigOrBuilder(); } diff --git a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Topic.java b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Topic.java index 0950d68e3..cd7f9d7d7 100644 --- a/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Topic.java +++ b/proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/Topic.java @@ -202,7 +202,7 @@ public interface PartitionConfigOrBuilder * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @return Whether the scale field is set. */ @java.lang.Deprecated @@ -223,7 +223,7 @@ public interface PartitionConfigOrBuilder * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @return The scale. */ @java.lang.Deprecated @@ -1153,7 +1153,7 @@ public long getCount() { * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @return Whether the scale field is set. */ @java.lang.Override @@ -1177,7 +1177,7 @@ public boolean hasScale() { * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @return The scale. */ @java.lang.Override @@ -1726,7 +1726,7 @@ public Builder clearCount() { * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @return Whether the scale field is set. */ @java.lang.Deprecated @@ -1749,7 +1749,7 @@ public boolean hasScale() { * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @return The scale. */ @java.lang.Deprecated @@ -1775,7 +1775,7 @@ public int getScale() { * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @param value The scale to set. * @return This builder for chaining. */ @@ -1802,7 +1802,7 @@ public Builder setScale(int value) { * int32 scale = 2 [deprecated = true]; * * @deprecated google.cloud.pubsublite.v1.Topic.PartitionConfig.scale is deprecated. See - * google/cloud/pubsublite/v1/common.proto;l=137 + * google/cloud/pubsublite/v1/common.proto;l=139 * @return This builder for chaining. */ @java.lang.Deprecated diff --git a/proto-google-cloud-pubsublite-v1/src/main/proto/google/cloud/pubsublite/v1/common.proto b/proto-google-cloud-pubsublite-v1/src/main/proto/google/cloud/pubsublite/v1/common.proto index 8725031f5..2a2c62ccb 100644 --- a/proto-google-cloud-pubsublite-v1/src/main/proto/google/cloud/pubsublite/v1/common.proto +++ b/proto-google-cloud-pubsublite-v1/src/main/proto/google/cloud/pubsublite/v1/common.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,9 +16,11 @@ syntax = "proto3"; package google.cloud.pubsublite.v1; +import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.PubSubLite.V1"; @@ -225,6 +227,79 @@ message Subscription { // The settings for this subscription's message delivery. DeliveryConfig delivery_config = 3; + + // If present, messages are automatically written from the Pub/Sub Lite topic + // associated with this subscription to a destination. + ExportConfig export_config = 4; +} + +// Configuration for a Pub/Sub Lite subscription that writes messages to a +// destination. User subscriber clients must not connect to this subscription. +message ExportConfig { + // An export state. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // Messages are being exported. + ACTIVE = 1; + + // Exporting messages is suspended. + PAUSED = 2; + } + + // The export status of a partition. + message PartitionStatus { + // The partition number. + int64 partition = 1; + + // If the export for a partition is healthy and the desired state is + // `ACTIVE`, the status code will be `OK` (zero). If the desired state of + // the export is `PAUSED`, the status code will be `CANCELLED`. + // + // If the export has been suspended due to an error, the status will be + // populated with an error code and details. The service will automatically + // retry after a period of time, and will update the status code to `OK` if + // export subsequently succeeds. + google.rpc.Status status = 2; + } + + // Configuration for exporting to a Pub/Sub topic. + message PubSubConfig { + // The name of the Pub/Sub topic. + // Structured like: projects/{project_number}/topics/{topic_id}. + // The topic may be changed. + string topic = 1; + } + + // The desired state of this export. + State desired_state = 1; + + // Output only. The export statuses of each partition. This field is output only. + repeated PartitionStatus statuses = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not + // be exported to the destination. For example, the message can not be + // published to the Pub/Sub service because it does not satisfy the + // constraints documented at https://cloud.google.com/pubsub/docs/publisher. + // + // Structured like: + // projects/{project_number}/locations/{location}/topics/{topic_id}. + // Must be within the same project and location as the subscription. The topic + // may be changed or removed. + string dead_letter_topic = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "pubsublite.googleapis.com/Topic" + } + ]; + + // The destination to export to. Required. + oneof destination { + // Messages are automatically written from the Pub/Sub Lite topic associated + // with this subscription to a Pub/Sub topic. + PubSubConfig pubsub_config = 3; + } } // A target publish or event time. Can be used for seeking to or retrieving the diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000..687e7f3b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.cloud.pubsublite.v1.AdminServiceSettings; +import com.google.cloud.pubsublite.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AdminServiceSettings adminServiceSettings = + AdminServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + AdminServiceClient adminServiceClient = AdminServiceClient.create(adminServiceSettings); + } +} +// [END pubsublite_v1_generated_adminserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000..cacc3d1fd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_create_setendpoint_sync] +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.cloud.pubsublite.v1.AdminServiceSettings; +import com.google.cloud.pubsublite.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AdminServiceSettings adminServiceSettings = + AdminServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + AdminServiceClient adminServiceClient = AdminServiceClient.create(adminServiceSettings); + } +} +// [END pubsublite_v1_generated_adminserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/AsyncCreateReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/AsyncCreateReservation.java new file mode 100644 index 000000000..58aca73dd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/AsyncCreateReservation.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createreservation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.CreateReservationRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncCreateReservation { + + public static void main(String[] args) throws Exception { + asyncCreateReservation(); + } + + public static void asyncCreateReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + CreateReservationRequest request = + CreateReservationRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setReservation(Reservation.newBuilder().build()) + .setReservationId("reservationId1116965383") + .build(); + ApiFuture future = + adminServiceClient.createReservationCallable().futureCall(request); + // Do something. + Reservation response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createreservation_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservation.java new file mode 100644 index 000000000..b4afedc75 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createreservation_sync] +import com.google.cloud.pubsublite.proto.CreateReservationRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateReservation { + + public static void main(String[] args) throws Exception { + syncCreateReservation(); + } + + public static void syncCreateReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + CreateReservationRequest request = + CreateReservationRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setReservation(Reservation.newBuilder().build()) + .setReservationId("reservationId1116965383") + .build(); + Reservation response = adminServiceClient.createReservation(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createreservation_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservationLocationnameReservationString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservationLocationnameReservationString.java new file mode 100644 index 000000000..3203da8a9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservationLocationnameReservationString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createreservation_locationnamereservationstring_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateReservationLocationnameReservationString { + + public static void main(String[] args) throws Exception { + syncCreateReservationLocationnameReservationString(); + } + + public static void syncCreateReservationLocationnameReservationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Reservation reservation = Reservation.newBuilder().build(); + String reservationId = "reservationId1116965383"; + Reservation response = + adminServiceClient.createReservation(parent, reservation, reservationId); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createreservation_locationnamereservationstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservationStringReservationString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservationStringReservationString.java new file mode 100644 index 000000000..7b190f096 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createreservation/SyncCreateReservationStringReservationString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createreservation_stringreservationstring_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateReservationStringReservationString { + + public static void main(String[] args) throws Exception { + syncCreateReservationStringReservationString(); + } + + public static void syncCreateReservationStringReservationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Reservation reservation = Reservation.newBuilder().build(); + String reservationId = "reservationId1116965383"; + Reservation response = + adminServiceClient.createReservation(parent, reservation, reservationId); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createreservation_stringreservationstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/AsyncCreateSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/AsyncCreateSubscription.java new file mode 100644 index 000000000..28bacecc3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/AsyncCreateSubscription.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createsubscription_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.CreateSubscriptionRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncCreateSubscription { + + public static void main(String[] args) throws Exception { + asyncCreateSubscription(); + } + + public static void asyncCreateSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + CreateSubscriptionRequest request = + CreateSubscriptionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSubscription(Subscription.newBuilder().build()) + .setSubscriptionId("subscriptionId1478790936") + .setSkipBacklog(true) + .build(); + ApiFuture future = + adminServiceClient.createSubscriptionCallable().futureCall(request); + // Do something. + Subscription response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createsubscription_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscription.java new file mode 100644 index 000000000..440e6e718 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscription.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createsubscription_sync] +import com.google.cloud.pubsublite.proto.CreateSubscriptionRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateSubscription { + + public static void main(String[] args) throws Exception { + syncCreateSubscription(); + } + + public static void syncCreateSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + CreateSubscriptionRequest request = + CreateSubscriptionRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setSubscription(Subscription.newBuilder().build()) + .setSubscriptionId("subscriptionId1478790936") + .setSkipBacklog(true) + .build(); + Subscription response = adminServiceClient.createSubscription(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createsubscription_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscriptionLocationnameSubscriptionString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscriptionLocationnameSubscriptionString.java new file mode 100644 index 000000000..93b7d9696 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscriptionLocationnameSubscriptionString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createsubscription_locationnamesubscriptionstring_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateSubscriptionLocationnameSubscriptionString { + + public static void main(String[] args) throws Exception { + syncCreateSubscriptionLocationnameSubscriptionString(); + } + + public static void syncCreateSubscriptionLocationnameSubscriptionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Subscription subscription = Subscription.newBuilder().build(); + String subscriptionId = "subscriptionId1478790936"; + Subscription response = + adminServiceClient.createSubscription(parent, subscription, subscriptionId); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createsubscription_locationnamesubscriptionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscriptionStringSubscriptionString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscriptionStringSubscriptionString.java new file mode 100644 index 000000000..04b722912 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createsubscription/SyncCreateSubscriptionStringSubscriptionString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createsubscription_stringsubscriptionstring_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateSubscriptionStringSubscriptionString { + + public static void main(String[] args) throws Exception { + syncCreateSubscriptionStringSubscriptionString(); + } + + public static void syncCreateSubscriptionStringSubscriptionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Subscription subscription = Subscription.newBuilder().build(); + String subscriptionId = "subscriptionId1478790936"; + Subscription response = + adminServiceClient.createSubscription(parent, subscription, subscriptionId); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createsubscription_stringsubscriptionstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/AsyncCreateTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/AsyncCreateTopic.java new file mode 100644 index 000000000..6cccc4770 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/AsyncCreateTopic.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createtopic_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.CreateTopicRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncCreateTopic { + + public static void main(String[] args) throws Exception { + asyncCreateTopic(); + } + + public static void asyncCreateTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + CreateTopicRequest request = + CreateTopicRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setTopic(Topic.newBuilder().build()) + .setTopicId("topicId-1139259734") + .build(); + ApiFuture future = adminServiceClient.createTopicCallable().futureCall(request); + // Do something. + Topic response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createtopic_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopic.java new file mode 100644 index 000000000..f749292a1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopic.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createtopic_sync] +import com.google.cloud.pubsublite.proto.CreateTopicRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateTopic { + + public static void main(String[] args) throws Exception { + syncCreateTopic(); + } + + public static void syncCreateTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + CreateTopicRequest request = + CreateTopicRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setTopic(Topic.newBuilder().build()) + .setTopicId("topicId-1139259734") + .build(); + Topic response = adminServiceClient.createTopic(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createtopic_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopicLocationnameTopicString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopicLocationnameTopicString.java new file mode 100644 index 000000000..9255fd1b5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopicLocationnameTopicString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createtopic_locationnametopicstring_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateTopicLocationnameTopicString { + + public static void main(String[] args) throws Exception { + syncCreateTopicLocationnameTopicString(); + } + + public static void syncCreateTopicLocationnameTopicString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Topic topic = Topic.newBuilder().build(); + String topicId = "topicId-1139259734"; + Topic response = adminServiceClient.createTopic(parent, topic, topicId); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createtopic_locationnametopicstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopicStringTopicString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopicStringTopicString.java new file mode 100644 index 000000000..02e11945d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/createtopic/SyncCreateTopicStringTopicString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_createtopic_stringtopicstring_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncCreateTopicStringTopicString { + + public static void main(String[] args) throws Exception { + syncCreateTopicStringTopicString(); + } + + public static void syncCreateTopicStringTopicString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Topic topic = Topic.newBuilder().build(); + String topicId = "topicId-1139259734"; + Topic response = adminServiceClient.createTopic(parent, topic, topicId); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_createtopic_stringtopicstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/AsyncDeleteReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/AsyncDeleteReservation.java new file mode 100644 index 000000000..b1d727151 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/AsyncDeleteReservation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletereservation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.DeleteReservationRequest; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteReservation { + + public static void main(String[] args) throws Exception { + asyncDeleteReservation(); + } + + public static void asyncDeleteReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + DeleteReservationRequest request = + DeleteReservationRequest.newBuilder() + .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + .build(); + ApiFuture future = adminServiceClient.deleteReservationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletereservation_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservation.java new file mode 100644 index 000000000..43051a145 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletereservation_sync] +import com.google.cloud.pubsublite.proto.DeleteReservationRequest; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteReservation { + + public static void main(String[] args) throws Exception { + syncDeleteReservation(); + } + + public static void syncDeleteReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + DeleteReservationRequest request = + DeleteReservationRequest.newBuilder() + .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + .build(); + adminServiceClient.deleteReservation(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletereservation_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservationReservationname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservationReservationname.java new file mode 100644 index 000000000..28e7b8f39 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservationReservationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletereservation_reservationname_sync] +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteReservationReservationname { + + public static void main(String[] args) throws Exception { + syncDeleteReservationReservationname(); + } + + public static void syncDeleteReservationReservationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + adminServiceClient.deleteReservation(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletereservation_reservationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservationString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservationString.java new file mode 100644 index 000000000..bd742204d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletereservation/SyncDeleteReservationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletereservation_string_sync] +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteReservationString { + + public static void main(String[] args) throws Exception { + syncDeleteReservationString(); + } + + public static void syncDeleteReservationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); + adminServiceClient.deleteReservation(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletereservation_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/AsyncDeleteSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/AsyncDeleteSubscription.java new file mode 100644 index 000000000..7daf66d12 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/AsyncDeleteSubscription.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletesubscription_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.DeleteSubscriptionRequest; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteSubscription { + + public static void main(String[] args) throws Exception { + asyncDeleteSubscription(); + } + + public static void asyncDeleteSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + DeleteSubscriptionRequest request = + DeleteSubscriptionRequest.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .build(); + ApiFuture future = adminServiceClient.deleteSubscriptionCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletesubscription_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscription.java new file mode 100644 index 000000000..a2c51c925 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscription.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletesubscription_sync] +import com.google.cloud.pubsublite.proto.DeleteSubscriptionRequest; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSubscription { + + public static void main(String[] args) throws Exception { + syncDeleteSubscription(); + } + + public static void syncDeleteSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + DeleteSubscriptionRequest request = + DeleteSubscriptionRequest.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .build(); + adminServiceClient.deleteSubscription(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletesubscription_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscriptionString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscriptionString.java new file mode 100644 index 000000000..73d1e3457 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscriptionString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletesubscription_string_sync] +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSubscriptionString { + + public static void main(String[] args) throws Exception { + syncDeleteSubscriptionString(); + } + + public static void syncDeleteSubscriptionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString(); + adminServiceClient.deleteSubscription(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletesubscription_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscriptionSubscriptionname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscriptionSubscriptionname.java new file mode 100644 index 000000000..936f1c2e8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletesubscription/SyncDeleteSubscriptionSubscriptionname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletesubscription_subscriptionname_sync] +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteSubscriptionSubscriptionname { + + public static void main(String[] args) throws Exception { + syncDeleteSubscriptionSubscriptionname(); + } + + public static void syncDeleteSubscriptionSubscriptionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]"); + adminServiceClient.deleteSubscription(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletesubscription_subscriptionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/AsyncDeleteTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/AsyncDeleteTopic.java new file mode 100644 index 000000000..2f3c310fb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/AsyncDeleteTopic.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletetopic_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.DeleteTopicRequest; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class AsyncDeleteTopic { + + public static void main(String[] args) throws Exception { + asyncDeleteTopic(); + } + + public static void asyncDeleteTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + DeleteTopicRequest request = + DeleteTopicRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .build(); + ApiFuture future = adminServiceClient.deleteTopicCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletetopic_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopic.java new file mode 100644 index 000000000..e6142da0e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopic.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletetopic_sync] +import com.google.cloud.pubsublite.proto.DeleteTopicRequest; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTopic { + + public static void main(String[] args) throws Exception { + syncDeleteTopic(); + } + + public static void syncDeleteTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + DeleteTopicRequest request = + DeleteTopicRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .build(); + adminServiceClient.deleteTopic(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletetopic_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopicString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopicString.java new file mode 100644 index 000000000..07f789675 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopicString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletetopic_string_sync] +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTopicString { + + public static void main(String[] args) throws Exception { + syncDeleteTopicString(); + } + + public static void syncDeleteTopicString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); + adminServiceClient.deleteTopic(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletetopic_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopicTopicname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopicTopicname.java new file mode 100644 index 000000000..dfa993b80 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/deletetopic/SyncDeleteTopicTopicname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_deletetopic_topicname_sync] +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.Empty; + +public class SyncDeleteTopicTopicname { + + public static void main(String[] args) throws Exception { + syncDeleteTopicTopicname(); + } + + public static void syncDeleteTopicTopicname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); + adminServiceClient.deleteTopic(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_deletetopic_topicname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/AsyncGetReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/AsyncGetReservation.java new file mode 100644 index 000000000..f533c84c4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/AsyncGetReservation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getreservation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.GetReservationRequest; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncGetReservation { + + public static void main(String[] args) throws Exception { + asyncGetReservation(); + } + + public static void asyncGetReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetReservationRequest request = + GetReservationRequest.newBuilder() + .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + .build(); + ApiFuture future = + adminServiceClient.getReservationCallable().futureCall(request); + // Do something. + Reservation response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getreservation_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservation.java new file mode 100644 index 000000000..eac90d662 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservation.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getreservation_sync] +import com.google.cloud.pubsublite.proto.GetReservationRequest; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetReservation { + + public static void main(String[] args) throws Exception { + syncGetReservation(); + } + + public static void syncGetReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetReservationRequest request = + GetReservationRequest.newBuilder() + .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + .build(); + Reservation response = adminServiceClient.getReservation(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getreservation_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservationReservationname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservationReservationname.java new file mode 100644 index 000000000..589ab383f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservationReservationname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getreservation_reservationname_sync] +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetReservationReservationname { + + public static void main(String[] args) throws Exception { + syncGetReservationReservationname(); + } + + public static void syncGetReservationReservationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + Reservation response = adminServiceClient.getReservation(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getreservation_reservationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservationString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservationString.java new file mode 100644 index 000000000..c6c1c057d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getreservation/SyncGetReservationString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getreservation_string_sync] +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetReservationString { + + public static void main(String[] args) throws Exception { + syncGetReservationString(); + } + + public static void syncGetReservationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); + Reservation response = adminServiceClient.getReservation(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getreservation_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/AsyncGetSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/AsyncGetSubscription.java new file mode 100644 index 000000000..54b2304f3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/AsyncGetSubscription.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getsubscription_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.GetSubscriptionRequest; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncGetSubscription { + + public static void main(String[] args) throws Exception { + asyncGetSubscription(); + } + + public static void asyncGetSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetSubscriptionRequest request = + GetSubscriptionRequest.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .build(); + ApiFuture future = + adminServiceClient.getSubscriptionCallable().futureCall(request); + // Do something. + Subscription response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getsubscription_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscription.java new file mode 100644 index 000000000..6f90a9d51 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscription.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getsubscription_sync] +import com.google.cloud.pubsublite.proto.GetSubscriptionRequest; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetSubscription { + + public static void main(String[] args) throws Exception { + syncGetSubscription(); + } + + public static void syncGetSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetSubscriptionRequest request = + GetSubscriptionRequest.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .build(); + Subscription response = adminServiceClient.getSubscription(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getsubscription_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscriptionString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscriptionString.java new file mode 100644 index 000000000..4d12df398 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscriptionString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getsubscription_string_sync] +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetSubscriptionString { + + public static void main(String[] args) throws Exception { + syncGetSubscriptionString(); + } + + public static void syncGetSubscriptionString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString(); + Subscription response = adminServiceClient.getSubscription(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getsubscription_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscriptionSubscriptionname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscriptionSubscriptionname.java new file mode 100644 index 000000000..1d5d2a9a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/getsubscription/SyncGetSubscriptionSubscriptionname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_getsubscription_subscriptionname_sync] +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetSubscriptionSubscriptionname { + + public static void main(String[] args) throws Exception { + syncGetSubscriptionSubscriptionname(); + } + + public static void syncGetSubscriptionSubscriptionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + SubscriptionName name = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]"); + Subscription response = adminServiceClient.getSubscription(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_getsubscription_subscriptionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/AsyncGetTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/AsyncGetTopic.java new file mode 100644 index 000000000..95ae315e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/AsyncGetTopic.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopic_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.GetTopicRequest; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncGetTopic { + + public static void main(String[] args) throws Exception { + asyncGetTopic(); + } + + public static void asyncGetTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetTopicRequest request = + GetTopicRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .build(); + ApiFuture future = adminServiceClient.getTopicCallable().futureCall(request); + // Do something. + Topic response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopic_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopic.java new file mode 100644 index 000000000..c44939df9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopic.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopic_sync] +import com.google.cloud.pubsublite.proto.GetTopicRequest; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetTopic { + + public static void main(String[] args) throws Exception { + syncGetTopic(); + } + + public static void syncGetTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetTopicRequest request = + GetTopicRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .build(); + Topic response = adminServiceClient.getTopic(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopic_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopicString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopicString.java new file mode 100644 index 000000000..c75832728 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopicString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopic_string_sync] +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetTopicString { + + public static void main(String[] args) throws Exception { + syncGetTopicString(); + } + + public static void syncGetTopicString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); + Topic response = adminServiceClient.getTopic(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopic_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopicTopicname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopicTopicname.java new file mode 100644 index 000000000..6e8674d11 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopic/SyncGetTopicTopicname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopic_topicname_sync] +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetTopicTopicname { + + public static void main(String[] args) throws Exception { + syncGetTopicTopicname(); + } + + public static void syncGetTopicTopicname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); + Topic response = adminServiceClient.getTopic(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopic_topicname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/AsyncGetTopicPartitions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/AsyncGetTopicPartitions.java new file mode 100644 index 000000000..7d12521c3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/AsyncGetTopicPartitions.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopicpartitions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.GetTopicPartitionsRequest; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.proto.TopicPartitions; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncGetTopicPartitions { + + public static void main(String[] args) throws Exception { + asyncGetTopicPartitions(); + } + + public static void asyncGetTopicPartitions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetTopicPartitionsRequest request = + GetTopicPartitionsRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .build(); + ApiFuture future = + adminServiceClient.getTopicPartitionsCallable().futureCall(request); + // Do something. + TopicPartitions response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopicpartitions_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitions.java new file mode 100644 index 000000000..dca232d90 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitions.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopicpartitions_sync] +import com.google.cloud.pubsublite.proto.GetTopicPartitionsRequest; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.proto.TopicPartitions; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetTopicPartitions { + + public static void main(String[] args) throws Exception { + syncGetTopicPartitions(); + } + + public static void syncGetTopicPartitions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + GetTopicPartitionsRequest request = + GetTopicPartitionsRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .build(); + TopicPartitions response = adminServiceClient.getTopicPartitions(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopicpartitions_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitionsString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitionsString.java new file mode 100644 index 000000000..1e0129537 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitionsString.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopicpartitions_string_sync] +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.proto.TopicPartitions; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetTopicPartitionsString { + + public static void main(String[] args) throws Exception { + syncGetTopicPartitionsString(); + } + + public static void syncGetTopicPartitionsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); + TopicPartitions response = adminServiceClient.getTopicPartitions(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopicpartitions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitionsTopicname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitionsTopicname.java new file mode 100644 index 000000000..d71d88d1b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/gettopicpartitions/SyncGetTopicPartitionsTopicname.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_gettopicpartitions_topicname_sync] +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.proto.TopicPartitions; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncGetTopicPartitionsTopicname { + + public static void main(String[] args) throws Exception { + syncGetTopicPartitionsTopicname(); + } + + public static void syncGetTopicPartitionsTopicname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); + TopicPartitions response = adminServiceClient.getTopicPartitions(name); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_gettopicpartitions_topicname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/AsyncListReservations.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/AsyncListReservations.java new file mode 100644 index 000000000..0e8720b21 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/AsyncListReservations.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ListReservationsRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncListReservations { + + public static void main(String[] args) throws Exception { + asyncListReservations(); + } + + public static void asyncListReservations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListReservationsRequest request = + ListReservationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + adminServiceClient.listReservationsPagedCallable().futureCall(request); + // Do something. + for (Reservation element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservations_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/AsyncListReservationsPaged.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/AsyncListReservationsPaged.java new file mode 100644 index 000000000..c6c2ca945 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/AsyncListReservationsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservations_paged_async] +import com.google.cloud.pubsublite.proto.ListReservationsRequest; +import com.google.cloud.pubsublite.proto.ListReservationsResponse; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.common.base.Strings; + +public class AsyncListReservationsPaged { + + public static void main(String[] args) throws Exception { + asyncListReservationsPaged(); + } + + public static void asyncListReservationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListReservationsRequest request = + ListReservationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListReservationsResponse response = + adminServiceClient.listReservationsCallable().call(request); + for (Reservation element : response.getReservationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservations.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservations.java new file mode 100644 index 000000000..6a3049400 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservations.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservations_sync] +import com.google.cloud.pubsublite.proto.ListReservationsRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListReservations { + + public static void main(String[] args) throws Exception { + syncListReservations(); + } + + public static void syncListReservations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListReservationsRequest request = + ListReservationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Reservation element : adminServiceClient.listReservations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservations_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservationsLocationname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservationsLocationname.java new file mode 100644 index 000000000..5d3db6fc2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservationsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservations_locationname_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListReservationsLocationname { + + public static void main(String[] args) throws Exception { + syncListReservationsLocationname(); + } + + public static void syncListReservationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Reservation element : adminServiceClient.listReservations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservations_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservationsString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservationsString.java new file mode 100644 index 000000000..fdbb03e08 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservations/SyncListReservationsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservations_string_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListReservationsString { + + public static void main(String[] args) throws Exception { + syncListReservationsString(); + } + + public static void syncListReservationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Reservation element : adminServiceClient.listReservations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservations_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/AsyncListReservationTopics.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/AsyncListReservationTopics.java new file mode 100644 index 000000000..86f8fde16 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/AsyncListReservationTopics.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservationtopics_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ListReservationTopicsRequest; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncListReservationTopics { + + public static void main(String[] args) throws Exception { + asyncListReservationTopics(); + } + + public static void asyncListReservationTopics() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListReservationTopicsRequest request = + ListReservationTopicsRequest.newBuilder() + .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + adminServiceClient.listReservationTopicsPagedCallable().futureCall(request); + // Do something. + for (String element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservationtopics_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/AsyncListReservationTopicsPaged.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/AsyncListReservationTopicsPaged.java new file mode 100644 index 000000000..1bf99ba40 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/AsyncListReservationTopicsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservationtopics_paged_async] +import com.google.cloud.pubsublite.proto.ListReservationTopicsRequest; +import com.google.cloud.pubsublite.proto.ListReservationTopicsResponse; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.common.base.Strings; + +public class AsyncListReservationTopicsPaged { + + public static void main(String[] args) throws Exception { + asyncListReservationTopicsPaged(); + } + + public static void asyncListReservationTopicsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListReservationTopicsRequest request = + ListReservationTopicsRequest.newBuilder() + .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListReservationTopicsResponse response = + adminServiceClient.listReservationTopicsCallable().call(request); + for (String element : response.getTopicsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservationtopics_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopics.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopics.java new file mode 100644 index 000000000..8e5710d12 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopics.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservationtopics_sync] +import com.google.cloud.pubsublite.proto.ListReservationTopicsRequest; +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListReservationTopics { + + public static void main(String[] args) throws Exception { + syncListReservationTopics(); + } + + public static void syncListReservationTopics() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListReservationTopicsRequest request = + ListReservationTopicsRequest.newBuilder() + .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (String element : adminServiceClient.listReservationTopics(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservationtopics_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopicsReservationname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopicsReservationname.java new file mode 100644 index 000000000..777739ea0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopicsReservationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservationtopics_reservationname_sync] +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListReservationTopicsReservationname { + + public static void main(String[] args) throws Exception { + syncListReservationTopicsReservationname(); + } + + public static void syncListReservationTopicsReservationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + for (String element : adminServiceClient.listReservationTopics(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservationtopics_reservationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopicsString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopicsString.java new file mode 100644 index 000000000..b58d8eab5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listreservationtopics/SyncListReservationTopicsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listreservationtopics_string_sync] +import com.google.cloud.pubsublite.proto.ReservationName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListReservationTopicsString { + + public static void main(String[] args) throws Exception { + syncListReservationTopicsString(); + } + + public static void syncListReservationTopicsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); + for (String element : adminServiceClient.listReservationTopics(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listreservationtopics_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/AsyncListSubscriptions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/AsyncListSubscriptions.java new file mode 100644 index 000000000..90b9f00b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/AsyncListSubscriptions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listsubscriptions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ListSubscriptionsRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncListSubscriptions { + + public static void main(String[] args) throws Exception { + asyncListSubscriptions(); + } + + public static void asyncListSubscriptions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListSubscriptionsRequest request = + ListSubscriptionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + adminServiceClient.listSubscriptionsPagedCallable().futureCall(request); + // Do something. + for (Subscription element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listsubscriptions_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/AsyncListSubscriptionsPaged.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/AsyncListSubscriptionsPaged.java new file mode 100644 index 000000000..9ad616607 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/AsyncListSubscriptionsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listsubscriptions_paged_async] +import com.google.cloud.pubsublite.proto.ListSubscriptionsRequest; +import com.google.cloud.pubsublite.proto.ListSubscriptionsResponse; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.common.base.Strings; + +public class AsyncListSubscriptionsPaged { + + public static void main(String[] args) throws Exception { + asyncListSubscriptionsPaged(); + } + + public static void asyncListSubscriptionsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListSubscriptionsRequest request = + ListSubscriptionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListSubscriptionsResponse response = + adminServiceClient.listSubscriptionsCallable().call(request); + for (Subscription element : response.getSubscriptionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listsubscriptions_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptions.java new file mode 100644 index 000000000..4e38f1b8a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptions.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listsubscriptions_sync] +import com.google.cloud.pubsublite.proto.ListSubscriptionsRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListSubscriptions { + + public static void main(String[] args) throws Exception { + syncListSubscriptions(); + } + + public static void syncListSubscriptions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListSubscriptionsRequest request = + ListSubscriptionsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Subscription element : adminServiceClient.listSubscriptions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listsubscriptions_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptionsLocationname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptionsLocationname.java new file mode 100644 index 000000000..0bf5809af --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptionsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listsubscriptions_locationname_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListSubscriptionsLocationname { + + public static void main(String[] args) throws Exception { + syncListSubscriptionsLocationname(); + } + + public static void syncListSubscriptionsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Subscription element : adminServiceClient.listSubscriptions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listsubscriptions_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptionsString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptionsString.java new file mode 100644 index 000000000..dd112bbe8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listsubscriptions/SyncListSubscriptionsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listsubscriptions_string_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListSubscriptionsString { + + public static void main(String[] args) throws Exception { + syncListSubscriptionsString(); + } + + public static void syncListSubscriptionsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Subscription element : adminServiceClient.listSubscriptions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listsubscriptions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/AsyncListTopics.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/AsyncListTopics.java new file mode 100644 index 000000000..20fbfa894 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/AsyncListTopics.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopics_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ListTopicsRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncListTopics { + + public static void main(String[] args) throws Exception { + asyncListTopics(); + } + + public static void asyncListTopics() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListTopicsRequest request = + ListTopicsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = adminServiceClient.listTopicsPagedCallable().futureCall(request); + // Do something. + for (Topic element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopics_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/AsyncListTopicsPaged.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/AsyncListTopicsPaged.java new file mode 100644 index 000000000..f39b6184a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/AsyncListTopicsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopics_paged_async] +import com.google.cloud.pubsublite.proto.ListTopicsRequest; +import com.google.cloud.pubsublite.proto.ListTopicsResponse; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.common.base.Strings; + +public class AsyncListTopicsPaged { + + public static void main(String[] args) throws Exception { + asyncListTopicsPaged(); + } + + public static void asyncListTopicsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListTopicsRequest request = + ListTopicsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListTopicsResponse response = adminServiceClient.listTopicsCallable().call(request); + for (Topic element : response.getTopicsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopics_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopics.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopics.java new file mode 100644 index 000000000..ef90816a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopics.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopics_sync] +import com.google.cloud.pubsublite.proto.ListTopicsRequest; +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListTopics { + + public static void main(String[] args) throws Exception { + syncListTopics(); + } + + public static void syncListTopics() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListTopicsRequest request = + ListTopicsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Topic element : adminServiceClient.listTopics(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopics_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopicsLocationname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopicsLocationname.java new file mode 100644 index 000000000..73388317e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopicsLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopics_locationname_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListTopicsLocationname { + + public static void main(String[] args) throws Exception { + syncListTopicsLocationname(); + } + + public static void syncListTopicsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Topic element : adminServiceClient.listTopics(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopics_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopicsString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopicsString.java new file mode 100644 index 000000000..7da915b14 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopics/SyncListTopicsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopics_string_sync] +import com.google.cloud.pubsublite.proto.LocationName; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListTopicsString { + + public static void main(String[] args) throws Exception { + syncListTopicsString(); + } + + public static void syncListTopicsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Topic element : adminServiceClient.listTopics(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopics_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/AsyncListTopicSubscriptions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/AsyncListTopicSubscriptions.java new file mode 100644 index 000000000..c0370c611 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/AsyncListTopicSubscriptions.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ListTopicSubscriptionsRequest; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncListTopicSubscriptions { + + public static void main(String[] args) throws Exception { + asyncListTopicSubscriptions(); + } + + public static void asyncListTopicSubscriptions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListTopicSubscriptionsRequest request = + ListTopicSubscriptionsRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + adminServiceClient.listTopicSubscriptionsPagedCallable().futureCall(request); + // Do something. + for (String element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/AsyncListTopicSubscriptionsPaged.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/AsyncListTopicSubscriptionsPaged.java new file mode 100644 index 000000000..99e2ffa67 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/AsyncListTopicSubscriptionsPaged.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_paged_async] +import com.google.cloud.pubsublite.proto.ListTopicSubscriptionsRequest; +import com.google.cloud.pubsublite.proto.ListTopicSubscriptionsResponse; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.common.base.Strings; + +public class AsyncListTopicSubscriptionsPaged { + + public static void main(String[] args) throws Exception { + asyncListTopicSubscriptionsPaged(); + } + + public static void asyncListTopicSubscriptionsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListTopicSubscriptionsRequest request = + ListTopicSubscriptionsRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListTopicSubscriptionsResponse response = + adminServiceClient.listTopicSubscriptionsCallable().call(request); + for (String element : response.getSubscriptionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptions.java new file mode 100644 index 000000000..ff88f5585 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptions.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_sync] +import com.google.cloud.pubsublite.proto.ListTopicSubscriptionsRequest; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListTopicSubscriptions { + + public static void main(String[] args) throws Exception { + syncListTopicSubscriptions(); + } + + public static void syncListTopicSubscriptions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + ListTopicSubscriptionsRequest request = + ListTopicSubscriptionsRequest.newBuilder() + .setName(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (String element : adminServiceClient.listTopicSubscriptions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptionsString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptionsString.java new file mode 100644 index 000000000..97a2ff121 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptionsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_string_sync] +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListTopicSubscriptionsString { + + public static void main(String[] args) throws Exception { + syncListTopicSubscriptionsString(); + } + + public static void syncListTopicSubscriptionsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); + for (String element : adminServiceClient.listTopicSubscriptions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptionsTopicname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptionsTopicname.java new file mode 100644 index 000000000..4d9f444e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/listtopicsubscriptions/SyncListTopicSubscriptionsTopicname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_topicname_sync] +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncListTopicSubscriptionsTopicname { + + public static void main(String[] args) throws Exception { + syncListTopicSubscriptionsTopicname(); + } + + public static void syncListTopicSubscriptionsTopicname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); + for (String element : adminServiceClient.listTopicSubscriptions(name).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_listtopicsubscriptions_topicname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/AsyncSeekSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/AsyncSeekSubscription.java new file mode 100644 index 000000000..d14742126 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/AsyncSeekSubscription.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_seeksubscription_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.SeekSubscriptionRequest; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.longrunning.Operation; + +public class AsyncSeekSubscription { + + public static void main(String[] args) throws Exception { + asyncSeekSubscription(); + } + + public static void asyncSeekSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + SeekSubscriptionRequest request = + SeekSubscriptionRequest.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .build(); + ApiFuture future = + adminServiceClient.seekSubscriptionCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_seeksubscription_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/AsyncSeekSubscriptionLRO.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/AsyncSeekSubscriptionLRO.java new file mode 100644 index 000000000..48b949afe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/AsyncSeekSubscriptionLRO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_seeksubscription_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.pubsublite.proto.OperationMetadata; +import com.google.cloud.pubsublite.proto.SeekSubscriptionRequest; +import com.google.cloud.pubsublite.proto.SeekSubscriptionResponse; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class AsyncSeekSubscriptionLRO { + + public static void main(String[] args) throws Exception { + asyncSeekSubscriptionLRO(); + } + + public static void asyncSeekSubscriptionLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + SeekSubscriptionRequest request = + SeekSubscriptionRequest.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .build(); + OperationFuture future = + adminServiceClient.seekSubscriptionOperationCallable().futureCall(request); + // Do something. + SeekSubscriptionResponse response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_seeksubscription_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/SyncSeekSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/SyncSeekSubscription.java new file mode 100644 index 000000000..6e8f5e43e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/seeksubscription/SyncSeekSubscription.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_seeksubscription_sync] +import com.google.cloud.pubsublite.proto.SeekSubscriptionRequest; +import com.google.cloud.pubsublite.proto.SeekSubscriptionResponse; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.AdminServiceClient; + +public class SyncSeekSubscription { + + public static void main(String[] args) throws Exception { + syncSeekSubscription(); + } + + public static void syncSeekSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + SeekSubscriptionRequest request = + SeekSubscriptionRequest.newBuilder() + .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .build(); + SeekSubscriptionResponse response = adminServiceClient.seekSubscriptionAsync(request).get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_seeksubscription_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/AsyncUpdateReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/AsyncUpdateReservation.java new file mode 100644 index 000000000..02f0daf15 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/AsyncUpdateReservation.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatereservation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.proto.UpdateReservationRequest; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateReservation { + + public static void main(String[] args) throws Exception { + asyncUpdateReservation(); + } + + public static void asyncUpdateReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + UpdateReservationRequest request = + UpdateReservationRequest.newBuilder() + .setReservation(Reservation.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + adminServiceClient.updateReservationCallable().futureCall(request); + // Do something. + Reservation response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatereservation_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/SyncUpdateReservation.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/SyncUpdateReservation.java new file mode 100644 index 000000000..0a15418a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/SyncUpdateReservation.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatereservation_sync] +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.proto.UpdateReservationRequest; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateReservation { + + public static void main(String[] args) throws Exception { + syncUpdateReservation(); + } + + public static void syncUpdateReservation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + UpdateReservationRequest request = + UpdateReservationRequest.newBuilder() + .setReservation(Reservation.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Reservation response = adminServiceClient.updateReservation(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatereservation_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/SyncUpdateReservationReservationFieldmask.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/SyncUpdateReservationReservationFieldmask.java new file mode 100644 index 000000000..bbff5efd9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatereservation/SyncUpdateReservationReservationFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatereservation_reservationfieldmask_sync] +import com.google.cloud.pubsublite.proto.Reservation; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateReservationReservationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateReservationReservationFieldmask(); + } + + public static void syncUpdateReservationReservationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + Reservation reservation = Reservation.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Reservation response = adminServiceClient.updateReservation(reservation, updateMask); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatereservation_reservationfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/AsyncUpdateSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/AsyncUpdateSubscription.java new file mode 100644 index 000000000..5069dd0a9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/AsyncUpdateSubscription.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatesubscription_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.proto.UpdateSubscriptionRequest; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSubscription { + + public static void main(String[] args) throws Exception { + asyncUpdateSubscription(); + } + + public static void asyncUpdateSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + UpdateSubscriptionRequest request = + UpdateSubscriptionRequest.newBuilder() + .setSubscription(Subscription.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + adminServiceClient.updateSubscriptionCallable().futureCall(request); + // Do something. + Subscription response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatesubscription_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/SyncUpdateSubscription.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/SyncUpdateSubscription.java new file mode 100644 index 000000000..9e22f42a3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/SyncUpdateSubscription.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatesubscription_sync] +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.proto.UpdateSubscriptionRequest; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSubscription { + + public static void main(String[] args) throws Exception { + syncUpdateSubscription(); + } + + public static void syncUpdateSubscription() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + UpdateSubscriptionRequest request = + UpdateSubscriptionRequest.newBuilder() + .setSubscription(Subscription.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Subscription response = adminServiceClient.updateSubscription(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatesubscription_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/SyncUpdateSubscriptionSubscriptionFieldmask.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/SyncUpdateSubscriptionSubscriptionFieldmask.java new file mode 100644 index 000000000..0414ad229 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatesubscription/SyncUpdateSubscriptionSubscriptionFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatesubscription_subscriptionfieldmask_sync] +import com.google.cloud.pubsublite.proto.Subscription; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSubscriptionSubscriptionFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateSubscriptionSubscriptionFieldmask(); + } + + public static void syncUpdateSubscriptionSubscriptionFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + Subscription subscription = Subscription.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Subscription response = adminServiceClient.updateSubscription(subscription, updateMask); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatesubscription_subscriptionfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/AsyncUpdateTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/AsyncUpdateTopic.java new file mode 100644 index 000000000..5657bda63 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/AsyncUpdateTopic.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatetopic_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.proto.UpdateTopicRequest; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateTopic { + + public static void main(String[] args) throws Exception { + asyncUpdateTopic(); + } + + public static void asyncUpdateTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + UpdateTopicRequest request = + UpdateTopicRequest.newBuilder() + .setTopic(Topic.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = adminServiceClient.updateTopicCallable().futureCall(request); + // Do something. + Topic response = future.get(); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatetopic_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/SyncUpdateTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/SyncUpdateTopic.java new file mode 100644 index 000000000..3a3ed63b9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/SyncUpdateTopic.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatetopic_sync] +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.proto.UpdateTopicRequest; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTopic { + + public static void main(String[] args) throws Exception { + syncUpdateTopic(); + } + + public static void syncUpdateTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + UpdateTopicRequest request = + UpdateTopicRequest.newBuilder() + .setTopic(Topic.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Topic response = adminServiceClient.updateTopic(request); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatetopic_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/SyncUpdateTopicTopicFieldmask.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/SyncUpdateTopicTopicFieldmask.java new file mode 100644 index 000000000..7debf8a85 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminserviceclient/updatetopic/SyncUpdateTopicTopicFieldmask.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminserviceclient_updatetopic_topicfieldmask_sync] +import com.google.cloud.pubsublite.proto.Topic; +import com.google.cloud.pubsublite.v1.AdminServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateTopicTopicFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateTopicTopicFieldmask(); + } + + public static void syncUpdateTopicTopicFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { + Topic topic = Topic.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Topic response = adminServiceClient.updateTopic(topic, updateMask); + } + } +} +// [END pubsublite_v1_generated_adminserviceclient_updatetopic_topicfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservicesettings/createtopic/SyncCreateTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservicesettings/createtopic/SyncCreateTopic.java new file mode 100644 index 000000000..1a03d1f0d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservicesettings/createtopic/SyncCreateTopic.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_adminservicesettings_createtopic_sync] +import com.google.cloud.pubsublite.v1.AdminServiceSettings; +import java.time.Duration; + +public class SyncCreateTopic { + + public static void main(String[] args) throws Exception { + syncCreateTopic(); + } + + public static void syncCreateTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AdminServiceSettings.Builder adminServiceSettingsBuilder = AdminServiceSettings.newBuilder(); + adminServiceSettingsBuilder + .createTopicSettings() + .setRetrySettings( + adminServiceSettingsBuilder + .createTopicSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + AdminServiceSettings adminServiceSettings = adminServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_adminservicesettings_createtopic_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/commitcursor/AsyncCommitCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/commitcursor/AsyncCommitCursor.java new file mode 100644 index 000000000..681d953f1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/commitcursor/AsyncCommitCursor.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_commitcursor_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.CommitCursorRequest; +import com.google.cloud.pubsublite.proto.CommitCursorResponse; +import com.google.cloud.pubsublite.proto.Cursor; +import com.google.cloud.pubsublite.v1.CursorServiceClient; + +public class AsyncCommitCursor { + + public static void main(String[] args) throws Exception { + asyncCommitCursor(); + } + + public static void asyncCommitCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + CommitCursorRequest request = + CommitCursorRequest.newBuilder() + .setSubscription("subscription341203229") + .setPartition(-1799810326) + .setCursor(Cursor.newBuilder().build()) + .build(); + ApiFuture future = + cursorServiceClient.commitCursorCallable().futureCall(request); + // Do something. + CommitCursorResponse response = future.get(); + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_commitcursor_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/commitcursor/SyncCommitCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/commitcursor/SyncCommitCursor.java new file mode 100644 index 000000000..9a9b1774f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/commitcursor/SyncCommitCursor.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_commitcursor_sync] +import com.google.cloud.pubsublite.proto.CommitCursorRequest; +import com.google.cloud.pubsublite.proto.CommitCursorResponse; +import com.google.cloud.pubsublite.proto.Cursor; +import com.google.cloud.pubsublite.v1.CursorServiceClient; + +public class SyncCommitCursor { + + public static void main(String[] args) throws Exception { + syncCommitCursor(); + } + + public static void syncCommitCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + CommitCursorRequest request = + CommitCursorRequest.newBuilder() + .setSubscription("subscription341203229") + .setPartition(-1799810326) + .setCursor(Cursor.newBuilder().build()) + .build(); + CommitCursorResponse response = cursorServiceClient.commitCursor(request); + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_commitcursor_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000..2b5c2e816 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.pubsublite.v1.CursorServiceClient; +import com.google.cloud.pubsublite.v1.CursorServiceSettings; +import com.google.cloud.pubsublite.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CursorServiceSettings cursorServiceSettings = + CursorServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CursorServiceClient cursorServiceClient = CursorServiceClient.create(cursorServiceSettings); + } +} +// [END pubsublite_v1_generated_cursorserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000..e28e90350 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_create_setendpoint_sync] +import com.google.cloud.pubsublite.v1.CursorServiceClient; +import com.google.cloud.pubsublite.v1.CursorServiceSettings; +import com.google.cloud.pubsublite.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CursorServiceSettings cursorServiceSettings = + CursorServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + CursorServiceClient cursorServiceClient = CursorServiceClient.create(cursorServiceSettings); + } +} +// [END pubsublite_v1_generated_cursorserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/AsyncListPartitionCursors.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/AsyncListPartitionCursors.java new file mode 100644 index 000000000..b4b45e294 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/AsyncListPartitionCursors.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ListPartitionCursorsRequest; +import com.google.cloud.pubsublite.proto.PartitionCursor; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.CursorServiceClient; + +public class AsyncListPartitionCursors { + + public static void main(String[] args) throws Exception { + asyncListPartitionCursors(); + } + + public static void asyncListPartitionCursors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + ListPartitionCursorsRequest request = + ListPartitionCursorsRequest.newBuilder() + .setParent( + SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + cursorServiceClient.listPartitionCursorsPagedCallable().futureCall(request); + // Do something. + for (PartitionCursor element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/AsyncListPartitionCursorsPaged.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/AsyncListPartitionCursorsPaged.java new file mode 100644 index 000000000..333ce7f84 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/AsyncListPartitionCursorsPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_paged_async] +import com.google.cloud.pubsublite.proto.ListPartitionCursorsRequest; +import com.google.cloud.pubsublite.proto.ListPartitionCursorsResponse; +import com.google.cloud.pubsublite.proto.PartitionCursor; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.CursorServiceClient; +import com.google.common.base.Strings; + +public class AsyncListPartitionCursorsPaged { + + public static void main(String[] args) throws Exception { + asyncListPartitionCursorsPaged(); + } + + public static void asyncListPartitionCursorsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + ListPartitionCursorsRequest request = + ListPartitionCursorsRequest.newBuilder() + .setParent( + SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListPartitionCursorsResponse response = + cursorServiceClient.listPartitionCursorsCallable().call(request); + for (PartitionCursor element : response.getPartitionCursorsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursors.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursors.java new file mode 100644 index 000000000..86feca999 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursors.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_sync] +import com.google.cloud.pubsublite.proto.ListPartitionCursorsRequest; +import com.google.cloud.pubsublite.proto.PartitionCursor; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.CursorServiceClient; + +public class SyncListPartitionCursors { + + public static void main(String[] args) throws Exception { + syncListPartitionCursors(); + } + + public static void syncListPartitionCursors() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + ListPartitionCursorsRequest request = + ListPartitionCursorsRequest.newBuilder() + .setParent( + SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (PartitionCursor element : + cursorServiceClient.listPartitionCursors(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursorsString.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursorsString.java new file mode 100644 index 000000000..bcf25f2b0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursorsString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_string_sync] +import com.google.cloud.pubsublite.proto.PartitionCursor; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.CursorServiceClient; + +public class SyncListPartitionCursorsString { + + public static void main(String[] args) throws Exception { + syncListPartitionCursorsString(); + } + + public static void syncListPartitionCursorsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + String parent = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString(); + for (PartitionCursor element : + cursorServiceClient.listPartitionCursors(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursorsSubscriptionname.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursorsSubscriptionname.java new file mode 100644 index 000000000..33d1794fe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/listpartitioncursors/SyncListPartitionCursorsSubscriptionname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_subscriptionname_sync] +import com.google.cloud.pubsublite.proto.PartitionCursor; +import com.google.cloud.pubsublite.proto.SubscriptionName; +import com.google.cloud.pubsublite.v1.CursorServiceClient; + +public class SyncListPartitionCursorsSubscriptionname { + + public static void main(String[] args) throws Exception { + syncListPartitionCursorsSubscriptionname(); + } + + public static void syncListPartitionCursorsSubscriptionname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + SubscriptionName parent = SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]"); + for (PartitionCursor element : + cursorServiceClient.listPartitionCursors(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_listpartitioncursors_subscriptionname_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/streamingcommitcursor/AsyncStreamingCommitCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/streamingcommitcursor/AsyncStreamingCommitCursor.java new file mode 100644 index 000000000..012269dec --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorserviceclient/streamingcommitcursor/AsyncStreamingCommitCursor.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorserviceclient_streamingcommitcursor_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.pubsublite.proto.StreamingCommitCursorRequest; +import com.google.cloud.pubsublite.proto.StreamingCommitCursorResponse; +import com.google.cloud.pubsublite.v1.CursorServiceClient; + +public class AsyncStreamingCommitCursor { + + public static void main(String[] args) throws Exception { + asyncStreamingCommitCursor(); + } + + public static void asyncStreamingCommitCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CursorServiceClient cursorServiceClient = CursorServiceClient.create()) { + BidiStream bidiStream = + cursorServiceClient.streamingCommitCursorCallable().call(); + StreamingCommitCursorRequest request = StreamingCommitCursorRequest.newBuilder().build(); + bidiStream.send(request); + for (StreamingCommitCursorResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END pubsublite_v1_generated_cursorserviceclient_streamingcommitcursor_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorservicesettings/commitcursor/SyncCommitCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorservicesettings/commitcursor/SyncCommitCursor.java new file mode 100644 index 000000000..e15618d11 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/cursorservicesettings/commitcursor/SyncCommitCursor.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_cursorservicesettings_commitcursor_sync] +import com.google.cloud.pubsublite.v1.CursorServiceSettings; +import java.time.Duration; + +public class SyncCommitCursor { + + public static void main(String[] args) throws Exception { + syncCommitCursor(); + } + + public static void syncCommitCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CursorServiceSettings.Builder cursorServiceSettingsBuilder = CursorServiceSettings.newBuilder(); + cursorServiceSettingsBuilder + .commitCursorSettings() + .setRetrySettings( + cursorServiceSettingsBuilder + .commitCursorSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CursorServiceSettings cursorServiceSettings = cursorServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_cursorservicesettings_commitcursor_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/assignpartitions/AsyncAssignPartitions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/assignpartitions/AsyncAssignPartitions.java new file mode 100644 index 000000000..a5509069b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/assignpartitions/AsyncAssignPartitions.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_partitionassignmentserviceclient_assignpartitions_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.pubsublite.proto.PartitionAssignment; +import com.google.cloud.pubsublite.proto.PartitionAssignmentRequest; +import com.google.cloud.pubsublite.v1.PartitionAssignmentServiceClient; + +public class AsyncAssignPartitions { + + public static void main(String[] args) throws Exception { + asyncAssignPartitions(); + } + + public static void asyncAssignPartitions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PartitionAssignmentServiceClient partitionAssignmentServiceClient = + PartitionAssignmentServiceClient.create()) { + BidiStream bidiStream = + partitionAssignmentServiceClient.assignPartitionsCallable().call(); + PartitionAssignmentRequest request = PartitionAssignmentRequest.newBuilder().build(); + bidiStream.send(request); + for (PartitionAssignment response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END pubsublite_v1_generated_partitionassignmentserviceclient_assignpartitions_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000..a048ce2a3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_partitionassignmentserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.pubsublite.v1.PartitionAssignmentServiceClient; +import com.google.cloud.pubsublite.v1.PartitionAssignmentServiceSettings; +import com.google.cloud.pubsublite.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PartitionAssignmentServiceSettings partitionAssignmentServiceSettings = + PartitionAssignmentServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PartitionAssignmentServiceClient partitionAssignmentServiceClient = + PartitionAssignmentServiceClient.create(partitionAssignmentServiceSettings); + } +} +// [END pubsublite_v1_generated_partitionassignmentserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000..6ebda49ac --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_partitionassignmentserviceclient_create_setendpoint_sync] +import com.google.cloud.pubsublite.v1.PartitionAssignmentServiceClient; +import com.google.cloud.pubsublite.v1.PartitionAssignmentServiceSettings; +import com.google.cloud.pubsublite.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PartitionAssignmentServiceSettings partitionAssignmentServiceSettings = + PartitionAssignmentServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + PartitionAssignmentServiceClient partitionAssignmentServiceClient = + PartitionAssignmentServiceClient.create(partitionAssignmentServiceSettings); + } +} +// [END pubsublite_v1_generated_partitionassignmentserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentservicesettings/assignpartitions/SyncAssignPartitions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentservicesettings/assignpartitions/SyncAssignPartitions.java new file mode 100644 index 000000000..a9654a383 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/partitionassignmentservicesettings/assignpartitions/SyncAssignPartitions.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_partitionassignmentservicesettings_assignpartitions_sync] +import com.google.cloud.pubsublite.v1.PartitionAssignmentServiceSettings; +import java.time.Duration; + +public class SyncAssignPartitions { + + public static void main(String[] args) throws Exception { + syncAssignPartitions(); + } + + public static void syncAssignPartitions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PartitionAssignmentServiceSettings.Builder partitionAssignmentServiceSettingsBuilder = + PartitionAssignmentServiceSettings.newBuilder(); + partitionAssignmentServiceSettingsBuilder + .assignPartitionsSettings() + .setRetrySettings( + partitionAssignmentServiceSettingsBuilder + .assignPartitionsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PartitionAssignmentServiceSettings partitionAssignmentServiceSettings = + partitionAssignmentServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_partitionassignmentservicesettings_assignpartitions_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000..bc7f788fb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_publisherserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.pubsublite.v1.PublisherServiceClient; +import com.google.cloud.pubsublite.v1.PublisherServiceSettings; +import com.google.cloud.pubsublite.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PublisherServiceSettings publisherServiceSettings = + PublisherServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PublisherServiceClient publisherServiceClient = + PublisherServiceClient.create(publisherServiceSettings); + } +} +// [END pubsublite_v1_generated_publisherserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000..6cba30133 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_publisherserviceclient_create_setendpoint_sync] +import com.google.cloud.pubsublite.v1.PublisherServiceClient; +import com.google.cloud.pubsublite.v1.PublisherServiceSettings; +import com.google.cloud.pubsublite.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PublisherServiceSettings publisherServiceSettings = + PublisherServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + PublisherServiceClient publisherServiceClient = + PublisherServiceClient.create(publisherServiceSettings); + } +} +// [END pubsublite_v1_generated_publisherserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/publish/AsyncPublish.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/publish/AsyncPublish.java new file mode 100644 index 000000000..c8e92cc9d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherserviceclient/publish/AsyncPublish.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_publisherserviceclient_publish_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.pubsublite.proto.PublishRequest; +import com.google.cloud.pubsublite.proto.PublishResponse; +import com.google.cloud.pubsublite.v1.PublisherServiceClient; + +public class AsyncPublish { + + public static void main(String[] args) throws Exception { + asyncPublish(); + } + + public static void asyncPublish() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PublisherServiceClient publisherServiceClient = PublisherServiceClient.create()) { + BidiStream bidiStream = + publisherServiceClient.publishCallable().call(); + PublishRequest request = PublishRequest.newBuilder().build(); + bidiStream.send(request); + for (PublishResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END pubsublite_v1_generated_publisherserviceclient_publish_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherservicesettings/publish/SyncPublish.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherservicesettings/publish/SyncPublish.java new file mode 100644 index 000000000..8779457fe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/publisherservicesettings/publish/SyncPublish.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_publisherservicesettings_publish_sync] +import com.google.cloud.pubsublite.v1.PublisherServiceSettings; +import java.time.Duration; + +public class SyncPublish { + + public static void main(String[] args) throws Exception { + syncPublish(); + } + + public static void syncPublish() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PublisherServiceSettings.Builder publisherServiceSettingsBuilder = + PublisherServiceSettings.newBuilder(); + publisherServiceSettingsBuilder + .publishSettings() + .setRetrySettings( + publisherServiceSettingsBuilder + .publishSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PublisherServiceSettings publisherServiceSettings = publisherServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_publisherservicesettings_publish_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/adminservicestubsettings/createtopic/SyncCreateTopic.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/adminservicestubsettings/createtopic/SyncCreateTopic.java new file mode 100644 index 000000000..48462b552 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/adminservicestubsettings/createtopic/SyncCreateTopic.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.stub.samples; + +// [START pubsublite_v1_generated_adminservicestubsettings_createtopic_sync] +import com.google.cloud.pubsublite.v1.stub.AdminServiceStubSettings; +import java.time.Duration; + +public class SyncCreateTopic { + + public static void main(String[] args) throws Exception { + syncCreateTopic(); + } + + public static void syncCreateTopic() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + AdminServiceStubSettings.Builder adminServiceSettingsBuilder = + AdminServiceStubSettings.newBuilder(); + adminServiceSettingsBuilder + .createTopicSettings() + .setRetrySettings( + adminServiceSettingsBuilder + .createTopicSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + AdminServiceStubSettings adminServiceSettings = adminServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_adminservicestubsettings_createtopic_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/cursorservicestubsettings/commitcursor/SyncCommitCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/cursorservicestubsettings/commitcursor/SyncCommitCursor.java new file mode 100644 index 000000000..0f57eb921 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/cursorservicestubsettings/commitcursor/SyncCommitCursor.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.stub.samples; + +// [START pubsublite_v1_generated_cursorservicestubsettings_commitcursor_sync] +import com.google.cloud.pubsublite.v1.stub.CursorServiceStubSettings; +import java.time.Duration; + +public class SyncCommitCursor { + + public static void main(String[] args) throws Exception { + syncCommitCursor(); + } + + public static void syncCommitCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CursorServiceStubSettings.Builder cursorServiceSettingsBuilder = + CursorServiceStubSettings.newBuilder(); + cursorServiceSettingsBuilder + .commitCursorSettings() + .setRetrySettings( + cursorServiceSettingsBuilder + .commitCursorSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CursorServiceStubSettings cursorServiceSettings = cursorServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_cursorservicestubsettings_commitcursor_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/partitionassignmentservicestubsettings/assignpartitions/SyncAssignPartitions.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/partitionassignmentservicestubsettings/assignpartitions/SyncAssignPartitions.java new file mode 100644 index 000000000..54085f56b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/partitionassignmentservicestubsettings/assignpartitions/SyncAssignPartitions.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.stub.samples; + +// [START pubsublite_v1_generated_partitionassignmentservicestubsettings_assignpartitions_sync] +import com.google.cloud.pubsublite.v1.stub.PartitionAssignmentServiceStubSettings; +import java.time.Duration; + +public class SyncAssignPartitions { + + public static void main(String[] args) throws Exception { + syncAssignPartitions(); + } + + public static void syncAssignPartitions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PartitionAssignmentServiceStubSettings.Builder partitionAssignmentServiceSettingsBuilder = + PartitionAssignmentServiceStubSettings.newBuilder(); + partitionAssignmentServiceSettingsBuilder + .assignPartitionsSettings() + .setRetrySettings( + partitionAssignmentServiceSettingsBuilder + .assignPartitionsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PartitionAssignmentServiceStubSettings partitionAssignmentServiceSettings = + partitionAssignmentServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_partitionassignmentservicestubsettings_assignpartitions_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/publisherservicestubsettings/publish/SyncPublish.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/publisherservicestubsettings/publish/SyncPublish.java new file mode 100644 index 000000000..b9c707aae --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/publisherservicestubsettings/publish/SyncPublish.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.stub.samples; + +// [START pubsublite_v1_generated_publisherservicestubsettings_publish_sync] +import com.google.cloud.pubsublite.v1.stub.PublisherServiceStubSettings; +import java.time.Duration; + +public class SyncPublish { + + public static void main(String[] args) throws Exception { + syncPublish(); + } + + public static void syncPublish() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PublisherServiceStubSettings.Builder publisherServiceSettingsBuilder = + PublisherServiceStubSettings.newBuilder(); + publisherServiceSettingsBuilder + .publishSettings() + .setRetrySettings( + publisherServiceSettingsBuilder + .publishSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PublisherServiceStubSettings publisherServiceSettings = publisherServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_publisherservicestubsettings_publish_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/subscriberservicestubsettings/subscribe/SyncSubscribe.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/subscriberservicestubsettings/subscribe/SyncSubscribe.java new file mode 100644 index 000000000..a22a52452 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/subscriberservicestubsettings/subscribe/SyncSubscribe.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.stub.samples; + +// [START pubsublite_v1_generated_subscriberservicestubsettings_subscribe_sync] +import com.google.cloud.pubsublite.v1.stub.SubscriberServiceStubSettings; +import java.time.Duration; + +public class SyncSubscribe { + + public static void main(String[] args) throws Exception { + syncSubscribe(); + } + + public static void syncSubscribe() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SubscriberServiceStubSettings.Builder subscriberServiceSettingsBuilder = + SubscriberServiceStubSettings.newBuilder(); + subscriberServiceSettingsBuilder + .subscribeSettings() + .setRetrySettings( + subscriberServiceSettingsBuilder + .subscribeSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SubscriberServiceStubSettings subscriberServiceSettings = + subscriberServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_subscriberservicestubsettings_subscribe_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/topicstatsservicestubsettings/computemessagestats/SyncComputeMessageStats.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/topicstatsservicestubsettings/computemessagestats/SyncComputeMessageStats.java new file mode 100644 index 000000000..ba44032b2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/stub/topicstatsservicestubsettings/computemessagestats/SyncComputeMessageStats.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.stub.samples; + +// [START pubsublite_v1_generated_topicstatsservicestubsettings_computemessagestats_sync] +import com.google.cloud.pubsublite.v1.stub.TopicStatsServiceStubSettings; +import java.time.Duration; + +public class SyncComputeMessageStats { + + public static void main(String[] args) throws Exception { + syncComputeMessageStats(); + } + + public static void syncComputeMessageStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + TopicStatsServiceStubSettings.Builder topicStatsServiceSettingsBuilder = + TopicStatsServiceStubSettings.newBuilder(); + topicStatsServiceSettingsBuilder + .computeMessageStatsSettings() + .setRetrySettings( + topicStatsServiceSettingsBuilder + .computeMessageStatsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TopicStatsServiceStubSettings topicStatsServiceSettings = + topicStatsServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_topicstatsservicestubsettings_computemessagestats_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000..9202fac50 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_subscriberserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.pubsublite.v1.SubscriberServiceClient; +import com.google.cloud.pubsublite.v1.SubscriberServiceSettings; +import com.google.cloud.pubsublite.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SubscriberServiceSettings subscriberServiceSettings = + SubscriberServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SubscriberServiceClient subscriberServiceClient = + SubscriberServiceClient.create(subscriberServiceSettings); + } +} +// [END pubsublite_v1_generated_subscriberserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000..b8ef09865 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_subscriberserviceclient_create_setendpoint_sync] +import com.google.cloud.pubsublite.v1.SubscriberServiceClient; +import com.google.cloud.pubsublite.v1.SubscriberServiceSettings; +import com.google.cloud.pubsublite.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SubscriberServiceSettings subscriberServiceSettings = + SubscriberServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + SubscriberServiceClient subscriberServiceClient = + SubscriberServiceClient.create(subscriberServiceSettings); + } +} +// [END pubsublite_v1_generated_subscriberserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/subscribe/AsyncSubscribe.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/subscribe/AsyncSubscribe.java new file mode 100644 index 000000000..e5fa87fed --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberserviceclient/subscribe/AsyncSubscribe.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_subscriberserviceclient_subscribe_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.pubsublite.proto.SubscribeRequest; +import com.google.cloud.pubsublite.proto.SubscribeResponse; +import com.google.cloud.pubsublite.v1.SubscriberServiceClient; + +public class AsyncSubscribe { + + public static void main(String[] args) throws Exception { + asyncSubscribe(); + } + + public static void asyncSubscribe() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (SubscriberServiceClient subscriberServiceClient = SubscriberServiceClient.create()) { + BidiStream bidiStream = + subscriberServiceClient.subscribeCallable().call(); + SubscribeRequest request = SubscribeRequest.newBuilder().build(); + bidiStream.send(request); + for (SubscribeResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END pubsublite_v1_generated_subscriberserviceclient_subscribe_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberservicesettings/subscribe/SyncSubscribe.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberservicesettings/subscribe/SyncSubscribe.java new file mode 100644 index 000000000..7fe79204f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/subscriberservicesettings/subscribe/SyncSubscribe.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_subscriberservicesettings_subscribe_sync] +import com.google.cloud.pubsublite.v1.SubscriberServiceSettings; +import java.time.Duration; + +public class SyncSubscribe { + + public static void main(String[] args) throws Exception { + syncSubscribe(); + } + + public static void syncSubscribe() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + SubscriberServiceSettings.Builder subscriberServiceSettingsBuilder = + SubscriberServiceSettings.newBuilder(); + subscriberServiceSettingsBuilder + .subscribeSettings() + .setRetrySettings( + subscriberServiceSettingsBuilder + .subscribeSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SubscriberServiceSettings subscriberServiceSettings = subscriberServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_subscriberservicesettings_subscribe_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computeheadcursor/AsyncComputeHeadCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computeheadcursor/AsyncComputeHeadCursor.java new file mode 100644 index 000000000..9de0dde5e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computeheadcursor/AsyncComputeHeadCursor.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_computeheadcursor_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ComputeHeadCursorRequest; +import com.google.cloud.pubsublite.proto.ComputeHeadCursorResponse; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; + +public class AsyncComputeHeadCursor { + + public static void main(String[] args) throws Exception { + asyncComputeHeadCursor(); + } + + public static void asyncComputeHeadCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (TopicStatsServiceClient topicStatsServiceClient = TopicStatsServiceClient.create()) { + ComputeHeadCursorRequest request = + ComputeHeadCursorRequest.newBuilder() + .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPartition(-1799810326) + .build(); + ApiFuture future = + topicStatsServiceClient.computeHeadCursorCallable().futureCall(request); + // Do something. + ComputeHeadCursorResponse response = future.get(); + } + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_computeheadcursor_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computeheadcursor/SyncComputeHeadCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computeheadcursor/SyncComputeHeadCursor.java new file mode 100644 index 000000000..7b69b1a2d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computeheadcursor/SyncComputeHeadCursor.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_computeheadcursor_sync] +import com.google.cloud.pubsublite.proto.ComputeHeadCursorRequest; +import com.google.cloud.pubsublite.proto.ComputeHeadCursorResponse; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; + +public class SyncComputeHeadCursor { + + public static void main(String[] args) throws Exception { + syncComputeHeadCursor(); + } + + public static void syncComputeHeadCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (TopicStatsServiceClient topicStatsServiceClient = TopicStatsServiceClient.create()) { + ComputeHeadCursorRequest request = + ComputeHeadCursorRequest.newBuilder() + .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPartition(-1799810326) + .build(); + ComputeHeadCursorResponse response = topicStatsServiceClient.computeHeadCursor(request); + } + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_computeheadcursor_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computemessagestats/AsyncComputeMessageStats.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computemessagestats/AsyncComputeMessageStats.java new file mode 100644 index 000000000..61bbdbdea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computemessagestats/AsyncComputeMessageStats.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_computemessagestats_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ComputeMessageStatsRequest; +import com.google.cloud.pubsublite.proto.ComputeMessageStatsResponse; +import com.google.cloud.pubsublite.proto.Cursor; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; + +public class AsyncComputeMessageStats { + + public static void main(String[] args) throws Exception { + asyncComputeMessageStats(); + } + + public static void asyncComputeMessageStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (TopicStatsServiceClient topicStatsServiceClient = TopicStatsServiceClient.create()) { + ComputeMessageStatsRequest request = + ComputeMessageStatsRequest.newBuilder() + .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPartition(-1799810326) + .setStartCursor(Cursor.newBuilder().build()) + .setEndCursor(Cursor.newBuilder().build()) + .build(); + ApiFuture future = + topicStatsServiceClient.computeMessageStatsCallable().futureCall(request); + // Do something. + ComputeMessageStatsResponse response = future.get(); + } + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_computemessagestats_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computemessagestats/SyncComputeMessageStats.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computemessagestats/SyncComputeMessageStats.java new file mode 100644 index 000000000..ceac9ea14 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computemessagestats/SyncComputeMessageStats.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_computemessagestats_sync] +import com.google.cloud.pubsublite.proto.ComputeMessageStatsRequest; +import com.google.cloud.pubsublite.proto.ComputeMessageStatsResponse; +import com.google.cloud.pubsublite.proto.Cursor; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; + +public class SyncComputeMessageStats { + + public static void main(String[] args) throws Exception { + syncComputeMessageStats(); + } + + public static void syncComputeMessageStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (TopicStatsServiceClient topicStatsServiceClient = TopicStatsServiceClient.create()) { + ComputeMessageStatsRequest request = + ComputeMessageStatsRequest.newBuilder() + .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPartition(-1799810326) + .setStartCursor(Cursor.newBuilder().build()) + .setEndCursor(Cursor.newBuilder().build()) + .build(); + ComputeMessageStatsResponse response = topicStatsServiceClient.computeMessageStats(request); + } + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_computemessagestats_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computetimecursor/AsyncComputeTimeCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computetimecursor/AsyncComputeTimeCursor.java new file mode 100644 index 000000000..2dafc68b8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computetimecursor/AsyncComputeTimeCursor.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_computetimecursor_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.pubsublite.proto.ComputeTimeCursorRequest; +import com.google.cloud.pubsublite.proto.ComputeTimeCursorResponse; +import com.google.cloud.pubsublite.proto.TimeTarget; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; + +public class AsyncComputeTimeCursor { + + public static void main(String[] args) throws Exception { + asyncComputeTimeCursor(); + } + + public static void asyncComputeTimeCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (TopicStatsServiceClient topicStatsServiceClient = TopicStatsServiceClient.create()) { + ComputeTimeCursorRequest request = + ComputeTimeCursorRequest.newBuilder() + .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPartition(-1799810326) + .setTarget(TimeTarget.newBuilder().build()) + .build(); + ApiFuture future = + topicStatsServiceClient.computeTimeCursorCallable().futureCall(request); + // Do something. + ComputeTimeCursorResponse response = future.get(); + } + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_computetimecursor_async] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computetimecursor/SyncComputeTimeCursor.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computetimecursor/SyncComputeTimeCursor.java new file mode 100644 index 000000000..94c1ef2a7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/computetimecursor/SyncComputeTimeCursor.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_computetimecursor_sync] +import com.google.cloud.pubsublite.proto.ComputeTimeCursorRequest; +import com.google.cloud.pubsublite.proto.ComputeTimeCursorResponse; +import com.google.cloud.pubsublite.proto.TimeTarget; +import com.google.cloud.pubsublite.proto.TopicName; +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; + +public class SyncComputeTimeCursor { + + public static void main(String[] args) throws Exception { + syncComputeTimeCursor(); + } + + public static void syncComputeTimeCursor() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (TopicStatsServiceClient topicStatsServiceClient = TopicStatsServiceClient.create()) { + ComputeTimeCursorRequest request = + ComputeTimeCursorRequest.newBuilder() + .setTopic(TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString()) + .setPartition(-1799810326) + .setTarget(TimeTarget.newBuilder().build()) + .build(); + ComputeTimeCursorResponse response = topicStatsServiceClient.computeTimeCursor(request); + } + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_computetimecursor_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000..8257bab23 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; +import com.google.cloud.pubsublite.v1.TopicStatsServiceSettings; +import com.google.cloud.pubsublite.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + TopicStatsServiceSettings topicStatsServiceSettings = + TopicStatsServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + TopicStatsServiceClient topicStatsServiceClient = + TopicStatsServiceClient.create(topicStatsServiceSettings); + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000..c82f6b3f4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsserviceclient_create_setendpoint_sync] +import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; +import com.google.cloud.pubsublite.v1.TopicStatsServiceSettings; +import com.google.cloud.pubsublite.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + TopicStatsServiceSettings topicStatsServiceSettings = + TopicStatsServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + TopicStatsServiceClient topicStatsServiceClient = + TopicStatsServiceClient.create(topicStatsServiceSettings); + } +} +// [END pubsublite_v1_generated_topicstatsserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsservicesettings/computemessagestats/SyncComputeMessageStats.java b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsservicesettings/computemessagestats/SyncComputeMessageStats.java new file mode 100644 index 000000000..1c0721816 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/pubsublite/v1/topicstatsservicesettings/computemessagestats/SyncComputeMessageStats.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.pubsublite.v1.samples; + +// [START pubsublite_v1_generated_topicstatsservicesettings_computemessagestats_sync] +import com.google.cloud.pubsublite.v1.TopicStatsServiceSettings; +import java.time.Duration; + +public class SyncComputeMessageStats { + + public static void main(String[] args) throws Exception { + syncComputeMessageStats(); + } + + public static void syncComputeMessageStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + TopicStatsServiceSettings.Builder topicStatsServiceSettingsBuilder = + TopicStatsServiceSettings.newBuilder(); + topicStatsServiceSettingsBuilder + .computeMessageStatsSettings() + .setRetrySettings( + topicStatsServiceSettingsBuilder + .computeMessageStatsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TopicStatsServiceSettings topicStatsServiceSettings = topicStatsServiceSettingsBuilder.build(); + } +} +// [END pubsublite_v1_generated_topicstatsservicesettings_computemessagestats_sync]