Skip to content

Commit

Permalink
update client to fixed body requests (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
fw2568 committed Jan 2, 2024
1 parent 5b6566f commit c0b02cf
Show file tree
Hide file tree
Showing 44 changed files with 391 additions and 275 deletions.
13 changes: 12 additions & 1 deletion src/Eryph.ComputeClient.Commands/Catlets/StopCatletCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ public SwitchParameter NoWait
set => _nowait = value;
}

[Parameter]
public SwitchParameter Graceful
{
get => _graceful;
set => _graceful = value;
}

private bool _force;
private bool _nowait;
private bool _graceful;
private bool _yesToAll, _noToAll;


Expand All @@ -65,7 +73,10 @@ protected override void ProcessRecord()
continue;
}

WaitForOperation(Factory.CreateCatletsClient().Stop(id).Value, _nowait, false, id);
WaitForOperation(Factory.CreateCatletsClient().Stop(id,new StopCatletRequestBody()
{
Graceful = _graceful,
}).Value, _nowait, false, id);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ protected override void ProcessRecord()
foreach (var id in Id)
{
var config = DeserializeConfigString(Config);
WaitForOperation(Factory.CreateCatletsClient().Update(new UpdateCatletRequest(Guid.NewGuid(),
JsonSerializer.SerializeToElement(config), id))
WaitForOperation(Factory.CreateCatletsClient().Update(id, new UpdateCatletRequestBody(Guid.NewGuid(),
JsonSerializer.SerializeToElement(config)))
, _nowait, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Text;
using System.Text.Json;
using Eryph.ComputeClient.Models;
using Eryph.ConfigModel.Catlets;
using Eryph.ConfigModel.Json;
using Eryph.ConfigModel.Networks;
using JetBrains.Annotations;
Expand Down
56 changes: 30 additions & 26 deletions src/Eryph.ComputeClient/Generated/CatletsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal CatletsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipelin
}

/// <summary> Creates a new catlet. </summary>
/// <param name="body"> The NewCatletRequest to use. </param>
/// <param name="body"> The <see cref="NewCatletRequest"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <remarks> Creates a catlet. </remarks>
public virtual async Task<Response<Models.Operation>> CreateAsync(NewCatletRequest body = null, CancellationToken cancellationToken = default)
Expand All @@ -60,7 +60,7 @@ public virtual async Task<Response<Models.Operation>> CreateAsync(NewCatletReque
}

/// <summary> Creates a new catlet. </summary>
/// <param name="body"> The NewCatletRequest to use. </param>
/// <param name="body"> The <see cref="NewCatletRequest"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <remarks> Creates a catlet. </remarks>
public virtual Response<Models.Operation> Create(NewCatletRequest body = null, CancellationToken cancellationToken = default)
Expand All @@ -79,7 +79,7 @@ public virtual Response<Models.Operation> Create(NewCatletRequest body = null, C
}

/// <summary> Deletes a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Models.Operation>> DeleteAsync(string id, CancellationToken cancellationToken = default)
{
Expand All @@ -97,7 +97,7 @@ public virtual async Task<Response<Models.Operation>> DeleteAsync(string id, Can
}

/// <summary> Deletes a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Models.Operation> Delete(string id, CancellationToken cancellationToken = default)
{
Expand All @@ -115,7 +115,7 @@ public virtual Response<Models.Operation> Delete(string id, CancellationToken ca
}

/// <summary> Get a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Catlet>> GetAsync(string id, CancellationToken cancellationToken = default)
{
Expand All @@ -133,7 +133,7 @@ public virtual async Task<Response<Catlet>> GetAsync(string id, CancellationToke
}

/// <summary> Get a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Catlet> Get(string id, CancellationToken cancellationToken = default)
{
Expand All @@ -151,7 +151,7 @@ public virtual Response<Catlet> Get(string id, CancellationToken cancellationTok
}

/// <summary> Get catlet configuration. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <remarks> Get the configuration of a catlet. </remarks>
public virtual async Task<Response<CatletConfiguration>> GetConfigAsync(string id, CancellationToken cancellationToken = default)
Expand All @@ -170,7 +170,7 @@ public virtual async Task<Response<CatletConfiguration>> GetConfigAsync(string i
}

/// <summary> Get catlet configuration. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <remarks> Get the configuration of a catlet. </remarks>
public virtual Response<CatletConfiguration> GetConfig(string id, CancellationToken cancellationToken = default)
Expand All @@ -189,7 +189,7 @@ public virtual Response<CatletConfiguration> GetConfig(string id, CancellationTo
}

/// <summary> Starts a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Models.Operation>> StartAsync(string id, CancellationToken cancellationToken = default)
{
Expand All @@ -207,7 +207,7 @@ public virtual async Task<Response<Models.Operation>> StartAsync(string id, Canc
}

/// <summary> Starts a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Models.Operation> Start(string id, CancellationToken cancellationToken = default)
{
Expand All @@ -225,15 +225,16 @@ public virtual Response<Models.Operation> Start(string id, CancellationToken can
}

/// <summary> Stops a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="body"> The <see cref="StopCatletRequestBody"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Models.Operation>> StopAsync(string id, CancellationToken cancellationToken = default)
public virtual async Task<Response<Models.Operation>> StopAsync(string id, StopCatletRequestBody body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("CatletsClient.Stop");
scope.Start();
try
{
return await RestClient.StopAsync(id, cancellationToken).ConfigureAwait(false);
return await RestClient.StopAsync(id, body, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
Expand All @@ -243,15 +244,16 @@ public virtual async Task<Response<Models.Operation>> StopAsync(string id, Cance
}

/// <summary> Stops a catlet. </summary>
/// <param name="id"> The String to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="body"> The <see cref="StopCatletRequestBody"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Models.Operation> Stop(string id, CancellationToken cancellationToken = default)
public virtual Response<Models.Operation> Stop(string id, StopCatletRequestBody body = null, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("CatletsClient.Stop");
scope.Start();
try
{
return RestClient.Stop(id, cancellationToken);
return RestClient.Stop(id, body, cancellationToken);
}
catch (Exception e)
{
Expand All @@ -261,15 +263,16 @@ public virtual Response<Models.Operation> Stop(string id, CancellationToken canc
}

/// <summary> Updates a catlet. </summary>
/// <param name="body"> The UpdateCatletRequest to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="body"> The <see cref="UpdateCatletRequestBody"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async Task<Response<Models.Operation>> UpdateAsync(UpdateCatletRequest body = null, CancellationToken cancellationToken = default)
public virtual async Task<Response<Models.Operation>> UpdateAsync(string id, UpdateCatletRequestBody body, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("CatletsClient.Update");
scope.Start();
try
{
return await RestClient.UpdateAsync(body, cancellationToken).ConfigureAwait(false);
return await RestClient.UpdateAsync(id, body, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
Expand All @@ -279,15 +282,16 @@ public virtual async Task<Response<Models.Operation>> UpdateAsync(UpdateCatletRe
}

/// <summary> Updates a catlet. </summary>
/// <param name="body"> The UpdateCatletRequest to use. </param>
/// <param name="id"> The <see cref="string"/> to use. </param>
/// <param name="body"> The <see cref="UpdateCatletRequestBody"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Response<Models.Operation> Update(UpdateCatletRequest body = null, CancellationToken cancellationToken = default)
public virtual Response<Models.Operation> Update(string id, UpdateCatletRequestBody body, CancellationToken cancellationToken = default)
{
using var scope = _clientDiagnostics.CreateScope("CatletsClient.Update");
scope.Start();
try
{
return RestClient.Update(body, cancellationToken);
return RestClient.Update(id, body, cancellationToken);
}
catch (Exception e)
{
Expand All @@ -297,8 +301,8 @@ public virtual Response<Models.Operation> Update(UpdateCatletRequest body = null
}

/// <summary> List all catlets. </summary>
/// <param name="count"> The Boolean to use. </param>
/// <param name="project"> The String to use. </param>
/// <param name="count"> The <see cref="bool"/>? to use. </param>
/// <param name="project"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual AsyncPageable<Catlet> ListAsync(bool? count = null, string project = null, CancellationToken cancellationToken = default)
{
Expand All @@ -308,8 +312,8 @@ public virtual AsyncPageable<Catlet> ListAsync(bool? count = null, string projec
}

/// <summary> List all catlets. </summary>
/// <param name="count"> The Boolean to use. </param>
/// <param name="project"> The String to use. </param>
/// <param name="count"> The <see cref="bool"/>? to use. </param>
/// <param name="project"> The <see cref="string"/> to use. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Pageable<Catlet> List(bool? count = null, string project = null, CancellationToken cancellationToken = default)
{
Expand Down
Loading

0 comments on commit c0b02cf

Please sign in to comment.