Adds missing endpoints

This commit is contained in:
Pierre Lannoy 2024-02-12 11:27:28 +01:00
commit 9e323171fd
Signed by: Pierre Lannoy
GPG key ID: D27231EF87D53F31
8 changed files with 451 additions and 3 deletions

View file

@ -58,6 +58,8 @@ $result = $api->list(['address' => '11.22.33.44/32'])
* [Interfaces](src/Api/DCIM/Interfaces.php)
* [InventoryItems](src/Api/DCIM/InventoryItems.php)
* [Manufacturers](src/Api/DCIM/Manufacturers.php)
* [ModuleBays](src/Api/DCIM/ModuleBays.php)
* [Modules](src/Api/DCIM/Modules.php)
* [Platforms](src/Api/DCIM/Platforms.php)
* [PowerFeeds](src/Api/DCIM/PowerFeeds.php)
* [PowerOutletTemplates](src/Api/DCIM/PowerOutletTemplates.php)
@ -102,6 +104,10 @@ $result = $api->list(['address' => '11.22.33.44/32'])
* [Secrets](src/Api/Secrets/Secrets.php)
* [Session](src/Api/Secrets/Session.php)
* Tenancy
* [ContactAssignments](src/Api/Tenancy/ContactAssignments.php)
* [ContactGroups](src/Api/Tenancy/ContactGroups.php)
* [ContactRoles](src/Api/Tenancy/ContactRoles.php)
* [Contacts](src/Api/Tenancy/Contacts.php)
* [TenantGroups](src/Api/Tenancy/TenantGroups.php)
* [Tenants](src/Api/Tenancy/Tenants.php)
* Users
@ -114,6 +120,4 @@ $result = $api->list(['address' => '11.22.33.44/32'])
* [ClusterTypes](src/Api/Virtualization/ClusterTypes.php)
* [Clusters](src/Api/Virtualization/Clusters.php)
* [Interfaces](src/Api/Virtualization/Interfaces.php)
* [VirtualMachines](src/Api/Virtualization/VirtualMachines.php)
* [VirtualMachines](src/Api/Virtualization/VirtualMachines.php)

View file

