Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/cloud/secretmanager_v1beta1/types/resources.py: 100%

31 statements  

« prev     ^ index     » next       coverage.py v7.3.1, created at 2023-09-25 06:37 +0000

1# -*- coding: utf-8 -*- 

2# Copyright 2023 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# http://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# 

16from __future__ import annotations 

17 

18from typing import MutableMapping, MutableSequence 

19 

20from google.protobuf import timestamp_pb2 # type: ignore 

21import proto # type: ignore 

22 

23__protobuf__ = proto.module( 

24 package="google.cloud.secrets.v1beta1", 

25 manifest={ 

26 "Secret", 

27 "SecretVersion", 

28 "Replication", 

29 "SecretPayload", 

30 }, 

31) 

32 

33 

34class Secret(proto.Message): 

35 r"""A [Secret][google.cloud.secrets.v1beta1.Secret] is a logical secret 

36 whose value and versions can be accessed. 

37 

38 A [Secret][google.cloud.secrets.v1beta1.Secret] is made up of zero 

39 or more [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion] 

40 that represent the secret data. 

41 

42 Attributes: 

43 name (str): 

44 Output only. The resource name of the 

45 [Secret][google.cloud.secrets.v1beta1.Secret] in the format 

46 ``projects/*/secrets/*``. 

47 replication (google.cloud.secretmanager_v1beta1.types.Replication): 

48 Required. Immutable. The replication policy of the secret 

49 data attached to the 

50 [Secret][google.cloud.secrets.v1beta1.Secret]. 

51 

52 The replication policy cannot be changed after the Secret 

53 has been created. 

54 create_time (google.protobuf.timestamp_pb2.Timestamp): 

55 Output only. The time at which the 

56 [Secret][google.cloud.secrets.v1beta1.Secret] was created. 

57 labels (MutableMapping[str, str]): 

58 The labels assigned to this Secret. 

59 

60 Label keys must be between 1 and 63 characters long, have a 

61 UTF-8 encoding of maximum 128 bytes, and must conform to the 

62 following PCRE regular expression: 

63 ``[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`` 

64 

65 Label values must be between 0 and 63 characters long, have 

66 a UTF-8 encoding of maximum 128 bytes, and must conform to 

67 the following PCRE regular expression: 

68 ``[\p{Ll}\p{Lo}\p{N}_-]{0,63}`` 

69 

70 No more than 64 labels can be assigned to a given resource. 

71 """ 

72 

73 name: str = proto.Field( 

74 proto.STRING, 

75 number=1, 

76 ) 

77 replication: "Replication" = proto.Field( 

78 proto.MESSAGE, 

79 number=2, 

80 message="Replication", 

81 ) 

82 create_time: timestamp_pb2.Timestamp = proto.Field( 

83 proto.MESSAGE, 

84 number=3, 

85 message=timestamp_pb2.Timestamp, 

86 ) 

87 labels: MutableMapping[str, str] = proto.MapField( 

88 proto.STRING, 

89 proto.STRING, 

90 number=4, 

91 ) 

92 

93 

94class SecretVersion(proto.Message): 

95 r"""A secret version resource in the Secret Manager API. 

96 

97 Attributes: 

98 name (str): 

99 Output only. The resource name of the 

100 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] 

101 in the format ``projects/*/secrets/*/versions/*``. 

102 

103 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] 

104 IDs in a [Secret][google.cloud.secrets.v1beta1.Secret] start 

105 at 1 and are incremented for each subsequent version of the 

106 secret. 

107 create_time (google.protobuf.timestamp_pb2.Timestamp): 

108 Output only. The time at which the 

109 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] 

110 was created. 

111 destroy_time (google.protobuf.timestamp_pb2.Timestamp): 

112 Output only. The time this 

113 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] 

114 was destroyed. Only present if 

115 [state][google.cloud.secrets.v1beta1.SecretVersion.state] is 

116 [DESTROYED][google.cloud.secrets.v1beta1.SecretVersion.State.DESTROYED]. 

117 state (google.cloud.secretmanager_v1beta1.types.SecretVersion.State): 

118 Output only. The current state of the 

119 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]. 

120 """ 

121 

122 class State(proto.Enum): 

