-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generate JetStream models with NJsonSchema (#90)
Signed-off-by: Caleb Lloyd <[email protected]>
- Loading branch information
1 parent
514149c
commit ba0bf9e
Showing
162 changed files
with
6,214 additions
and
1,351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace NATS.Client.JetStream.Models; | ||
|
||
/// <summary> | ||
/// A response from the JetStream $JS.API.INFO API | ||
/// </summary> | ||
|
||
public record AccountInfoResponse : AccountStats | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,66 @@ | ||
// Copyright 2023 The NATS Authors | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.Text.Json.Serialization; | ||
|
||
namespace NATS.Client.JetStream.Models; | ||
|
||
public record AccountLimits | ||
{ | ||
[JsonPropertyName("max_memory")] | ||
public long MaxMemory { get; set; } | ||
/// <summary> | ||
/// The maximum amount of Memory storage Stream Messages may consume | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("max_memory")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(-1, int.MaxValue)] | ||
public int MaxMemory { get; set; } = default!; | ||
|
||
[JsonPropertyName("max_storage")] | ||
public long MaxStorage { get; set; } | ||
/// <summary> | ||
/// The maximum amount of File storage Stream Messages may consume | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("max_storage")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(-1, int.MaxValue)] | ||
public int MaxStorage { get; set; } = default!; | ||
|
||
[JsonPropertyName("max_streams")] | ||
public long MaxStreams { get; set; } | ||
/// <summary> | ||
/// The maximum number of Streams an account can create | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("max_streams")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(-1, int.MaxValue)] | ||
public int MaxStreams { get; set; } = default!; | ||
|
||
[JsonPropertyName("max_consumers")] | ||
public long MaxConsumers { get; set; } | ||
/// <summary> | ||
/// The maximum number of Consumer an account can create | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("max_consumers")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(-1, int.MaxValue)] | ||
public int MaxConsumers { get; set; } = default!; | ||
|
||
[JsonPropertyName("max_ack_pending")] | ||
public long MaxAckPending { get; set; } | ||
/// <summary> | ||
/// Indicates if Streams created in this account requires the max_bytes property set | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("max_bytes_required")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
public bool MaxBytesRequired { get; set; } = false; | ||
|
||
[JsonPropertyName("memory_max_stream_bytes")] | ||
public long MemoryMaxStreamBytes { get; set; } | ||
/// <summary> | ||
/// The maximum number of outstanding ACKs any consumer may configure | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("max_ack_pending")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
public int MaxAckPending { get; set; } = default!; | ||
|
||
[JsonPropertyName("storage_max_stream_bytes")] | ||
public long StorageMaxStreamBytes { get; set; } | ||
/// <summary> | ||
/// The maximum size any single memory stream may be | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("memory_max_stream_bytes")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
[System.ComponentModel.DataAnnotations.Range(-1, int.MaxValue)] | ||
public int MemoryMaxStreamBytes { get; set; } = -1; | ||
|
||
[JsonPropertyName("max_bytes_required")] | ||
public bool MaxBytesRequired { get; set; } | ||
/// <summary> | ||
/// The maximum size any single storage based stream may be | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("storage_max_stream_bytes")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
[System.ComponentModel.DataAnnotations.Range(-1, int.MaxValue)] | ||
public int StorageMaxStreamBytes { get; set; } = -1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace NATS.Client.JetStream.Models; | ||
|
||
/// <summary> | ||
/// A response from the JetStream $JS.API.ACCOUNT.PURGE API | ||
/// </summary> | ||
|
||
public record AccountPurgeResponse | ||
{ | ||
/// <summary> | ||
/// If the purge operation was succesfully started | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("initiated")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
public bool Initiated { get; set; } = false; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
namespace NATS.Client.JetStream.Models; | ||
|
||
public record AccountStats | ||
{ | ||
/// <summary> | ||
/// Memory Storage being used for Stream Message storage | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("memory")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] | ||
public int Memory { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// File Storage being used for Stream Message storage | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("storage")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] | ||
public int Storage { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// Number of active Streams | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("streams")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] | ||
public int Streams { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// Number of active Consumers | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("consumers")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] | ||
public int Consumers { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// The JetStream domain this account is in | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("domain")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
public string Domain { get; set; } = default!; | ||
|
||
[System.Text.Json.Serialization.JsonPropertyName("limits")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Required] | ||
public AccountLimits Limits { get; set; } = new AccountLimits(); | ||
|
||
[System.Text.Json.Serialization.JsonPropertyName("tiers")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
public System.Collections.Generic.IDictionary<string, object> Tiers { get; set; } = default!; | ||
|
||
[System.Text.Json.Serialization.JsonPropertyName("api")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Required] | ||
public ApiStats Api { get; set; } = new ApiStats(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace NATS.Client.JetStream.Models; | ||
|
||
public record ApiError | ||
{ | ||
/// <summary> | ||
/// HTTP like error code in the 300 to 500 range | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("code")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(300, 699)] | ||
public int Code { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// A human friendly description of the error | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("description")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
public string Description { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// The NATS error code unique to each kind of error | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("err_code")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] | ||
[System.ComponentModel.DataAnnotations.Range(0, 65535)] | ||
public int ErrCode { get; set; } = default!; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
// Copyright 2023 The NATS Authors | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.Text.Json.Serialization; | ||
|
||
namespace NATS.Client.JetStream.Models; | ||
|
||
public record ApiStats | ||
{ | ||
[JsonPropertyName("total")] | ||
public long Total { get; set; } | ||
/// <summary> | ||
/// Total number of API requests received for this account | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("total")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] | ||
public int Total { get; set; } = default!; | ||
|
||
[JsonPropertyName("errors")] | ||
public long Errors { get; set; } | ||
/// <summary> | ||
/// API requests that resulted in an error response | ||
/// </summary> | ||
[System.Text.Json.Serialization.JsonPropertyName("errors")] | ||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] | ||
[System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] | ||
public int Errors { get; set; } = default!; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.