-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from Etherna/feature/BHM-148-import-bee-load-b…
…alancer Feature/bhm 148 import bee load balancer
- Loading branch information
Showing
35 changed files
with
1,083 additions
and
72 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
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,53 @@ | ||
// Copyright 2021-present Etherna SA | ||
// This file is part of Beehive. | ||
// | ||
// Beehive is free software: you can redistribute it and/or modify it under the terms of the | ||
// GNU Affero General Public License as published by the Free Software Foundation, | ||
// either version 3 of the License, or (at your option) any later version. | ||
// | ||
// Beehive is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
// See the GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License along with Beehive. | ||
// If not, see <https://www.gnu.org/licenses/>. | ||
|
||
using Etherna.Beehive.Areas.Api.DtoModels; | ||
using Etherna.Beehive.Areas.Api.Services; | ||
using Etherna.Beehive.Attributes; | ||
using Etherna.BeeNet.Models; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Threading.Tasks; | ||
|
||
namespace Etherna.Beehive.Areas.Api.Controllers | ||
{ | ||
[ApiController] | ||
[Route("bytes")] | ||
[Route("v{api-version:apiVersion}/bytes")] | ||
public class BytesController(IBytesControllerService service) | ||
: ControllerBase | ||
{ | ||
// Get. | ||
|
||
[HttpGet("{*hash:minlength(1)}")] | ||
[SimpleExceptionFilter] | ||
[ProducesResponseType(StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status404NotFound)] | ||
public Task<IResult> DownloadBytesAsync(SwarmHash hash) => | ||
service.DownloadBytesAsync(hash, HttpContext); | ||
|
||
// Post. | ||
|
||
[HttpPost] | ||
[SimpleExceptionFilter] | ||
[ProducesResponseType(typeof(ChunkReferenceDto), StatusCodes.Status201Created)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status402PaymentRequired)] | ||
public Task<IResult> UploadBytesAsync( | ||
[FromHeader(Name = SwarmHttpConsts.SwarmPostageBatchIdHeader), Required] PostageBatchId batchId) => | ||
service.UploadBytesAsync(batchId, HttpContext); | ||
} | ||
} |
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,55 @@ | ||
// Copyright 2021-present Etherna SA | ||
// This file is part of Beehive. | ||
// | ||
// Beehive is free software: you can redistribute it and/or modify it under the terms of the | ||
// GNU Affero General Public License as published by the Free Software Foundation, | ||
// either version 3 of the License, or (at your option) any later version. | ||
// | ||
// Beehive is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
// See the GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License along with Beehive. | ||
// If not, see <https://www.gnu.org/licenses/>. | ||
|
||
using Etherna.Beehive.Areas.Api.Services; | ||
using Etherna.Beehive.Attributes; | ||
using Etherna.BeeNet.Models; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Threading.Tasks; | ||
|
||
namespace Etherna.Beehive.Areas.Api.Controllers | ||
{ | ||
[ApiController] | ||
[Route("feeds")] | ||
[Route("v{api-version:apiVersion}/feeds")] | ||
public class FeedsController(IFeedsControllerService service) | ||
: ControllerBase | ||
{ | ||
// Get. | ||
|
||
[HttpGet("{owner:length(40)}/{topic}")] | ||
[SimpleExceptionFilter] | ||
[ProducesResponseType(StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status404NotFound)] | ||
public Task<IResult> FindFeedUpdateAsync(string owner, string topic) => | ||
service.FindFeedUpdateAsync(owner, topic, HttpContext); | ||
|
||
// Post. | ||
|
||
[HttpPost("{owner:length(40)}/{topic}")] | ||
[SimpleExceptionFilter] | ||
[ProducesResponseType(StatusCodes.Status201Created)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||
[ProducesResponseType(StatusCodes.Status402PaymentRequired)] | ||
public Task<IResult> CreateFeedRootManifestAsync( | ||
string owner, | ||
string topic, | ||
[FromHeader(Name = SwarmHttpConsts.SwarmPostageBatchIdHeader), Required] PostageBatchId batchId) => | ||
service.CreateFeedRootManifestAsync(owner, topic, batchId, HttpContext); | ||
} | ||
} |
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,44 @@ | ||
// Copyright 2021-present Etherna SA | ||
// This file is part of Beehive. | ||
// | ||
// Beehive is free software: you can redistribute it and/or modify it under the terms of the | ||
// GNU Affero General Public License as published by the Free Software Foundation, | ||
// either version 3 of the License, or (at your option) any later version. | ||
// | ||
// Beehive is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
// See the GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License along with Beehive. | ||
// If not, see <https://www.gnu.org/licenses/>. | ||
|
||
using Etherna.Beehive.Areas.Api.Services; | ||
using Etherna.Beehive.Attributes; | ||
using Etherna.BeeNet.Models; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Threading.Tasks; | ||
|
||
namespace Etherna.Beehive.Areas.Api.Controllers | ||
{ | ||
[ApiController] | ||
[Route("pss")] | ||
[Route("v{api-version:apiVersion}/pss")] | ||
public class PssController(IPssControllerService service) | ||
: ControllerBase | ||
{ | ||
// Post. | ||
|
||
[HttpPost("send/{topic}/{targets}")] | ||
[SimpleExceptionFilter] | ||
[ProducesResponseType(StatusCodes.Status201Created)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status402PaymentRequired)] | ||
public Task<IResult> SendPssMessageAsync( | ||
string topic, | ||
string targets, | ||
[FromHeader(Name = SwarmHttpConsts.SwarmPostageBatchIdHeader), Required] PostageBatchId batchId) => | ||
service.SendPssMessageAsync(topic, targets, batchId, HttpContext); | ||
} | ||
} |
Oops, something went wrong.