resources.proto 16 KB

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