-
Notifications
You must be signed in to change notification settings - Fork 94
Operator Create Network Area #382
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
Changes from 6 commits
dd55f8f
e1fe8dc
fa3efc0
ba8cffd
23bcb35
d7e8c26
3f4128f
9d3d7ff
6a5f359
fe6123f
5cb9ed0
a0c4986
97444c3
3abb767
e6ac926
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,37 @@ public class KeyringResponse | |
| public int NumNodes { get; set; } | ||
| } | ||
|
|
||
| public class Area | ||
|
||
| { | ||
| /// <summary> | ||
| /// PeerDatacenter is the peer Consul datacenter that will make up the | ||
| /// other side of this network area. Network areas always involve a pair | ||
| /// of datacenters: the datacenter where the area was created, and the | ||
| /// peer datacenter. This is required. | ||
| /// </summary> | ||
| public string PeerDatacenter { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// RetryJoin specifies the address of Consul servers to join to, such as | ||
| /// an IPs or hostnames with an optional port number. This is optional. | ||
| /// </summary> | ||
| public string[] RetryJoin { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// UseTLS specifies whether gossip over this area should be encrypted with TLS | ||
| /// if possible. | ||
| /// </summary> | ||
| public bool UseTLS { get; set; } | ||
| } | ||
|
|
||
| public class AreaResponse : Area | ||
|
||
| { | ||
| /// <summary> | ||
| /// ID is this identifier for an area (a UUID). This must be left empty | ||
|
||
| /// when creating a new area. | ||
| /// </summary> | ||
| public string ID { get; set; } | ||
| } | ||
| public class Operator : IOperatorEndpoint | ||
| { | ||
| private readonly ConsulClient _client; | ||
|
|
@@ -249,6 +280,25 @@ public Task<QueryResult<string[]>> SegmentList(CancellationToken ct = default) | |
| { | ||
| return SegmentList(QueryOptions.Default, ct); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// CreateArea will create a new network area. The ID in the given structure must | ||
|
||
| /// be empty and a generated ID will be returned on success. | ||
| /// </summary> | ||
| public Task<WriteResult<string>> CreateArea(Area area, CancellationToken ct = default) | ||
| { | ||
| return CreateArea(area, WriteOptions.Default, ct); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// CreateArea will create a new network area. The ID in the given structure must | ||
| /// be empty and a generated ID will be returned on success. | ||
| /// </summary> | ||
| public async Task<WriteResult<string>> CreateArea(Area area, WriteOptions q, CancellationToken ct = default) | ||
| { | ||
| var res = await _client.Post<Area, AreaResponse>("/v1/operator/area", area, q).Execute(ct).ConfigureAwait(false); | ||
| return new WriteResult<string>(res, res.Response.ID); | ||
| } | ||
| } | ||
|
|
||
| public class ConsulLicense | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result type should be
Task<WriteResult<AreaResponse>>There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I made that comment I assumed that
AreaResponsewill contain only anIDfield.