1# Copyright 2016 Google LLC. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# Generated by the protocol buffer compiler.  DO NOT EDIT!
15# source: storage/onestore/v3/snapshot.proto
16
17from googlecloudsdk.third_party.appengine.proto import ProtocolBuffer
18import abc
19import array
20try:
21  from thread import allocate_lock as _Lock
22except ImportError:
23  from threading import Lock as _Lock
24
25if hasattr(__builtins__, 'xrange'): range = xrange
26
27if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):
28  _extension_runtime = True
29  _ExtendableProtocolMessage = ProtocolBuffer.ExtendableProtocolMessage
30else:
31  _extension_runtime = False
32  _ExtendableProtocolMessage = ProtocolBuffer.ProtocolMessage
33
34class Snapshot(ProtocolBuffer.ProtocolMessage):
35
36  # Status values
37  INACTIVE     =    0
38  ACTIVE       =    1
39
40  _Status_NAMES = {
41    0: "INACTIVE",
42    1: "ACTIVE",
43  }
44
45  def Status_Name(cls, x): return cls._Status_NAMES.get(x, "")
46  Status_Name = classmethod(Status_Name)
47
48  has_ts_ = 0
49  ts_ = 0
50
51  def __init__(self, contents=None):
52    if contents is not None: self.MergeFromString(contents)
53
54  def ts(self): return self.ts_
55
56  def set_ts(self, x):
57    self.has_ts_ = 1
58    self.ts_ = x
59
60  def clear_ts(self):
61    if self.has_ts_:
62      self.has_ts_ = 0
63      self.ts_ = 0
64
65  def has_ts(self): return self.has_ts_
66
67
68  def MergeFrom(self, x):
69    assert x is not self
70    if (x.has_ts()): self.set_ts(x.ts())
71
72  def Equals(self, x):
73    if x is self: return 1
74    if self.has_ts_ != x.has_ts_: return 0
75    if self.has_ts_ and self.ts_ != x.ts_: return 0
76    return 1
77
78  def IsInitialized(self, debug_strs=None):
79    initialized = 1
80    if (not self.has_ts_):
81      initialized = 0
82      if debug_strs is not None:
83        debug_strs.append('Required field: ts not set.')
84    return initialized
85
86  def ByteSize(self):
87    n = 0
88    n += self.lengthVarInt64(self.ts_)
89    return n + 1
90
91  def ByteSizePartial(self):
92    n = 0
93    if (self.has_ts_):
94      n += 1
95      n += self.lengthVarInt64(self.ts_)
96    return n
97
98  def Clear(self):
99    self.clear_ts()
100
101  def OutputUnchecked(self, out):
102    out.putVarInt32(8)
103    out.putVarInt64(self.ts_)
104
105  def OutputPartial(self, out):
106    if (self.has_ts_):
107      out.putVarInt32(8)
108      out.putVarInt64(self.ts_)
109
110  def TryMerge(self, d):
111    while d.avail() > 0:
112      tt = d.getVarInt32()
113      if tt == 8:
114        self.set_ts(d.getVarInt64())
115        continue
116      # tag 0 is special: it's used to indicate an error.
117      # so if we see it we raise an exception.
118      if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError()
119      d.skipData(tt)
120
121
122  def __str__(self, prefix="", printElemNumber=0):
123    res=""
124    if self.has_ts_: res+=prefix+("ts: %s\n" % self.DebugFormatInt64(self.ts_))
125    return res
126
127
128  def _BuildTagLookupTable(sparse, maxtag, default=None):
129    return tuple([sparse.get(i, default) for i in range(0, 1+maxtag)])
130
131  kts = 1
132
133  _TEXT = _BuildTagLookupTable({
134    0: "ErrorCode",
135    1: "ts",
136  }, 1)
137
138  _TYPES = _BuildTagLookupTable({
139    0: ProtocolBuffer.Encoder.NUMERIC,
140    1: ProtocolBuffer.Encoder.NUMERIC,
141  }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
142
143  # stylesheet for XML output
144  _STYLE = \
145   """"""
146  _STYLE_CONTENT_TYPE = \
147   """"""
148  _PROTO_DESCRIPTOR_NAME = 'storage_onestore_v3.Snapshot'
149if _extension_runtime:
150  pass
151
152__all__ = ['Snapshot']
153