resources.proto 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. // Copyright 2021 Google LLC
  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. syntax = "proto3";
  15. package google.cloud.secretmanager.v1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/duration.proto";
  19. import "google/protobuf/timestamp.proto";
  20. option cc_enable_arenas = true;
  21. option csharp_namespace = "Google.Cloud.SecretManager.V1";
  22. option go_package = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1;secretmanager";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "ResourcesProto";
  25. option java_package = "com.google.cloud.secretmanager.v1";
  26. option objc_class_prefix = "GSM";
  27. option php_namespace = "Google\\Cloud\\SecretManager\\V1";
  28. option ruby_package = "Google::Cloud::SecretManager::V1";
  29. // A [Secret][google.cloud.secretmanager.v1.Secret] is a logical secret whose value and versions can
  30. // be accessed.
  31. //
  32. // A [Secret][google.cloud.secretmanager.v1.Secret] is made up of zero or more [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] that
  33. // represent the secret data.
  34. message Secret {
  35. option (google.api.resource) = {
  36. type: "secretmanager.googleapis.com/Secret"
  37. pattern: "projects/{project}/secrets/{secret}"
  38. };
  39. // Output only. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] in the format `projects/*/secrets/*`.
  40. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  41. // Required. Immutable. The replication policy of the secret data attached to the [Secret][google.cloud.secretmanager.v1.Secret].
  42. //
  43. // The replication policy cannot be changed after the Secret has been created.
  44. Replication replication = 2 [
  45. (google.api.field_behavior) = IMMUTABLE,
  46. (google.api.field_behavior) = REQUIRED
  47. ];
  48. // Output only. The time at which the [Secret][google.cloud.secretmanager.v1.Secret] was created.
  49. google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  50. // The labels assigned to this Secret.
  51. //
  52. // Label keys must be between 1 and 63 characters long, have a UTF-8 encoding
  53. // of maximum 128 bytes, and must conform to the following PCRE regular
  54. // expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`
  55. //
  56. // Label values must be between 0 and 63 characters long, have a UTF-8
  57. // encoding of maximum 128 bytes, and must conform to the following PCRE
  58. // regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`
  59. //
  60. // No more than 64 labels can be assigned to a given resource.
  61. map<string, string> labels = 4;
  62. // Optional. A list of up to 10 Pub/Sub topics to which messages are published when
  63. // control plane operations are called on the secret or its versions.
  64. repeated Topic topics = 5 [(google.api.field_behavior) = OPTIONAL];
  65. // Expiration policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. If specified the [Secret][google.cloud.secretmanager.v1.Secret]
  66. // and all [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be automatically deleted at
  67. // expiration. Expired secrets are irreversibly deleted.
  68. //
  69. // Expiration is *not* the recommended way to set time-based permissions. [IAM
  70. // Conditions](https://cloud.google.com/secret-manager/docs/access-control#conditions)
  71. // is recommended for granting time-based permissions because the operation
  72. // can be reversed.
  73. oneof expiration {
  74. // Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
  75. // always provided on output, regardless of what was sent on input.
  76. google.protobuf.Timestamp expire_time = 6 [(google.api.field_behavior) = OPTIONAL];
  77. // Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
  78. google.protobuf.Duration ttl = 7 [(google.api.field_behavior) = INPUT_ONLY];
  79. }
  80. // Optional. Etag of the currently stored [Secret][google.cloud.secretmanager.v1.Secret].
  81. string etag = 8 [(google.api.field_behavior) = OPTIONAL];
  82. // Optional. Rotation policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. May be excluded if there is no
  83. // rotation policy.
  84. Rotation rotation = 9 [(google.api.field_behavior) = OPTIONAL];
  85. // Optional. Mapping from version alias to version name.
  86. //
  87. // A version alias is a string with a maximum length of 63 characters and can
  88. // contain uppercase and lowercase letters, numerals, and the hyphen (`-`)
  89. // and underscore ('_') characters. An alias string must start with a
  90. // letter and cannot be the string 'latest' or 'NEW'.
  91. // No more than 50 aliases can be assigned to a given secret.
  92. //
  93. // Version-Alias pairs will be viewable via GetSecret and modifiable via
  94. // UpdateSecret. At launch access by alias will only be supported on
  95. // GetSecretVersion and AccessSecretVersion.
  96. map<string, int64> version_aliases = 11 [(google.api.field_behavior) = OPTIONAL];
  97. }
  98. // A secret version resource in the Secret Manager API.
  99. message SecretVersion {
  100. option (google.api.resource) = {
  101. type: "secretmanager.googleapis.com/SecretVersion"
  102. pattern: "projects/{project}/secrets/{secret}/versions/{secret_version}"
  103. };
  104. // The state of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion], indicating if it can be accessed.
  105. enum State {
  106. // Not specified. This value is unused and invalid.
  107. STATE_UNSPECIFIED = 0;
  108. // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may be accessed.
  109. ENABLED = 1;
  110. // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may not be accessed, but the secret data
  111. // is still available and can be placed back into the [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED]
  112. // state.
  113. DISABLED = 2;
  114. // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] is destroyed and the secret data is no longer
  115. // stored. A version may not leave this state once entered.
  116. DESTROYED = 3;
  117. }
  118. // Output only. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the
  119. // format `projects/*/secrets/*/versions/*`.
  120. //
  121. // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] IDs in a [Secret][google.cloud.secretmanager.v1.Secret] start at 1 and
  122. // are incremented for each subsequent version of the secret.
  123. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  124. // Output only. The time at which the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was created.
  125. google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  126. // Output only. The time this [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was destroyed.
  127. // Only present if [state][google.cloud.secretmanager.v1.SecretVersion.state] is
  128. // [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED].
  129. google.protobuf.Timestamp destroy_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  130. // Output only. The current state of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  131. State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  132. // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  133. ReplicationStatus replication_status = 5;
  134. // Output only. Etag of the currently stored [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  135. string etag = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  136. // Output only. True if payload checksum specified in [SecretPayload][google.cloud.secretmanager.v1.SecretPayload] object has been
  137. // received by [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] on
  138. // [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion].
  139. bool client_specified_payload_checksum = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  140. }
  141. // A policy that defines the replication and encryption configuration of data.
  142. message Replication {
  143. // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload without any
  144. // restrictions.
  145. message Automatic {
  146. // Optional. The customer-managed encryption configuration of the [Secret][google.cloud.secretmanager.v1.Secret]. If no
  147. // configuration is provided, Google-managed default encryption is used.
  148. //
  149. // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to
  150. // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply
  151. // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
  152. CustomerManagedEncryption customer_managed_encryption = 1 [(google.api.field_behavior) = OPTIONAL];
  153. }
  154. // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload into the
  155. // locations specified in [Secret.replication.user_managed.replicas][]
  156. message UserManaged {
  157. // Represents a Replica for this [Secret][google.cloud.secretmanager.v1.Secret].
  158. message Replica {
  159. // The canonical IDs of the location to replicate data.
  160. // For example: `"us-east1"`.
  161. string location = 1;
  162. // Optional. The customer-managed encryption configuration of the [User-Managed
  163. // Replica][Replication.UserManaged.Replica]. If no configuration is
  164. // provided, Google-managed default encryption is used.
  165. //
  166. // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to
  167. // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply
  168. // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
  169. CustomerManagedEncryption customer_managed_encryption = 2 [(google.api.field_behavior) = OPTIONAL];
  170. }
  171. // Required. The list of Replicas for this [Secret][google.cloud.secretmanager.v1.Secret].
  172. //
  173. // Cannot be empty.
  174. repeated Replica replicas = 1 [(google.api.field_behavior) = REQUIRED];
  175. }
  176. // The replication policy for this secret.
  177. oneof replication {
  178. // The [Secret][google.cloud.secretmanager.v1.Secret] will automatically be replicated without any restrictions.
  179. Automatic automatic = 1;
  180. // The [Secret][google.cloud.secretmanager.v1.Secret] will only be replicated into the locations specified.
  181. UserManaged user_managed = 2;
  182. }
  183. }
  184. // Configuration for encrypting secret payloads using customer-managed
  185. // encryption keys (CMEK).
  186. message CustomerManagedEncryption {
  187. // Required. The resource name of the Cloud KMS CryptoKey used to encrypt secret
  188. // payloads.
  189. //
  190. // For secrets using the [UserManaged][google.cloud.secretmanager.v1.Replication.UserManaged] replication
  191. // policy type, Cloud KMS CryptoKeys must reside in the same location as the
  192. // [replica location][Secret.UserManaged.Replica.location].
  193. //
  194. // For secrets using the [Automatic][google.cloud.secretmanager.v1.Replication.Automatic] replication policy
  195. // type, Cloud KMS CryptoKeys must reside in `global`.
  196. //
  197. // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
  198. string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED];
  199. }
  200. // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  201. message ReplicationStatus {
  202. // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using automatic replication.
  203. //
  204. // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication
  205. // policy.
  206. message AutomaticStatus {
  207. // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only
  208. // populated if customer-managed encryption is used.
  209. CustomerManagedEncryptionStatus customer_managed_encryption = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  210. }
  211. // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using user-managed
  212. // replication.
  213. //
  214. // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication
  215. // policy.
  216. message UserManagedStatus {
  217. // Describes the status of a user-managed replica for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  218. message ReplicaStatus {
  219. // Output only. The canonical ID of the replica location.
  220. // For example: `"us-east1"`.
  221. string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  222. // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only
  223. // populated if customer-managed encryption is used.
  224. CustomerManagedEncryptionStatus customer_managed_encryption = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  225. }
  226. // Output only. The list of replica statuses for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  227. repeated ReplicaStatus replicas = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  228. }
  229. // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  230. oneof replication_status {
  231. // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with
  232. // automatic replication.
  233. //
  234. // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication
  235. // policy.
  236. AutomaticStatus automatic = 1;
  237. // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with
  238. // user-managed replication.
  239. //
  240. // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication
  241. // policy.
  242. UserManagedStatus user_managed = 2;
  243. }
  244. }
  245. // Describes the status of customer-managed encryption.
  246. message CustomerManagedEncryptionStatus {
  247. // Required. The resource name of the Cloud KMS CryptoKeyVersion used to encrypt the
  248. // secret payload, in the following format:
  249. // `projects/*/locations/*/keyRings/*/cryptoKeys/*/versions/*`.
  250. string kms_key_version_name = 1 [(google.api.field_behavior) = REQUIRED];
  251. }
  252. // A Pub/Sub topic which Secret Manager will publish to when control plane
  253. // events occur on this secret.
  254. message Topic {
  255. option (google.api.resource) = {
  256. type: "pubsub.googleapis.com/Topic"
  257. pattern: "projects/{project}/topics/{topic}"
  258. };
  259. // Required. The resource name of the Pub/Sub topic that will be published to, in the
  260. // following format: `projects/*/topics/*`. For publication to succeed, the
  261. // Secret Manager P4SA must have `pubsub.publisher` permissions on the topic.
  262. string name = 1 [(google.api.field_behavior) = REQUIRED];
  263. }
  264. // The rotation time and period for a [Secret][google.cloud.secretmanager.v1.Secret]. At next_rotation_time, Secret
  265. // Manager will send a Pub/Sub notification to the topics configured on the
  266. // Secret. [Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be set to configure rotation.
  267. message Rotation {
  268. // Optional. Timestamp in UTC at which the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to rotate. Cannot be
  269. // set to less than 300s (5 min) in the future and at most 3153600000s (100
  270. // years).
  271. //
  272. // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] MUST be set if [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set.
  273. google.protobuf.Timestamp next_rotation_time = 1 [(google.api.field_behavior) = OPTIONAL];
  274. // Input only. The Duration between rotation notifications. Must be in seconds
  275. // and at least 3600s (1h) and at most 3153600000s (100 years).
  276. //
  277. // If [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set, [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] must be set.
  278. // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] will be advanced by this period when the service
  279. // automatically sends rotation notifications.
  280. google.protobuf.Duration rotation_period = 2 [(google.api.field_behavior) = INPUT_ONLY];
  281. }
  282. // A secret payload resource in the Secret Manager API. This contains the
  283. // sensitive secret payload that is associated with a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
  284. message SecretPayload {
  285. // The secret data. Must be no larger than 64KiB.
  286. bytes data = 1;
  287. // Optional. If specified, [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will verify the integrity of the
  288. // received [data][google.cloud.secretmanager.v1.SecretPayload.data] on [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] calls using
  289. // the crc32c checksum and store it to include in future
  290. // [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion] responses. If a checksum is
  291. // not provided in the [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] request, the
  292. // [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will generate and store one for you.
  293. //
  294. // The CRC32C value is encoded as a Int64 for compatibility, and can be
  295. // safely downconverted to uint32 in languages that support this type.
  296. // https://cloud.google.com/apis/design/design_patterns#integer_types
  297. optional int64 data_crc32c = 2 [(google.api.field_behavior) = OPTIONAL];
  298. }