Skip to content

Commit

Permalink
Improve missing KMS error message (#6) (#2279)
Browse files Browse the repository at this point in the history
* Improve missing KMS error message

Also enhance examples, some minor cleanup

* Fix tests
  • Loading branch information
rayokota authored Aug 6, 2024
1 parent e7ffcd8 commit 55943a3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
6 changes: 5 additions & 1 deletion examples/AvroGenericEncryption/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static async Task Main(string[] args)
AzureKmsDriver.Register();
GcpKmsDriver.Register();
HcVaultKmsDriver.Register();
LocalKmsDriver.Register();
FieldEncryptionExecutor.Register();

string bootstrapServers = args[0];
Expand Down Expand Up @@ -79,7 +80,10 @@ static async Task Main(string[] args)
// optional Avro serializer properties:
BufferBytes = 100
};

// KMS properties can be passed as follows
// avroSerializerConfig.Set("rules.secret.access.key", "xxx");
// avroSerializerConfig.Set("rules.access.key.id", "xxx");

RuleSet ruleSet = new RuleSet(new List<Rule>(),
new List<Rule>
{
Expand Down
6 changes: 5 additions & 1 deletion examples/AvroSpecificEncryption/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static void Main(string[] args)
AzureKmsDriver.Register();
GcpKmsDriver.Register();
HcVaultKmsDriver.Register();
LocalKmsDriver.Register();
FieldEncryptionExecutor.Register();

string bootstrapServers = args[0];
Expand Down Expand Up @@ -82,7 +83,10 @@ static void Main(string[] args)
// optional Avro serializer properties:
BufferBytes = 100
};

// KMS properties can be passed as follows
// avroSerializerConfig.Set("rules.secret.access.key", "xxx");
// avroSerializerConfig.Set("rules.access.key.id", "xxx");

RuleSet ruleSet = new RuleSet(new List<Rule>(),
new List<Rule>
{
Expand Down
4 changes: 4 additions & 0 deletions examples/JsonEncryption/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ static async Task Main(string[] args)
AzureKmsDriver.Register();
GcpKmsDriver.Register();
HcVaultKmsDriver.Register();
LocalKmsDriver.Register();
FieldEncryptionExecutor.Register();

string bootstrapServers = args[0];
Expand Down Expand Up @@ -135,6 +136,9 @@ static async Task Main(string[] args)
UseLatestVersion = true,
BufferBytes = 100
};
// KMS properties can be passed as follows
// jsonSerializerConfig.Set("rules.secret.access.key", "xxx");
// jsonSerializerConfig.Set("rules.access.key.id", "xxx");

RuleSet ruleSet = new RuleSet(new List<Rule>(),
new List<Rule>
Expand Down
6 changes: 5 additions & 1 deletion examples/ProtobufEncryption/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static async Task Main(string[] args)
AzureKmsDriver.Register();
GcpKmsDriver.Register();
HcVaultKmsDriver.Register();
LocalKmsDriver.Register();
FieldEncryptionExecutor.Register();

string bootstrapServers = args[0];
Expand Down Expand Up @@ -96,7 +97,10 @@ message User {
// optional Avro serializer properties:
BufferBytes = 100
};

// KMS properties can be passed as follows
// protobufSerializerConfig.Set("rules.secret.access.key", "xxx");
// protobufSerializerConfig.Set("rules.access.key.id", "xxx");

RuleSet ruleSet = new RuleSet(new List<Rule>(),
new List<Rule>
{
Expand Down
3 changes: 2 additions & 1 deletion src/Confluent.SchemaRegistry.Encryption/KmsRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//
// Refer to LICENSE for more information.

using System;
using System.Collections.Generic;
using System.Threading;

Expand Down Expand Up @@ -61,7 +62,7 @@ public static IKmsDriver GetKmsDriver(string keyUrl)
kmsDriversMutex.Release();
}

return null;
throw new ArgumentException("No KMS driver found for key URL: " + keyUrl); ;
}

public static void RegisterKmsClient(IKmsClient kmsClient)
Expand Down
9 changes: 3 additions & 6 deletions src/Confluent.SchemaRegistry/Rest/DataContracts/Schema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,18 @@ public class Schema : IComparable<Schema>, IEquatable<Schema>
#region API backwards-compatibility hack

/// <summary>
/// DEPRECATED. The subject the schema is registered against.
/// The subject the schema is registered against.
/// </summary>
[Obsolete("Included to maintain API backwards compatibility only. Use RegisteredSchema instead. This property will be removed in a future version of the library.")]
public virtual string Subject { get; set; }

/// <summary>
/// DEPRECATED. The schema version.
/// The schema version.
/// </summary>
[Obsolete("Included to maintain API backwards compatibility only. Use RegisteredSchema instead. This property will be removed in a future version of the library.")]
public virtual int Version { get; set; }

/// <summary>
/// DEPRECATED. Unique identifier of the schema.
/// Unique identifier of the schema.
/// </summary>
[Obsolete("Included to maintain API backwards compatibility only. Use RegisteredSchema instead. This property will be removed in a future version of the library.")]
public virtual int Id { get; set; }

/// <summary>
Expand Down

0 comments on commit 55943a3

Please sign in to comment.