Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-export googleapi proto definitions for KMS; updated documentation #268

Merged
merged 2 commits into from
May 23, 2024
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
2 changes: 1 addition & 1 deletion kms/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "google-cloud-kms"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
authors = ["yoshidan <naohiro.y@gmail.com>"]
repository = "https://github.com/yoshidan/google-cloud-rust/tree/main/kms"
Expand Down
2 changes: 1 addition & 1 deletion kms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Google Cloud Platform Key Management Service Client library.

[![crates.io](https://img.shields.io/crates/v/google-cloud-artifact-registry.svg)](https://crates.io/crates/google-cloud-artifact-registry)
[![crates.io](https://img.shields.io/crates/v/google-cloud-kms.svg)](https://crates.io/crates/google-cloud-kms)

* [About KMS](https://cloud.google.com/kms/)
* [JSON API Documentation](https://cloud.google.com/kms/docs/reference/rest)
Expand Down
2 changes: 1 addition & 1 deletion kms/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod tests {

use serial_test::serial;

use google_cloud_googleapis::cloud::kms::v1::{
use crate::grpc::kms::v1::{
AsymmetricSignRequest, CreateKeyRingRequest, DecryptRequest, EncryptRequest, GenerateRandomBytesRequest,
GetKeyRingRequest, GetPublicKeyRequest, ListKeyRingsRequest, MacSignRequest, MacVerifyRequest, ProtectionLevel,
};
Expand Down
2 changes: 1 addition & 1 deletion kms/src/grpc/apiv1/conn_pool.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::grpc::kms::v1::key_management_service_client::KeyManagementServiceClient;
use google_cloud_gax::conn::{Channel, Environment};
use google_cloud_gax::conn::{ConnectionManager as GRPCConnectionManager, ConnectionOptions, Error};
use google_cloud_googleapis::cloud::kms::v1::key_management_service_client::KeyManagementServiceClient;

pub const AUDIENCE: &str = "https://cloudkms.googleapis.com/";
pub const KMS: &str = "cloudkms.googleapis.com";
Expand Down
70 changes: 35 additions & 35 deletions kms/src/grpc/apiv1/kms_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ use google_cloud_gax::create_request;
use google_cloud_gax::grpc::{Code, Status};
use google_cloud_gax::retry::{invoke, RetrySetting};

use google_cloud_googleapis::cloud::kms::v1::CreateCryptoKeyVersionRequest;
use google_cloud_googleapis::cloud::kms::v1::CreateKeyRingRequest;
use google_cloud_googleapis::cloud::kms::v1::CryptoKey;
use google_cloud_googleapis::cloud::kms::v1::CryptoKeyVersion;
use google_cloud_googleapis::cloud::kms::v1::DestroyCryptoKeyVersionRequest;
use google_cloud_googleapis::cloud::kms::v1::GenerateRandomBytesRequest;
use google_cloud_googleapis::cloud::kms::v1::GenerateRandomBytesResponse;
use google_cloud_googleapis::cloud::kms::v1::GetCryptoKeyRequest;
use google_cloud_googleapis::cloud::kms::v1::GetCryptoKeyVersionRequest;
use google_cloud_googleapis::cloud::kms::v1::GetKeyRingRequest;
use google_cloud_googleapis::cloud::kms::v1::KeyRing;
use google_cloud_googleapis::cloud::kms::v1::ListCryptoKeyVersionsRequest;
use google_cloud_googleapis::cloud::kms::v1::ListCryptoKeyVersionsResponse;
use google_cloud_googleapis::cloud::kms::v1::ListCryptoKeysRequest;
use google_cloud_googleapis::cloud::kms::v1::ListCryptoKeysResponse;
use google_cloud_googleapis::cloud::kms::v1::ListKeyRingsRequest;
use google_cloud_googleapis::cloud::kms::v1::ListKeyRingsResponse;
use google_cloud_googleapis::cloud::kms::v1::{
use crate::grpc::kms::v1::CreateCryptoKeyVersionRequest;
use crate::grpc::kms::v1::CreateKeyRingRequest;
use crate::grpc::kms::v1::CryptoKey;
use crate::grpc::kms::v1::CryptoKeyVersion;
use crate::grpc::kms::v1::DestroyCryptoKeyVersionRequest;
use crate::grpc::kms::v1::GenerateRandomBytesRequest;
use crate::grpc::kms::v1::GenerateRandomBytesResponse;
use crate::grpc::kms::v1::GetCryptoKeyRequest;
use crate::grpc::kms::v1::GetCryptoKeyVersionRequest;
use crate::grpc::kms::v1::GetKeyRingRequest;
use crate::grpc::kms::v1::KeyRing;
use crate::grpc::kms::v1::ListCryptoKeyVersionsRequest;
use crate::grpc::kms::v1::ListCryptoKeyVersionsResponse;
use crate::grpc::kms::v1::ListCryptoKeysRequest;
use crate::grpc::kms::v1::ListCryptoKeysResponse;
use crate::grpc::kms::v1::ListKeyRingsRequest;
use crate::grpc::kms::v1::ListKeyRingsResponse;
use crate::grpc::kms::v1::{
AsymmetricSignRequest, AsymmetricSignResponse, CreateCryptoKeyRequest, DecryptRequest, DecryptResponse,
EncryptRequest, EncryptResponse, GetPublicKeyRequest, MacSignRequest, MacSignResponse, MacVerifyRequest,
MacVerifyResponse, PublicKey,
Expand Down Expand Up @@ -52,7 +52,7 @@ impl Client {

/// Generate random bytes
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn generate_random_bytes(
Expand All @@ -71,7 +71,7 @@ impl Client {

/// Create crypto key
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.CreateCryptoKey
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.CreateCryptoKey>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn create_crypto_key(
Expand All @@ -90,7 +90,7 @@ impl Client {

/// Create crypto key version
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn create_crypto_key_version(
Expand All @@ -109,7 +109,7 @@ impl Client {

/// Create key ring
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.CreateKeyRing
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.CreateKeyRing>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn create_key_ring(
Expand All @@ -128,7 +128,7 @@ impl Client {

/// Destroy crypto key version
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn destroy_crypto_key_version(
Expand All @@ -147,7 +147,7 @@ impl Client {

/// Get crypto key
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GetCryptoKey
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GetCryptoKey>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn get_crypto_key(
Expand All @@ -166,7 +166,7 @@ impl Client {

/// Get crypto key version
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn get_crypto_key_version(
Expand All @@ -185,7 +185,7 @@ impl Client {

/// Get key ring
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GetKeyRing
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.GetKeyRing>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn get_key_ring(&self, req: GetKeyRingRequest, retry: Option<RetrySetting>) -> Result<KeyRing, Status> {
Expand All @@ -200,7 +200,7 @@ impl Client {

/// List crypto key versions
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn list_crypto_key_versions(
Expand All @@ -219,7 +219,7 @@ impl Client {

/// List crypto keys
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.ListCryptoKeys
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.ListCryptoKeys>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn list_crypto_keys(
Expand All @@ -238,7 +238,7 @@ impl Client {

/// List key rings
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.ListKeyRings
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.ListKeyRings>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn list_key_rings(
Expand All @@ -257,7 +257,7 @@ impl Client {

/// Encrypt
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.Encrypt
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.Encrypt>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn encrypt(&self, req: EncryptRequest, retry: Option<RetrySetting>) -> Result<EncryptResponse, Status> {
Expand All @@ -272,7 +272,7 @@ impl Client {

/// Decrypt
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.Decrypt
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.Decrypt>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn decrypt(&self, req: DecryptRequest, retry: Option<RetrySetting>) -> Result<DecryptResponse, Status> {
Expand All @@ -287,7 +287,7 @@ impl Client {

/// AsymmetricSign
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.AsymmetricSign
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.AsymmetricSign>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn asymmetric_sign(
Expand All @@ -306,7 +306,7 @@ impl Client {

/// MacSign
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.MacSign
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.MacSign>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn mac_sign(&self, req: MacSignRequest, retry: Option<RetrySetting>) -> Result<MacSignResponse, Status> {
Expand All @@ -321,7 +321,7 @@ impl Client {

/// MacVerify
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.MacVerify
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.MacVerify>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn mac_verify(
Expand All @@ -340,7 +340,7 @@ impl Client {

/// PublicKey
///
/// https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.PublicKey
/// <https://cloud.google.com/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.PublicKey>
///
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
pub async fn get_public_key(
Expand Down
1 change: 1 addition & 0 deletions kms/src/grpc/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pub mod apiv1;
pub use google_cloud_googleapis::cloud::kms;
Loading