• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 // Generated by the protocol buffer compiler.  DO NOT EDIT!
17 // source: google/cloud/compute/v1/compute.proto
18 
19 package com.google.cloud.compute.v1;
20 
21 /**
22  *
23  *
24  * <pre>
25  * </pre>
26  *
27  * Protobuf type {@code google.cloud.compute.v1.Allowed}
28  */
29 public final class Allowed extends com.google.protobuf.GeneratedMessageV3
30     implements
31     // @@protoc_insertion_point(message_implements:google.cloud.compute.v1.Allowed)
32     AllowedOrBuilder {
33   private static final long serialVersionUID = 0L;
34   // Use Allowed.newBuilder() to construct.
Allowed(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)35   private Allowed(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
36     super(builder);
37   }
38 
Allowed()39   private Allowed() {
40     iPProtocol_ = "";
41     ports_ = com.google.protobuf.LazyStringArrayList.EMPTY;
42   }
43 
44   @java.lang.Override
45   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)46   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
47     return new Allowed();
48   }
49 
50   @java.lang.Override
getUnknownFields()51   public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
52     return this.unknownFields;
53   }
54 
getDescriptor()55   public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
56     return com.google.cloud.compute.v1.Compute
57         .internal_static_google_cloud_compute_v1_Allowed_descriptor;
58   }
59 
60   @java.lang.Override
61   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()62       internalGetFieldAccessorTable() {
63     return com.google.cloud.compute.v1.Compute
64         .internal_static_google_cloud_compute_v1_Allowed_fieldAccessorTable
65         .ensureFieldAccessorsInitialized(
66             com.google.cloud.compute.v1.Allowed.class,
67             com.google.cloud.compute.v1.Allowed.Builder.class);
68   }
69 
70   private int bitField0_;
71   public static final int I_P_PROTOCOL_FIELD_NUMBER = 488094525;
72 
73   @SuppressWarnings("serial")
74   private volatile java.lang.Object iPProtocol_ = "";
75   /**
76    *
77    *
78    * <pre>
79    * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
80    * </pre>
81    *
82    * <code>optional string I_p_protocol = 488094525;</code>
83    *
84    * @return Whether the iPProtocol field is set.
85    */
86   @java.lang.Override
hasIPProtocol()87   public boolean hasIPProtocol() {
88     return ((bitField0_ & 0x00000001) != 0);
89   }
90   /**
91    *
92    *
93    * <pre>
94    * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
95    * </pre>
96    *
97    * <code>optional string I_p_protocol = 488094525;</code>
98    *
99    * @return The iPProtocol.
100    */
101   @java.lang.Override
getIPProtocol()102   public java.lang.String getIPProtocol() {
103     java.lang.Object ref = iPProtocol_;
104     if (ref instanceof java.lang.String) {
105       return (java.lang.String) ref;
106     } else {
107       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
108       java.lang.String s = bs.toStringUtf8();
109       iPProtocol_ = s;
110       return s;
111     }
112   }
113   /**
114    *
115    *
116    * <pre>
117    * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
118    * </pre>
119    *
120    * <code>optional string I_p_protocol = 488094525;</code>
121    *
122    * @return The bytes for iPProtocol.
123    */
124   @java.lang.Override
getIPProtocolBytes()125   public com.google.protobuf.ByteString getIPProtocolBytes() {
126     java.lang.Object ref = iPProtocol_;
127     if (ref instanceof java.lang.String) {
128       com.google.protobuf.ByteString b =
129           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
130       iPProtocol_ = b;
131       return b;
132     } else {
133       return (com.google.protobuf.ByteString) ref;
134     }
135   }
136 
137   public static final int PORTS_FIELD_NUMBER = 106854418;
138 
139   @SuppressWarnings("serial")
140   private com.google.protobuf.LazyStringList ports_;
141   /**
142    *
143    *
144    * <pre>
145    * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
146    * </pre>
147    *
148    * <code>repeated string ports = 106854418;</code>
149    *
150    * @return A list containing the ports.
151    */
getPortsList()152   public com.google.protobuf.ProtocolStringList getPortsList() {
153     return ports_;
154   }
155   /**
156    *
157    *
158    * <pre>
159    * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
160    * </pre>
161    *
162    * <code>repeated string ports = 106854418;</code>
163    *
164    * @return The count of ports.
165    */
getPortsCount()166   public int getPortsCount() {
167     return ports_.size();
168   }
169   /**
170    *
171    *
172    * <pre>
173    * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
174    * </pre>
175    *
176    * <code>repeated string ports = 106854418;</code>
177    *
178    * @param index The index of the element to return.
179    * @return The ports at the given index.
180    */
getPorts(int index)181   public java.lang.String getPorts(int index) {
182     return ports_.get(index);
183   }
184   /**
185    *
186    *
187    * <pre>
188    * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
189    * </pre>
190    *
191    * <code>repeated string ports = 106854418;</code>
192    *
193    * @param index The index of the value to return.
194    * @return The bytes of the ports at the given index.
195    */
getPortsBytes(int index)196   public com.google.protobuf.ByteString getPortsBytes(int index) {
197     return ports_.getByteString(index);
198   }
199 
200   private byte memoizedIsInitialized = -1;
201 
202   @java.lang.Override
isInitialized()203   public final boolean isInitialized() {
204     byte isInitialized = memoizedIsInitialized;
205     if (isInitialized == 1) return true;
206     if (isInitialized == 0) return false;
207 
208     memoizedIsInitialized = 1;
209     return true;
210   }
211 
212   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)213   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
214     for (int i = 0; i < ports_.size(); i++) {
215       com.google.protobuf.GeneratedMessageV3.writeString(output, 106854418, ports_.getRaw(i));
216     }
217     if (((bitField0_ & 0x00000001) != 0)) {
218       com.google.protobuf.GeneratedMessageV3.writeString(output, 488094525, iPProtocol_);
219     }
220     getUnknownFields().writeTo(output);
221   }
222 
223   @java.lang.Override
getSerializedSize()224   public int getSerializedSize() {
225     int size = memoizedSize;
226     if (size != -1) return size;
227 
228     size = 0;
229     {
230       int dataSize = 0;
231       for (int i = 0; i < ports_.size(); i++) {
232         dataSize += computeStringSizeNoTag(ports_.getRaw(i));
233       }
234       size += dataSize;
235       size += 5 * getPortsList().size();
236     }
237     if (((bitField0_ & 0x00000001) != 0)) {
238       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(488094525, iPProtocol_);
239     }
240     size += getUnknownFields().getSerializedSize();
241     memoizedSize = size;
242     return size;
243   }
244 
245   @java.lang.Override
equals(final java.lang.Object obj)246   public boolean equals(final java.lang.Object obj) {
247     if (obj == this) {
248       return true;
249     }
250     if (!(obj instanceof com.google.cloud.compute.v1.Allowed)) {
251       return super.equals(obj);
252     }
253     com.google.cloud.compute.v1.Allowed other = (com.google.cloud.compute.v1.Allowed) obj;
254 
255     if (hasIPProtocol() != other.hasIPProtocol()) return false;
256     if (hasIPProtocol()) {
257       if (!getIPProtocol().equals(other.getIPProtocol())) return false;
258     }
259     if (!getPortsList().equals(other.getPortsList())) return false;
260     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
261     return true;
262   }
263 
264   @java.lang.Override
hashCode()265   public int hashCode() {
266     if (memoizedHashCode != 0) {
267       return memoizedHashCode;
268     }
269     int hash = 41;
270     hash = (19 * hash) + getDescriptor().hashCode();
271     if (hasIPProtocol()) {
272       hash = (37 * hash) + I_P_PROTOCOL_FIELD_NUMBER;
273       hash = (53 * hash) + getIPProtocol().hashCode();
274     }
275     if (getPortsCount() > 0) {
276       hash = (37 * hash) + PORTS_FIELD_NUMBER;
277       hash = (53 * hash) + getPortsList().hashCode();
278     }
279     hash = (29 * hash) + getUnknownFields().hashCode();
280     memoizedHashCode = hash;
281     return hash;
282   }
283 
parseFrom(java.nio.ByteBuffer data)284   public static com.google.cloud.compute.v1.Allowed parseFrom(java.nio.ByteBuffer data)
285       throws com.google.protobuf.InvalidProtocolBufferException {
286     return PARSER.parseFrom(data);
287   }
288 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)289   public static com.google.cloud.compute.v1.Allowed parseFrom(
290       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
291       throws com.google.protobuf.InvalidProtocolBufferException {
292     return PARSER.parseFrom(data, extensionRegistry);
293   }
294 
parseFrom(com.google.protobuf.ByteString data)295   public static com.google.cloud.compute.v1.Allowed parseFrom(com.google.protobuf.ByteString data)
296       throws com.google.protobuf.InvalidProtocolBufferException {
297     return PARSER.parseFrom(data);
298   }
299 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)300   public static com.google.cloud.compute.v1.Allowed parseFrom(
301       com.google.protobuf.ByteString data,
302       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
303       throws com.google.protobuf.InvalidProtocolBufferException {
304     return PARSER.parseFrom(data, extensionRegistry);
305   }
306 
parseFrom(byte[] data)307   public static com.google.cloud.compute.v1.Allowed parseFrom(byte[] data)
308       throws com.google.protobuf.InvalidProtocolBufferException {
309     return PARSER.parseFrom(data);
310   }
311 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)312   public static com.google.cloud.compute.v1.Allowed parseFrom(
313       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
314       throws com.google.protobuf.InvalidProtocolBufferException {
315     return PARSER.parseFrom(data, extensionRegistry);
316   }
317 
parseFrom(java.io.InputStream input)318   public static com.google.cloud.compute.v1.Allowed parseFrom(java.io.InputStream input)
319       throws java.io.IOException {
320     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
321   }
322 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)323   public static com.google.cloud.compute.v1.Allowed parseFrom(
324       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
325       throws java.io.IOException {
326     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
327         PARSER, input, extensionRegistry);
328   }
329 
parseDelimitedFrom(java.io.InputStream input)330   public static com.google.cloud.compute.v1.Allowed parseDelimitedFrom(java.io.InputStream input)
331       throws java.io.IOException {
332     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
333   }
334 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)335   public static com.google.cloud.compute.v1.Allowed parseDelimitedFrom(
336       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
337       throws java.io.IOException {
338     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
339         PARSER, input, extensionRegistry);
340   }
341 
parseFrom( com.google.protobuf.CodedInputStream input)342   public static com.google.cloud.compute.v1.Allowed parseFrom(
343       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
344     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
345   }
346 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)347   public static com.google.cloud.compute.v1.Allowed parseFrom(
348       com.google.protobuf.CodedInputStream input,
349       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
350       throws java.io.IOException {
351     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
352         PARSER, input, extensionRegistry);
353   }
354 
355   @java.lang.Override
newBuilderForType()356   public Builder newBuilderForType() {
357     return newBuilder();
358   }
359 
newBuilder()360   public static Builder newBuilder() {
361     return DEFAULT_INSTANCE.toBuilder();
362   }
363 
newBuilder(com.google.cloud.compute.v1.Allowed prototype)364   public static Builder newBuilder(com.google.cloud.compute.v1.Allowed prototype) {
365     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
366   }
367 
368   @java.lang.Override
toBuilder()369   public Builder toBuilder() {
370     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
371   }
372 
373   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)374   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
375     Builder builder = new Builder(parent);
376     return builder;
377   }
378   /**
379    *
380    *
381    * <pre>
382    * </pre>
383    *
384    * Protobuf type {@code google.cloud.compute.v1.Allowed}
385    */
386   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
387       implements
388       // @@protoc_insertion_point(builder_implements:google.cloud.compute.v1.Allowed)
389       com.google.cloud.compute.v1.AllowedOrBuilder {
getDescriptor()390     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
391       return com.google.cloud.compute.v1.Compute
392           .internal_static_google_cloud_compute_v1_Allowed_descriptor;
393     }
394 
395     @java.lang.Override
396     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()397         internalGetFieldAccessorTable() {
398       return com.google.cloud.compute.v1.Compute
399           .internal_static_google_cloud_compute_v1_Allowed_fieldAccessorTable
400           .ensureFieldAccessorsInitialized(
401               com.google.cloud.compute.v1.Allowed.class,
402               com.google.cloud.compute.v1.Allowed.Builder.class);
403     }
404 
405     // Construct using com.google.cloud.compute.v1.Allowed.newBuilder()
Builder()406     private Builder() {}
407 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)408     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
409       super(parent);
410     }
411 
412     @java.lang.Override
clear()413     public Builder clear() {
414       super.clear();
415       bitField0_ = 0;
416       iPProtocol_ = "";
417       ports_ = com.google.protobuf.LazyStringArrayList.EMPTY;
418       bitField0_ = (bitField0_ & ~0x00000002);
419       return this;
420     }
421 
422     @java.lang.Override
getDescriptorForType()423     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
424       return com.google.cloud.compute.v1.Compute
425           .internal_static_google_cloud_compute_v1_Allowed_descriptor;
426     }
427 
428     @java.lang.Override
getDefaultInstanceForType()429     public com.google.cloud.compute.v1.Allowed getDefaultInstanceForType() {
430       return com.google.cloud.compute.v1.Allowed.getDefaultInstance();
431     }
432 
433     @java.lang.Override
build()434     public com.google.cloud.compute.v1.Allowed build() {
435       com.google.cloud.compute.v1.Allowed result = buildPartial();
436       if (!result.isInitialized()) {
437         throw newUninitializedMessageException(result);
438       }
439       return result;
440     }
441 
442     @java.lang.Override
buildPartial()443     public com.google.cloud.compute.v1.Allowed buildPartial() {
444       com.google.cloud.compute.v1.Allowed result = new com.google.cloud.compute.v1.Allowed(this);
445       buildPartialRepeatedFields(result);
446       if (bitField0_ != 0) {
447         buildPartial0(result);
448       }
449       onBuilt();
450       return result;
451     }
452 
buildPartialRepeatedFields(com.google.cloud.compute.v1.Allowed result)453     private void buildPartialRepeatedFields(com.google.cloud.compute.v1.Allowed result) {
454       if (((bitField0_ & 0x00000002) != 0)) {
455         ports_ = ports_.getUnmodifiableView();
456         bitField0_ = (bitField0_ & ~0x00000002);
457       }
458       result.ports_ = ports_;
459     }
460 
buildPartial0(com.google.cloud.compute.v1.Allowed result)461     private void buildPartial0(com.google.cloud.compute.v1.Allowed result) {
462       int from_bitField0_ = bitField0_;
463       int to_bitField0_ = 0;
464       if (((from_bitField0_ & 0x00000001) != 0)) {
465         result.iPProtocol_ = iPProtocol_;
466         to_bitField0_ |= 0x00000001;
467       }
468       result.bitField0_ |= to_bitField0_;
469     }
470 
471     @java.lang.Override
clone()472     public Builder clone() {
473       return super.clone();
474     }
475 
476     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)477     public Builder setField(
478         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
479       return super.setField(field, value);
480     }
481 
482     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)483     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
484       return super.clearField(field);
485     }
486 
487     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)488     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
489       return super.clearOneof(oneof);
490     }
491 
492     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)493     public Builder setRepeatedField(
494         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
495       return super.setRepeatedField(field, index, value);
496     }
497 
498     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)499     public Builder addRepeatedField(
500         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
501       return super.addRepeatedField(field, value);
502     }
503 
504     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)505     public Builder mergeFrom(com.google.protobuf.Message other) {
506       if (other instanceof com.google.cloud.compute.v1.Allowed) {
507         return mergeFrom((com.google.cloud.compute.v1.Allowed) other);
508       } else {
509         super.mergeFrom(other);
510         return this;
511       }
512     }
513 
mergeFrom(com.google.cloud.compute.v1.Allowed other)514     public Builder mergeFrom(com.google.cloud.compute.v1.Allowed other) {
515       if (other == com.google.cloud.compute.v1.Allowed.getDefaultInstance()) return this;
516       if (other.hasIPProtocol()) {
517         iPProtocol_ = other.iPProtocol_;
518         bitField0_ |= 0x00000001;
519         onChanged();
520       }
521       if (!other.ports_.isEmpty()) {
522         if (ports_.isEmpty()) {
523           ports_ = other.ports_;
524           bitField0_ = (bitField0_ & ~0x00000002);
525         } else {
526           ensurePortsIsMutable();
527           ports_.addAll(other.ports_);
528         }
529         onChanged();
530       }
531       this.mergeUnknownFields(other.getUnknownFields());
532       onChanged();
533       return this;
534     }
535 
536     @java.lang.Override
isInitialized()537     public final boolean isInitialized() {
538       return true;
539     }
540 
541     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)542     public Builder mergeFrom(
543         com.google.protobuf.CodedInputStream input,
544         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
545         throws java.io.IOException {
546       if (extensionRegistry == null) {
547         throw new java.lang.NullPointerException();
548       }
549       try {
550         boolean done = false;
551         while (!done) {
552           int tag = input.readTag();
553           switch (tag) {
554             case 0:
555               done = true;
556               break;
557             case 854835346:
558               {
559                 java.lang.String s = input.readStringRequireUtf8();
560                 ensurePortsIsMutable();
561                 ports_.add(s);
562                 break;
563               } // case 854835346
564             case -390211094:
565               {
566                 iPProtocol_ = input.readStringRequireUtf8();
567                 bitField0_ |= 0x00000001;
568                 break;
569               } // case -390211094
570             default:
571               {
572                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
573                   done = true; // was an endgroup tag
574                 }
575                 break;
576               } // default:
577           } // switch (tag)
578         } // while (!done)
579       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
580         throw e.unwrapIOException();
581       } finally {
582         onChanged();
583       } // finally
584       return this;
585     }
586 
587     private int bitField0_;
588 
589     private java.lang.Object iPProtocol_ = "";
590     /**
591      *
592      *
593      * <pre>
594      * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
595      * </pre>
596      *
597      * <code>optional string I_p_protocol = 488094525;</code>
598      *
599      * @return Whether the iPProtocol field is set.
600      */
hasIPProtocol()601     public boolean hasIPProtocol() {
602       return ((bitField0_ & 0x00000001) != 0);
603     }
604     /**
605      *
606      *
607      * <pre>
608      * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
609      * </pre>
610      *
611      * <code>optional string I_p_protocol = 488094525;</code>
612      *
613      * @return The iPProtocol.
614      */
getIPProtocol()615     public java.lang.String getIPProtocol() {
616       java.lang.Object ref = iPProtocol_;
617       if (!(ref instanceof java.lang.String)) {
618         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
619         java.lang.String s = bs.toStringUtf8();
620         iPProtocol_ = s;
621         return s;
622       } else {
623         return (java.lang.String) ref;
624       }
625     }
626     /**
627      *
628      *
629      * <pre>
630      * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
631      * </pre>
632      *
633      * <code>optional string I_p_protocol = 488094525;</code>
634      *
635      * @return The bytes for iPProtocol.
636      */
getIPProtocolBytes()637     public com.google.protobuf.ByteString getIPProtocolBytes() {
638       java.lang.Object ref = iPProtocol_;
639       if (ref instanceof String) {
640         com.google.protobuf.ByteString b =
641             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
642         iPProtocol_ = b;
643         return b;
644       } else {
645         return (com.google.protobuf.ByteString) ref;
646       }
647     }
648     /**
649      *
650      *
651      * <pre>
652      * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
653      * </pre>
654      *
655      * <code>optional string I_p_protocol = 488094525;</code>
656      *
657      * @param value The iPProtocol to set.
658      * @return This builder for chaining.
659      */
setIPProtocol(java.lang.String value)660     public Builder setIPProtocol(java.lang.String value) {
661       if (value == null) {
662         throw new NullPointerException();
663       }
664       iPProtocol_ = value;
665       bitField0_ |= 0x00000001;
666       onChanged();
667       return this;
668     }
669     /**
670      *
671      *
672      * <pre>
673      * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
674      * </pre>
675      *
676      * <code>optional string I_p_protocol = 488094525;</code>
677      *
678      * @return This builder for chaining.
679      */
clearIPProtocol()680     public Builder clearIPProtocol() {
681       iPProtocol_ = getDefaultInstance().getIPProtocol();
682       bitField0_ = (bitField0_ & ~0x00000001);
683       onChanged();
684       return this;
685     }
686     /**
687      *
688      *
689      * <pre>
690      * The IP protocol to which this rule applies. The protocol type is required when creating a firewall rule. This value can either be one of the following well known protocol strings (tcp, udp, icmp, esp, ah, ipip, sctp) or the IP protocol number.
691      * </pre>
692      *
693      * <code>optional string I_p_protocol = 488094525;</code>
694      *
695      * @param value The bytes for iPProtocol to set.
696      * @return This builder for chaining.
697      */
setIPProtocolBytes(com.google.protobuf.ByteString value)698     public Builder setIPProtocolBytes(com.google.protobuf.ByteString value) {
699       if (value == null) {
700         throw new NullPointerException();
701       }
702       checkByteStringIsUtf8(value);
703       iPProtocol_ = value;
704       bitField0_ |= 0x00000001;
705       onChanged();
706       return this;
707     }
708 
709     private com.google.protobuf.LazyStringList ports_ =
710         com.google.protobuf.LazyStringArrayList.EMPTY;
711 
ensurePortsIsMutable()712     private void ensurePortsIsMutable() {
713       if (!((bitField0_ & 0x00000002) != 0)) {
714         ports_ = new com.google.protobuf.LazyStringArrayList(ports_);
715         bitField0_ |= 0x00000002;
716       }
717     }
718     /**
719      *
720      *
721      * <pre>
722      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
723      * </pre>
724      *
725      * <code>repeated string ports = 106854418;</code>
726      *
727      * @return A list containing the ports.
728      */
getPortsList()729     public com.google.protobuf.ProtocolStringList getPortsList() {
730       return ports_.getUnmodifiableView();
731     }
732     /**
733      *
734      *
735      * <pre>
736      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
737      * </pre>
738      *
739      * <code>repeated string ports = 106854418;</code>
740      *
741      * @return The count of ports.
742      */
getPortsCount()743     public int getPortsCount() {
744       return ports_.size();
745     }
746     /**
747      *
748      *
749      * <pre>
750      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
751      * </pre>
752      *
753      * <code>repeated string ports = 106854418;</code>
754      *
755      * @param index The index of the element to return.
756      * @return The ports at the given index.
757      */
getPorts(int index)758     public java.lang.String getPorts(int index) {
759       return ports_.get(index);
760     }
761     /**
762      *
763      *
764      * <pre>
765      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
766      * </pre>
767      *
768      * <code>repeated string ports = 106854418;</code>
769      *
770      * @param index The index of the value to return.
771      * @return The bytes of the ports at the given index.
772      */
getPortsBytes(int index)773     public com.google.protobuf.ByteString getPortsBytes(int index) {
774       return ports_.getByteString(index);
775     }
776     /**
777      *
778      *
779      * <pre>
780      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
781      * </pre>
782      *
783      * <code>repeated string ports = 106854418;</code>
784      *
785      * @param index The index to set the value at.
786      * @param value The ports to set.
787      * @return This builder for chaining.
788      */
setPorts(int index, java.lang.String value)789     public Builder setPorts(int index, java.lang.String value) {
790       if (value == null) {
791         throw new NullPointerException();
792       }
793       ensurePortsIsMutable();
794       ports_.set(index, value);
795       onChanged();
796       return this;
797     }
798     /**
799      *
800      *
801      * <pre>
802      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
803      * </pre>
804      *
805      * <code>repeated string ports = 106854418;</code>
806      *
807      * @param value The ports to add.
808      * @return This builder for chaining.
809      */
addPorts(java.lang.String value)810     public Builder addPorts(java.lang.String value) {
811       if (value == null) {
812         throw new NullPointerException();
813       }
814       ensurePortsIsMutable();
815       ports_.add(value);
816       onChanged();
817       return this;
818     }
819     /**
820      *
821      *
822      * <pre>
823      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
824      * </pre>
825      *
826      * <code>repeated string ports = 106854418;</code>
827      *
828      * @param values The ports to add.
829      * @return This builder for chaining.
830      */
addAllPorts(java.lang.Iterable<java.lang.String> values)831     public Builder addAllPorts(java.lang.Iterable<java.lang.String> values) {
832       ensurePortsIsMutable();
833       com.google.protobuf.AbstractMessageLite.Builder.addAll(values, ports_);
834       onChanged();
835       return this;
836     }
837     /**
838      *
839      *
840      * <pre>
841      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
842      * </pre>
843      *
844      * <code>repeated string ports = 106854418;</code>
845      *
846      * @return This builder for chaining.
847      */
clearPorts()848     public Builder clearPorts() {
849       ports_ = com.google.protobuf.LazyStringArrayList.EMPTY;
850       bitField0_ = (bitField0_ & ~0x00000002);
851       onChanged();
852       return this;
853     }
854     /**
855      *
856      *
857      * <pre>
858      * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"].
859      * </pre>
860      *
861      * <code>repeated string ports = 106854418;</code>
862      *
863      * @param value The bytes of the ports to add.
864      * @return This builder for chaining.
865      */
addPortsBytes(com.google.protobuf.ByteString value)866     public Builder addPortsBytes(com.google.protobuf.ByteString value) {
867       if (value == null) {
868         throw new NullPointerException();
869       }
870       checkByteStringIsUtf8(value);
871       ensurePortsIsMutable();
872       ports_.add(value);
873       onChanged();
874       return this;
875     }
876 
877     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)878     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
879       return super.setUnknownFields(unknownFields);
880     }
881 
882     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)883     public final Builder mergeUnknownFields(
884         final com.google.protobuf.UnknownFieldSet unknownFields) {
885       return super.mergeUnknownFields(unknownFields);
886     }
887 
888     // @@protoc_insertion_point(builder_scope:google.cloud.compute.v1.Allowed)
889   }
890 
891   // @@protoc_insertion_point(class_scope:google.cloud.compute.v1.Allowed)
892   private static final com.google.cloud.compute.v1.Allowed DEFAULT_INSTANCE;
893 
894   static {
895     DEFAULT_INSTANCE = new com.google.cloud.compute.v1.Allowed();
896   }
897 
getDefaultInstance()898   public static com.google.cloud.compute.v1.Allowed getDefaultInstance() {
899     return DEFAULT_INSTANCE;
900   }
901 
902   private static final com.google.protobuf.Parser<Allowed> PARSER =
903       new com.google.protobuf.AbstractParser<Allowed>() {
904         @java.lang.Override
905         public Allowed parsePartialFrom(
906             com.google.protobuf.CodedInputStream input,
907             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
908             throws com.google.protobuf.InvalidProtocolBufferException {
909           Builder builder = newBuilder();
910           try {
911             builder.mergeFrom(input, extensionRegistry);
912           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
913             throw e.setUnfinishedMessage(builder.buildPartial());
914           } catch (com.google.protobuf.UninitializedMessageException e) {
915             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
916           } catch (java.io.IOException e) {
917             throw new com.google.protobuf.InvalidProtocolBufferException(e)
918                 .setUnfinishedMessage(builder.buildPartial());
919           }
920           return builder.buildPartial();
921         }
922       };
923 
parser()924   public static com.google.protobuf.Parser<Allowed> parser() {
925     return PARSER;
926   }
927 
928   @java.lang.Override
getParserForType()929   public com.google.protobuf.Parser<Allowed> getParserForType() {
930     return PARSER;
931   }
932 
933   @java.lang.Override
getDefaultInstanceForType()934   public com.google.cloud.compute.v1.Allowed getDefaultInstanceForType() {
935     return DEFAULT_INSTANCE;
936   }
937 }
938