Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php namespace App\Http\Controllers;
<?php

namespace App\Http\Controllers;

/**
* Copyright 2017 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,7 +15,9 @@
* limitations under the License.
**/
use App\Models\Foundation\Marketplace\IPublicCloudServiceRepository;
use Illuminate\Http\Response;
use models\oauth2\IResourceServerContext;
use OpenApi\Attributes as OA;

/**
* Class PublicCloudsApiController
Expand All @@ -21,14 +26,86 @@
final class PublicCloudsApiController extends AbstractCompanyServiceApiController
{
/**
* PrivateCloudsApiController constructor.
* PublicCloudsApiController constructor.
* @param IPublicCloudServiceRepository $repository
*/
public function __construct(IPublicCloudServiceRepository $repository, IResourceServerContext $resource_server_context)
{
parent::__construct($repository, $resource_server_context);
}

#[OA\Get(
path: "/api/public/v1/marketplace/public-clouds",
description: "Get all marketplace public cloud services (OpenStack implementations)",
summary: 'Get all public clouds',
operationId: 'getAllPublicClouds',
tags: ['Marketplace', 'Clouds'],
parameters: [
new OA\Parameter(
name: 'page',
in: 'query',
required: false,
description: 'Page number for pagination',
schema: new OA\Schema(type: 'integer', example: 1)
),
new OA\Parameter(
name: 'per_page',
in: 'query',
required: false,
description: 'Items per page',
schema: new OA\Schema(type: 'integer', example: 10, maximum: 100)
),
new OA\Parameter(
name: 'filter[]',
in: 'query',
required: false,
description: 'Filter expressions in the format field<op>value. Available fields: name, company. Operators: =@, ==, @@.',
style: 'form',
explode: true,
schema: new OA\Schema(
type: 'array',
items: new OA\Items(type: 'string', example: 'name@@aws')
)
),
new OA\Parameter(
name: 'order',
in: 'query',
required: false,
description: 'Order by field(s)',
schema: new OA\Schema(type: 'string', example: 'name,-id')
),
new OA\Parameter(
name: 'expand',
in: 'query',
required: false,
description: 'Comma-separated list of related resources to include. Available relations: company, type, capabilities, guests, hypervisors, supported_regions, data_centers, data_center_regions',
schema: new OA\Schema(type: 'string', example: 'company,data_centers')
),
new OA\Parameter(
name: 'relations',
in: 'query',
required: false,
description: 'Relations to load eagerly',
schema: new OA\Schema(type: 'string', example: 'company,data_centers')
),
new OA\Parameter(
name: 'fields',
in: 'query',
required: false,
description: 'Comma-separated list of fields to return',
schema: new OA\Schema(type: 'string', example: 'id,name,company.name')
),
],
responses: [
new OA\Response(
response: 200,
description: 'Success - Returns paginated list of public clouds',
content: new OA\JsonContent(ref: '#/components/schemas/PaginatedPublicOrPrivateCloudsResponse')
),
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error")
]
)]
public function getAll()
{
return parent::getAll();
Expand Down
20 changes: 20 additions & 0 deletions app/Swagger/MarketplaceSchemas.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,23 @@ class PaginatedConsultantsResponseSchema
class PaginatedMarketplaceDistributionResponseSchema
{
}

#[OA\Schema(
schema: 'PaginatedPublicOrPrivateCloudsResponse',
allOf: [
new OA\Schema(ref: '#/components/schemas/PaginateDataSchemaResponse'),
new OA\Schema(
type: 'object',
properties: [
new OA\Property(
property: 'data',
type: 'array',
items: new OA\Items(ref: '#/components/schemas/CloudService')
)
]
)
]
)]
class PaginatedPublicOrPrivateCloudsResponseSchema
{
}
23 changes: 23 additions & 0 deletions app/Swagger/Models/CloudServiceSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'CloudService',
allOf: [
new OA\Schema(ref: '#/components/schemas/OpenStackImplementation'),
new OA\Schema(
type: 'object',
properties: [
new OA\Property(property: 'data_centers', type: 'array', items: new OA\Items(ref: '#/components/schemas/DataCenterLocation'), description: 'List of DataCenterLocation objects associated with this CloudService, only if ?relations=data_centers is used in the query string'),
new OA\Property(property: 'data_center_regions', type: 'array', items: new OA\Items(ref: '#/components/schemas/DataCenterRegion'), description: 'List of DataCenterRegion objects associated with this CloudService, only if ?relations=data_center_regions is used in the query string'),
]
),
],
)]
class CloudServiceSchema
{
}
27 changes: 27 additions & 0 deletions app/Swagger/Models/DataCenterLocationSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'DataCenterLocation',
type: 'object',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'created', type: 'integer', example: 1),
new OA\Property(property: 'last_edited', type: 'integer', example: 1),
new OA\Property(property: 'city', type: 'string', example: 'New York'),
new OA\Property(property: 'state', type: 'string', example: 'NY'),
new OA\Property(property: 'country', type: 'string', example: 'USA'),
new OA\Property(property: 'lat', type: 'number', example: 40.7128),
new OA\Property(property: 'lng', type: 'number', example: -74.0060),
new OA\Property(property: 'region_id', type: 'integer', example: 1, description: 'DataCenterRegion ID'),
new OA\Property(property: 'region', ref: '#/components/schemas/DataCenterRegion', description: 'DataCenterRegion object, only present if ?expand=region is used in the query string'),

])
]
class DataCenterLocationSchema
{
}
21 changes: 21 additions & 0 deletions app/Swagger/Models/DataCenterRegionSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'DataCenterRegion',
type: 'object',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'created', type: 'integer', example: 1),
new OA\Property(property: 'last_edited', type: 'integer', example: 1),
new OA\Property(property: 'name', type: 'string', example: 'Data Center 1'),
new OA\Property(property: 'endpoint', type: 'string', example: 'https://endpoint.example.com'),
])
]
class DataCenterRegionSchema
{
}
1 change: 1 addition & 0 deletions app/Swagger/schemas.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,4 @@ class ChunkedFileUploadCompleteResponseSchema {}
]
)]
class ChunkedFileUploadRequestSchema {}