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,5 @@
<?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 +13,9 @@
* limitations under the License.
**/
use App\Models\Foundation\Marketplace\IDistributionRepository;
use Illuminate\Http\Response;
use models\oauth2\IResourceServerContext;
use OpenApi\Attributes as OA;

/**
* Class DistributionsApiController
Expand All @@ -30,6 +33,78 @@ public function __construct(IDistributionRepository $repository, IResourceServer
parent::__construct($repository, $resource_server_context);
}

#[OA\Get(
path: "/api/public/v1/marketplace/distros",
description: "Get all marketplace distributions (OpenStack implementations)",
summary: 'Get all distributions',
operationId: 'getAllDistributions',
tags: ['Marketplace', 'Marketplace Distributions'],
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@@ubuntu')
)
),
new OA\Parameter(
name: 'order',
in: 'query',
required: false,
description: 'Order by field(s). Allowed fields: id, name, company',
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',
schema: new OA\Schema(type: 'string', example: 'company,type')
),
new OA\Parameter(
name: 'relations',
in: 'query',
required: false,
description: 'Relations to load eagerly',
schema: new OA\Schema(type: 'string', example: 'company,type')
),
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 distributions',
content: new OA\JsonContent(ref: "#/components/schemas/PaginatedMarketplaceDistributionResponseSchema")
),
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
4 changes: 2 additions & 2 deletions app/Models/Foundation/Marketplace/CompanyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function getCompany()
}

/**
* @return Company
* @return MarketPlaceType
*/
public function getType()
{
Expand Down Expand Up @@ -225,4 +225,4 @@ public function getResources()
{
return $this->resources->toArray();
}
}
}
31 changes: 29 additions & 2 deletions app/Swagger/MarketplaceSchemas.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
'type_id' => new OA\Property(property: 'type_id', type: 'integer', example: 1)
]
)]
class ConsultantsResponseSchema {}
class ConsultantsResponseSchema
{
}

#[OA\Schema(
schema: 'PaginatedConsultantsResponse',
Expand All @@ -37,4 +39,29 @@ class ConsultantsResponseSchema {}
)
]
)]
class PaginatedConsultantsResponseSchema {}
class PaginatedConsultantsResponseSchema
{
}




#[OA\Schema(
schema: 'PaginatedMarketplaceDistributionResponseSchema',
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/Distribution')
)
]
)
]
)]
class PaginatedMarketplaceDistributionResponseSchema
{
}
42 changes: 42 additions & 0 deletions app/Swagger/Models/CompanySchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'Company',
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'),
new OA\Property(property: 'url', type: 'string'),
new OA\Property(property: 'url_segment', type: 'string'),
new OA\Property(property: 'city', type: 'string'),
new OA\Property(property: 'state', type: 'string'),
new OA\Property(property: 'country', type: 'string'),
new OA\Property(property: 'description', type: 'string'),
new OA\Property(property: 'industry', type: 'string'),
new OA\Property(property: 'contributions', type: 'string'),
new OA\Property(property: 'member_level', type: 'string'),
new OA\Property(property: 'overview', type: 'string'),
new OA\Property(property: 'products', type: 'string'),
new OA\Property(property: 'commitment', type: 'string'),
new OA\Property(property: 'commitment_author', type: 'string'),
new OA\Property(property: 'logo', type: 'string'),
new OA\Property(property: 'big_logo', type: 'string'),
new OA\Property(property: 'color', type: 'string'),
new OA\Property(property: 'display_on_site', type: 'boolean'),
new OA\Property(property: 'featured', type: 'boolean'),
new OA\Property(property: 'contact_email', type: 'string'),
new OA\Property(property: 'admin_email', type: 'string'),
new OA\Property(property: 'sponsorships', type: 'array', items: new OA\Items(oneOf: [new OA\Schema(type: 'integer'), new OA\Schema(ref: '#/components/schemas/SummitSponsorship'),]), description: "SummitSponsorship, IDs when used as relationship, object when included in expand"),
new OA\Property(property: 'project_sponsorships', type: 'array', items: new OA\Items(oneOf: [new OA\Schema(type: 'integer'), new OA\Schema(ref: '#/components/schemas/ProjectSponsorshipType'),]), description: "ProjectSponsorshipType supported by the distribution, IDs when used as relationship, object when included in expand"),
])
]
class CompanySchema
{
}
14 changes: 14 additions & 0 deletions app/Swagger/Models/DistributionSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'Distribution',
ref: '#/components/schemas/OpenStackImplementation',
)]
class DistributionSchema
{
}
20 changes: 20 additions & 0 deletions app/Swagger/Models/GuestOSTypeSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'GuestOSType',
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: 'type', type: 'string', example: 'KVM'),
])
]
class GuestOSTypeSchema
{
}
20 changes: 20 additions & 0 deletions app/Swagger/Models/HyperVisorTypeSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'HyperVisorType',
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: 'type', type: 'string', example: 'KVM'),
])
]
class HyperVisorTypeSchema
{
}
21 changes: 21 additions & 0 deletions app/Swagger/Models/OpenStackComponentSchema.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: 'OpenStackComponent',
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'),
new OA\Property(property: 'code_name', type: 'string'),
])
]
class OpenStackComponentSchema
{
}
22 changes: 22 additions & 0 deletions app/Swagger/Models/OpenStackImplementationApiCoverageSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'OpenStackImplementationApiCoverage',
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: 'api_coverage', type: 'integer', example: 1),
new OA\Property(property: 'component', ref: '#/components/schemas/OpenStackComponent'),
new OA\Property(property: 'release', ref: '#/components/schemas/OpenStackRelease'),
]
)]
class OpenStackImplementationApiCoverageSchema
{
}
52 changes: 52 additions & 0 deletions app/Swagger/Models/OpenStackImplementationSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;

