From 0dc2188e1e9b79f6ddbd5e509480e6fedfc7128e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 3 Feb 2021 10:08:03 -0800 Subject: [PATCH] feat: added expire_time and ttl fields to Secret (#355) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/1a417553-bc66-460b-9d88-fe487d5b0cb6/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 352563582 Source-Link: https://github.com/googleapis/googleapis/commit/9ecdacc9a00e1dd443b11bf10215d6e7648db8a7 --- .../secretmanager/v1/ResourcesProto.java | 132 ++-- .../google/cloud/secretmanager/v1/Secret.java | 699 ++++++++++++++++++ .../secretmanager/v1/SecretOrBuilder.java | 78 ++ .../cloud/secretmanager/v1/resources.proto | 18 + synth.metadata | 4 +- 5 files changed, 866 insertions(+), 65 deletions(-) diff --git a/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/ResourcesProto.java b/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/ResourcesProto.java index 91c616cd..0e0777b3 100644 --- a/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/ResourcesProto.java +++ b/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/ResourcesProto.java @@ -95,68 +95,72 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "\n-google/cloud/secretmanager/v1/resource" + "s.proto\022\035google.cloud.secretmanager.v1\032\037" + "google/api/field_behavior.proto\032\031google/" - + "api/resource.proto\032\037google/protobuf/time" - + "stamp.proto\032\034google/api/annotations.prot" - + "o\"\333\002\n\006Secret\022\021\n\004name\030\001 \001(\tB\003\340A\003\022G\n\013repli" - + "cation\030\002 \001(\0132*.google.cloud.secretmanage" - + "r.v1.ReplicationB\006\340A\005\340A\002\0224\n\013create_time\030" - + "\003 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022A" - + "\n\006labels\030\004 \003(\01321.google.cloud.secretmana" - + "ger.v1.Secret.LabelsEntry\032-\n\013LabelsEntry" - + "\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:M\352AJ\n#s" - + "ecretmanager.googleapis.com/Secret\022#proj" - + "ects/{project}/secrets/{secret}\"\337\003\n\rSecr" - + "etVersion\022\021\n\004name\030\001 \001(\tB\003\340A\003\0224\n\013create_t" - + "ime\030\002 \001(\0132\032.google.protobuf.TimestampB\003\340" - + "A\003\0225\n\014destroy_time\030\003 \001(\0132\032.google.protob" - + "uf.TimestampB\003\340A\003\022F\n\005state\030\004 \001(\01622.googl" - + "e.cloud.secretmanager.v1.SecretVersion.S" - + "tateB\003\340A\003\022L\n\022replication_status\030\005 \001(\01320." - + "google.cloud.secretmanager.v1.Replicatio" - + "nStatus\"H\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022" - + "\013\n\007ENABLED\020\001\022\014\n\010DISABLED\020\002\022\r\n\tDESTROYED\020" - + "\003:n\352Ak\n*secretmanager.googleapis.com/Sec" - + "retVersion\022=projects/{project}/secrets/{" - + "secret}/versions/{secret_version}\"\220\004\n\013Re" - + "plication\022I\n\tautomatic\030\001 \001(\01324.google.cl" - + "oud.secretmanager.v1.Replication.Automat" - + "icH\000\022N\n\014user_managed\030\002 \001(\01326.google.clou" - + "d.secretmanager.v1.Replication.UserManag" - + "edH\000\032o\n\tAutomatic\022b\n\033customer_managed_en" - + "cryption\030\001 \001(\01328.google.cloud.secretmana" - + "ger.v1.CustomerManagedEncryptionB\003\340A\001\032\345\001" - + "\n\013UserManaged\022U\n\010replicas\030\001 \003(\0132>.google" - + ".cloud.secretmanager.v1.Replication.User" - + "Managed.ReplicaB\003\340A\002\032\177\n\007Replica\022\020\n\010locat" - + "ion\030\001 \001(\t\022b\n\033customer_managed_encryption" - + "\030\002 \001(\01328.google.cloud.secretmanager.v1.C" - + "ustomerManagedEncryptionB\003\340A\001B\r\n\013replica" - + "tion\"6\n\031CustomerManagedEncryption\022\031\n\014kms" - + "_key_name\030\001 \001(\tB\003\340A\002\"\353\004\n\021ReplicationStat" - + "us\022U\n\tautomatic\030\001 \001(\0132@.google.cloud.sec" - + "retmanager.v1.ReplicationStatus.Automati" - + "cStatusH\000\022Z\n\014user_managed\030\002 \001(\0132B.google" - + ".cloud.secretmanager.v1.ReplicationStatu" - + "s.UserManagedStatusH\000\032{\n\017AutomaticStatus" - + "\022h\n\033customer_managed_encryption\030\001 \001(\0132>." - + "google.cloud.secretmanager.v1.CustomerMa" - + "nagedEncryptionStatusB\003\340A\003\032\217\002\n\021UserManag" - + "edStatus\022g\n\010replicas\030\001 \003(\0132P.google.clou" - + "d.secretmanager.v1.ReplicationStatus.Use" - + "rManagedStatus.ReplicaStatusB\003\340A\003\032\220\001\n\rRe" - + "plicaStatus\022\025\n\010location\030\001 \001(\tB\003\340A\003\022h\n\033cu" - + "stomer_managed_encryption\030\002 \001(\0132>.google" - + ".cloud.secretmanager.v1.CustomerManagedE" - + "ncryptionStatusB\003\340A\003B\024\n\022replication_stat" - + "us\"D\n\037CustomerManagedEncryptionStatus\022!\n" - + "\024kms_key_version_name\030\001 \001(\tB\003\340A\002\"\035\n\rSecr" - + "etPayload\022\014\n\004data\030\001 \001(\014B\355\001\n!com.google.c" - + "loud.secretmanager.v1B\016ResourcesProtoP\001Z" - + "Jgoogle.golang.org/genproto/googleapis/c" - + "loud/secretmanager/v1;secretmanager\370\001\001\242\002" - + "\003GSM\252\002\035Google.Cloud.SecretManager.V1\312\002\035G" - + "oogle\\Cloud\\SecretManager\\V1\352\002 Google::C" - + "loud::SecretManager::V1b\006proto3" + + "api/resource.proto\032\036google/protobuf/dura" + + "tion.proto\032\037google/protobuf/timestamp.pr" + + "oto\032\034google/api/annotations.proto\"\320\003\n\006Se" + + "cret\022\021\n\004name\030\001 \001(\tB\003\340A\003\022G\n\013replication\030\002" + + " \001(\0132*.google.cloud.secretmanager.v1.Rep" + + "licationB\006\340A\005\340A\002\0224\n\013create_time\030\003 \001(\0132\032." + + "google.protobuf.TimestampB\003\340A\003\022A\n\006labels" + + "\030\004 \003(\01321.google.cloud.secretmanager.v1.S" + + "ecret.LabelsEntry\0226\n\013expire_time\030\006 \001(\0132\032" + + ".google.protobuf.TimestampB\003\340A\001H\000\022-\n\003ttl" + + "\030\007 \001(\0132\031.google.protobuf.DurationB\003\340A\004H\000" + + "\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 " + + "\001(\t:\0028\001:M\352AJ\n#secretmanager.googleapis.c" + + "om/Secret\022#projects/{project}/secrets/{s" + + "ecret}B\014\n\nexpiration\"\337\003\n\rSecretVersion\022\021" + + "\n\004name\030\001 \001(\tB\003\340A\003\0224\n\013create_time\030\002 \001(\0132\032" + + ".google.protobuf.TimestampB\003\340A\003\0225\n\014destr" + + "oy_time\030\003 \001(\0132\032.google.protobuf.Timestam" + + "pB\003\340A\003\022F\n\005state\030\004 \001(\01622.google.cloud.sec" + + "retmanager.v1.SecretVersion.StateB\003\340A\003\022L" + + "\n\022replication_status\030\005 \001(\01320.google.clou" + + "d.secretmanager.v1.ReplicationStatus\"H\n\005" + + "State\022\025\n\021STATE_UNSPECIFIED\020\000\022\013\n\007ENABLED\020" + + "\001\022\014\n\010DISABLED\020\002\022\r\n\tDESTROYED\020\003:n\352Ak\n*sec" + + "retmanager.googleapis.com/SecretVersion\022" + + "=projects/{project}/secrets/{secret}/ver" + + "sions/{secret_version}\"\220\004\n\013Replication\022I" + + "\n\tautomatic\030\001 \001(\01324.google.cloud.secretm" + + "anager.v1.Replication.AutomaticH\000\022N\n\014use" + + "r_managed\030\002 \001(\01326.google.cloud.secretman" + + "ager.v1.Replication.UserManagedH\000\032o\n\tAut" + + "omatic\022b\n\033customer_managed_encryption\030\001 " + + "\001(\01328.google.cloud.secretmanager.v1.Cust" + + "omerManagedEncryptionB\003\340A\001\032\345\001\n\013UserManag" + + "ed\022U\n\010replicas\030\001 \003(\0132>.google.cloud.secr" + + "etmanager.v1.Replication.UserManaged.Rep" + + "licaB\003\340A\002\032\177\n\007Replica\022\020\n\010location\030\001 \001(\t\022b" + + "\n\033customer_managed_encryption\030\002 \001(\01328.go" + + "ogle.cloud.secretmanager.v1.CustomerMana" + + "gedEncryptionB\003\340A\001B\r\n\013replication\"6\n\031Cus" + + "tomerManagedEncryption\022\031\n\014kms_key_name\030\001" + + " \001(\tB\003\340A\002\"\353\004\n\021ReplicationStatus\022U\n\tautom" + + "atic\030\001 \001(\0132@.google.cloud.secretmanager." + + "v1.ReplicationStatus.AutomaticStatusH\000\022Z" + + "\n\014user_managed\030\002 \001(\0132B.google.cloud.secr" + + "etmanager.v1.ReplicationStatus.UserManag" + + "edStatusH\000\032{\n\017AutomaticStatus\022h\n\033custome" + + "r_managed_encryption\030\001 \001(\0132>.google.clou" + + "d.secretmanager.v1.CustomerManagedEncryp" + + "tionStatusB\003\340A\003\032\217\002\n\021UserManagedStatus\022g\n" + + "\010replicas\030\001 \003(\0132P.google.cloud.secretman" + + "ager.v1.ReplicationStatus.UserManagedSta" + + "tus.ReplicaStatusB\003\340A\003\032\220\001\n\rReplicaStatus" + + "\022\025\n\010location\030\001 \001(\tB\003\340A\003\022h\n\033customer_mana" + + "ged_encryption\030\002 \001(\0132>.google.cloud.secr" + + "etmanager.v1.CustomerManagedEncryptionSt" + + "atusB\003\340A\003B\024\n\022replication_status\"D\n\037Custo" + + "merManagedEncryptionStatus\022!\n\024kms_key_ve" + + "rsion_name\030\001 \001(\tB\003\340A\002\"\035\n\rSecretPayload\022\014" + + "\n\004data\030\001 \001(\014B\355\001\n!com.google.cloud.secret" + + "manager.v1B\016ResourcesProtoP\001ZJgoogle.gol" + + "ang.org/genproto/googleapis/cloud/secret" + + "manager/v1;secretmanager\370\001\001\242\002\003GSM\252\002\035Goog" + + "le.Cloud.SecretManager.V1\312\002\035Google\\Cloud" + + "\\SecretManager\\V1\352\002 Google::Cloud::Secre" + + "tManager::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -164,6 +168,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), + com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.api.AnnotationsProto.getDescriptor(), }); @@ -173,7 +178,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_secretmanager_v1_Secret_descriptor, new java.lang.String[] { - "Name", "Replication", "CreateTime", "Labels", + "Name", "Replication", "CreateTime", "Labels", "ExpireTime", "Ttl", "Expiration", }); internal_static_google_cloud_secretmanager_v1_Secret_LabelsEntry_descriptor = internal_static_google_cloud_secretmanager_v1_Secret_descriptor.getNestedTypes().get(0); @@ -299,6 +304,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { descriptor, registry); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); + com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.api.AnnotationsProto.getDescriptor(); } diff --git a/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/Secret.java b/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/Secret.java index d43a3d83..b236012b 100644 --- a/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/Secret.java +++ b/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/Secret.java @@ -125,6 +125,36 @@ private Secret( labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); break; } + case 50: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (expirationCase_ == 6) { + subBuilder = ((com.google.protobuf.Timestamp) expiration_).toBuilder(); + } + expiration_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.protobuf.Timestamp) expiration_); + expiration_ = subBuilder.buildPartial(); + } + expirationCase_ = 6; + break; + } + case 58: + { + com.google.protobuf.Duration.Builder subBuilder = null; + if (expirationCase_ == 7) { + subBuilder = ((com.google.protobuf.Duration) expiration_).toBuilder(); + } + expiration_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.protobuf.Duration) expiration_); + expiration_ = subBuilder.buildPartial(); + } + expirationCase_ = 7; + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { @@ -170,6 +200,53 @@ protected com.google.protobuf.MapField internalGetMapField(int number) { com.google.cloud.secretmanager.v1.Secret.Builder.class); } + private int expirationCase_ = 0; + private java.lang.Object expiration_; + + public enum ExpirationCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + EXPIRE_TIME(6), + TTL(7), + EXPIRATION_NOT_SET(0); + private final int value; + + private ExpirationCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ExpirationCase valueOf(int value) { + return forNumber(value); + } + + public static ExpirationCase forNumber(int value) { + switch (value) { + case 6: + return EXPIRE_TIME; + case 7: + return TTL; + case 0: + return EXPIRATION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ExpirationCase getExpirationCase() { + return ExpirationCase.forNumber(expirationCase_); + } + public static final int NAME_FIELD_NUMBER = 1; private volatile java.lang.Object name_; /** @@ -451,6 +528,114 @@ public java.lang.String getLabelsOrThrow(java.lang.String key) { return map.get(key); } + public static final int EXPIRE_TIME_FIELD_NUMBER = 6; + /** + * + * + *
+   * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+   * always provided on output, regardless of what was sent on input.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expirationCase_ == 6; + } + /** + * + * + *
+   * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+   * always provided on output, regardless of what was sent on input.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + if (expirationCase_ == 6) { + return (com.google.protobuf.Timestamp) expiration_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + /** + * + * + *
+   * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+   * always provided on output, regardless of what was sent on input.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expirationCase_ == 6) { + return (com.google.protobuf.Timestamp) expiration_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + + public static final int TTL_FIELD_NUMBER = 7; + /** + * + * + *
+   * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+   * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + * + * @return Whether the ttl field is set. + */ + @java.lang.Override + public boolean hasTtl() { + return expirationCase_ == 7; + } + /** + * + * + *
+   * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+   * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + * + * @return The ttl. + */ + @java.lang.Override + public com.google.protobuf.Duration getTtl() { + if (expirationCase_ == 7) { + return (com.google.protobuf.Duration) expiration_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + /** + * + * + *
+   * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+   * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getTtlOrBuilder() { + if (expirationCase_ == 7) { + return (com.google.protobuf.Duration) expiration_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -476,6 +661,12 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4); + if (expirationCase_ == 6) { + output.writeMessage(6, (com.google.protobuf.Timestamp) expiration_); + } + if (expirationCase_ == 7) { + output.writeMessage(7, (com.google.protobuf.Duration) expiration_); + } unknownFields.writeTo(output); } @@ -504,6 +695,16 @@ public int getSerializedSize() { .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, labels__); } + if (expirationCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.protobuf.Timestamp) expiration_); + } + if (expirationCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.protobuf.Duration) expiration_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -529,6 +730,17 @@ public boolean equals(final java.lang.Object obj) { if (!getCreateTime().equals(other.getCreateTime())) return false; } if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!getExpirationCase().equals(other.getExpirationCase())) return false; + switch (expirationCase_) { + case 6: + if (!getExpireTime().equals(other.getExpireTime())) return false; + break; + case 7: + if (!getTtl().equals(other.getTtl())) return false; + break; + case 0: + default: + } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -554,6 +766,18 @@ public int hashCode() { hash = (37 * hash) + LABELS_FIELD_NUMBER; hash = (53 * hash) + internalGetLabels().hashCode(); } + switch (expirationCase_) { + case 6: + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + break; + case 7: + hash = (37 * hash) + TTL_FIELD_NUMBER; + hash = (53 * hash) + getTtl().hashCode(); + break; + case 0: + default: + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -737,6 +961,8 @@ public Builder clear() { createTimeBuilder_ = null; } internalGetMutableLabels().clear(); + expirationCase_ = 0; + expiration_ = null; return this; } @@ -778,6 +1004,21 @@ public com.google.cloud.secretmanager.v1.Secret buildPartial() { } result.labels_ = internalGetLabels(); result.labels_.makeImmutable(); + if (expirationCase_ == 6) { + if (expireTimeBuilder_ == null) { + result.expiration_ = expiration_; + } else { + result.expiration_ = expireTimeBuilder_.build(); + } + } + if (expirationCase_ == 7) { + if (ttlBuilder_ == null) { + result.expiration_ = expiration_; + } else { + result.expiration_ = ttlBuilder_.build(); + } + } + result.expirationCase_ = expirationCase_; onBuilt(); return result; } @@ -838,6 +1079,22 @@ public Builder mergeFrom(com.google.cloud.secretmanager.v1.Secret other) { mergeCreateTime(other.getCreateTime()); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + switch (other.getExpirationCase()) { + case EXPIRE_TIME: + { + mergeExpireTime(other.getExpireTime()); + break; + } + case TTL: + { + mergeTtl(other.getTtl()); + break; + } + case EXPIRATION_NOT_SET: + { + break; + } + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -867,6 +1124,20 @@ public Builder mergeFrom( return this; } + private int expirationCase_ = 0; + private java.lang.Object expiration_; + + public ExpirationCase getExpirationCase() { + return ExpirationCase.forNumber(expirationCase_); + } + + public Builder clearExpiration() { + expirationCase_ = 0; + expiration_ = null; + onChanged(); + return this; + } + private int bitField0_; private java.lang.Object name_ = ""; @@ -1595,6 +1866,434 @@ public Builder putAllLabels(java.util.Map va return this; } + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expirationCase_ == 6; + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + if (expirationCase_ == 6) { + return (com.google.protobuf.Timestamp) expiration_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } else { + if (expirationCase_ == 6) { + return expireTimeBuilder_.getMessage(); + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expiration_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + expirationCase_ = 6; + return this; + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expiration_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + expirationCase_ = 6; + return this; + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expirationCase_ == 6 + && expiration_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + expiration_ = + com.google.protobuf.Timestamp.newBuilder((com.google.protobuf.Timestamp) expiration_) + .mergeFrom(value) + .buildPartial(); + } else { + expiration_ = value; + } + onChanged(); + } else { + if (expirationCase_ == 6) { + expireTimeBuilder_.mergeFrom(value); + } + expireTimeBuilder_.setMessage(value); + } + expirationCase_ = 6; + return this; + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + if (expirationCase_ == 6) { + expirationCase_ = 0; + expiration_ = null; + onChanged(); + } + } else { + if (expirationCase_ == 6) { + expirationCase_ = 0; + expiration_ = null; + } + expireTimeBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if ((expirationCase_ == 6) && (expireTimeBuilder_ != null)) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + if (expirationCase_ == 6) { + return (com.google.protobuf.Timestamp) expiration_; + } + return com.google.protobuf.Timestamp.getDefaultInstance(); + } + } + /** + * + * + *
+     * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+     * always provided on output, regardless of what was sent on input.
+     * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + if (!(expirationCase_ == 6)) { + expiration_ = com.google.protobuf.Timestamp.getDefaultInstance(); + } + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + (com.google.protobuf.Timestamp) expiration_, getParentForChildren(), isClean()); + expiration_ = null; + } + expirationCase_ = 6; + onChanged(); + ; + return expireTimeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + ttlBuilder_; + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + * + * @return Whether the ttl field is set. + */ + @java.lang.Override + public boolean hasTtl() { + return expirationCase_ == 7; + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + * + * @return The ttl. + */ + @java.lang.Override + public com.google.protobuf.Duration getTtl() { + if (ttlBuilder_ == null) { + if (expirationCase_ == 7) { + return (com.google.protobuf.Duration) expiration_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } else { + if (expirationCase_ == 7) { + return ttlBuilder_.getMessage(); + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + public Builder setTtl(com.google.protobuf.Duration value) { + if (ttlBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expiration_ = value; + onChanged(); + } else { + ttlBuilder_.setMessage(value); + } + expirationCase_ = 7; + return this; + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + public Builder setTtl(com.google.protobuf.Duration.Builder builderForValue) { + if (ttlBuilder_ == null) { + expiration_ = builderForValue.build(); + onChanged(); + } else { + ttlBuilder_.setMessage(builderForValue.build()); + } + expirationCase_ = 7; + return this; + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + public Builder mergeTtl(com.google.protobuf.Duration value) { + if (ttlBuilder_ == null) { + if (expirationCase_ == 7 + && expiration_ != com.google.protobuf.Duration.getDefaultInstance()) { + expiration_ = + com.google.protobuf.Duration.newBuilder((com.google.protobuf.Duration) expiration_) + .mergeFrom(value) + .buildPartial(); + } else { + expiration_ = value; + } + onChanged(); + } else { + if (expirationCase_ == 7) { + ttlBuilder_.mergeFrom(value); + } + ttlBuilder_.setMessage(value); + } + expirationCase_ = 7; + return this; + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + public Builder clearTtl() { + if (ttlBuilder_ == null) { + if (expirationCase_ == 7) { + expirationCase_ = 0; + expiration_ = null; + onChanged(); + } + } else { + if (expirationCase_ == 7) { + expirationCase_ = 0; + expiration_ = null; + } + ttlBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + public com.google.protobuf.Duration.Builder getTtlBuilder() { + return getTtlFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getTtlOrBuilder() { + if ((expirationCase_ == 7) && (ttlBuilder_ != null)) { + return ttlBuilder_.getMessageOrBuilder(); + } else { + if (expirationCase_ == 7) { + return (com.google.protobuf.Duration) expiration_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + } + /** + * + * + *
+     * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+     * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getTtlFieldBuilder() { + if (ttlBuilder_ == null) { + if (!(expirationCase_ == 7)) { + expiration_ = com.google.protobuf.Duration.getDefaultInstance(); + } + ttlBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + (com.google.protobuf.Duration) expiration_, getParentForChildren(), isClean()); + expiration_ = null; + } + expirationCase_ = 7; + onChanged(); + ; + return ttlBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/SecretOrBuilder.java b/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/SecretOrBuilder.java index c9c7244e..1c2c32b8 100644 --- a/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/SecretOrBuilder.java +++ b/proto-google-cloud-secretmanager-v1/src/main/java/com/google/cloud/secretmanager/v1/SecretOrBuilder.java @@ -218,4 +218,82 @@ public interface SecretOrBuilder * map<string, string> labels = 4; */ java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+   * always provided on output, regardless of what was sent on input.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+   * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+   * always provided on output, regardless of what was sent on input.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+   * Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is
+   * always provided on output, regardless of what was sent on input.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + + /** + * + * + *
+   * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+   * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + * + * @return Whether the ttl field is set. + */ + boolean hasTtl(); + /** + * + * + *
+   * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+   * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + * + * @return The ttl. + */ + com.google.protobuf.Duration getTtl(); + /** + * + * + *
+   * Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
+   * 
+ * + * .google.protobuf.Duration ttl = 7 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + com.google.protobuf.DurationOrBuilder getTtlOrBuilder(); + + public com.google.cloud.secretmanager.v1.Secret.ExpirationCase getExpirationCase(); } diff --git a/proto-google-cloud-secretmanager-v1/src/main/proto/google/cloud/secretmanager/v1/resources.proto b/proto-google-cloud-secretmanager-v1/src/main/proto/google/cloud/secretmanager/v1/resources.proto index fa51c26a..7532b085 100644 --- a/proto-google-cloud-secretmanager-v1/src/main/proto/google/cloud/secretmanager/v1/resources.proto +++ b/proto-google-cloud-secretmanager-v1/src/main/proto/google/cloud/secretmanager/v1/resources.proto @@ -18,6 +18,7 @@ package google.cloud.secretmanager.v1; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; @@ -68,6 +69,23 @@ message Secret { // // No more than 64 labels can be assigned to a given resource. map labels = 4; + + // Expiration policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. If specified the [Secret][google.cloud.secretmanager.v1.Secret] + // and all [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be automatically deleted at + // expiration. Expired secrets are irreversibly deleted. + // + // Expiration is *not* the recommended way to set time-based permissions. [IAM + // Conditions](https://cloud.google.com/secret-manager/docs/access-control#conditions) + // is recommended for granting time-based permissions because the operation + // can be reversed. + oneof expiration { + // Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is + // always provided on output, regardless of what was sent on input. + google.protobuf.Timestamp expire_time = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret]. + google.protobuf.Duration ttl = 7 [(google.api.field_behavior) = INPUT_ONLY]; + } } // A secret version resource in the Secret Manager API. diff --git a/synth.metadata b/synth.metadata index 8d8eadeb..64ba69f1 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "9ecdacc9a00e1dd443b11bf10215d6e7648db8a7", + "internalRef": "352563582" } }, {