Marketplace API
* Migrated from eloquent to doctrine ORM * Added public endpoints (rate limited) exposing marketplace api Change-Id: Ib60ad6c45e3e41afd66c9c7a1a667a50f947aaa5
This commit is contained in:
parent
2aa48ad352
commit
ae8a7c030d
@ -128,16 +128,23 @@ abstract class AbstractSerializer implements IModelSerializer
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
|
||||
{
|
||||
$values = array();
|
||||
$values = [];
|
||||
$method_prefix = ['get', 'is'];
|
||||
if(!count($fields)) $fields = $this->getAllowedFields();
|
||||
$mappings = $this->getAttributeMappings();
|
||||
|
||||
if (count($mappings)) {
|
||||
$new_values = array();
|
||||
$new_values = [];
|
||||
foreach ($mappings as $attribute => $mapping) {
|
||||
$mapping = preg_split('/:/',$mapping);
|
||||
$mapping = preg_split('/:/', $mapping);
|
||||
if(count($fields) > 0 && !in_array($mapping[0], $fields)) continue;
|
||||
$value = call_user_func( array( $this->object, 'get'.$attribute ) );
|
||||
|
||||
foreach($method_prefix as $prefix){
|
||||
if(method_exists($this->object, $prefix.$attribute)){
|
||||
$value = call_user_func([$this->object, $prefix.$attribute ]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(count($mapping) > 1)
|
||||
{
|
||||
//we have a formatter ...
|
||||
|
@ -0,0 +1,127 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\IBaseRepository;
|
||||
use models\exceptions\EntityNotFoundException;
|
||||
use models\exceptions\ValidationException;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use utils\Filter;
|
||||
use utils\FilterParser;
|
||||
use utils\OrderParser;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use utils\PagingInfo;
|
||||
/**
|
||||
* Class AbstractCompanyServiceApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
abstract class AbstractCompanyServiceApiController extends JsonController
|
||||
{
|
||||
/**
|
||||
* @var IBaseRepository
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
/**
|
||||
* AppliancesApiController constructor.
|
||||
* @param IBaseRepository $repository
|
||||
*/
|
||||
public function __construct(IBaseRepository $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAll(){
|
||||
$values = Input::all();
|
||||
|
||||
$rules = array
|
||||
(
|
||||
'page' => 'integer|min:1',
|
||||
'per_page' => 'required_with:page|integer|min:5|max:100',
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
$validation = Validator::make($values, $rules);
|
||||
|
||||
if ($validation->fails()) {
|
||||
$ex = new ValidationException();
|
||||
throw $ex->setMessages($validation->messages()->toArray());
|
||||
}
|
||||
|
||||
// default values
|
||||
$page = 1;
|
||||
$per_page = 5;
|
||||
|
||||
if (Input::has('page')) {
|
||||
$page = intval(Input::get('page'));
|
||||
$per_page = intval(Input::get('per_page'));
|
||||
}
|
||||
|
||||
$filter = null;
|
||||
|
||||
if (Input::has('filter')) {
|
||||
$filter = FilterParser::parse(Input::get('filter'), array
|
||||
(
|
||||
'name' => ['=@', '=='],
|
||||
'company' => ['=@', '=='],
|
||||
));
|
||||
}
|
||||
|
||||
$order = null;
|
||||
|
||||
if (Input::has('order'))
|
||||
{
|
||||
$order = OrderParser::parse(Input::get('order'), array
|
||||
(
|
||||
'name',
|
||||
'company',
|
||||
'id',
|
||||
));
|
||||
}
|
||||
|
||||
if(is_null($filter)) $filter = new Filter();
|
||||
|
||||
$data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order);
|
||||
$fields = Request::input('fields', '');
|
||||
$fields = !empty($fields) ? explode(',', $fields) : [];
|
||||
$relations = Request::input('relations', '');
|
||||
$relations = !empty($relations) ? explode(',', $relations) : [];
|
||||
return $this->ok
|
||||
(
|
||||
$data->toArray
|
||||
(
|
||||
Request::input('expand', ''),
|
||||
$fields,
|
||||
$relations
|
||||
)
|
||||
);
|
||||
}
|
||||
catch (EntityNotFoundException $ex1) {
|
||||
Log::warning($ex1);
|
||||
return $this->error404();
|
||||
}
|
||||
catch (ValidationException $ex2) {
|
||||
Log::warning($ex2);
|
||||
return $this->error412($ex2->getMessages());
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\IApplianceRepository;
|
||||
use models\exceptions\EntityNotFoundException;
|
||||
use models\exceptions\ValidationException;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use utils\Filter;
|
||||
use utils\FilterParser;
|
||||
use utils\OrderParser;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use utils\PagingInfo;
|
||||
/**
|
||||
* Class AppliancesApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
final class AppliancesApiController extends AbstractCompanyServiceApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* AppliancesApiController constructor.
|
||||
* @param IApplianceRepository $repository
|
||||
*/
|
||||
public function __construct(IApplianceRepository $repository)
|
||||
{
|
||||
parent::__construct($repository);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return parent::getAll();
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\IConsultantRepository;
|
||||
|
||||
/**
|
||||
* Class ConsultantsApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
final class ConsultantsApiController extends AbstractCompanyServiceApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* ConsultansApiController constructor.
|
||||
* @param IConsultantRepository $repository
|
||||
*/
|
||||
public function __construct(IConsultantRepository $repository)
|
||||
{
|
||||
parent::__construct($repository);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return parent::getAll();
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Http\Controllers\JsonController;
|
||||
use App\Models\Foundation\Marketplace\IDistributionRepository;
|
||||
use models\exceptions\EntityNotFoundException;
|
||||
use models\exceptions\ValidationException;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use utils\FilterParser;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use utils\Filter;
|
||||
use utils\PagingInfo;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use utils\OrderParser;
|
||||
/**
|
||||
* Class DistributionsApiController
|
||||
* @package App\Http\Controllers\Apis\Marketplace
|
||||
*/
|
||||
final class DistributionsApiController extends AbstractCompanyServiceApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* DistributionsApiController constructor.
|
||||
* @param IDistributionRepository $repository
|
||||
*/
|
||||
public function __construct(IDistributionRepository $repository)
|
||||
{
|
||||
parent::__construct($repository);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return parent::getAll();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\IPrivateCloudServiceRepository;
|
||||
/**
|
||||
* Class PrivateCloudsApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
final class PrivateCloudsApiController extends AbstractCompanyServiceApiController
|
||||
{
|
||||
/**
|
||||
* PrivateCloudsApiController constructor.
|
||||
* @param IPrivateCloudServiceRepository $repository
|
||||
*/
|
||||
public function __construct(IPrivateCloudServiceRepository $repository)
|
||||
{
|
||||
parent::__construct($repository);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return parent::getAll();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\IPublicCloudServiceRepository;
|
||||
/**
|
||||
* Class PublicCloudsApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
final class PublicCloudsApiController extends AbstractCompanyServiceApiController
|
||||
{
|
||||
/**
|
||||
* PrivateCloudsApiController constructor.
|
||||
* @param IPublicCloudServiceRepository $repository
|
||||
*/
|
||||
public function __construct(IPublicCloudServiceRepository $repository)
|
||||
{
|
||||
parent::__construct($repository);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return parent::getAll();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\IRemoteCloudServiceRepository;
|
||||
/**
|
||||
* Class RemoteCloudsApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
final class RemoteCloudsApiController extends AbstractCompanyServiceApiController
|
||||
{
|
||||
/**
|
||||
* PrivateCloudsApiController constructor.
|
||||
* @param IRemoteCloudServiceRepository $repository
|
||||
*/
|
||||
public function __construct(IRemoteCloudServiceRepository $repository)
|
||||
{
|
||||
parent::__construct($repository);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return parent::getAll();
|
||||
}
|
||||
}
|
@ -47,6 +47,7 @@ final class OAuth2MembersApiController extends OAuth2ProtectedController
|
||||
}
|
||||
|
||||
public function getMembers(){
|
||||
|
||||
$values = Input::all();
|
||||
|
||||
$rules = array
|
||||
@ -136,7 +137,6 @@ final class OAuth2MembersApiController extends OAuth2ProtectedController
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -38,6 +38,12 @@ class OAuth2SummitNotificationsApiController extends OAuth2ProtectedController
|
||||
*/
|
||||
private $summit_repository;
|
||||
|
||||
/**
|
||||
* OAuth2SummitNotificationsApiController constructor.
|
||||
* @param ISummitRepository $summit_repository
|
||||
* @param ISummitNotificationRepository $notification_repository
|
||||
* @param IResourceServerContext $resource_server_context
|
||||
*/
|
||||
public function __construct
|
||||
(
|
||||
ISummitRepository $summit_repository,
|
||||
@ -115,13 +121,12 @@ class OAuth2SummitNotificationsApiController extends OAuth2ProtectedController
|
||||
));
|
||||
}
|
||||
|
||||
$result = $this->repository->getAllByPage($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||
$result = $this->repository->getAllByPageBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||
|
||||
return $this->ok
|
||||
(
|
||||
$result->toArray(Request::input('expand', ''),[],[],['summit_id' => $summit_id])
|
||||
);
|
||||
|
||||
}
|
||||
catch (EntityNotFoundException $ex1)
|
||||
{
|
@ -1,86 +0,0 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class OAuth2CloudApiController
|
||||
*/
|
||||
abstract class OAuth2CloudApiController extends OAuth2CompanyServiceApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* query string params:
|
||||
* page: You can specify further pages
|
||||
* per_page: custom page size up to 100 ( min 10)
|
||||
* status: cloud status ( active , not active, all)
|
||||
* order_by: order by field
|
||||
* order_dir: order direction
|
||||
* @return mixed
|
||||
*/
|
||||
public function getClouds()
|
||||
{
|
||||
return $this->getCompanyServices();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCloud($id)
|
||||
{
|
||||
return $this->getCompanyService($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCloudDataCenters($id)
|
||||
{
|
||||
try {
|
||||
$cloud = $this->repository->getById($id);
|
||||
|
||||
if (!$cloud)
|
||||
{
|
||||
return $this->error404();
|
||||
}
|
||||
|
||||
$data_center_regions = $cloud->datacenters_regions();
|
||||
|
||||
$res = array();
|
||||
|
||||
foreach ($data_center_regions as $region)
|
||||
{
|
||||
$data = $region->toArray();
|
||||
$locations = $region->locations();
|
||||
$data_locations = array();
|
||||
foreach ($locations as $loc)
|
||||
{
|
||||
array_push($data_locations, $loc->toArray());
|
||||
}
|
||||
$data['locations'] = $data_locations;
|
||||
array_push($res, $data);
|
||||
}
|
||||
|
||||
return $this->ok(array('datacenters' => $res ));
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\oauth2\IResourceServerContext;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use models\marketplace\ICompanyServiceRepository;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
/**
|
||||
* Class OAuth2CompanyServiceApiController
|
||||
*/
|
||||
abstract class OAuth2CompanyServiceApiController extends OAuth2ProtectedController
|
||||
{
|
||||
/**
|
||||
* @var ICompanyServiceRepository
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
public function __construct(IResourceServerContext $resource_server_context)
|
||||
{
|
||||
parent::__construct($resource_server_context);
|
||||
|
||||
Validator::extend('status', function ($attribute, $value, $parameters) {
|
||||
return $value == ICompanyServiceRepository::Status_All ||
|
||||
$value == ICompanyServiceRepository::Status_non_active ||
|
||||
$value == ICompanyServiceRepository::Status_active;
|
||||
});
|
||||
|
||||
Validator::extend('order', function ($attribute, $value, $parameters) {
|
||||
return $value == ICompanyServiceRepository::Order_date ||
|
||||
$value == ICompanyServiceRepository::Order_name ;
|
||||
});
|
||||
|
||||
Validator::extend('order_dir', function ($attribute, $value, $parameters) {
|
||||
return $value == 'desc' ||
|
||||
$value == 'asc';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* query string params:
|
||||
* page: You can specify further pages
|
||||
* per_page: custom page size up to 100 ( min 10)
|
||||
* status: cloud status ( active , not active, all)
|
||||
* order_by: order by field
|
||||
* order_dir: order direction
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCompanyServices()
|
||||
{
|
||||
try
|
||||
{
|
||||
//default params
|
||||
$page = 1;
|
||||
$per_page = 10;
|
||||
$status = ICompanyServiceRepository::Status_All;
|
||||
$order_by = ICompanyServiceRepository::Order_date;
|
||||
$order_dir = 'asc';
|
||||
|
||||
//validation of optional parameters
|
||||
|
||||
$values = Input::all();
|
||||
|
||||
$messages = array(
|
||||
'status' => 'The :attribute field is does not has a valid value (all, active, non_active).',
|
||||
'order' => 'The :attribute field is does not has a valid value (date, name).',
|
||||
'order_dir' => 'The :attribute field is does not has a valid value (desc, asc).',
|
||||
);
|
||||
|
||||
$rules = array(
|
||||
'page' => 'integer|min:1',
|
||||
'per_page' => 'required_with:page|integer|min:10|max:100',
|
||||
'status' => 'status',
|
||||
'order_by' => 'order',
|
||||
'order_dir' => 'required_with:order_by|order_dir',
|
||||
);
|
||||
// Creates a Validator instance and validates the data.
|
||||
$validation = Validator::make($values, $rules, $messages);
|
||||
|
||||
if ($validation->fails())
|
||||
{
|
||||
$messages = $validation->messages()->toArray();
|
||||
return $this->error412($messages);
|
||||
}
|
||||
|
||||
if (Input::has('page'))
|
||||
{
|
||||
$page = intval(Input::get('page'));
|
||||
$per_page = intval(Input::get('per_page'));
|
||||
}
|
||||
|
||||
if (Input::has('status'))
|
||||
{
|
||||
$status = Input::get('status');
|
||||
}
|
||||
|
||||
if (Input::has('order_by'))
|
||||
{
|
||||
$order_by = Input::get('order_by');
|
||||
$order_dir = Input::get('order_dir');
|
||||
}
|
||||
|
||||
$data = $this->repository->getAll($page, $per_page, $status, $order_by, $order_dir);
|
||||
return $this->ok($data);
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCompanyService($id)
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = $this->repository->getById($id);
|
||||
return ($data)? $this->ok($data) : $this->error404();
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\marketplace\IConsultantRepository;
|
||||
use models\oauth2\IResourceServerContext;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class OAuth2ConsultantsApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
class OAuth2ConsultantsApiController extends OAuth2CompanyServiceApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param IConsultantRepository $repository
|
||||
* @param IResourceServerContext $resource_server_context
|
||||
*/
|
||||
public function __construct(IConsultantRepository $repository, IResourceServerContext $resource_server_context)
|
||||
{
|
||||
parent::__construct($resource_server_context);
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* query string params:
|
||||
* page: You can specify further pages
|
||||
* per_page: custom page size up to 100 ( min 10)
|
||||
* status: cloud status ( active , not active, all)
|
||||
* order_by: order by field
|
||||
* order_dir: order direction
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConsultants()
|
||||
{
|
||||
return $this->getCompanyServices();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConsultant($id)
|
||||
{
|
||||
return $this->getCompanyService($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOffices($id)
|
||||
{
|
||||
try
|
||||
{
|
||||
$consultant = $this->repository->getById($id);
|
||||
|
||||
if (!$consultant)
|
||||
{
|
||||
return $this->error404();
|
||||
}
|
||||
|
||||
$offices = $consultant->offices();
|
||||
$res = array();
|
||||
|
||||
foreach ($offices as $office)
|
||||
{
|
||||
array_push($res, $office->toArray());
|
||||
}
|
||||
return $this->ok(array('offices' => $res));
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\marketplace\IPrivateCloudServiceRepository;
|
||||
use models\oauth2\IResourceServerContext;
|
||||
|
||||
/**
|
||||
* Class OAuth2PrivateCloudApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
final class OAuth2PrivateCloudApiController extends OAuth2CloudApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param IPrivateCloudServiceRepository $repository
|
||||
* @param IResourceServerContext $resource_server_context
|
||||
*/
|
||||
public function __construct(
|
||||
IPrivateCloudServiceRepository $repository,
|
||||
IResourceServerContext $resource_server_context
|
||||
) {
|
||||
parent::__construct($resource_server_context);
|
||||
$this->repository = $repository;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\marketplace\IPublicCloudServiceRepository;
|
||||
use models\oauth2\IResourceServerContext;
|
||||
|
||||
/**
|
||||
* Class OAuth2PublicCloudApiController
|
||||
*/
|
||||
final class OAuth2PublicCloudApiController extends OAuth2CloudApiController
|
||||
{
|
||||
|
||||
public function __construct(IPublicCloudServiceRepository $repository, IResourceServerContext $resource_server_context)
|
||||
{
|
||||
parent::__construct($resource_server_context);
|
||||
$this->repository = $repository;
|
||||
}
|
||||
}
|
@ -29,6 +29,7 @@ Route::group([
|
||||
Route::group(['prefix'=>'members'], function() {
|
||||
Route::get('', 'OAuth2MembersApiController@getMembers');
|
||||
});
|
||||
|
||||
// summits
|
||||
Route::group(['prefix'=>'summits'], function() {
|
||||
Route::get('', [ 'middleware' => 'cache:'.Config::get('cache_api_response.get_summit_response_lifetime', 600), 'uses' => 'OAuth2SummitApiController@getSummits']);
|
||||
@ -43,6 +44,33 @@ Route::group([
|
||||
});
|
||||
});
|
||||
|
||||
// marketplace
|
||||
Route::group(array('prefix' => 'marketplace'), function () {
|
||||
|
||||
Route::group(array('prefix' => 'appliances'), function () {
|
||||
Route::get('', 'AppliancesApiController@getAll');
|
||||
});
|
||||
|
||||
Route::group(array('prefix' => 'distros'), function () {
|
||||
Route::get('', 'DistributionsApiController@getAll');
|
||||
});
|
||||
|
||||
Route::group(array('prefix' => 'consultants'), function () {
|
||||
Route::get('', 'ConsultantsApiController@getAll');
|
||||
});
|
||||
|
||||
Route::group(array('prefix' => 'hosted-private-clouds'), function () {
|
||||
Route::get('', 'PrivateCloudsApiController@getAll');
|
||||
});
|
||||
|
||||
Route::group(array('prefix' => 'remotely-managed-private-clouds'), function () {
|
||||
Route::get('', 'RemoteCloudsApiController@getAll');
|
||||
});
|
||||
|
||||
Route::group(array('prefix' => 'public-clouds'), function () {
|
||||
Route::get('', 'PublicCloudsApiController@getAll');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//OAuth2 Protected API
|
||||
@ -54,28 +82,6 @@ Route::group([
|
||||
'middleware' => ['ssl', 'oauth2.protected', 'rate.limit','etags']
|
||||
], function () {
|
||||
|
||||
Route::group(array('prefix' => 'marketplace'), function () {
|
||||
|
||||
Route::group(array('prefix' => 'public-clouds'), function () {
|
||||
Route::get('', 'OAuth2PublicCloudApiController@getClouds');
|
||||
Route::get('/{id}', 'OAuth2PublicCloudApiController@getCloud');
|
||||
Route::get('/{id}/data-centers', 'OAuth2PublicCloudApiController@getCloudDataCenters');
|
||||
});
|
||||
|
||||
Route::group(array('prefix' => 'private-clouds'), function () {
|
||||
Route::get('', 'OAuth2PrivateCloudApiController@getClouds');
|
||||
Route::get('/{id}', 'OAuth2PrivateCloudApiController@getCloud');
|
||||
Route::get('/{id}/data-centers', 'OAuth2PrivateCloudApiController@getCloudDataCenters');
|
||||
});
|
||||
|
||||
Route::group(array('prefix' => 'consultants'), function () {
|
||||
Route::get('', 'OAuth2ConsultantsApiController@getConsultants');
|
||||
Route::get('/{id}', 'OAuth2ConsultantsApiController@getConsultant');
|
||||
Route::get('/{id}/offices', 'OAuth2ConsultantsApiController@getOffices');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// members
|
||||
Route::group(['prefix'=>'members'], function(){
|
||||
Route::get('', 'OAuth2MembersApiController@getMembers');
|
||||
|
22
app/ModelSerializers/Marketplace/ApplianceSerializer.php
Normal file
22
app/ModelSerializers/Marketplace/ApplianceSerializer.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Class ApplianceSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class ApplianceSerializer extends OpenStackImplementationSerializer
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\CloudServiceOffered;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
|
||||
/**
|
||||
* Class CloudServiceOfferedSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class CloudServiceOfferedSerializer extends SilverStripeSerializer
|
||||
{
|
||||
|
||||
protected static $allowed_relations = [
|
||||
'pricing_schemas',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$service = $this->object;
|
||||
if(!$service instanceof CloudServiceOffered) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if(in_array('pricing_schemas', $relations)){
|
||||
$res = [];
|
||||
foreach ($service->getPricingSchemas() as $schema){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($schema)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['pricing_schemas'] = $res;
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
70
app/ModelSerializers/Marketplace/CloudServiceSerializer.php
Normal file
70
app/ModelSerializers/Marketplace/CloudServiceSerializer.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace App\ModelSerializers\Marketplace;
|
||||
use App\Models\Foundation\Marketplace\CloudService;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
class CloudServiceSerializer extends OpenStackImplementationSerializer
|
||||
{
|
||||
protected static $allowed_relations = [
|
||||
'data_centers',
|
||||
'data_center_regions',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$cloud_service = $this->object;
|
||||
if(!$cloud_service instanceof CloudService) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if(in_array('data_centers', $relations)){
|
||||
$res = [];
|
||||
foreach ($cloud_service->getDataCenters() as $dataCenter){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($dataCenter)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['data_centers'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('data_center_regions', $relations)){
|
||||
$res = [];
|
||||
foreach ($cloud_service->getDataCenterRegions() as $region){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($region)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['data_center_regions'] = $res;
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\CompanyService;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class CompanyServiceSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
class CompanyServiceSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
'Overview' => 'overview:json_string',
|
||||
'Call2ActionUrl' => 'call_2_action_url:json_string',
|
||||
'CompanyId' => 'company_id:json_int',
|
||||
'TypeId' => 'type_id:json_int',
|
||||
];
|
||||
|
||||
protected static $allowed_relations = [
|
||||
'reviews',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
$company_service = $this->object;
|
||||
if(!$company_service instanceof CompanyService) return [];
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
case 'company': {
|
||||
unset($values['company_id']);
|
||||
$values['company'] = SerializerRegistry::getInstance()->getSerializer($company_service->getCompany())->serialize(null, [], ['none']);;
|
||||
}
|
||||
break;
|
||||
case 'type': {
|
||||
unset($values['type_id']);
|
||||
$values['type'] = SerializerRegistry::getInstance()->getSerializer($company_service->getType())->serialize(null, [], ['none']);;
|
||||
}
|
||||
break;
|
||||
case 'reviews':
|
||||
{
|
||||
if(in_array('reviews', $relations)){
|
||||
$reviews = [];
|
||||
foreach ($company_service->getApprovedReviews() as $r) {
|
||||
$reviews[] = SerializerRegistry::getInstance()->getSerializer($r)->serialize();
|
||||
}
|
||||
$values['reviews'] = $reviews;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
|
||||
/**
|
||||
* Class ConfigurationManagementTypeSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class ConfigurationManagementTypeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Type' => 'type:json_string',
|
||||
];
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class ConsultantClientSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class ConsultantClientSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
];
|
||||
}
|
116
app/ModelSerializers/Marketplace/ConsultantSerializer.php
Normal file
116
app/ModelSerializers/Marketplace/ConsultantSerializer.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\Consultant;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
/**
|
||||
* Class ConsultantSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class ConsultantSerializer extends RegionalSupportedCompanyServiceSerializer
|
||||
{
|
||||
protected static $allowed_relations = [
|
||||
'offices',
|
||||
'clients',
|
||||
'spoken_languages',
|
||||
'configuration_management_expertise',
|
||||
'expertise_areas',
|
||||
'services_offered',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$consultant = $this->object;
|
||||
if(!$consultant instanceof Consultant) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if(in_array('offices', $relations)){
|
||||
$res = [];
|
||||
foreach ($consultant->getOffices() as $office){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($office)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['offices'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('clients', $relations)){
|
||||
$res = [];
|
||||
foreach ($consultant->getClients() as $client){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($client)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['clients'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('spoken_languages', $relations)){
|
||||
$res = [];
|
||||
foreach ($consultant->getSpokenLanguages() as $lang){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($lang)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['spoken_languages'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('configuration_management_expertise', $relations)){
|
||||
$res = [];
|
||||
foreach ($consultant->getConfigurationManagementExpertise() as $exp){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($exp)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['configuration_management_expertise'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('expertise_areas', $relations)){
|
||||
$res = [];
|
||||
foreach ($consultant->getExpertiseAreas() as $area){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($area)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['expertise_areas'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('services_offered', $relations)){
|
||||
$res = [];
|
||||
foreach ($consultant->getServicesOffered() as $service){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($service)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['services_offered'] = $res;
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\ConsultantServiceOfferedType;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class ConsultantServiceOfferedTypeSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class ConsultantServiceOfferedTypeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
|
||||
];
|
||||
|
||||
protected static $allowed_relations = [
|
||||
'service_offered_type',
|
||||
'region',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$service = $this->object;
|
||||
if(!$service instanceof ConsultantServiceOfferedType) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if(in_array('service_offered_type', $relations)){
|
||||
$values['service_offered_type'] = SerializerRegistry::getInstance()
|
||||
->getSerializer($service->getServiceOffered())
|
||||
->serialize($expand);
|
||||
}
|
||||
|
||||
if(in_array('region', $relations)){
|
||||
$values['region'] = SerializerRegistry::getInstance()
|
||||
->getSerializer($service->getRegion())
|
||||
->serialize($expand);
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\DataCenterLocation;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class DataCenterLocationSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class DataCenterLocationSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'City' => 'city:json_string',
|
||||
'State' => 'state:json_string',
|
||||
'Country' => 'country:json_string',
|
||||
'Lat' => 'lat:json_float',
|
||||
'Lng' => 'lng:json_float',
|
||||
'RegionId' => 'region_id:json_int',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$location = $this->object;
|
||||
if(!$location instanceof DataCenterLocation) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
case 'region':
|
||||
unset($values['region_id']);
|
||||
$values['region'] = SerializerRegistry ::getInstance()
|
||||
->getSerializer($location->getRegion())
|
||||
->serialize($expand);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class DataCenterRegionSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class DataCenterRegionSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
'Endpoint' => 'endpoint:json_string',
|
||||
];
|
||||
}
|
23
app/ModelSerializers/Marketplace/DistributionSerializer.php
Normal file
23
app/ModelSerializers/Marketplace/DistributionSerializer.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Class DistributionSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
class DistributionSerializer extends OpenStackImplementationSerializer
|
||||
{
|
||||
|
||||
}
|
29
app/ModelSerializers/Marketplace/GuestOSTypeSerializer.php
Normal file
29
app/ModelSerializers/Marketplace/GuestOSTypeSerializer.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
|
||||
/**
|
||||
* Class GuestOSTypeSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class GuestOSTypeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Type' => 'type:json_string',
|
||||
];
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class HyperVisorTypeSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class HyperVisorTypeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Type' => 'type:json_string',
|
||||
];
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class MarketPlaceReviewSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class MarketPlaceReviewSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Title' => 'title:json_string',
|
||||
'Comment' => 'comment:json_string',
|
||||
'Rating' => 'rating:json_int',
|
||||
];
|
||||
}
|
36
app/ModelSerializers/Marketplace/OfficeSerializer.php
Normal file
36
app/ModelSerializers/Marketplace/OfficeSerializer.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Class OfficeSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class OfficeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Address' => 'address:json_string',
|
||||
'Address2' => 'address2:json_string',
|
||||
'State' => 'state:json_string',
|
||||
'ZipCode' => 'zip_code:json_string',
|
||||
'City' => 'city:json_string',
|
||||
'Country' => 'country:json_string',
|
||||
'Lat' => 'lat:json_float',
|
||||
'Lng' => 'lng:json_float',
|
||||
];
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\OpenStackImplementationApiCoverage;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class OpenStackImplementationApiCoverageSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class OpenStackImplementationApiCoverageSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Percent' => 'api_coverage:json_int',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
$api_coverage = $this->object;
|
||||
if(!$api_coverage instanceof OpenStackImplementationApiCoverage) return [];
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
if(!$api_coverage->hasReleaseSupportedApiVersion()) return $values;
|
||||
|
||||
$release_api_version = $api_coverage->getReleaseSupportedApiVersion();
|
||||
if($release_api_version->hasApiVersion() && $release_api_version->getApiVersion()->hasComponent()){
|
||||
$values["component"] = SerializerRegistry::getInstance()
|
||||
->getSerializer($release_api_version->getApiVersion()->getComponent())
|
||||
->serialize();
|
||||
}
|
||||
else if($release_api_version->hasComponent()){
|
||||
$values["component"] = SerializerRegistry::getInstance()
|
||||
->getSerializer($release_api_version->getComponent())
|
||||
->serialize();
|
||||
}
|
||||
|
||||
if($release_api_version->hasRelease()){
|
||||
$values["release"] = SerializerRegistry::getInstance()
|
||||
->getSerializer($release_api_version->getRelease())
|
||||
->serialize();
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use App\Models\Foundation\Marketplace\OpenStackImplementation;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
|
||||
/**
|
||||
* Class OpenStackImplementationSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
class OpenStackImplementationSerializer extends RegionalSupportedCompanyServiceSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'CompatibleWithStorage' => 'is_compatible_with_storage:json_boolean',
|
||||
'CompatibleWithCompute' => 'is_compatible_with_compute:json_boolean',
|
||||
'CompatibleWithFederatedIdentity' => 'is_compatible_with_federated_identity:json_boolean',
|
||||
'CompatibleWithPlatform' => 'is_compatible_with_platform:json_boolean',
|
||||
'OpenStackPowered' => 'is_openstack_powered:json_boolean',
|
||||
'OpenStackTested' => 'is_openstack_tested:json_boolean',
|
||||
'OpenStackTestedLabel' => 'openstack_tested_info:json_string',
|
||||
];
|
||||
|
||||
protected static $allowed_relations = [
|
||||
'capabilities',
|
||||
'guests',
|
||||
'hypervisors',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$implementation = $this->object;
|
||||
if(!$implementation instanceof OpenStackImplementation) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if(in_array('capabilities', $relations)){
|
||||
$res = [];
|
||||
foreach ($implementation->getCapabilities() as $capability){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($capability)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['capabilities'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('hypervisors', $relations)){
|
||||
$res = [];
|
||||
foreach ($implementation->getHypervisors() as $hypervisor){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($hypervisor)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['hypervisors'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('guests', $relations)){
|
||||
$res = [];
|
||||
foreach ($implementation->getGuests() as $guest){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($guest)
|
||||
->serialize($expand);
|
||||
}
|
||||
$values['guests'] = $res;
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
final class PricingSchemaTypeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Type' => 'type:json_string',
|
||||
];
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
/**
|
||||
* Class PrivateCloudServiceSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class PrivateCloudServiceSerializer extends CloudServiceSerializer
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
/**
|
||||
* Class PublicCloudServiceSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class PublicCloudServiceSerializer extends CloudServiceSerializer
|
||||
{
|
||||
|
||||
}
|
27
app/ModelSerializers/Marketplace/RegionSerializer.php
Normal file
27
app/ModelSerializers/Marketplace/RegionSerializer.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class RegionSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class RegionSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
];
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
|
||||
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\RegionalSupport;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
|
||||
/**
|
||||
* Class RegionalSupportSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
class RegionalSupportSerializer extends SilverStripeSerializer
|
||||
{
|
||||
|
||||
protected static $allowed_relations = [
|
||||
'supported_channel_types',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$regional_support = $this->object;
|
||||
if(!$regional_support instanceof RegionalSupport) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if(in_array('supported_channel_types', $relations)){
|
||||
$res = [];
|
||||
foreach ($regional_support->getSupportedChannelTypes() as $channel_type){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($channel_type)
|
||||
->serialize();
|
||||
}
|
||||
$values['supported_channel_types'] = $res;
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
case 'region':
|
||||
unset($values['region_id']);
|
||||
$values['region'] = SerializerRegistry::getInstance()
|
||||
->getSerializer($regional_support->getRegion())
|
||||
->serialize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Marketplace\RegionalSupportedCompanyService;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
/**
|
||||
* Class RegionalSupportedCompanyServiceSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
class RegionalSupportedCompanyServiceSerializer extends CompanyServiceSerializer
|
||||
{
|
||||
|
||||
protected static $allowed_relations = [
|
||||
'supported_regions',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
|
||||
{
|
||||
|
||||
$regional_service = $this->object;
|
||||
if(!$regional_service instanceof RegionalSupportedCompanyService) return [];
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
if(in_array('supported_regions', $relations)){
|
||||
$res = [];
|
||||
foreach ($regional_service->getRegionalSupports() as $region){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($region)
|
||||
->serialize($expand = 'region');
|
||||
}
|
||||
$values['supported_regions'] = $res;
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Class RemoteCloudServiceSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class RemoteCloudServiceSerializer extends OpenStackImplementationSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'HardwareSpec' => 'hardware_spec:json_string',
|
||||
'PricingModels' => 'pricing_models:json_string',
|
||||
'PublishedSla' => 'published_sla:json_string',
|
||||
'VendorManagedUpgrades' => 'is_vendor_managed_upgrades:json_boolean',
|
||||
];
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class ServiceOfferedTypeSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class ServiceOfferedTypeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Type' => 'type:json_string',
|
||||
];
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
|
||||
/**
|
||||
* Class SpokenLanguageSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class SpokenLanguageSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
];
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php namespace App\ModelSerializers\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class SupportChannelTypeSerializer
|
||||
* @package App\ModelSerializers\Marketplace
|
||||
*/
|
||||
final class SupportChannelTypeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Type' => 'type:json_string',
|
||||
];
|
||||
}
|
@ -1,8 +1,29 @@
|
||||
<?php namespace ModelSerializers;
|
||||
use App\ModelSerializers\Marketplace\CloudServiceOfferedSerializer;
|
||||
use App\ModelSerializers\Marketplace\ConfigurationManagementTypeSerializer;
|
||||
use App\ModelSerializers\Marketplace\ConsultantClientSerializer;
|
||||
use App\ModelSerializers\Marketplace\ConsultantSerializer;
|
||||
use App\ModelSerializers\Marketplace\ConsultantServiceOfferedTypeSerializer;
|
||||
use App\ModelSerializers\Marketplace\DataCenterLocationSerializer;
|
||||
use App\ModelSerializers\Marketplace\DataCenterRegionSerializer;
|
||||
use App\ModelSerializers\Marketplace\DistributionSerializer;
|
||||
use App\ModelSerializers\Marketplace\GuestOSTypeSerializer;
|
||||
use App\ModelSerializers\Marketplace\HyperVisorTypeSerializer;
|
||||
use App\ModelSerializers\Marketplace\MarketPlaceReviewSerializer;
|
||||
use App\ModelSerializers\Marketplace\OfficeSerializer;
|
||||
use App\ModelSerializers\Marketplace\OpenStackImplementationApiCoverageSerializer;
|
||||
use App\ModelSerializers\Marketplace\PricingSchemaTypeSerializer;
|
||||
use App\ModelSerializers\Marketplace\PrivateCloudServiceSerializer;
|
||||
use App\ModelSerializers\Marketplace\PublicCloudServiceSerializer;
|
||||
use App\ModelSerializers\Marketplace\RegionalSupportSerializer;
|
||||
use App\ModelSerializers\Marketplace\RegionSerializer;
|
||||
use App\ModelSerializers\Marketplace\RemoteCloudServiceSerializer;
|
||||
use App\ModelSerializers\Marketplace\ServiceOfferedTypeSerializer;
|
||||
use App\ModelSerializers\Marketplace\SpokenLanguageSerializer;
|
||||
use App\ModelSerializers\Marketplace\SupportChannelTypeSerializer;
|
||||
use App\ModelSerializers\Software\OpenStackComponentSerializer;
|
||||
use App\ModelSerializers\Software\OpenStackReleaseSerializer;
|
||||
use Libs\ModelSerializers\IModelSerializer;
|
||||
use models\main\ChatTeam;
|
||||
use models\main\ChatTeamMember;
|
||||
use models\main\ChatTeamPushNotificationMessage;
|
||||
use ModelSerializers\ChatTeams\ChatTeamInvitationSerializer;
|
||||
use ModelSerializers\ChatTeams\ChatTeamMemberSerializer;
|
||||
use ModelSerializers\ChatTeams\ChatTeamPushNotificationMessageSerializer;
|
||||
@ -14,6 +35,7 @@ use ModelSerializers\Locations\SummitLocationImageSerializer;
|
||||
use ModelSerializers\Locations\SummitVenueFloorSerializer;
|
||||
use ModelSerializers\Locations\SummitVenueRoomSerializer;
|
||||
use ModelSerializers\Locations\SummitVenueSerializer;
|
||||
use App\ModelSerializers\Marketplace\ApplianceSerializer;
|
||||
|
||||
/**
|
||||
* Copyright 2016 OpenStack Foundation
|
||||
@ -37,9 +59,7 @@ final class SerializerRegistry
|
||||
const SerializerType_Public = 'PUBLIC';
|
||||
const SerializerType_Private = 'PRIVATE';
|
||||
|
||||
private function __clone()
|
||||
{
|
||||
}
|
||||
private function __clone(){}
|
||||
|
||||
/**
|
||||
* @return SerializerRegistry
|
||||
@ -107,6 +127,36 @@ final class SerializerRegistry
|
||||
$this->registry['ChatTeamMember'] = ChatTeamMemberSerializer::class;
|
||||
$this->registry['ChatTeamInvitation'] = ChatTeamInvitationSerializer::class;
|
||||
$this->registry['ChatTeamPushNotificationMessage'] = ChatTeamPushNotificationMessageSerializer::class;
|
||||
|
||||
// marketplace
|
||||
|
||||
$this->registry['Appliance'] = ApplianceSerializer::class;
|
||||
$this->registry["Distribution"] = DistributionSerializer::class;
|
||||
$this->registry['MarketPlaceReview'] = MarketPlaceReviewSerializer::class;
|
||||
$this->registry['OpenStackImplementationApiCoverage'] = OpenStackImplementationApiCoverageSerializer::class;
|
||||
$this->registry['GuestOSType'] = GuestOSTypeSerializer::class;
|
||||
$this->registry['HyperVisorType'] = HyperVisorTypeSerializer::class;
|
||||
$this->registry['Region'] = RegionSerializer::class;
|
||||
$this->registry['RegionalSupport'] = RegionalSupportSerializer::class;
|
||||
$this->registry['SupportChannelType'] = SupportChannelTypeSerializer::class;
|
||||
$this->registry['Office'] = OfficeSerializer::class;
|
||||
$this->registry['Consultant'] = ConsultantSerializer::class;
|
||||
$this->registry['ConsultantClient'] = ConsultantClientSerializer::class;
|
||||
$this->registry['SpokenLanguage'] = SpokenLanguageSerializer::class;
|
||||
$this->registry['ConfigurationManagementType'] = ConfigurationManagementTypeSerializer::class;
|
||||
$this->registry['ServiceOfferedType'] = ServiceOfferedTypeSerializer::class;
|
||||
$this->registry['ConsultantServiceOfferedType'] = ConsultantServiceOfferedTypeSerializer::class;
|
||||
$this->registry['DataCenterLocation'] = DataCenterLocationSerializer::class;
|
||||
$this->registry['DataCenterRegion'] = DataCenterRegionSerializer::class;
|
||||
$this->registry['PricingSchemaType'] = PricingSchemaTypeSerializer::class;
|
||||
$this->registry['PrivateCloudService'] = PrivateCloudServiceSerializer::class;
|
||||
$this->registry['PublicCloudService'] = PublicCloudServiceSerializer::class;
|
||||
$this->registry['RemoteCloudService'] = RemoteCloudServiceSerializer::class;
|
||||
$this->registry['CloudServiceOffered'] = CloudServiceOfferedSerializer::class;
|
||||
// software
|
||||
|
||||
$this->registry['OpenStackComponent'] = OpenStackComponentSerializer::class;
|
||||
$this->registry['OpenStackRelease'] = OpenStackReleaseSerializer::class;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,6 +165,7 @@ final class SerializerRegistry
|
||||
* @return IModelSerializer
|
||||
*/
|
||||
public function getSerializer($object, $type = self::SerializerType_Public){
|
||||
if(is_null($object)) return null;
|
||||
$reflect = new \ReflectionClass($object);
|
||||
$class = $reflect->getShortName();
|
||||
if(!isset($this->registry[$class]))
|
||||
|
@ -0,0 +1,29 @@
|
||||
<?php namespace App\ModelSerializers\Software;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class OpenStackComponentSerializer
|
||||
* @package App\ModelSerializers\Software
|
||||
*/
|
||||
final class OpenStackComponentSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
'CodeName' => 'code_name:json_string',
|
||||
];
|
||||
|
||||
}
|
29
app/ModelSerializers/Software/OpenStackReleaseSerializer.php
Normal file
29
app/ModelSerializers/Software/OpenStackReleaseSerializer.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php namespace App\ModelSerializers\Software;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class OpenStackReleaseSerializer
|
||||
* @package App\ModelSerializers\Software
|
||||
*/
|
||||
final class OpenStackReleaseSerializer extends SilverStripeSerializer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
'ReleaseNumber' => 'release_number:json_string',
|
||||
];
|
||||
|
||||
}
|
@ -31,7 +31,7 @@ use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="Member")
|
||||
* @ORM\Entity(repositoryClass="repositories\summit\DoctrineMemberRepository")
|
||||
* @ORM\Entity(repositoryClass="App\Repositories\Summit\DoctrineMemberRepository")
|
||||
* Class Member
|
||||
* @package models\main
|
||||
*/
|
||||
|
@ -12,9 +12,10 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use App\Models\Utils\BaseEntity;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\summit\SummitEvent;
|
||||
use models\utils\IEntity;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
@ -22,22 +23,8 @@ use models\utils\IEntity;
|
||||
* Class SummitMemberSchedule
|
||||
* @package models\main
|
||||
*/
|
||||
final class SummitMemberFavorite
|
||||
final class SummitMemberFavorite extends BaseEntity
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(name="ID", type="integer", unique=true, nullable=false)
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Member
|
||||
@ -77,17 +64,9 @@ final class SummitMemberFavorite
|
||||
$this->event = $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Member", inversedBy="favorites")
|
||||
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID", nullable=true )
|
||||
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
|
||||
* @var Member
|
||||
*/
|
||||
private $member;
|
||||
|
@ -11,33 +11,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use App\Models\Utils\BaseEntity;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\summit\SummitEvent;
|
||||
use models\utils\IEntity;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="Member_Schedule")
|
||||
* Class SummitMemberSchedule
|
||||
* @package models\main
|
||||
*/
|
||||
final class SummitMemberSchedule implements IEntity
|
||||
final class SummitMemberSchedule extends BaseEntity
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(name="ID", type="integer", unique=true, nullable=false)
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Member", inversedBy="schedule")
|
||||
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID", nullable=true )
|
||||
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
|
||||
* @var Member
|
||||
*/
|
||||
private $member;
|
||||
@ -49,22 +38,6 @@ final class SummitMemberSchedule implements IEntity
|
||||
*/
|
||||
private $event;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Member
|
||||
*/
|
||||
|
24
app/Models/Foundation/Marketplace/Appliance.php
Normal file
24
app/Models/Foundation/Marketplace/Appliance.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repositories\Marketplace\DoctrineApplianceRepository")
|
||||
* @ORM\Table(name="Appliance")
|
||||
* Class Appliance
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class Appliance extends OpenStackImplementation
|
||||
{
|
||||
|
||||
}
|
60
app/Models/Foundation/Marketplace/CloudService.php
Normal file
60
app/Models/Foundation/Marketplace/CloudService.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="CloudService")
|
||||
* Class CloudService
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class CloudService extends OpenStackImplementation
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="DataCenterLocation", mappedBy="cloud_service", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var DataCenterLocation[]
|
||||
*/
|
||||
protected $data_centers;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="DataCenterRegion", mappedBy="cloud_service", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var DataCenterRegion[]
|
||||
*/
|
||||
protected $data_center_regions;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->data_centers = new ArrayCollection();
|
||||
$this->capabilities_offered = new ArrayCollection();
|
||||
$this->data_center_regions = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataCenterLocation[]
|
||||
*/
|
||||
public function getDataCenters()
|
||||
{
|
||||
return $this->data_centers->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataCenterRegion[]
|
||||
*/
|
||||
public function getDataCenterRegions()
|
||||
{
|
||||
return $this->data_center_regions->toArray();
|
||||
}
|
||||
|
||||
}
|
61
app/Models/Foundation/Marketplace/CloudServiceOffered.php
Normal file
61
app/Models/Foundation/Marketplace/CloudServiceOffered.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="CloudServiceOffered")
|
||||
* Class CloudServiceOffered
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class CloudServiceOffered extends OpenStackImplementationApiCoverage
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Type", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="App\Models\Foundation\Marketplace\PricingSchemaType", cascade={"persist"})
|
||||
* @ORM\JoinTable(name="CloudServiceOffered_PricingSchemas",
|
||||
* joinColumns={@ORM\JoinColumn(name="CloudServiceOfferedID", referencedColumnName="ID")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="PricingSchemaTypeID", referencedColumnName="ID")}
|
||||
* )
|
||||
* @var PricingSchemaType[]
|
||||
*/
|
||||
private $pricing_schemas;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->pricing_schemas = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PricingSchemaType[]
|
||||
*/
|
||||
public function getPricingSchemas()
|
||||
{
|
||||
return $this->pricing_schemas->toArray();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?php namespace models\marketplace;
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
@ -12,28 +12,219 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\utils\BaseModelEloquent;
|
||||
use models\utils\IEntity;
|
||||
|
||||
class CompanyService extends BaseModelEloquent implements IEntity
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
use models\main\Company;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="CompanyService")
|
||||
* @ORM\InheritanceType("JOINED")
|
||||
* @ORM\DiscriminatorColumn(name="ClassName", type="string")
|
||||
* @ORM\DiscriminatorMap({
|
||||
* "CompanyService" = "CompanyService",
|
||||
* "RegionalSupportedCompanyService" = "RegionalSupportedCompanyService",
|
||||
* "OpenStackImplementation" = "OpenStackImplementation",
|
||||
* "Appliance" = "Appliance",
|
||||
* "Distribution" = "Distribution",
|
||||
* "Consultant" = "Consultant",
|
||||
* "CloudService", "CloudService",
|
||||
* "PrivateCloudService" = "PrivateCloudService",
|
||||
* "PublicCloudService" = "PublicCloudService",
|
||||
* "RemoteCloudService" = "RemoteCloudService"
|
||||
* } )
|
||||
* Class CompanyService
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class CompanyService extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
protected $hidden = array('ClassName', 'MarketPlaceTypeID', 'EditedByID');
|
||||
/**
|
||||
* @ORM\Column(name="Slug", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $slug;
|
||||
|
||||
protected $table = 'CompanyService';
|
||||
/**
|
||||
* @ORM\Column(name="Overview", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $overview;
|
||||
|
||||
protected $connection = 'ss';
|
||||
/**
|
||||
* @ORM\Column(name="Call2ActionUri", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $call_2_action_url;
|
||||
|
||||
protected $stiClassField = 'ClassName';
|
||||
/**
|
||||
* @ORM\Column(name="Active", type="boolean")
|
||||
* @var bool
|
||||
*/
|
||||
protected $is_active;
|
||||
|
||||
protected $stiBaseClass = 'models\marketplace\CompanyService';
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="models\main\Company", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinColumn(name="CompanyID", referencedColumnName="ID")
|
||||
* @var Company
|
||||
*/
|
||||
protected $company;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="MarketPlaceType", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinColumn(name="MarketPlaceTypeID", referencedColumnName="ID")
|
||||
* @var MarketPlaceType
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="MarketPlaceReview", mappedBy="company_service", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var MarketPlaceReview[]
|
||||
*/
|
||||
protected $reviews;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="MarketPlaceVideo", mappedBy="company_service", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var MarketPlaceVideo[]
|
||||
*/
|
||||
protected $videos;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="CompanyServiceResource", mappedBy="company_service", cascade={"persist"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "order"})
|
||||
* @var CompanyServiceResource[]
|
||||
*/
|
||||
protected $resources;
|
||||
|
||||
/**
|
||||
* CompanyService constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->reviews = new ArrayCollection();
|
||||
$this->videos = new ArrayCollection();
|
||||
$this->resources = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOverview()
|
||||
{
|
||||
return $this->overview;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
return $this->is_active;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Company
|
||||
*/
|
||||
public function getCompany()
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Company
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIdentifier()
|
||||
public function getCompanyId()
|
||||
{
|
||||
return (int)$this->ID;
|
||||
try {
|
||||
return !is_null($this->company)? $this->company->getId():0;
|
||||
}
|
||||
catch(\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTypeId()
|
||||
{
|
||||
try {
|
||||
return !is_null($this->type)? $this->type->getId():0;
|
||||
}
|
||||
catch(\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MarketPlaceReview[]
|
||||
*/
|
||||
public function getApprovedReviews(){
|
||||
$criteria = Criteria::create();
|
||||
$criteria->where(Criteria::expr()->eq('is_approved', true));
|
||||
return $this->reviews->matching($criteria)->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCall2ActionUrl()
|
||||
{
|
||||
return $this->call_2_action_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MarketPlaceReview[]
|
||||
*/
|
||||
public function getReviews()
|
||||
{
|
||||
return $this->reviews->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MarketPlaceVideo[]
|
||||
*/
|
||||
public function getVideos()
|
||||
{
|
||||
return $this->videos->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompanyServiceResource[]
|
||||
*/
|
||||
public function getResources()
|
||||
{
|
||||
return $this->resources->toArray();
|
||||
}
|
||||
}
|
81
app/Models/Foundation/Marketplace/CompanyServiceResource.php
Normal file
81
app/Models/Foundation/Marketplace/CompanyServiceResource.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="CompanyServiceResource")
|
||||
* Class CompanyServiceResource
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class CompanyServiceResource extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Uri", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $uri;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Order", type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $order;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="CompanyService",inversedBy="resources", fetch="LAZY")
|
||||
* @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID")
|
||||
* @var CompanyService
|
||||
*/
|
||||
private $company_service;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUri()
|
||||
{
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompanyService
|
||||
*/
|
||||
public function getCompanyService()
|
||||
{
|
||||
return $this->company_service;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="ConfigurationManagementType")
|
||||
* Class ConfigurationManagementType
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class ConfigurationManagementType extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Type", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
<?php namespace models\marketplace;
|
||||
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -12,18 +11,122 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
class Consultant extends CompanyService implements IConsultant
|
||||
use App\Models\Foundation\Software\OpenStackComponent;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repositories\Marketplace\DoctrineConsultantRepository")
|
||||
* @ORM\Table(name="Consultant")
|
||||
* Class Consultant
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class Consultant extends RegionalSupportedCompanyService
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Office", mappedBy="consultant", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var Office[]
|
||||
*/
|
||||
private $offices;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="ConsultantClient", mappedBy="consultant", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var ConsultantClient[]
|
||||
*/
|
||||
private $clients;
|
||||
|
||||
protected $connection = 'ss';
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="SpokenLanguage", cascade={"persist"})
|
||||
* @ORM\JoinTable(name="Consultant_SpokenLanguages",
|
||||
* joinColumns={@ORM\JoinColumn(name="ConsultantID", referencedColumnName="ID")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="SpokenLanguageID", referencedColumnName="ID")}
|
||||
* )
|
||||
* @var SpokenLanguage[]
|
||||
*/
|
||||
private $spoken_languages;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="ConfigurationManagementType", cascade={"persist"})
|
||||
* @ORM\JoinTable(name="Consultant_ConfigurationManagementExpertises",
|
||||
* joinColumns={@ORM\JoinColumn(name="ConsultantID", referencedColumnName="ID")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="ConfigurationManagementTypeID", referencedColumnName="ID")}
|
||||
* )
|
||||
* @var ConfigurationManagementType[]
|
||||
*/
|
||||
private $configuration_management_expertise;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="App\Models\Foundation\Software\OpenStackComponent", cascade={"persist"})
|
||||
* @ORM\JoinTable(name="Consultant_ExpertiseAreas",
|
||||
* joinColumns={@ORM\JoinColumn(name="ConsultantID", referencedColumnName="ID")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="OpenStackComponentID", referencedColumnName="ID")}
|
||||
* )
|
||||
* @var OpenStackComponent[]
|
||||
*/
|
||||
private $expertise_areas;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="ConsultantServiceOfferedType", mappedBy="consultant", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var ConsultantServiceOfferedType[]
|
||||
*/
|
||||
private $services_offered;
|
||||
|
||||
/**
|
||||
* Consultant constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->offices = new ArrayCollection();
|
||||
$this->clients = new ArrayCollection();
|
||||
$this->spoken_languages = new ArrayCollection();
|
||||
$this->configuration_management_expertises = new ArrayCollection();
|
||||
$this->expertise_areas = new ArrayCollection();
|
||||
$this->services_offered = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Office[]
|
||||
*/
|
||||
public function offices()
|
||||
public function getOffices()
|
||||
{
|
||||
return $this->hasMany('models\marketplace\Office', 'ConsultantID', 'ID')->get();
|
||||
return $this->offices->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ConsultantClient[]
|
||||
*/
|
||||
public function getClients(){
|
||||
return $this->clients->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SpokenLanguage[]
|
||||
*/
|
||||
public function getSpokenLanguages()
|
||||
{
|
||||
return $this->spoken_languages->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ConfigurationManagementType[]
|
||||
*/
|
||||
public function getConfigurationManagementExpertise()
|
||||
{
|
||||
return $this->configuration_management_expertise->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OpenStackComponent[]
|
||||
*/
|
||||
public function getExpertiseAreas()
|
||||
{
|
||||
return $this->expertise_areas->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ConsultantServiceOfferedType[]
|
||||
*/
|
||||
public function getServicesOffered()
|
||||
{
|
||||
return $this->services_offered->toArray();
|
||||
}
|
||||
}
|
66
app/Models/Foundation/Marketplace/ConsultantClient.php
Normal file
66
app/Models/Foundation/Marketplace/ConsultantClient.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="ConsultantClient")
|
||||
* Class ConsultantClient
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class ConsultantClient extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Order", type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $order;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Consultant",inversedBy="clients", fetch="LAZY")
|
||||
* @ORM\JoinColumn(name="ConsultantID", referencedColumnName="ID")
|
||||
* @var Consultant
|
||||
*/
|
||||
private $consultant;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Consultant
|
||||
*/
|
||||
public function getConsultant()
|
||||
{
|
||||
return $this->consultant;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Utils\BaseEntity;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="Consultant_ServicesOffered")
|
||||
* Class ConsultantServiceOfferedType
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class ConsultantServiceOfferedType extends BaseEntity
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Consultant", inversedBy="services_offered")
|
||||
* @ORM\JoinColumn(name="ConsultantID", referencedColumnName="ID")
|
||||
* @var Consultant
|
||||
*/
|
||||
private $consultant;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="ServiceOfferedType", fetch="LAZY")
|
||||
* @ORM\JoinColumn(name="ConsultantServiceOfferedTypeID", referencedColumnName="ID")
|
||||
* @var ServiceOfferedType
|
||||
*/
|
||||
private $service_offered;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Region", fetch="LAZY")
|
||||
* @ORM\JoinColumn(name="RegionID", referencedColumnName="ID")
|
||||
* @var Region
|
||||
*/
|
||||
private $region;
|
||||
|
||||
/**
|
||||
* @return Consultant
|
||||
*/
|
||||
public function getConsultant()
|
||||
{
|
||||
return $this->consultant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ServiceOfferedType
|
||||
*/
|
||||
public function getServiceOffered()
|
||||
{
|
||||
return $this->service_offered;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Region
|
||||
*/
|
||||
public function getRegion()
|
||||
{
|
||||
return $this->region;
|
||||
}
|
||||
}
|
@ -1,37 +1,136 @@
|
||||
<?php namespace models\marketplace;
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\utils\BaseModelEloquent;
|
||||
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* Class DataCenterLocation
|
||||
* @package models\marketplace
|
||||
*/
|
||||
class DataCenterLocation extends BaseModelEloquent
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="DataCenterLocation")
|
||||
* Class DataCenterLocation
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class DataCenterLocation extends SilverstripeBaseModel
|
||||
{
|
||||
|
||||
protected $table = 'DataCenterLocation';
|
||||
/**
|
||||
* @ORM\Column(name="City", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $city;
|
||||
|
||||
protected $connection = 'ss';
|
||||
/**
|
||||
* @ORM\Column(name="State", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $state;
|
||||
|
||||
protected $hidden = array('ClassName','CloudServiceID','DataCenterRegionID');
|
||||
/**
|
||||
* @ORM\Column(name="Country", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $country;
|
||||
|
||||
/**
|
||||
* @return DataCenterRegion
|
||||
*/
|
||||
public function region()
|
||||
{
|
||||
return $this->belongsTo('models\marketplace\DataCenterRegion', 'DataCenterRegionID');
|
||||
}
|
||||
/**
|
||||
* @ORM\Column(name="Lat", type="float")
|
||||
* @var float
|
||||
*/
|
||||
private $lat;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Lng", type="float")
|
||||
* @var float
|
||||
*/
|
||||
private $lng;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="CloudService",inversedBy="data_centers", fetch="LAZY")
|
||||
* @ORM\JoinColumn(name="CloudServiceID", referencedColumnName="ID")
|
||||
* @var CloudService
|
||||
*/
|
||||
private $cloud_service;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="DataCenterRegion",inversedBy="locations", fetch="LAZY")
|
||||
* @ORM\JoinColumn(name="DataCenterRegionID", referencedColumnName="ID")
|
||||
* @var DataCenterRegion
|
||||
*/
|
||||
private $region;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCountry()
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLat()
|
||||
{
|
||||
return $this->lat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLng()
|
||||
{
|
||||
return $this->lng;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CloudService
|
||||
*/
|
||||
public function getCloudService()
|
||||
{
|
||||
return $this->cloud_service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataCenterRegion
|
||||
*/
|
||||
public function getRegion()
|
||||
{
|
||||
return $this->region;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRegionId(){
|
||||
try{
|
||||
return !is_null($this->region) ? $this->region->getId(): 0;
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +1,101 @@
|
||||
<?php namespace models\marketplace;
|
||||
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\utils\BaseModelEloquent;
|
||||
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* Class DataCenterRegion
|
||||
* @package models\marketplace
|
||||
*/
|
||||
class DataCenterRegion extends BaseModelEloquent
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="DataCenterRegion")
|
||||
* Class DataCenterRegion
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class DataCenterRegion extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
protected $table = 'DataCenterRegion';
|
||||
/**
|
||||
* @ORM\Column(name="Endpoint", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $endpoint;
|
||||
|
||||
protected $connection = 'ss';
|
||||
/**
|
||||
* @ORM\Column(name="Color", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $color;
|
||||
|
||||
protected $hidden = array('ClassName','CloudServiceID','PublicCloudID');
|
||||
/**
|
||||
* @return DataCenterLocation[]
|
||||
*/
|
||||
public function locations()
|
||||
{
|
||||
return $this->hasMany('models\marketplace\DataCenterLocation', 'DataCenterRegionID', 'ID')->get();
|
||||
}
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="DataCenterLocation", mappedBy="region", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var DataCenterLocation[]
|
||||
*/
|
||||
private $locations;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="CloudService",inversedBy="data_center_regions", fetch="LAZY")
|
||||
* @ORM\JoinColumn(name="CloudServiceID", referencedColumnName="ID")
|
||||
* @var CloudService
|
||||
*/
|
||||
private $cloud_service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->locations = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getColor()
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataCenterLocation[]
|
||||
*/
|
||||
public function getLocations()
|
||||
{
|
||||
return $this->locations->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CloudService
|
||||
*/
|
||||
public function getCloudService()
|
||||
{
|
||||
return $this->cloud_service;
|
||||
}
|
||||
}
|
24
app/Models/Foundation/Marketplace/Distribution.php
Normal file
24
app/Models/Foundation/Marketplace/Distribution.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repositories\Marketplace\DoctrineDistributionRepository")
|
||||
* @ORM\Table(name="Distribution")
|
||||
* Class Distribution
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class Distribution extends OpenStackImplementation
|
||||
{
|
||||
|
||||
}
|
37
app/Models/Foundation/Marketplace/GuestOSType.php
Normal file
37
app/Models/Foundation/Marketplace/GuestOSType.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="GuestOSType")
|
||||
* Class GuestOSType
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class GuestOSType extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Type", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
37
app/Models/Foundation/Marketplace/HyperVisorType.php
Normal file
37
app/Models/Foundation/Marketplace/HyperVisorType.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="HyperVisorType")
|
||||
* Class HyperVisorType
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class HyperVisorType extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Type", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
23
app/Models/Foundation/Marketplace/IApplianceRepository.php
Normal file
23
app/Models/Foundation/Marketplace/IApplianceRepository.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\IBaseRepository;
|
||||
|
||||
/**
|
||||
* Interface IApplianceRepository
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
interface IApplianceRepository extends IBaseRepository
|
||||
{
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php namespace models\marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Interface ICloudService
|
||||
* @package models\marketplace
|
||||
*/
|
||||
interface ICloudService
|
||||
{
|
||||
|
||||
/**
|
||||
* @return DataCenterRegion[]
|
||||
*/
|
||||
public function datacenters_regions();
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php namespace models\marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Interface ICloudServiceRepository
|
||||
* @package models\marketplace\repositories
|
||||
*/
|
||||
interface ICloudServiceRepository extends ICompanyServiceRepository
|
||||
{
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
<?php namespace models\marketplace;
|
||||
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\utils\IBaseRepository;
|
||||
|
||||
/**
|
||||
* Interface ICompanyServiceRepository
|
||||
* @package models\marketplace
|
||||
*/
|
||||
interface ICompanyServiceRepository extends IBaseRepository
|
||||
{
|
||||
|
||||
const Status_All = 'all';
|
||||
const Status_active = 'active';
|
||||
const Status_non_active = 'non_active';
|
||||
|
||||
const Order_date = 'date';
|
||||
const Order_name = 'name';
|
||||
|
||||
/**
|
||||
* @param int $page
|
||||
* @param int $per_page
|
||||
* @param string $status
|
||||
* @param string $order_by
|
||||
* @param string $order_dir
|
||||
* @return \IEntity[]
|
||||
*/
|
||||
public function getAll(
|
||||
$page = 1,
|
||||
$per_page = 1000,
|
||||
$status = ICompanyServiceRepository::Status_All,
|
||||
$order_by = ICompanyServiceRepository::Order_date,
|
||||
$order_dir = 'asc'
|
||||
);
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php namespace models\marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Interface IConsultant
|
||||
* @package models\marketplace
|
||||
*/
|
||||
interface IConsultant
|
||||
{
|
||||
/**
|
||||
* @return Office[]
|
||||
*/
|
||||
public function offices();
|
||||
}
|
@ -1,21 +1,22 @@
|
||||
<?php namespace models\marketplace;
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\IBaseRepository;
|
||||
/**
|
||||
* Interface IConsultantRepository
|
||||
* @package models\marketplace
|
||||
*/
|
||||
interface IConsultantRepository extends ICompanyServiceRepository
|
||||
* Interface IConsultantRepository
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
interface IConsultantRepository extends IBaseRepository
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\IBaseRepository;
|
||||
/**
|
||||
* Interface IDistributionRepository
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
interface IDistributionRepository extends IBaseRepository
|
||||
{
|
||||
|
||||
}
|
@ -1,21 +1,22 @@
|
||||
<?php namespace models\marketplace;
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\IBaseRepository;
|
||||
/**
|
||||
* Interface IPrivateCloudServiceRepository
|
||||
* @package models\marketplace
|
||||
*/
|
||||
interface IPrivateCloudServiceRepository extends ICloudServiceRepository
|
||||
* Interface IPrivateCloudServiceRepository
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
interface IPrivateCloudServiceRepository extends IBaseRepository
|
||||
{
|
||||
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
<?php namespace models\marketplace;
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2015 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\IBaseRepository;
|
||||
/**
|
||||
* Interface IPublicCloudServiceRepository
|
||||
* @package models\marketplace
|
||||
*/
|
||||
interface IPublicCloudServiceRepository extends ICloudServiceRepository
|
||||
* Interface IPublicCloudServiceRepository
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
interface IPublicCloudServiceRepository extends IBaseRepository
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\IBaseRepository;
|
||||
/**
|
||||
* Interface IRemoteCloudServiceRepository
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
interface IRemoteCloudServiceRepository extends IBaseRepository
|
||||
{
|
||||
|
||||
}
|
80
app/Models/Foundation/Marketplace/InteropCapability.php
Normal file
80
app/Models/Foundation/Marketplace/InteropCapability.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="InteropCapability")
|
||||
* Class InteropCapability
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class InteropCapability extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Description", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $descripion;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Status", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="InteropCapabilityType", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinColumn(name="TypeID", referencedColumnName="ID")
|
||||
* @var InteropCapabilityType
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescripion()
|
||||
{
|
||||
return $this->descripion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return InteropCapabilityType
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
38
app/Models/Foundation/Marketplace/InteropCapabilityType.php
Normal file
38
app/Models/Foundation/Marketplace/InteropCapabilityType.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="InteropCapabilityType")
|
||||
* Class InteropCapabilityType
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class InteropCapabilityType extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?php namespace App\Models\Foundation\Marketplace;
|
||||
/**
|
||||
* Copyright 2017 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="InteropDesignatedSection")
|
||||
* Class InteropCapability
|
||||
* @package App\Models\Foundation\Marketplace
|
||||
*/
|
||||
class InteropDesignatedSection extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Status", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Guidance", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $guidance;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Comment", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getGuidance()
|
||||
{
|
||||
return $this->guidance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user