#[OA\Schema(
schema: 'OpenStackImplementation',
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'),
new OA\Property(property: 'url', type: 'string'),
new OA\Property(property: 'url_segment', type: 'string'),
new OA\Property(property: 'city', type: 'string'),
new OA\Property(property: 'state', type: 'string'),
new OA\Property(property: 'country', type: 'string'),
new OA\Property(property: 'description', type: 'string'),
new OA\Property(property: 'industry', type: 'string'),
new OA\Property(property: 'contributions', type: 'string'),
new OA\Property(property: 'member_level', type: 'string'),
new OA\Property(property: 'overview', type: 'string'),
new OA\Property(property: 'products', type: 'string'),
new OA\Property(property: 'commitment', type: 'string'),
new OA\Property(property: 'commitment_author', type: 'string'),
new OA\Property(property: 'logo', type: 'string'),
new OA\Property(property: 'big_logo', type: 'string'),
new OA\Property(property: 'color', type: 'string'),
new OA\Property(property: 'display_on_site', type: 'boolean'),
new OA\Property(property: 'featured', type: 'boolean'),
new OA\Property(property: 'contact_email', type: 'string'),
new OA\Property(property: 'admin_email', type: 'string'),
new OA\Property(property: 'sponsorships', type: 'array', items: new OA\Items(oneOf: [new OA\Schema(type: 'integer'), new OA\Schema(ref: '#/components/schemas/SummitSponsorship'),]), description: "SummitSponsorship, IDs when used as relationship, object when included in expand"),
new OA\Property(property: 'project_sponsorships', type: 'array', items: new OA\Items(oneOf: [new OA\Schema(type: 'integer'), new OA\Schema(ref: '#/components/schemas/ProjectSponsorshipType'),]), description: "ProjectSponsorshipType supported by the distribution, IDs when used as relationship, object when included in expand"),
new OA\Property(property: 'supported_regions', type: 'array', items: new OA\Items(oneOf: [new OA\Schema(type: 'integer'), new OA\Schema(ref: '#/components/schemas/RegionalSupport'),]), description: "RegionalSupport, only available on expand"),
new OA\Property(property: 'is_compatible_with_storage', type: 'boolean', description: "RegionalSupport, only available on expand", ),
new OA\Property(property: 'is_compatible_with_compute', type: 'boolean', description: "RegionalSupport, only available on expand", ),
new OA\Property(property: 'is_compatible_with_federated_identity', type: 'boolean', description: "RegionalSupport, only available on expand", ),
new OA\Property(property: 'is_compatible_with_platform', type: 'boolean', description: "RegionalSupport, only available on expand", ),
new OA\Property(property: 'is_openstack_powered', type: 'boolean', description: "RegionalSupport, only available on expand", ),
new OA\Property(property: 'is_openstack_tested', type: 'boolean', description: "RegionalSupport, only available on expand", ),
new OA\Property(property: 'openstack_tested_info', type: 'string', description: "RegionalSupport, only available on expand", ),
new OA\Property(property: 'capabilities', type: 'array', items: new OA\Items(ref: '#/components/schemas/OpenStackImplementationApiCoverage'), description: "OpenStackImplementationApiCoverage, only available on relations", ),
new OA\Property(property: 'guests', type: 'array', items: new OA\Items(ref: '#/components/schemas/GuestOSType'), description: "GuestOSType, only available on relations", ),
new OA\Property(property: 'hypervisors', type: 'array', items: new OA\Items(ref: '#/components/schemas/HyperVisorType'), description: "HyperVisorType, only available on relations", ),
]
)]
class OpenStackImplementationSchema
{
}
26 changes: 26 additions & 0 deletions app/Swagger/Models/OpenStackReleaseSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Swagger\schemas;

use OpenApi\Attributes as OA;


#[OA\Schema(
schema: 'OpenStackRelease',
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'),
new OA\Property(property: 'components', type: 'array', items: new OA\Items(
oneOf: [
new OA\Schema(type: 'integer'),
new OA\Schema(ref: '#/components/schemas/OpenStackComponent'),
]
), description: "OpenStackComponent supported by the distribution, IDs when used as relationship, object when included in expand"),
])
]
class OpenStackReleaseSchema
{
}
Loading