Skip to content

Commit

Permalink
feat: Rotation for Secrets
Browse files Browse the repository at this point in the history
Users can now configure rotation schedules for their secrets. Secret Manager sends messages to PubSub topics configured on the secret based on the provided rotation frequency and rotation time.

Committer: @rlingutla
PiperOrigin-RevId: 365574085

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Mar 29 07:58:13 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 6c7693680fe320b4705dd8500c255843749eb58a
Source-Link: googleapis/googleapis@6c76936
  • Loading branch information
yoshi-automation authored and jskeet committed Mar 29, 2021
1 parent b40ca4e commit 5e2fe40
Show file tree
Hide file tree
Showing 3 changed files with 370 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void CreateSecretRequestObject()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.CreateSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -89,6 +90,7 @@ public void CreateSecretRequestObject()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.CreateSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -124,6 +126,7 @@ public void CreateSecret()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.CreateSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -157,6 +160,7 @@ public void CreateSecret()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.CreateSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -192,6 +196,7 @@ public void CreateSecretResourceNames()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.CreateSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -225,6 +230,7 @@ public void CreateSecretResourceNames()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.CreateSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -408,6 +414,7 @@ public void GetSecretRequestObject()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.GetSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -439,6 +446,7 @@ public void GetSecretRequestObject()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.GetSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -472,6 +480,7 @@ public void GetSecret()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.GetSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -503,6 +512,7 @@ public void GetSecret()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.GetSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -536,6 +546,7 @@ public void GetSecretResourceNames()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.GetSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -567,6 +578,7 @@ public void GetSecretResourceNames()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.GetSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -601,6 +613,7 @@ public void UpdateSecretRequestObject()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.UpdateSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -633,6 +646,7 @@ public void UpdateSecretRequestObject()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.UpdateSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -667,6 +681,7 @@ public void UpdateSecret()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.UpdateSecret(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -699,6 +714,7 @@ public void UpdateSecret()
Topics = { new Topic(), },
ExpireTime = new wkt::Timestamp(),
Ttl = new wkt::Duration(),
Rotation = new Rotation(),
};
mockGrpcClient.Setup(x => x.UpdateSecretAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Secret>(stt::Task.FromResult(expectedResponse), null, null, null, null));
SecretManagerServiceClient client = new SecretManagerServiceClientImpl(mockGrpcClient.Object, null);
Expand Down
Loading

0 comments on commit 5e2fe40

Please sign in to comment.