123 r"""The state of a 

124 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion], 

125 indicating if it can be accessed. 

126 

127 Values: 

128 STATE_UNSPECIFIED (0): 

129 Not specified. This value is unused and 

130 invalid. 

131 ENABLED (1): 

132 The 

133 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] 

134 may be accessed. 

135 DISABLED (2): 

136 The 

137 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] 

138 may not be accessed, but the secret data is still available 

139 and can be placed back into the 

140 [ENABLED][google.cloud.secrets.v1beta1.SecretVersion.State.ENABLED] 

141 state. 

142 DESTROYED (3): 

143 The 

144 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] 

145 is destroyed and the secret data is no longer stored. A 

146 version may not leave this state once entered. 

147 """ 

148 STATE_UNSPECIFIED = 0 

149 ENABLED = 1 

150 DISABLED = 2 

151 DESTROYED = 3 

152 

153 name: str = proto.Field( 

154 proto.STRING, 

155 number=1, 

156 ) 

157 create_time: timestamp_pb2.Timestamp = proto.Field( 

158 proto.MESSAGE, 

159 number=2, 

160 message=timestamp_pb2.Timestamp, 

161 ) 

162 destroy_time: timestamp_pb2.Timestamp = proto.Field( 

163 proto.MESSAGE, 

164 number=3, 

165 message=timestamp_pb2.Timestamp, 

166 ) 

167 state: State = proto.Field( 

168 proto.ENUM, 

169 number=4, 

170 enum=State, 

171 ) 

172 

173 

174class Replication(proto.Message): 

175 r"""A policy that defines the replication configuration of data. 

176 

177 This message has `oneof`_ fields (mutually exclusive fields). 

178 For each oneof, at most one member field can be set at the same time. 

179 Setting any member of the oneof automatically clears all other 

180 members. 

181 

182 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields 

183 

184 Attributes: 

185 automatic (google.cloud.secretmanager_v1beta1.types.Replication.Automatic): 

186 The [Secret][google.cloud.secrets.v1beta1.Secret] will 

187 automatically be replicated without any restrictions. 

188 

189 This field is a member of `oneof`_ ``replication``. 

190 user_managed (google.cloud.secretmanager_v1beta1.types.Replication.UserManaged): 

191 The [Secret][google.cloud.secrets.v1beta1.Secret] will only 

192 be replicated into the locations specified. 

193 

194 This field is a member of `oneof`_ ``replication``. 

195 """ 

196 

197 class Automatic(proto.Message): 

198 r"""A replication policy that replicates the 

199 [Secret][google.cloud.secrets.v1beta1.Secret] payload without any 

200 restrictions. 

201 

202 """ 

203 

204 class UserManaged(proto.Message): 

205 r"""A replication policy that replicates the 

206 [Secret][google.cloud.secrets.v1beta1.Secret] payload into the 

207 locations specified in [Secret.replication.user_managed.replicas][] 

208 

209 Attributes: 

210 replicas (MutableSequence[google.cloud.secretmanager_v1beta1.types.Replication.UserManaged.Replica]): 

211 Required. The list of Replicas for this 

212 [Secret][google.cloud.secrets.v1beta1.Secret]. 

213 

214 Cannot be empty. 

215 """ 

216 

217 class Replica(proto.Message): 

218 r"""Represents a Replica for this 

219 [Secret][google.cloud.secrets.v1beta1.Secret]. 

220 

221 Attributes: 

222 location (str): 

223 The canonical IDs of the location to replicate data. For 

224 example: ``"us-east1"``. 

225 """ 

226 

227 location: str = proto.Field( 

228 proto.STRING, 

229 number=1, 

230 ) 

231 

232 replicas: MutableSequence[ 

233 "Replication.UserManaged.Replica" 

234 ] = proto.RepeatedField( 

235 proto.MESSAGE, 

236 number=1, 

237 message="Replication.UserManaged.Replica", 

238 ) 

239 

240 automatic: Automatic = proto.Field( 

241 proto.MESSAGE, 

242 number=1, 

243 oneof="replication", 

244 message=Automatic, 

245 ) 

246 user_managed: UserManaged = proto.Field( 

247 proto.MESSAGE, 

248 number=2, 

249 oneof="replication", 

250 message=UserManaged, 

251 ) 

252 

253 

254class SecretPayload(proto.Message): 

255 r"""A secret payload resource in the Secret Manager API. This contains 

256 the sensitive secret data that is associated with a 

257 [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]. 

258 

259 Attributes: 

260 data (bytes): 

261 The secret data. Must be no larger than 

262 64KiB. 

263 """ 

264 

265 data: bytes = proto.Field( 

266 proto.BYTES, 

267 number=1, 

268 ) 

269 

270 

271__all__ = tuple(sorted(__protobuf__.manifest))