in tools/code/common/WorkspaceApi.cs [468:510]
public static async ValueTask Delete(this WorkspaceApiUri uri, HttpPipeline pipeline, CancellationToken cancellationToken) =>
await pipeline.DeleteResource(uri.ToUri(), waitForCompletion: true, cancellationToken);
public static async ValueTask DeleteAllRevisions(this WorkspaceApiUri uri, HttpPipeline pipeline, CancellationToken cancellationToken) =>
await pipeline.DeleteResource(uri.ToUri()
.SetQueryParam("deleteRevisions", "true")
.ToUri(), waitForCompletion: true, cancellationToken);
public static async ValueTask PutDto(this WorkspaceApiUri uri, WorkspaceApiDto dto, HttpPipeline pipeline, CancellationToken cancellationToken)
{
if (dto.Properties.Format is null && dto.Properties.Value is null)
{
var content = BinaryData.FromObjectAsJson(dto);
await pipeline.PutContent(uri.ToUri(), content, cancellationToken);
}
else
{
if (dto.Properties.Type is "soap")
{
await PutSoapApi(uri, dto, pipeline, cancellationToken);
}
else
{
await PutNonSoapApi(uri, dto, pipeline, cancellationToken);
}
}
using var _ =
await new ResiliencePipelineBuilder<Response>()
.AddRetry(new()
{
BackoffType = DelayBackoffType.Exponential,
UseJitter = true,
MaxRetryAttempts = 5,
ShouldHandle = new PredicateBuilder<Response>().HandleResult(CreationInProgress)
})
.Build()
.ExecuteAsync(async cancellationToken =>
{
using var request = pipeline.CreateRequest(uri.ToUri(), RequestMethod.Get);
return await pipeline.SendRequestAsync(request, cancellationToken);
}, cancellationToken);
}