func (kms *GoogleCloudKMS) DestroyKeyVersion(ctx context.Context, id string) error {
	if _, err := kms.client.DestroyCryptoKeyVersion(ctx, &kmspb.DestroyCryptoKeyVersionRequest{
		Name: id,
	}); err != nil {
		// Cloud KMS returns the following errors when the key is already destroyed
		// or does not exist.
		code := grpcstatus.Code(err)
		if code == grpccodes.NotFound || code == grpccodes.FailedPrecondition {
			return nil
		}

		return fmt.Errorf("failed to destroy key version: %w", err)
	}

	return nil
}
// DestroyKeyVersion marks the given key version for destruction. If the version
// does not exist, it does nothing. The id is the full resource name like
// projects/locations/keyRings/...
DestroyKeyVersion marks the given key version for destruction. If the version
does not exist, it does nothing. The id is the full resource name like
projects/locations/keyRings/
// DestroyKeyVersion marks the given key version for destruction . If the version // does not exist it does nothing . The id is the full resource name like // projects / locations / keyRings / ...
func (kms *GoogleCloudKMS) DestroyKeyVersion(ctx context.Context, id string) error {
	if _, err := kms.client.DestroyCryptoKeyVersion(ctx, &kmspb.DestroyCryptoKeyVersionRequest{
		Name: id,
	}); err != nil {
		code := grpcstatus.Code(err)
		if code == grpccodes.NotFound || code == grpccodes.FailedPrecondition {
			return nil
		}
		return fmt.Errorf("failed to destroy key version: %w", err)
	}
	return nil
}
func ( kms * GoogleCloudKMS ) DestroyKeyVersion ( ctx context . Context , id string ) error { if _ , err := kms . client . DestroyCryptoKeyVersion ( ctx , & kmspb . DestroyCryptoKeyVersionRequest { Name : id , } ) ; err != nil { code := grpcstatus . Code ( err ) if code == grpccodes . NotFound || code == grpccodes . FailedPrecondition { return nil } return fmt . Errorf ( " " , err ) } return nil }
DestroyKeyVersion marks the given key version for destruction.
DestroyKeyVersion marks the given key version for destruction .
// Cloud KMS returns the following errors when the key is already destroyed // or does not exist.