Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

feat: Etags in Secret Manager #481

Merged
merged 2 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ public final void deleteSecret(String name) {
* DeleteSecretRequest request =
* DeleteSecretRequest.newBuilder()
* .setName(SecretName.of("[PROJECT]", "[SECRET]").toString())
* .setEtag("etag3123477")
* .build();
* secretManagerServiceClient.deleteSecret(request);
* }
Expand All @@ -807,6 +808,7 @@ public final void deleteSecret(DeleteSecretRequest request) {
* DeleteSecretRequest request =
* DeleteSecretRequest.newBuilder()
* .setName(SecretName.of("[PROJECT]", "[SECRET]").toString())
* .setEtag("etag3123477")
* .build();
* ApiFuture<Empty> future =
* secretManagerServiceClient.deleteSecretCallable().futureCall(request);
Expand Down Expand Up @@ -981,7 +983,7 @@ public final ListSecretVersionsPagedResponse listSecretVersions(
/**
* Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand All @@ -997,7 +999,7 @@ public final ListSecretVersionsPagedResponse listSecretVersions(
* @param name Required. The resource name of the
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
* `projects/&#42;/secrets/&#42;/versions/&#42;`.
* `projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -1011,7 +1013,7 @@ public final SecretVersion getSecretVersion(SecretVersionName name) {
/**
* Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand All @@ -1027,7 +1029,7 @@ public final SecretVersion getSecretVersion(SecretVersionName name) {
* @param name Required. The resource name of the
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
* `projects/&#42;/secrets/&#42;/versions/&#42;`.
* `projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -1040,7 +1042,7 @@ public final SecretVersion getSecretVersion(String name) {
/**
* Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand All @@ -1067,7 +1069,7 @@ public final SecretVersion getSecretVersion(GetSecretVersionRequest request) {
/**
* Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand Down Expand Up @@ -1095,7 +1097,7 @@ public final UnaryCallable<GetSecretVersionRequest, SecretVersion> getSecretVers
* Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the
* secret data.
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand All @@ -1111,6 +1113,8 @@ public final UnaryCallable<GetSecretVersionRequest, SecretVersion> getSecretVers
* @param name Required. The resource name of the
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
* `projects/&#42;/secrets/&#42;/versions/&#42;`.
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final AccessSecretVersionResponse accessSecretVersion(SecretVersionName name) {
Expand All @@ -1126,7 +1130,7 @@ public final AccessSecretVersionResponse accessSecretVersion(SecretVersionName n
* Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the
* secret data.
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand All @@ -1142,6 +1146,8 @@ public final AccessSecretVersionResponse accessSecretVersion(SecretVersionName n
* @param name Required. The resource name of the
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format
* `projects/&#42;/secrets/&#42;/versions/&#42;`.
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final AccessSecretVersionResponse accessSecretVersion(String name) {
Expand All @@ -1155,7 +1161,7 @@ public final AccessSecretVersionResponse accessSecretVersion(String name) {
* Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the
* secret data.
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand Down Expand Up @@ -1184,7 +1190,7 @@ public final AccessSecretVersionResponse accessSecretVersion(AccessSecretVersion
* Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the
* secret data.
*
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the `latest`
* <p>`projects/&#42;/secrets/&#42;/versions/latest` is an alias to the most recently created
* [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
*
* <p>Sample code:
Expand Down Expand Up @@ -1284,6 +1290,7 @@ public final SecretVersion disableSecretVersion(String name) {
* DisableSecretVersionRequest request =
* DisableSecretVersionRequest.newBuilder()
* .setName(SecretVersionName.of("[PROJECT]", "[SECRET]", "[SECRET_VERSION]").toString())
* .setEtag("etag3123477")
* .build();
* SecretVersion response = secretManagerServiceClient.disableSecretVersion(request);
* }
Expand Down Expand Up @@ -1312,6 +1319,7 @@ public final SecretVersion disableSecretVersion(DisableSecretVersionRequest requ
* DisableSecretVersionRequest request =
* DisableSecretVersionRequest.newBuilder()
* .setName(SecretVersionName.of("[PROJECT]", "[SECRET]", "[SECRET_VERSION]").toString())
* .setEtag("etag3123477")
* .build();
* ApiFuture<SecretVersion> future =
* secretManagerServiceClient.disableSecretVersionCallable().futureCall(request);
Expand Down Expand Up @@ -1401,6 +1409,7 @@ public final SecretVersion enableSecretVersion(String name) {
* EnableSecretVersionRequest request =
* EnableSecretVersionRequest.newBuilder()
* .setName(SecretVersionName.of("[PROJECT]", "[SECRET]", "[SECRET_VERSION]").toString())
* .setEtag("etag3123477")
* .build();
* SecretVersion response = secretManagerServiceClient.enableSecretVersion(request);
* }
Expand Down Expand Up @@ -1429,6 +1438,7 @@ public final SecretVersion enableSecretVersion(EnableSecretVersionRequest reques
* EnableSecretVersionRequest request =
* EnableSecretVersionRequest.newBuilder()
* .setName(SecretVersionName.of("[PROJECT]", "[SECRET]", "[SECRET_VERSION]").toString())
* .setEtag("etag3123477")
* .build();
* ApiFuture<SecretVersion> future =
* secretManagerServiceClient.enableSecretVersionCallable().futureCall(request);
Expand Down Expand Up @@ -1521,6 +1531,7 @@ public final SecretVersion destroySecretVersion(String name) {
* DestroySecretVersionRequest request =
* DestroySecretVersionRequest.newBuilder()
* .setName(SecretVersionName.of("[PROJECT]", "[SECRET]", "[SECRET_VERSION]").toString())
* .setEtag("etag3123477")
* .build();
* SecretVersion response = secretManagerServiceClient.destroySecretVersion(request);
* }
Expand Down Expand Up @@ -1550,6 +1561,7 @@ public final SecretVersion destroySecretVersion(DestroySecretVersionRequest requ
* DestroySecretVersionRequest request =
* DestroySecretVersionRequest.newBuilder()
* .setName(SecretVersionName.of("[PROJECT]", "[SECRET]", "[SECRET_VERSION]").toString())
* .setEtag("etag3123477")
* .build();
* ApiFuture<SecretVersion> future =
* secretManagerServiceClient.destroySecretVersionCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public void createSecretTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.addAllTopics(new ArrayList<Topic>())
.setEtag("etag3123477")
.setRotation(Rotation.newBuilder().build())
.build();
mockSecretManagerService.addResponse(expectedResponse);
Expand Down Expand Up @@ -238,6 +239,7 @@ public void createSecretTest2() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.addAllTopics(new ArrayList<Topic>())
.setEtag("etag3123477")
.setRotation(Rotation.newBuilder().build())
.build();
mockSecretManagerService.addResponse(expectedResponse);
Expand Down Expand Up @@ -286,6 +288,7 @@ public void addSecretVersionTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -330,6 +333,7 @@ public void addSecretVersionTest2() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -375,6 +379,7 @@ public void getSecretTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.addAllTopics(new ArrayList<Topic>())
.setEtag("etag3123477")
.setRotation(Rotation.newBuilder().build())
.build();
mockSecretManagerService.addResponse(expectedResponse);
Expand Down Expand Up @@ -418,6 +423,7 @@ public void getSecretTest2() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.addAllTopics(new ArrayList<Topic>())
.setEtag("etag3123477")
.setRotation(Rotation.newBuilder().build())
.build();
mockSecretManagerService.addResponse(expectedResponse);
Expand Down Expand Up @@ -461,6 +467,7 @@ public void updateSecretTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.putAllLabels(new HashMap<String, String>())
.addAllTopics(new ArrayList<Topic>())
.setEtag("etag3123477")
.setRotation(Rotation.newBuilder().build())
.build();
mockSecretManagerService.addResponse(expectedResponse);
Expand Down Expand Up @@ -662,6 +669,7 @@ public void getSecretVersionTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -703,6 +711,7 @@ public void getSecretVersionTest2() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -822,6 +831,7 @@ public void disableSecretVersionTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -864,6 +874,7 @@ public void disableSecretVersionTest2() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -906,6 +917,7 @@ public void enableSecretVersionTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -947,6 +959,7 @@ public void enableSecretVersionTest2() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -988,6 +1001,7 @@ public void destroySecretVersionTest() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down Expand Up @@ -1030,6 +1044,7 @@ public void destroySecretVersionTest2() throws Exception {
.setCreateTime(Timestamp.newBuilder().build())
.setDestroyTime(Timestamp.newBuilder().build())
.setReplicationStatus(ReplicationStatus.newBuilder().build())
.setEtag("etag3123477")
.build();
mockSecretManagerService.addResponse(expectedResponse);

Expand Down
Loading