@ -0,0 +1,73 @@
<?php
namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi;
class ModuleBays extends AbstractApi
{
/**
* @param array $params
* @return array
* @throws GuzzleException
*/
public function add(array $params = []): array
{
return $this->post("/dcim/module-bays/", $params);
}
/**
* @param int $id
* @param array $params
* @return bool
* @throws GuzzleException
*/
public function remove(int $id, array $params = []): bool
{
return $this->delete("/dcim/module-bays/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function edit(int $id, array $params = []): array
{
return $this->put("/dcim/module-bays/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function update(int $id, array $params = []): array
{
return $this->patch("/dcim/module-bays/" . $id . "/", $params);
}
/**
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function list(array $params = [])
{
return $this->get("/dcim/module-bays/", $params);
}
/**
* @param int $id
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function show(int $id, array $params = [])
{
return $this->get("/dcim/module-bays/" . $id . "/", $params);
}
}

73
src/Api/DCIM/Modules.php Normal file
View file

@ -0,0 +1,73 @@
<?php
namespace Hosterra\NetBox\Api\DCIM;
use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi;
class Modules extends AbstractApi
{
/**
* @param array $params
* @return array
* @throws GuzzleException
*/
public function add(array $params = []): array
{
return $this->post("/dcim/modules/", $params);
}
/**
* @param int $id
* @param array $params
* @return bool
* @throws GuzzleException
*/
public function remove(int $id, array $params = []): bool
{
return $this->delete("/dcim/modules/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function edit(int $id, array $params = []): array
{
return $this->put("/dcim/modules/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function update(int $id, array $params = []): array
{
return $this->patch("/dcim/modules/" . $id . "/", $params);
}
/**
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function list(array $params = [])
{
return $this->get("/dcim/modules/", $params);
}
/**
* @param int $id
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function show(int $id, array $params = [])
{
return $this->get("/dcim/modules/" . $id . "/", $params);
}
}

View file

@ -0,0 +1,73 @@
<?php
namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi;
class ContactAssignments extends AbstractApi
{
/**
* @param array $params
* @return array
* @throws GuzzleException
*/
public function add(array $params = []): array
{
return $this->post("/tenancy/contact-assignments/", $params);
}
/**
* @param int $id
* @param array $params
* @return bool
* @throws GuzzleException
*/
public function remove(int $id, array $params = []): bool
{
return $this->delete("/tenancy/contact-assignments/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function edit(int $id, array $params = []): array
{
return $this->put("/tenancy/contact-assignments/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function update(int $id, array $params = []): array
{
return $this->patch("/tenancy/contact-assignments/" . $id . "/", $params);
}
/**
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function list(array $params = [])
{
return $this->get("/tenancy/contact-assignments/", $params);
}
/**
* @param int $id
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function show(int $id, array $params = [])
{
return $this->get("/tenancy/contact-assignments/" . $id . "/", $params);
}
}

View file

@ -0,0 +1,73 @@
<?php
namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi;
class ContactGroups extends AbstractApi
{
/**
* @param array $params
* @return array
* @throws GuzzleException
*/
public function add(array $params = []): array
{
return $this->post("/tenancy/contact-groups/", $params);
}
/**
* @param int $id
* @param array $params
* @return bool
* @throws GuzzleException
*/
public function remove(int $id, array $params = []): bool
{
return $this->delete("/tenancy/contact-groups/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function edit(int $id, array $params = []): array
{
return $this->put("/tenancy/contact-groups/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function update(int $id, array $params = []): array
{
return $this->patch("/tenancy/contact-groups/" . $id . "/", $params);
}
/**
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function list(array $params = [])
{
return $this->get("/tenancy/contact-groups/", $params);
}
/**
* @param int $id
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function show(int $id, array $params = [])
{
return $this->get("/tenancy/contact-groups/" . $id . "/", $params);
}
}

View file

@ -0,0 +1,73 @@
<?php
namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi;
class ContactRoles extends AbstractApi
{
/**
* @param array $params
* @return array
* @throws GuzzleException
*/
public function add(array $params = []): array
{
return $this->post("/tenancy/contact-roles/", $params);
}
/**
* @param int $id
* @param array $params
* @return bool
* @throws GuzzleException
*/
public function remove(int $id, array $params = []): bool
{
return $this->delete("/tenancy/contact-roles/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function edit(int $id, array $params = []): array
{
return $this->put("/tenancy/contact-roles/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function update(int $id, array $params = []): array
{
return $this->patch("/tenancy/contact-roles/" . $id . "/", $params);
}
/**
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function list(array $params = [])
{
return $this->get("/tenancy/contact-roles/", $params);
}
/**
* @param int $id
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function show(int $id, array $params = [])
{
return $this->get("/tenancy/contact-roles/" . $id . "/", $params);
}
}

View file

@ -0,0 +1,73 @@
<?php
namespace Hosterra\NetBox\Api\Tenancy;
use GuzzleHttp\Exception\GuzzleException;
use Hosterra\NetBox\Api\AbstractApi;
class Contacts extends AbstractApi
{
/**
* @param array $params
* @return array
* @throws GuzzleException
*/
public function add(array $params = []): array
{
return $this->post("/tenancy/contacts/", $params);
}
/**
* @param int $id
* @param array $params
* @return bool
* @throws GuzzleException
*/
public function remove(int $id, array $params = []): bool
{
return $this->delete("/tenancy/contacts/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function edit(int $id, array $params = []): array
{
return $this->put("/tenancy/contacts/" . $id . "/", $params);
}
/**
* @param int $id
* @param array $params
* @return array
* @throws GuzzleException
*/
public function update(int $id, array $params = []): array
{
return $this->patch("/tenancy/contacts/" . $id . "/", $params);
}
/**
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function list(array $params = [])
{
return $this->get("/tenancy/contacts/", $params);
}
/**
* @param int $id
* @param array $params
* @return mixed
* @throws GuzzleException
*/
public function show(int $id, array $params = [])
{
return $this->get("/tenancy/contacts/" . $id . "/", $params);
}
}

View file

@ -39,6 +39,8 @@ class Client
'interfaceTemplates' => 'DCIM\InterfaceTemplates',
'inventoryItems' => 'DCIM\InventoryItems',
'manufacturers' => 'DCIM\Manufacturers',
'moduleBays' => 'DCIM\ModuleBays',
'modules' => 'DCIM\Modules',
'platforms' => 'DCIM\Platforms',
'powerFeeds' => 'DCIM\PowerFeeds',
'powerOutlets' => 'DCIM\PowerOutlets',
@ -87,6 +89,10 @@ class Client
'session' => 'Secrets\Session',
// Tenancy
'contactAssignments' => 'Tenancy\ContactAssignments',
'contactGroups' => 'Tenancy\ContactGroups',
'contactRoles' => 'Tenancy\ContactRoles',
'contacts' => 'Tenancy\Contacts',
'tenantGroups' => 'Tenancy\TenantGroups',
'tenants' => 'Tenancy\Tenants',